|
...
|
...
|
@@ -153,11 +153,74 @@ struct WearDeviceInfo: Hashable { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Generated class from Pigeon that represents data sent in messages.
|
|
|
|
struct WatchTransformTheme: Hashable {
|
|
|
|
var themeId: Int64
|
|
|
|
var themeName: String
|
|
|
|
var energeticDescription: String
|
|
|
|
var energeticImage: FlutterStandardTypedData? = nil
|
|
|
|
var normalDescription: String
|
|
|
|
var normalImage: FlutterStandardTypedData? = nil
|
|
|
|
var slightStressfulDescription: String
|
|
|
|
var slightStressfulImage: FlutterStandardTypedData? = nil
|
|
|
|
var stressfulDescription: String
|
|
|
|
var stressfulImage: FlutterStandardTypedData? = nil
|
|
|
|
|
|
|
|
|
|
|
|
// swift-format-ignore: AlwaysUseLowerCamelCase
|
|
|
|
static func fromList(_ pigeonVar_list: [Any?]) -> WatchTransformTheme? {
|
|
|
|
let themeId = pigeonVar_list[0] as! Int64
|
|
|
|
let themeName = pigeonVar_list[1] as! String
|
|
|
|
let energeticDescription = pigeonVar_list[2] as! String
|
|
|
|
let energeticImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[3])
|
|
|
|
let normalDescription = pigeonVar_list[4] as! String
|
|
|
|
let normalImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[5])
|
|
|
|
let slightStressfulDescription = pigeonVar_list[6] as! String
|
|
|
|
let slightStressfulImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[7])
|
|
|
|
let stressfulDescription = pigeonVar_list[8] as! String
|
|
|
|
let stressfulImage: FlutterStandardTypedData? = nilOrValue(pigeonVar_list[9])
|
|
|
|
|
|
|
|
return WatchTransformTheme(
|
|
|
|
themeId: themeId,
|
|
|
|
themeName: themeName,
|
|
|
|
energeticDescription: energeticDescription,
|
|
|
|
energeticImage: energeticImage,
|
|
|
|
normalDescription: normalDescription,
|
|
|
|
normalImage: normalImage,
|
|
|
|
slightStressfulDescription: slightStressfulDescription,
|
|
|
|
slightStressfulImage: slightStressfulImage,
|
|
|
|
stressfulDescription: stressfulDescription,
|
|
|
|
stressfulImage: stressfulImage
|
|
|
|
)
|
|
|
|
}
|
|
|
|
func toList() -> [Any?] {
|
|
|
|
return [
|
|
|
|
themeId,
|
|
|
|
themeName,
|
|
|
|
energeticDescription,
|
|
|
|
energeticImage,
|
|
|
|
normalDescription,
|
|
|
|
normalImage,
|
|
|
|
slightStressfulDescription,
|
|
|
|
slightStressfulImage,
|
|
|
|
stressfulDescription,
|
|
|
|
stressfulImage,
|
|
|
|
]
|
|
|
|
}
|
|
|
|
static func == (lhs: WatchTransformTheme, rhs: WatchTransformTheme) -> Bool {
|
|
|
|
return deepEqualsWearEngineApi(lhs.toList(), rhs.toList()) }
|
|
|
|
func hash(into hasher: inout Hasher) {
|
|
|
|
deepHashWearEngineApi(value: toList(), hasher: &hasher)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private class WearEngineApiPigeonCodecReader: FlutterStandardReader {
|
|
|
|
override func readValue(ofType type: UInt8) -> Any? {
|
|
|
|
switch type {
|
|
|
|
case 129:
|
|
|
|
return WearDeviceInfo.fromList(self.readValue() as! [Any?])
|
|
|
|
case 130:
|
|
|
|
return WatchTransformTheme.fromList(self.readValue() as! [Any?])
|
|
|
|
default:
|
|
|
|
return super.readValue(ofType: type)
|
|
|
|
}
|
|
...
|
...
|
@@ -169,6 +232,9 @@ private class WearEngineApiPigeonCodecWriter: FlutterStandardWriter { |
|
|
|
if let value = value as? WearDeviceInfo {
|
|
|
|
super.writeByte(129)
|
|
|
|
super.writeValue(value.toList())
|
|
|
|
} else if let value = value as? WatchTransformTheme {
|
|
|
|
super.writeByte(130)
|
|
|
|
super.writeValue(value.toList())
|
|
|
|
} else {
|
|
|
|
super.writeValue(value)
|
|
|
|
}
|
|
...
|
...
|
@@ -198,7 +264,8 @@ protocol WearEngineHostApi { |
|
|
|
func sendTextMessage(message: String) throws -> Bool
|
|
|
|
/// 添加表盘
|
|
|
|
func addWatchSurface(completion: @escaping (Result<Bool, Error>) -> Void)
|
|
|
|
func sendWatchSyncPayload(jsonPayload: String, completion: @escaping (Result<Bool, Error>) -> Void)
|
|
|
|
/// 添加或者删除主题
|
|
|
|
func syncWatchTheme(theme: WatchTransformTheme?, completion: @escaping (Result<Bool, Error>) -> Void)
|
|
|
|
/// Opens the system photo picker and returns a local PNG file path after
|
|
|
|
/// removing the image background on the host platform.
|
|
|
|
func removeBackground(originImagePath: String, completion: @escaping (Result<String?, Error>) -> Void)
|
|
...
|
...
|
@@ -284,12 +351,13 @@ class WearEngineHostApiSetup { |
|
|
|
} else {
|
|
|
|
addWatchSurfaceChannel.setMessageHandler(nil)
|
|
|
|
}
|
|
|
|
let sendWatchSyncPayloadChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.WearEngineHostApi.sendWatchSyncPayload\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
|
|
|
|
/// 添加或者删除主题
|
|
|
|
let syncWatchThemeChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.WearEngineHostApi.syncWatchTheme\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
|
|
|
|
if let api = api {
|
|
|
|
sendWatchSyncPayloadChannel.setMessageHandler { message, reply in
|
|
|
|
syncWatchThemeChannel.setMessageHandler { message, reply in
|
|
|
|
let args = message as! [Any?]
|
|
|
|
let jsonPayloadArg = args[0] as! String
|
|
|
|
api.sendWatchSyncPayload(jsonPayload: jsonPayloadArg) { result in
|
|
|
|
let themeArg: WatchTransformTheme? = nilOrValue(args[0])
|
|
|
|
api.syncWatchTheme(theme: themeArg) { result in
|
|
|
|
switch result {
|
|
|
|
case .success(let res):
|
|
|
|
reply(wrapResult(res))
|
|
...
|
...
|
@@ -299,7 +367,7 @@ class WearEngineHostApiSetup { |
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
sendWatchSyncPayloadChannel.setMessageHandler(nil)
|
|
|
|
syncWatchThemeChannel.setMessageHandler(nil)
|
|
|
|
}
|
|
|
|
/// Opens the system photo picker and returns a local PNG file path after
|
|
|
|
/// removing the image background on the host platform.
|
...
|
...
|
|