Showing
8 changed files
with
142 additions
and
131 deletions
| 1 | -// Autogenerated from Pigeon (v0.1.7), do not edit directly. | 1 | +// Autogenerated from Pigeon (v0.1.14), do not edit directly. |
| 2 | // See also: https://pub.dev/packages/pigeon | 2 | // See also: https://pub.dev/packages/pigeon |
| 3 | package creativemaybeno.wakelock | 3 | package creativemaybeno.wakelock |
| 4 | 4 | ||
| 5 | import io.flutter.plugin.common.BasicMessageChannel | 5 | import io.flutter.plugin.common.BasicMessageChannel |
| 6 | import io.flutter.plugin.common.BinaryMessenger | 6 | import io.flutter.plugin.common.BinaryMessenger |
| 7 | import io.flutter.plugin.common.StandardMessageCodec | 7 | import io.flutter.plugin.common.StandardMessageCodec |
| 8 | -import java.util.* | 8 | +import java.util.ArrayList |
| 9 | +import java.util.HashMap | ||
| 9 | 10 | ||
| 10 | /** Generated class from Pigeon. */ | 11 | /** Generated class from Pigeon. */ |
| 11 | object Messages { | 12 | object Messages { |
| 12 | - private fun wrapError(exception: Exception): HashMap<*, *> { | ||
| 13 | - val errorMap = HashMap<String, Any?>() | ||
| 14 | - errorMap["message"] = exception.toString() | ||
| 15 | - errorMap["code"] = null | ||
| 16 | - errorMap["details"] = null | ||
| 17 | - return errorMap | ||
| 18 | - } | ||
| 19 | - | ||
| 20 | - /** Generated class from Pigeon that represents data sent in messages. */ | ||
| 21 | - class ToggleMessage { | ||
| 22 | - private var enable: Boolean? = null | ||
| 23 | - fun getEnable(): Boolean? { | ||
| 24 | - return enable | ||
| 25 | - } | ||
| 26 | - | ||
| 27 | - fun setEnable(setterArg: Boolean?) { | ||
| 28 | - enable = setterArg | 13 | + private fun wrapError(exception: Exception): HashMap { |
| 14 | + val errorMap: HashMap<String, Object> = HashMap() | ||
| 15 | + errorMap.put("message", exception.toString()) | ||
| 16 | + errorMap.put("code", exception.getClass().getSimpleName()) | ||
| 17 | + errorMap.put("details", null) | ||
| 18 | + return errorMap | ||
| 29 | } | 19 | } |
| 30 | 20 | ||
| 31 | - fun toMap(): HashMap<*, *> { | ||
| 32 | - val toMapResult = HashMap<String, Any?>() | ||
| 33 | - toMapResult["enable"] = enable | ||
| 34 | - return toMapResult | ||
| 35 | - } | 21 | + /** Generated class from Pigeon that represents data sent in messages. */ |
| 22 | + class ToggleMessage { | ||
| 23 | + private var enable: Boolean? = null | ||
| 24 | + fun getEnable(): Boolean? { | ||
| 25 | + return enable | ||
| 26 | + } | ||
| 36 | 27 | ||
| 37 | - companion object { | ||
| 38 | - fun fromMap(map: HashMap<*, *>?): ToggleMessage { | ||
| 39 | - val fromMapResult = ToggleMessage() | ||
| 40 | - val enable = map!!["enable"] | ||
| 41 | - fromMapResult.enable = enable as Boolean? | ||
| 42 | - return fromMapResult | ||
| 43 | - } | ||
| 44 | - } | ||
| 45 | - } | 28 | + fun setEnable(setterArg: Boolean?) { |
| 29 | + enable = setterArg | ||
| 30 | + } | ||
| 46 | 31 | ||
| 47 | - /** Generated class from Pigeon that represents data sent in messages. */ | ||
| 48 | - class IsEnabledMessage { | ||
| 49 | - private var enabled: Boolean? = null | ||
| 50 | - fun getEnabled(): Boolean? { | ||
| 51 | - return enabled | ||
| 52 | - } | 32 | + fun toMap(): HashMap { |
| 33 | + val toMapResult: HashMap<String, Object> = HashMap() | ||
| 34 | + toMapResult.put("enable", enable) | ||
| 35 | + return toMapResult | ||
| 36 | + } | ||
| 53 | 37 | ||
| 54 | - fun setEnabled(setterArg: Boolean?) { | ||
| 55 | - enabled = setterArg | 38 | + companion object { |
| 39 | + fun fromMap(map: HashMap): ToggleMessage { | ||
| 40 | + val fromMapResult = ToggleMessage() | ||
| 41 | + val enable: Object = map.get("enable") | ||
| 42 | + fromMapResult.enable = enable | ||
| 43 | + return fromMapResult | ||
| 44 | + } | ||
| 45 | + } | ||
| 56 | } | 46 | } |
| 57 | 47 | ||
| 58 | - fun toMap(): HashMap<*, *> { | ||
| 59 | - val toMapResult = HashMap<String, Any?>() | ||
| 60 | - toMapResult["enabled"] = enabled | ||
| 61 | - return toMapResult | ||
| 62 | - } | 48 | + /** Generated class from Pigeon that represents data sent in messages. */ |
| 49 | + class IsEnabledMessage { | ||
| 50 | + private var enabled: Boolean? = null | ||
| 51 | + fun getEnabled(): Boolean? { | ||
| 52 | + return enabled | ||
| 53 | + } | ||
| 63 | 54 | ||
| 64 | - companion object { | ||
| 65 | - fun fromMap(map: HashMap<*, *>): IsEnabledMessage { | ||
| 66 | - val fromMapResult = IsEnabledMessage() | ||
| 67 | - val enabled = map["enabled"] | ||
| 68 | - fromMapResult.enabled = enabled as Boolean? | ||
| 69 | - return fromMapResult | ||
| 70 | - } | ||
| 71 | - } | ||
| 72 | - } | 55 | + fun setEnabled(setterArg: Boolean?) { |
| 56 | + enabled = setterArg | ||
| 57 | + } | ||
| 73 | 58 | ||
| 74 | - /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ | ||
| 75 | - interface WakelockApi { | ||
| 76 | - fun toggle(arg: ToggleMessage?) | ||
| 77 | - val isEnabled: IsEnabledMessage | 59 | + fun toMap(): HashMap { |
| 60 | + val toMapResult: HashMap<String, Object> = HashMap() | ||
| 61 | + toMapResult.put("enabled", enabled) | ||
| 62 | + return toMapResult | ||
| 63 | + } | ||
| 78 | 64 | ||
| 79 | - companion object { | ||
| 80 | - /** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger` */ | ||
| 81 | - fun setup(binaryMessenger: BinaryMessenger?, api: WakelockApi?) { | ||
| 82 | - run { | ||
| 83 | - val channel = BasicMessageChannel(binaryMessenger!!, "dev.flutter.pigeon.WakelockApi.toggle", StandardMessageCodec()) | ||
| 84 | - if (api != null) { | ||
| 85 | - channel.setMessageHandler { message: Any?, reply: BasicMessageChannel.Reply<Any> -> | ||
| 86 | - val wrapped = HashMap<String, HashMap<*, *>?>() | ||
| 87 | - try { | ||
| 88 | - val input = ToggleMessage.fromMap(message as HashMap<*, *>?) | ||
| 89 | - api.toggle(input) | ||
| 90 | - wrapped["result"] = null | ||
| 91 | - } catch (exception: Exception) { | ||
| 92 | - wrapped["error"] = wrapError(exception) | ||
| 93 | - } | ||
| 94 | - reply.reply(wrapped) | 65 | + companion object { |
| 66 | + fun fromMap(map: HashMap): IsEnabledMessage { | ||
| 67 | + val fromMapResult = IsEnabledMessage() | ||
| 68 | + val enabled: Object = map.get("enabled") | ||
| 69 | + fromMapResult.enabled = enabled | ||
| 70 | + return fromMapResult | ||
| 95 | } | 71 | } |
| 96 | - } else { | ||
| 97 | - channel.setMessageHandler(null) | ||
| 98 | - } | ||
| 99 | } | 72 | } |
| 100 | - run { | ||
| 101 | - val channel = BasicMessageChannel(binaryMessenger!!, "dev.flutter.pigeon.WakelockApi.isEnabled", StandardMessageCodec()) | ||
| 102 | - if (api != null) { | ||
| 103 | - channel.setMessageHandler { message: Any?, reply: BasicMessageChannel.Reply<Any> -> | ||
| 104 | - val wrapped = HashMap<String, HashMap<*, *>>() | ||
| 105 | - try { | ||
| 106 | - val output = api.isEnabled | ||
| 107 | - wrapped["result"] = output.toMap() | ||
| 108 | - } catch (exception: Exception) { | ||
| 109 | - wrapped["error"] = wrapError(exception) | ||
| 110 | - } | ||
| 111 | - reply.reply(wrapped) | 73 | + } |
| 74 | + | ||
| 75 | + /** Generated interface from Pigeon that represents a handler of messages from Flutter. */ | ||
| 76 | + interface WakelockApi { | ||
| 77 | + fun toggle(arg: ToggleMessage?) | ||
| 78 | + val isEnabled: IsEnabledMessage | ||
| 79 | + | ||
| 80 | + companion object { | ||
| 81 | + /** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger` */ | ||
| 82 | + fun setup(binaryMessenger: BinaryMessenger?, api: WakelockApi?) { | ||
| 83 | + run { | ||
| 84 | + val channel: BasicMessageChannel<Object> = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.WakelockApi.toggle", StandardMessageCodec()) | ||
| 85 | + if (api != null) { | ||
| 86 | + channel.setMessageHandler { message, reply -> | ||
| 87 | + val wrapped: HashMap<String, HashMap> = HashMap() | ||
| 88 | + try { | ||
| 89 | + @SuppressWarnings("ConstantConditions") val input = ToggleMessage.fromMap(message as HashMap) | ||
| 90 | + api.toggle(input) | ||
| 91 | + wrapped.put("result", null) | ||
| 92 | + } catch (exception: Exception) { | ||
| 93 | + wrapped.put("error", wrapError(exception)) | ||
| 94 | + } | ||
| 95 | + reply.reply(wrapped) | ||
| 96 | + } | ||
| 97 | + } else { | ||
| 98 | + channel.setMessageHandler(null) | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + run { | ||
| 102 | + val channel: BasicMessageChannel<Object> = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.WakelockApi.isEnabled", StandardMessageCodec()) | ||
| 103 | + if (api != null) { | ||
| 104 | + channel.setMessageHandler { message, reply -> | ||
| 105 | + val wrapped: HashMap<String, HashMap> = HashMap() | ||
| 106 | + try { | ||
| 107 | + val output = api.isEnabled | ||
| 108 | + wrapped.put("result", output.toMap()) | ||
| 109 | + } catch (exception: Exception) { | ||
| 110 | + wrapped.put("error", wrapError(exception)) | ||
| 111 | + } | ||
| 112 | + reply.reply(wrapped) | ||
| 113 | + } | ||
| 114 | + } else { | ||
| 115 | + channel.setMessageHandler(null) | ||
| 116 | + } | ||
| 117 | + } | ||
| 112 | } | 118 | } |
| 113 | - } else { | ||
| 114 | - channel.setMessageHandler(null) | ||
| 115 | - } | ||
| 116 | } | 119 | } |
| 117 | - } | ||
| 118 | } | 120 | } |
| 119 | - } | ||
| 120 | } | 121 | } |
| 1 | -// Autogenerated from Pigeon (v0.1.7), do not edit directly. | 1 | +// Autogenerated from Pigeon (v0.1.14), do not edit directly. |
| 2 | // See also: https://pub.dev/packages/pigeon | 2 | // See also: https://pub.dev/packages/pigeon |
| 3 | #import <Foundation/Foundation.h> | 3 | #import <Foundation/Foundation.h> |
| 4 | @protocol FlutterBinaryMessenger; | 4 | @protocol FlutterBinaryMessenger; |
| 1 | -// Autogenerated from Pigeon (v0.1.7), do not edit directly. | 1 | +// Autogenerated from Pigeon (v0.1.14), do not edit directly. |
| 2 | // See also: https://pub.dev/packages/pigeon | 2 | // See also: https://pub.dev/packages/pigeon |
| 3 | #import "messages.h" | 3 | #import "messages.h" |
| 4 | #import <Flutter/Flutter.h> | 4 | #import <Flutter/Flutter.h> |
| @@ -11,15 +11,15 @@ static NSDictionary* wrapResult(NSDictionary *result, FlutterError *error) { | @@ -11,15 +11,15 @@ static NSDictionary* wrapResult(NSDictionary *result, FlutterError *error) { | ||
| 11 | NSDictionary *errorDict = (NSDictionary *)[NSNull null]; | 11 | NSDictionary *errorDict = (NSDictionary *)[NSNull null]; |
| 12 | if (error) { | 12 | if (error) { |
| 13 | errorDict = [NSDictionary dictionaryWithObjectsAndKeys: | 13 | errorDict = [NSDictionary dictionaryWithObjectsAndKeys: |
| 14 | - (error.code ? error.code : [NSNull null]), @"code", | ||
| 15 | - (error.message ? error.message : [NSNull null]), @"message", | ||
| 16 | - (error.details ? error.details : [NSNull null]), @"details", | ||
| 17 | - nil]; | 14 | + (error.code ? error.code : [NSNull null]), @"code", |
| 15 | + (error.message ? error.message : [NSNull null]), @"message", | ||
| 16 | + (error.details ? error.details : [NSNull null]), @"details", | ||
| 17 | + nil]; | ||
| 18 | } | 18 | } |
| 19 | return [NSDictionary dictionaryWithObjectsAndKeys: | 19 | return [NSDictionary dictionaryWithObjectsAndKeys: |
| 20 | - (result ? result : [NSNull null]), @"result", | ||
| 21 | - errorDict, @"error", | ||
| 22 | - nil]; | 20 | + (result ? result : [NSNull null]), @"result", |
| 21 | + errorDict, @"error", | ||
| 22 | + nil]; | ||
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | @interface FLTToggleMessage () | 25 | @interface FLTToggleMessage () |
| @@ -62,9 +62,9 @@ static NSDictionary* wrapResult(NSDictionary *result, FlutterError *error) { | @@ -62,9 +62,9 @@ static NSDictionary* wrapResult(NSDictionary *result, FlutterError *error) { | ||
| 62 | void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakelockApi> api) { | 62 | void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakelockApi> api) { |
| 63 | { | 63 | { |
| 64 | FlutterBasicMessageChannel *channel = | 64 | FlutterBasicMessageChannel *channel = |
| 65 | - [FlutterBasicMessageChannel | ||
| 66 | - messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.toggle" | ||
| 67 | - binaryMessenger:binaryMessenger]; | 65 | + [FlutterBasicMessageChannel |
| 66 | + messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.toggle" | ||
| 67 | + binaryMessenger:binaryMessenger]; | ||
| 68 | if (api) { | 68 | if (api) { |
| 69 | [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { | 69 | [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { |
| 70 | FlutterError *error; | 70 | FlutterError *error; |
| @@ -79,9 +79,9 @@ void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakel | @@ -79,9 +79,9 @@ void FLTWakelockApiSetup(id<FlutterBinaryMessenger> binaryMessenger, id<FLTWakel | ||
| 79 | } | 79 | } |
| 80 | { | 80 | { |
| 81 | FlutterBasicMessageChannel *channel = | 81 | FlutterBasicMessageChannel *channel = |
| 82 | - [FlutterBasicMessageChannel | ||
| 83 | - messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.isEnabled" | ||
| 84 | - binaryMessenger:binaryMessenger]; | 82 | + [FlutterBasicMessageChannel |
| 83 | + messageChannelWithName:@"dev.flutter.pigeon.WakelockApi.isEnabled" | ||
| 84 | + binaryMessenger:binaryMessenger]; | ||
| 85 | if (api) { | 85 | if (api) { |
| 86 | [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { | 86 | [channel setMessageHandler:^(id _Nullable message, FlutterReply callback) { |
| 87 | FlutterError *error; | 87 | FlutterError *error; |
| @@ -2,7 +2,7 @@ name: wakelock | @@ -2,7 +2,7 @@ name: wakelock | ||
| 2 | description: >-2 | 2 | description: >-2 |
| 3 | Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on | 3 | Plugin that allows you to keep the device screen awake, i.e. prevent the screen from sleeping on |
| 4 | Android, iOS, and web. | 4 | Android, iOS, and web. |
| 5 | -version: 0.2.0+1 | 5 | +version: 0.2.0+2 |
| 6 | homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock | 6 | homepage: https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock |
| 7 | 7 | ||
| 8 | environment: | 8 | environment: |
| @@ -23,7 +23,7 @@ dev_dependencies: | @@ -23,7 +23,7 @@ dev_dependencies: | ||
| 23 | sdk: flutter | 23 | sdk: flutter |
| 24 | 24 | ||
| 25 | pedantic: ^1.9.2 | 25 | pedantic: ^1.9.2 |
| 26 | - pigeon: 0.1.7 | 26 | + pigeon: ^0.1.14 |
| 27 | 27 | ||
| 28 | flutter: | 28 | flutter: |
| 29 | plugin: | 29 | plugin: |
| 1 | -// Autogenerated from Pigeon (v0.1.7), do not edit directly. | 1 | +// Autogenerated from Pigeon (v0.1.14), do not edit directly. |
| 2 | // See also: https://pub.dev/packages/pigeon | 2 | // See also: https://pub.dev/packages/pigeon |
| 3 | // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import | 3 | // ignore_for_file: public_member_api_docs, non_constant_identifier_names, avoid_as, unused_import |
| 4 | // @dart = 2.8 | 4 | // @dart = 2.8 |
| @@ -17,9 +17,6 @@ class ToggleMessage { | @@ -17,9 +17,6 @@ class ToggleMessage { | ||
| 17 | 17 | ||
| 18 | // ignore: unused_element | 18 | // ignore: unused_element |
| 19 | static ToggleMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { | 19 | static ToggleMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { |
| 20 | - if (pigeonMap == null) { | ||
| 21 | - return null; | ||
| 22 | - } | ||
| 23 | final ToggleMessage result = ToggleMessage(); | 20 | final ToggleMessage result = ToggleMessage(); |
| 24 | result.enable = pigeonMap['enable']; | 21 | result.enable = pigeonMap['enable']; |
| 25 | return result; | 22 | return result; |
| @@ -37,9 +34,6 @@ class IsEnabledMessage { | @@ -37,9 +34,6 @@ class IsEnabledMessage { | ||
| 37 | 34 | ||
| 38 | // ignore: unused_element | 35 | // ignore: unused_element |
| 39 | static IsEnabledMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { | 36 | static IsEnabledMessage _fromMap(Map<dynamic, dynamic> pigeonMap) { |
| 40 | - if (pigeonMap == null) { | ||
| 41 | - return null; | ||
| 42 | - } | ||
| 43 | final IsEnabledMessage result = IsEnabledMessage(); | 37 | final IsEnabledMessage result = IsEnabledMessage(); |
| 44 | result.enabled = pigeonMap['enabled']; | 38 | result.enabled = pigeonMap['enabled']; |
| 45 | return result; | 39 | return result; |
| @@ -98,21 +92,29 @@ abstract class TestWakelockApi { | @@ -98,21 +92,29 @@ abstract class TestWakelockApi { | ||
| 98 | { | 92 | { |
| 99 | const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | 93 | const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( |
| 100 | 'dev.flutter.pigeon.WakelockApi.toggle', StandardMessageCodec()); | 94 | 'dev.flutter.pigeon.WakelockApi.toggle', StandardMessageCodec()); |
| 101 | - channel.setMockMessageHandler((dynamic message) async { | ||
| 102 | - final Map<dynamic, dynamic> mapMessage = | ||
| 103 | - message as Map<dynamic, dynamic>; | ||
| 104 | - final ToggleMessage input = ToggleMessage._fromMap(mapMessage); | ||
| 105 | - api.toggle(input); | ||
| 106 | - return <dynamic, dynamic>{}; | ||
| 107 | - }); | 95 | + if (api == null) { |
| 96 | + channel.setMockMessageHandler(null); | ||
| 97 | + } else { | ||
| 98 | + channel.setMockMessageHandler((dynamic message) async { | ||
| 99 | + final Map<dynamic, dynamic> mapMessage = | ||
| 100 | + message as Map<dynamic, dynamic>; | ||
| 101 | + final ToggleMessage input = ToggleMessage._fromMap(mapMessage); | ||
| 102 | + api.toggle(input); | ||
| 103 | + return <dynamic, dynamic>{}; | ||
| 104 | + }); | ||
| 105 | + } | ||
| 108 | } | 106 | } |
| 109 | { | 107 | { |
| 110 | const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( | 108 | const BasicMessageChannel<dynamic> channel = BasicMessageChannel<dynamic>( |
| 111 | 'dev.flutter.pigeon.WakelockApi.isEnabled', StandardMessageCodec()); | 109 | 'dev.flutter.pigeon.WakelockApi.isEnabled', StandardMessageCodec()); |
| 112 | - channel.setMockMessageHandler((dynamic message) async { | ||
| 113 | - final IsEnabledMessage output = api.isEnabled(); | ||
| 114 | - return <dynamic, dynamic>{'result': output._toMap()}; | ||
| 115 | - }); | 110 | + if (api == null) { |
| 111 | + channel.setMockMessageHandler(null); | ||
| 112 | + } else { | ||
| 113 | + channel.setMockMessageHandler((dynamic message) async { | ||
| 114 | + final IsEnabledMessage output = api.isEnabled(); | ||
| 115 | + return <dynamic, dynamic>{'result': output._toMap()}; | ||
| 116 | + }); | ||
| 117 | + } | ||
| 116 | } | 118 | } |
| 117 | } | 119 | } |
| 118 | } | 120 | } |
| @@ -2,7 +2,7 @@ name: wakelock_platform_interface | @@ -2,7 +2,7 @@ name: wakelock_platform_interface | ||
| 2 | description: >-2 | 2 | description: >-2 |
| 3 | A common platform interface for the wakelock plugin used by the different platform | 3 | A common platform interface for the wakelock plugin used by the different platform |
| 4 | implementations. | 4 | implementations. |
| 5 | -version: 0.1.0 | 5 | +version: 0.1.0+1 |
| 6 | homepage: >-2 | 6 | homepage: >-2 |
| 7 | https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock_platform_interface | 7 | https://github.com/creativecreatorormaybenot/wakelock/tree/master/wakelock_platform_interface |
| 8 | 8 |
-
Please register or login to post a comment