creativecreatorormaybenot
Committed by GitHub

Closes #52 (#53)

  1 +## 0.2.1
  2 +
  3 +* Rewrite messages to stay as Java code and use `1.8` JVM target in order to allow interop with
  4 + Kotlin. This **fixes** Android build errors.
  5 +
1 ## 0.2.0+2 6 ## 0.2.0+2
2 7
3 * Bumped pigeon to `0.1.14`. 8 * Bumped pigeon to `0.1.14`.
@@ -36,6 +36,13 @@ android { @@ -36,6 +36,13 @@ android {
36 lintOptions { 36 lintOptions {
37 disable 'InvalidPackage' 37 disable 'InvalidPackage'
38 } 38 }
  39 + compileOptions {
  40 + sourceCompatibility JavaVersion.VERSION_1_8
  41 + targetCompatibility JavaVersion.VERSION_1_8
  42 + }
  43 + kotlinOptions {
  44 + jvmTarget = '1.8'
  45 + }
39 } 46 }
40 47
41 dependencies { 48 dependencies {
  1 +// Autogenerated from Pigeon (v0.1.14), do not edit directly.
  2 +// See also: https://pub.dev/packages/pigeon
  3 +
  4 +package creativemaybeno.wakelock;
  5 +
  6 +import io.flutter.plugin.common.BasicMessageChannel;
  7 +import io.flutter.plugin.common.BinaryMessenger;
  8 +import io.flutter.plugin.common.StandardMessageCodec;
  9 +import java.util.ArrayList;
  10 +import java.util.HashMap;
  11 +
  12 +/** Generated class from Pigeon. */
  13 +@SuppressWarnings("unused")
  14 +public class Messages {
  15 +
  16 + /** Generated class from Pigeon that represents data sent in messages. */
  17 + public static class ToggleMessage {
  18 + private Boolean enable;
  19 + public Boolean getEnable() { return enable; }
  20 + public void setEnable(Boolean setterArg) { this.enable = setterArg; }
  21 +
  22 + HashMap toMap() {
  23 + HashMap<String, Object> toMapResult = new HashMap<>();
  24 + toMapResult.put("enable", enable);
  25 + return toMapResult;
  26 + }
  27 + static ToggleMessage fromMap(HashMap map) {
  28 + ToggleMessage fromMapResult = new ToggleMessage();
  29 + Object enable = map.get("enable");
  30 + fromMapResult.enable = (Boolean)enable;
  31 + return fromMapResult;
  32 + }
  33 + }
  34 +
  35 + /** Generated class from Pigeon that represents data sent in messages. */
  36 + public static class IsEnabledMessage {
  37 + private Boolean enabled;
  38 + public Boolean getEnabled() { return enabled; }
  39 + public void setEnabled(Boolean setterArg) { this.enabled = setterArg; }
  40 +
  41 + HashMap toMap() {
  42 + HashMap<String, Object> toMapResult = new HashMap<>();
  43 + toMapResult.put("enabled", enabled);
  44 + return toMapResult;
  45 + }
  46 + static IsEnabledMessage fromMap(HashMap map) {
  47 + IsEnabledMessage fromMapResult = new IsEnabledMessage();
  48 + Object enabled = map.get("enabled");
  49 + fromMapResult.enabled = (Boolean)enabled;
  50 + return fromMapResult;
  51 + }
  52 + }
  53 +
  54 + /** Generated interface from Pigeon that represents a handler of messages from Flutter.*/
  55 + public interface WakelockApi {
  56 + void toggle(ToggleMessage arg);
  57 + IsEnabledMessage isEnabled();
  58 +
  59 + /** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger` */
  60 + static void setup(BinaryMessenger binaryMessenger, WakelockApi api) {
  61 + {
  62 + BasicMessageChannel<Object> channel =
  63 + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WakelockApi.toggle", new StandardMessageCodec());
  64 + if (api != null) {
  65 + channel.setMessageHandler((message, reply) -> {
  66 + HashMap<String, HashMap> wrapped = new HashMap<>();
  67 + try {
  68 + @SuppressWarnings("ConstantConditions")
  69 + ToggleMessage input = ToggleMessage.fromMap((HashMap)message);
  70 + api.toggle(input);
  71 + wrapped.put("result", null);
  72 + }
  73 + catch (Exception exception) {
  74 + wrapped.put("error", wrapError(exception));
  75 + }
  76 + reply.reply(wrapped);
  77 + });
  78 + } else {
  79 + channel.setMessageHandler(null);
  80 + }
  81 + }
  82 + {
  83 + BasicMessageChannel<Object> channel =
  84 + new BasicMessageChannel<>(binaryMessenger, "dev.flutter.pigeon.WakelockApi.isEnabled", new StandardMessageCodec());
  85 + if (api != null) {
  86 + channel.setMessageHandler((message, reply) -> {
  87 + HashMap<String, HashMap> wrapped = new HashMap<>();
  88 + try {
  89 + IsEnabledMessage output = api.isEnabled();
  90 + wrapped.put("result", output.toMap());
  91 + }
  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 + }
  102 + }
  103 + private static HashMap wrapError(Exception exception) {
  104 + HashMap<String, Object> errorMap = new HashMap<>();
  105 + errorMap.put("message", exception.toString());
  106 + errorMap.put("code", exception.getClass().getSimpleName());
  107 + errorMap.put("details", null);
  108 + return errorMap;
  109 + }
  110 +}
1 -// Autogenerated from Pigeon (v0.1.14), do not edit directly.  
2 -// See also: https://pub.dev/packages/pigeon  
3 -package creativemaybeno.wakelock  
4 -  
5 -import io.flutter.plugin.common.BasicMessageChannel  
6 -import io.flutter.plugin.common.BinaryMessenger  
7 -import io.flutter.plugin.common.StandardMessageCodec  
8 -import java.util.ArrayList  
9 -import java.util.HashMap  
10 -  
11 -/** Generated class from Pigeon. */  
12 -object Messages {  
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  
19 - }  
20 -  
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 - }  
27 -  
28 - fun setEnable(setterArg: Boolean?) {  
29 - enable = setterArg  
30 - }  
31 -  
32 - fun toMap(): HashMap {  
33 - val toMapResult: HashMap<String, Object> = HashMap()  
34 - toMapResult.put("enable", enable)  
35 - return toMapResult  
36 - }  
37 -  
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 - }  
46 - }  
47 -  
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 - }  
54 -  
55 - fun setEnabled(setterArg: Boolean?) {  
56 - enabled = setterArg  
57 - }  
58 -  
59 - fun toMap(): HashMap {  
60 - val toMapResult: HashMap<String, Object> = HashMap()  
61 - toMapResult.put("enabled", enabled)  
62 - return toMapResult  
63 - }  
64 -  
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  
71 - }  
72 - }  
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 - }  
118 - }  
119 - }  
120 - }  
121 -}  
@@ -42,8 +42,7 @@ class WakelockPlugin : FlutterPlugin, WakelockApi, ActivityAware { @@ -42,8 +42,7 @@ class WakelockPlugin : FlutterPlugin, WakelockApi, ActivityAware {
42 wakelock!!.toggle(arg!!) 42 wakelock!!.toggle(arg!!)
43 } 43 }
44 44
45 - override val isEnabled: IsEnabledMessage  
46 - get() {  
47 - return wakelock!!.isEnabled()  
48 - } 45 + override fun isEnabled(): IsEnabledMessage {
  46 + return wakelock!!.isEnabled()
  47 + }
49 } 48 }
@@ -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+2 5 +version: 0.2.1
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: