This repository has been archived by the owner on Jul 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
142 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
191 changes: 96 additions & 95 deletions
191
wakelock/android/src/main/kotlin/creativemaybeno/wakelock/Messages.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,120 +1,121 @@ | ||
// Autogenerated from Pigeon (v0.1.7), do not edit directly. | ||
// Autogenerated from Pigeon (v0.1.14), do not edit directly. | ||
// See also: https://pub.dev/packages/pigeon | ||
package creativemaybeno.wakelock | ||
|
||
import io.flutter.plugin.common.BasicMessageChannel | ||
import io.flutter.plugin.common.BinaryMessenger | ||
import io.flutter.plugin.common.StandardMessageCodec | ||
import java.util.* | ||
import java.util.ArrayList | ||
import java.util.HashMap | ||
|
||
/** Generated class from Pigeon. */ | ||
object Messages { | ||
private fun wrapError(exception: Exception): HashMap<*, *> { | ||
val errorMap = HashMap<String, Any?>() | ||
errorMap["message"] = exception.toString() | ||
errorMap["code"] = null | ||
errorMap["details"] = null | ||
return errorMap | ||
} | ||
|
||
/** Generated class from Pigeon that represents data sent in messages. */ | ||
class ToggleMessage { | ||
private var enable: Boolean? = null | ||
fun getEnable(): Boolean? { | ||
return enable | ||
} | ||
|
||
fun setEnable(setterArg: Boolean?) { | ||
enable = setterArg | ||
private fun wrapError(exception: Exception): HashMap { | ||
val errorMap: HashMap<String, Object> = HashMap() | ||
errorMap.put("message", exception.toString()) | ||
errorMap.put("code", exception.getClass().getSimpleName()) | ||
errorMap.put("details", null) | ||
return errorMap | ||
} | ||
|
||
fun toMap(): HashMap<*, *> { | ||
val toMapResult = HashMap<String, Any?>() | ||
toMapResult["enable"] = enable | ||
return toMapResult | ||
} | ||
/** Generated class from Pigeon that represents data sent in messages. */ | ||
class ToggleMessage { | ||
private var enable: Boolean? = null | ||
fun getEnable(): Boolean? { | ||
return enable | ||
} | ||
|
||
companion object { | ||
fun fromMap(map: HashMap<*, *>?): ToggleMessage { | ||
val fromMapResult = ToggleMessage() | ||
val enable = map!!["enable"] | ||
fromMapResult.enable = enable as Boolean? | ||
return fromMapResult | ||
} | ||
} | ||
} | ||
fun setEnable(setterArg: Boolean?) { | ||
enable = setterArg | ||
} | ||
|
||
/** Generated class from Pigeon that represents data sent in messages. */ | ||
class IsEnabledMessage { | ||
private var enabled: Boolean? = null | ||
fun getEnabled(): Boolean? { | ||
return enabled | ||
} | ||
fun toMap(): HashMap { | ||
val toMapResult: HashMap<String, Object> = HashMap() | ||
toMapResult.put("enable", enable) | ||
return toMapResult | ||
} | ||
|
||
fun setEnabled(setterArg: Boolean?) { | ||
enabled = setterArg | ||
companion object { | ||
fun fromMap(map: HashMap): ToggleMessage { | ||
val fromMapResult = ToggleMessage() | ||
val enable: Object = map.get("enable") | ||
fromMapResult.enable = enable | ||
return fromMapResult | ||
} | ||
} | ||
} | ||
|
||
fun toMap(): HashMap<*, *> { | ||
val toMapResult = HashMap<String, Any?>() | ||
toMapResult["enabled"] = enabled | ||
return toMapResult | ||
} | ||
/** Generated class from Pigeon that represents data sent in messages. */ | ||
class IsEnabledMessage { | ||
private var enabled: Boolean? = null | ||
fun getEnabled(): Boolean? { | ||
return enabled | ||
} | ||
|
||
companion object { | ||
fun fromMap(map: HashMap<*, *>): IsEnabledMessage { | ||
val fromMapResult = IsEnabledMessage() | ||
val enabled = map["enabled"] | ||
fromMapResult.enabled = enabled as Boolean? | ||
return fromMapResult | ||
} | ||
} | ||
} | ||
fun setEnabled(setterArg: Boolean?) { | ||
enabled = setterArg | ||
} | ||
|
||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ | ||
interface WakelockApi { | ||
fun toggle(arg: ToggleMessage?) | ||
val isEnabled: IsEnabledMessage | ||
fun toMap(): HashMap { | ||
val toMapResult: HashMap<String, Object> = HashMap() | ||
toMapResult.put("enabled", enabled) | ||
return toMapResult | ||
} | ||
|
||
companion object { | ||
/** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger` */ | ||
fun setup(binaryMessenger: BinaryMessenger?, api: WakelockApi?) { | ||
run { | ||
val channel = BasicMessageChannel(binaryMessenger!!, "dev.flutter.pigeon.WakelockApi.toggle", StandardMessageCodec()) | ||
if (api != null) { | ||
channel.setMessageHandler { message: Any?, reply: BasicMessageChannel.Reply<Any> -> | ||
val wrapped = HashMap<String, HashMap<*, *>?>() | ||
try { | ||
val input = ToggleMessage.fromMap(message as HashMap<*, *>?) | ||
api.toggle(input) | ||
wrapped["result"] = null | ||
} catch (exception: Exception) { | ||
wrapped["error"] = wrapError(exception) | ||
} | ||
reply.reply(wrapped) | ||
companion object { | ||
fun fromMap(map: HashMap): IsEnabledMessage { | ||
val fromMapResult = IsEnabledMessage() | ||
val enabled: Object = map.get("enabled") | ||
fromMapResult.enabled = enabled | ||
return fromMapResult | ||
} | ||
} else { | ||
channel.setMessageHandler(null) | ||
} | ||
} | ||
run { | ||
val channel = BasicMessageChannel(binaryMessenger!!, "dev.flutter.pigeon.WakelockApi.isEnabled", StandardMessageCodec()) | ||
if (api != null) { | ||
channel.setMessageHandler { message: Any?, reply: BasicMessageChannel.Reply<Any> -> | ||
val wrapped = HashMap<String, HashMap<*, *>>() | ||
try { | ||
val output = api.isEnabled | ||
wrapped["result"] = output.toMap() | ||
} catch (exception: Exception) { | ||
wrapped["error"] = wrapError(exception) | ||
} | ||
reply.reply(wrapped) | ||
} | ||
|
||
/** Generated interface from Pigeon that represents a handler of messages from Flutter. */ | ||
interface WakelockApi { | ||
fun toggle(arg: ToggleMessage?) | ||
val isEnabled: IsEnabledMessage | ||
|
||
companion object { | ||
/** Sets up an instance of `WakelockApi` to handle messages through the `binaryMessenger` */ | ||
fun setup(binaryMessenger: BinaryMessenger?, api: WakelockApi?) { | ||
run { | ||
val channel: BasicMessageChannel<Object> = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.WakelockApi.toggle", StandardMessageCodec()) | ||
if (api != null) { | ||
channel.setMessageHandler { message, reply -> | ||
val wrapped: HashMap<String, HashMap> = HashMap() | ||
try { | ||
@SuppressWarnings("ConstantConditions") val input = ToggleMessage.fromMap(message as HashMap) | ||
api.toggle(input) | ||
wrapped.put("result", null) | ||
} catch (exception: Exception) { | ||
wrapped.put("error", wrapError(exception)) | ||
} | ||
reply.reply(wrapped) | ||
} | ||
} else { | ||
channel.setMessageHandler(null) | ||
} | ||
} | ||
run { | ||
val channel: BasicMessageChannel<Object> = BasicMessageChannel(binaryMessenger, "dev.flutter.pigeon.WakelockApi.isEnabled", StandardMessageCodec()) | ||
if (api != null) { | ||
channel.setMessageHandler { message, reply -> | ||
val wrapped: HashMap<String, HashMap> = HashMap() | ||
try { | ||
val output = api.isEnabled | ||
wrapped.put("result", output.toMap()) | ||
} catch (exception: Exception) { | ||
wrapped.put("error", wrapError(exception)) | ||
} | ||
reply.reply(wrapped) | ||
} | ||
} else { | ||
channel.setMessageHandler(null) | ||
} | ||
} | ||
} | ||
} else { | ||
channel.setMessageHandler(null) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.1.0 | ||
|
||
* Updated messages with upgraded version of pigeon. | ||
|
||
## 0.1.0 | ||
|
||
* Initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters