Showing
11 changed files
with
424 additions
and
21 deletions
GeneratedPluginRegistrant.h
0 → 100644
| 1 | +// | ||
| 2 | +// Generated file. Do not edit. | ||
| 3 | +// | ||
| 4 | + | ||
| 5 | +// clang-format off | ||
| 6 | + | ||
| 7 | +#ifndef GeneratedPluginRegistrant_h | ||
| 8 | +#define GeneratedPluginRegistrant_h | ||
| 9 | + | ||
| 10 | +#import <Flutter/Flutter.h> | ||
| 11 | + | ||
| 12 | +NS_ASSUME_NONNULL_BEGIN | ||
| 13 | + | ||
| 14 | +@interface GeneratedPluginRegistrant : NSObject | ||
| 15 | ++ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry; | ||
| 16 | +@end | ||
| 17 | + | ||
| 18 | +NS_ASSUME_NONNULL_END | ||
| 19 | +#endif /* GeneratedPluginRegistrant_h */ |
GeneratedPluginRegistrant.m
0 → 100644
| 1 | +// | ||
| 2 | +// Generated file. Do not edit. | ||
| 3 | +// | ||
| 4 | + | ||
| 5 | +// clang-format off | ||
| 6 | + | ||
| 7 | +#import "GeneratedPluginRegistrant.h" | ||
| 8 | + | ||
| 9 | +#if __has_include(<fluttertoast/FluttertoastPlugin.h>) | ||
| 10 | +#import <fluttertoast/FluttertoastPlugin.h> | ||
| 11 | +#else | ||
| 12 | +@import fluttertoast; | ||
| 13 | +#endif | ||
| 14 | + | ||
| 15 | +#if __has_include(<image_cropper/FLTImageCropperPlugin.h>) | ||
| 16 | +#import <image_cropper/FLTImageCropperPlugin.h> | ||
| 17 | +#else | ||
| 18 | +@import image_cropper; | ||
| 19 | +#endif | ||
| 20 | + | ||
| 21 | +#if __has_include(<image_picker_ios/FLTImagePickerPlugin.h>) | ||
| 22 | +#import <image_picker_ios/FLTImagePickerPlugin.h> | ||
| 23 | +#else | ||
| 24 | +@import image_picker_ios; | ||
| 25 | +#endif | ||
| 26 | + | ||
| 27 | +#if __has_include(<path_provider_foundation/PathProviderPlugin.h>) | ||
| 28 | +#import <path_provider_foundation/PathProviderPlugin.h> | ||
| 29 | +#else | ||
| 30 | +@import path_provider_foundation; | ||
| 31 | +#endif | ||
| 32 | + | ||
| 33 | +#if __has_include(<permission_handler_apple/PermissionHandlerPlugin.h>) | ||
| 34 | +#import <permission_handler_apple/PermissionHandlerPlugin.h> | ||
| 35 | +#else | ||
| 36 | +@import permission_handler_apple; | ||
| 37 | +#endif | ||
| 38 | + | ||
| 39 | +#if __has_include(<shared_preferences_foundation/SharedPreferencesPlugin.h>) | ||
| 40 | +#import <shared_preferences_foundation/SharedPreferencesPlugin.h> | ||
| 41 | +#else | ||
| 42 | +@import shared_preferences_foundation; | ||
| 43 | +#endif | ||
| 44 | + | ||
| 45 | +#if __has_include(<sqflite_darwin/SqflitePlugin.h>) | ||
| 46 | +#import <sqflite_darwin/SqflitePlugin.h> | ||
| 47 | +#else | ||
| 48 | +@import sqflite_darwin; | ||
| 49 | +#endif | ||
| 50 | + | ||
| 51 | +#if __has_include(<webview_flutter_wkwebview/WebViewFlutterPlugin.h>) | ||
| 52 | +#import <webview_flutter_wkwebview/WebViewFlutterPlugin.h> | ||
| 53 | +#else | ||
| 54 | +@import webview_flutter_wkwebview; | ||
| 55 | +#endif | ||
| 56 | + | ||
| 57 | +@implementation GeneratedPluginRegistrant | ||
| 58 | + | ||
| 59 | ++ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry { | ||
| 60 | + [FluttertoastPlugin registerWithRegistrar:[registry registrarForPlugin:@"FluttertoastPlugin"]]; | ||
| 61 | + [FLTImageCropperPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTImageCropperPlugin"]]; | ||
| 62 | + [FLTImagePickerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTImagePickerPlugin"]]; | ||
| 63 | + [PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]]; | ||
| 64 | + [PermissionHandlerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PermissionHandlerPlugin"]]; | ||
| 65 | + [SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]]; | ||
| 66 | + [SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]]; | ||
| 67 | + [WebViewFlutterPlugin registerWithRegistrar:[registry registrarForPlugin:@"WebViewFlutterPlugin"]]; | ||
| 68 | +} | ||
| 69 | + | ||
| 70 | +@end |
| @@ -117,6 +117,40 @@ data class AppleSignInModel ( | @@ -117,6 +117,40 @@ data class AppleSignInModel ( | ||
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | /** Generated class from Pigeon that represents data sent in messages. */ | 119 | /** Generated class from Pigeon that represents data sent in messages. */ |
| 120 | +data class WatchAppOtherInfo ( | ||
| 121 | + val userId: Long? = null, | ||
| 122 | + val nickname: String? = null, | ||
| 123 | + val markName: String? = null | ||
| 124 | +) | ||
| 125 | + { | ||
| 126 | + companion object { | ||
| 127 | + fun fromList(pigeonVar_list: List<Any?>): WatchAppOtherInfo { | ||
| 128 | + val userId = pigeonVar_list[0] as Long? | ||
| 129 | + val nickname = pigeonVar_list[1] as String? | ||
| 130 | + val markName = pigeonVar_list[2] as String? | ||
| 131 | + return WatchAppOtherInfo(userId, nickname, markName) | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + fun toList(): List<Any?> { | ||
| 135 | + return listOf( | ||
| 136 | + userId, | ||
| 137 | + nickname, | ||
| 138 | + markName, | ||
| 139 | + ) | ||
| 140 | + } | ||
| 141 | + override fun equals(other: Any?): Boolean { | ||
| 142 | + if (other !is WatchAppOtherInfo) { | ||
| 143 | + return false | ||
| 144 | + } | ||
| 145 | + if (this === other) { | ||
| 146 | + return true | ||
| 147 | + } | ||
| 148 | + return PlatformApiPigeonUtils.deepEquals(toList(), other.toList()) } | ||
| 149 | + | ||
| 150 | + override fun hashCode(): Int = toList().hashCode() | ||
| 151 | +} | ||
| 152 | + | ||
| 153 | +/** Generated class from Pigeon that represents data sent in messages. */ | ||
| 120 | data class AppleProductInfo ( | 154 | data class AppleProductInfo ( |
| 121 | /** 苹果商品id */ | 155 | /** 苹果商品id */ |
| 122 | val productId: String, | 156 | val productId: String, |
| @@ -237,11 +271,16 @@ private open class PlatformApiPigeonCodec : StandardMessageCodec() { | @@ -237,11 +271,16 @@ private open class PlatformApiPigeonCodec : StandardMessageCodec() { | ||
| 237 | } | 271 | } |
| 238 | 130.toByte() -> { | 272 | 130.toByte() -> { |
| 239 | return (readValue(buffer) as? List<Any?>)?.let { | 273 | return (readValue(buffer) as? List<Any?>)?.let { |
| 240 | - AppleProductInfo.fromList(it) | 274 | + WatchAppOtherInfo.fromList(it) |
| 241 | } | 275 | } |
| 242 | } | 276 | } |
| 243 | 131.toByte() -> { | 277 | 131.toByte() -> { |
| 244 | return (readValue(buffer) as? List<Any?>)?.let { | 278 | return (readValue(buffer) as? List<Any?>)?.let { |
| 279 | + AppleProductInfo.fromList(it) | ||
| 280 | + } | ||
| 281 | + } | ||
| 282 | + 132.toByte() -> { | ||
| 283 | + return (readValue(buffer) as? List<Any?>)?.let { | ||
| 245 | AppleProductPaymentResult.fromList(it) | 284 | AppleProductPaymentResult.fromList(it) |
| 246 | } | 285 | } |
| 247 | } | 286 | } |
| @@ -254,14 +293,18 @@ private open class PlatformApiPigeonCodec : StandardMessageCodec() { | @@ -254,14 +293,18 @@ private open class PlatformApiPigeonCodec : StandardMessageCodec() { | ||
| 254 | stream.write(129) | 293 | stream.write(129) |
| 255 | writeValue(stream, value.toList()) | 294 | writeValue(stream, value.toList()) |
| 256 | } | 295 | } |
| 257 | - is AppleProductInfo -> { | 296 | + is WatchAppOtherInfo -> { |
| 258 | stream.write(130) | 297 | stream.write(130) |
| 259 | writeValue(stream, value.toList()) | 298 | writeValue(stream, value.toList()) |
| 260 | } | 299 | } |
| 261 | - is AppleProductPaymentResult -> { | 300 | + is AppleProductInfo -> { |
| 262 | stream.write(131) | 301 | stream.write(131) |
| 263 | writeValue(stream, value.toList()) | 302 | writeValue(stream, value.toList()) |
| 264 | } | 303 | } |
| 304 | + is AppleProductPaymentResult -> { | ||
| 305 | + stream.write(132) | ||
| 306 | + writeValue(stream, value.toList()) | ||
| 307 | + } | ||
| 265 | else -> super.writeValue(stream, value) | 308 | else -> super.writeValue(stream, value) |
| 266 | } | 309 | } |
| 267 | } | 310 | } |
| @@ -281,6 +324,10 @@ interface PlatformHostApi { | @@ -281,6 +324,10 @@ interface PlatformHostApi { | ||
| 281 | * baseUrl: 请求地址, https://api.doublefeel.cn | 324 | * baseUrl: 请求地址, https://api.doublefeel.cn |
| 282 | */ | 325 | */ |
| 283 | fun updateLoginInfo(jsonString: String, baseUrl: String) | 326 | fun updateLoginInfo(jsonString: String, baseUrl: String) |
| 327 | + /** 设置好友显示到表盘 */ | ||
| 328 | + fun updateWatchOtherUserInfo(otherInfo: WatchAppOtherInfo) | ||
| 329 | + /** 刷新表盘 */ | ||
| 330 | + fun refreshWatchSurface() | ||
| 284 | /** 请求苹果登录 */ | 331 | /** 请求苹果登录 */ |
| 285 | fun requestAppleSignIn(callback: (Result<AppleSignInModel?>) -> Unit) | 332 | fun requestAppleSignIn(callback: (Result<AppleSignInModel?>) -> Unit) |
| 286 | /** | 333 | /** |
| @@ -338,6 +385,40 @@ interface PlatformHostApi { | @@ -338,6 +385,40 @@ interface PlatformHostApi { | ||
| 338 | } | 385 | } |
| 339 | } | 386 | } |
| 340 | run { | 387 | run { |
| 388 | + val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.updateWatchOtherUserInfo$separatedMessageChannelSuffix", codec) | ||
| 389 | + if (api != null) { | ||
| 390 | + channel.setMessageHandler { message, reply -> | ||
| 391 | + val args = message as List<Any?> | ||
| 392 | + val otherInfoArg = args[0] as WatchAppOtherInfo | ||
| 393 | + val wrapped: List<Any?> = try { | ||
| 394 | + api.updateWatchOtherUserInfo(otherInfoArg) | ||
| 395 | + listOf(null) | ||
| 396 | + } catch (exception: Throwable) { | ||
| 397 | + PlatformApiPigeonUtils.wrapError(exception) | ||
| 398 | + } | ||
| 399 | + reply.reply(wrapped) | ||
| 400 | + } | ||
| 401 | + } else { | ||
| 402 | + channel.setMessageHandler(null) | ||
| 403 | + } | ||
| 404 | + } | ||
| 405 | + run { | ||
| 406 | + val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.refreshWatchSurface$separatedMessageChannelSuffix", codec) | ||
| 407 | + if (api != null) { | ||
| 408 | + channel.setMessageHandler { _, reply -> | ||
| 409 | + val wrapped: List<Any?> = try { | ||
| 410 | + api.refreshWatchSurface() | ||
| 411 | + listOf(null) | ||
| 412 | + } catch (exception: Throwable) { | ||
| 413 | + PlatformApiPigeonUtils.wrapError(exception) | ||
| 414 | + } | ||
| 415 | + reply.reply(wrapped) | ||
| 416 | + } | ||
| 417 | + } else { | ||
| 418 | + channel.setMessageHandler(null) | ||
| 419 | + } | ||
| 420 | + } | ||
| 421 | + run { | ||
| 341 | val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn$separatedMessageChannelSuffix", codec) | 422 | val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn$separatedMessageChannelSuffix", codec) |
| 342 | if (api != null) { | 423 | if (api != null) { |
| 343 | channel.setMessageHandler { _, reply -> | 424 | channel.setMessageHandler { _, reply -> |
flutter_lldb_helper.py
0 → 100644
| 1 | +# | ||
| 2 | +# Generated file, do not edit. | ||
| 3 | +# | ||
| 4 | + | ||
| 5 | +import lldb | ||
| 6 | + | ||
| 7 | +def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict): | ||
| 8 | + """Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages.""" | ||
| 9 | + base = frame.register["x0"].GetValueAsAddress() | ||
| 10 | + page_len = frame.register["x1"].GetValueAsUnsigned() | ||
| 11 | + | ||
| 12 | + # Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the | ||
| 13 | + # first page to see if handled it correctly. This makes diagnosing | ||
| 14 | + # misconfiguration (e.g. missing breakpoint) easier. | ||
| 15 | + data = bytearray(page_len) | ||
| 16 | + data[0:8] = b'IHELPED!' | ||
| 17 | + | ||
| 18 | + error = lldb.SBError() | ||
| 19 | + frame.GetThread().GetProcess().WriteMemory(base, data, error) | ||
| 20 | + if not error.Success(): | ||
| 21 | + print(f'Failed to write into {base}[+{page_len}]', error) | ||
| 22 | + return | ||
| 23 | + | ||
| 24 | +def __lldb_init_module(debugger: lldb.SBDebugger, _): | ||
| 25 | + target = debugger.GetDummyTarget() | ||
| 26 | + # Caveat: must use BreakpointCreateByRegEx here and not | ||
| 27 | + # BreakpointCreateByName. For some reasons callback function does not | ||
| 28 | + # get carried over from dummy target for the later. | ||
| 29 | + bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$") | ||
| 30 | + bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__)) | ||
| 31 | + bp.SetAutoContinue(True) | ||
| 32 | + print("-- LLDB integration loaded --") |
flutter_lldbinit
0 → 100644
| @@ -31,7 +31,6 @@ target 'Runner' do | @@ -31,7 +31,6 @@ target 'Runner' do | ||
| 31 | 31 | ||
| 32 | # pod 'SDWebImage' | 32 | # pod 'SDWebImage' |
| 33 | # pod 'ThinkingSDK' | 33 | # pod 'ThinkingSDK' |
| 34 | - pod 'DeviceGuru' | ||
| 35 | 34 | ||
| 36 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) | 35 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) |
| 37 | 36 |
| 1 | PODS: | 1 | PODS: |
| 2 | - - DeviceGuru (10.0.11): | ||
| 3 | - - DeviceGuru/DeviceGuru (= 10.0.11) | ||
| 4 | - - DeviceGuru/DeviceGuru (10.0.11): | ||
| 5 | - - DeviceGuru/Resources | ||
| 6 | - - DeviceGuru/Resources (10.0.11) | ||
| 7 | - Flutter (1.0.0) | 2 | - Flutter (1.0.0) |
| 8 | - fluttertoast (0.0.2): | 3 | - fluttertoast (0.0.2): |
| 9 | - Flutter | 4 | - Flutter |
| @@ -31,7 +26,6 @@ PODS: | @@ -31,7 +26,6 @@ PODS: | ||
| 31 | - FlutterMacOS | 26 | - FlutterMacOS |
| 32 | 27 | ||
| 33 | DEPENDENCIES: | 28 | DEPENDENCIES: |
| 34 | - - DeviceGuru | ||
| 35 | - Flutter (from `Flutter`) | 29 | - Flutter (from `Flutter`) |
| 36 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) | 30 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) |
| 37 | - image_cropper (from `.symlinks/plugins/image_cropper/ios`) | 31 | - image_cropper (from `.symlinks/plugins/image_cropper/ios`) |
| @@ -45,7 +39,6 @@ DEPENDENCIES: | @@ -45,7 +39,6 @@ DEPENDENCIES: | ||
| 45 | 39 | ||
| 46 | SPEC REPOS: | 40 | SPEC REPOS: |
| 47 | trunk: | 41 | trunk: |
| 48 | - - DeviceGuru | ||
| 49 | - TOCropViewController | 42 | - TOCropViewController |
| 50 | 43 | ||
| 51 | EXTERNAL SOURCES: | 44 | EXTERNAL SOURCES: |
| @@ -71,7 +64,6 @@ EXTERNAL SOURCES: | @@ -71,7 +64,6 @@ EXTERNAL SOURCES: | ||
| 71 | :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin" | 64 | :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin" |
| 72 | 65 | ||
| 73 | SPEC CHECKSUMS: | 66 | SPEC CHECKSUMS: |
| 74 | - DeviceGuru: f0f2bd81953d82777689f22025bca418e0c51d64 | ||
| 75 | Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 | 67 | Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467 |
| 76 | fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1 | 68 | fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1 |
| 77 | image_cropper: c4326ea50132b1e1564499e5d32a84f01fb03537 | 69 | image_cropper: c4326ea50132b1e1564499e5d32a84f01fb03537 |
| @@ -84,6 +76,6 @@ SPEC CHECKSUMS: | @@ -84,6 +76,6 @@ SPEC CHECKSUMS: | ||
| 84 | TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654 | 76 | TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654 |
| 85 | webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2 | 77 | webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2 |
| 86 | 78 | ||
| 87 | -PODFILE CHECKSUM: 78d575ea7e6c8cdd99d8856129cd0c16fc5c03f9 | 79 | +PODFILE CHECKSUM: 0c5ef213fb4730cd4252ac64735589552e4ee974 |
| 88 | 80 | ||
| 89 | COCOAPODS: 1.16.2 | 81 | COCOAPODS: 1.16.2 |
| @@ -150,6 +150,39 @@ struct AppleSignInModel: Hashable { | @@ -150,6 +150,39 @@ struct AppleSignInModel: Hashable { | ||
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | /// Generated class from Pigeon that represents data sent in messages. | 152 | /// Generated class from Pigeon that represents data sent in messages. |
| 153 | +struct WatchAppOtherInfo: Hashable { | ||
| 154 | + var userId: Int64? = nil | ||
| 155 | + var nickname: String? = nil | ||
| 156 | + var markName: String? = nil | ||
| 157 | + | ||
| 158 | + | ||
| 159 | + // swift-format-ignore: AlwaysUseLowerCamelCase | ||
| 160 | + static func fromList(_ pigeonVar_list: [Any?]) -> WatchAppOtherInfo? { | ||
| 161 | + let userId: Int64? = nilOrValue(pigeonVar_list[0]) | ||
| 162 | + let nickname: String? = nilOrValue(pigeonVar_list[1]) | ||
| 163 | + let markName: String? = nilOrValue(pigeonVar_list[2]) | ||
| 164 | + | ||
| 165 | + return WatchAppOtherInfo( | ||
| 166 | + userId: userId, | ||
| 167 | + nickname: nickname, | ||
| 168 | + markName: markName | ||
| 169 | + ) | ||
| 170 | + } | ||
| 171 | + func toList() -> [Any?] { | ||
| 172 | + return [ | ||
| 173 | + userId, | ||
| 174 | + nickname, | ||
| 175 | + markName, | ||
| 176 | + ] | ||
| 177 | + } | ||
| 178 | + static func == (lhs: WatchAppOtherInfo, rhs: WatchAppOtherInfo) -> Bool { | ||
| 179 | + return deepEqualsPlatformApi(lhs.toList(), rhs.toList()) } | ||
| 180 | + func hash(into hasher: inout Hasher) { | ||
| 181 | + deepHashPlatformApi(value: toList(), hasher: &hasher) | ||
| 182 | + } | ||
| 183 | +} | ||
| 184 | + | ||
| 185 | +/// Generated class from Pigeon that represents data sent in messages. | ||
| 153 | struct AppleProductInfo: Hashable { | 186 | struct AppleProductInfo: Hashable { |
| 154 | /// 苹果商品id | 187 | /// 苹果商品id |
| 155 | var productId: String | 188 | var productId: String |
| @@ -270,8 +303,10 @@ private class PlatformApiPigeonCodecReader: FlutterStandardReader { | @@ -270,8 +303,10 @@ private class PlatformApiPigeonCodecReader: FlutterStandardReader { | ||
| 270 | case 129: | 303 | case 129: |
| 271 | return AppleSignInModel.fromList(self.readValue() as! [Any?]) | 304 | return AppleSignInModel.fromList(self.readValue() as! [Any?]) |
| 272 | case 130: | 305 | case 130: |
| 273 | - return AppleProductInfo.fromList(self.readValue() as! [Any?]) | 306 | + return WatchAppOtherInfo.fromList(self.readValue() as! [Any?]) |
| 274 | case 131: | 307 | case 131: |
| 308 | + return AppleProductInfo.fromList(self.readValue() as! [Any?]) | ||
| 309 | + case 132: | ||
| 275 | return AppleProductPaymentResult.fromList(self.readValue() as! [Any?]) | 310 | return AppleProductPaymentResult.fromList(self.readValue() as! [Any?]) |
| 276 | default: | 311 | default: |
| 277 | return super.readValue(ofType: type) | 312 | return super.readValue(ofType: type) |
| @@ -284,12 +319,15 @@ private class PlatformApiPigeonCodecWriter: FlutterStandardWriter { | @@ -284,12 +319,15 @@ private class PlatformApiPigeonCodecWriter: FlutterStandardWriter { | ||
| 284 | if let value = value as? AppleSignInModel { | 319 | if let value = value as? AppleSignInModel { |
| 285 | super.writeByte(129) | 320 | super.writeByte(129) |
| 286 | super.writeValue(value.toList()) | 321 | super.writeValue(value.toList()) |
| 287 | - } else if let value = value as? AppleProductInfo { | 322 | + } else if let value = value as? WatchAppOtherInfo { |
| 288 | super.writeByte(130) | 323 | super.writeByte(130) |
| 289 | super.writeValue(value.toList()) | 324 | super.writeValue(value.toList()) |
| 290 | - } else if let value = value as? AppleProductPaymentResult { | 325 | + } else if let value = value as? AppleProductInfo { |
| 291 | super.writeByte(131) | 326 | super.writeByte(131) |
| 292 | super.writeValue(value.toList()) | 327 | super.writeValue(value.toList()) |
| 328 | + } else if let value = value as? AppleProductPaymentResult { | ||
| 329 | + super.writeByte(132) | ||
| 330 | + super.writeValue(value.toList()) | ||
| 293 | } else { | 331 | } else { |
| 294 | super.writeValue(value) | 332 | super.writeValue(value) |
| 295 | } | 333 | } |
| @@ -320,6 +358,10 @@ protocol PlatformHostApi { | @@ -320,6 +358,10 @@ protocol PlatformHostApi { | ||
| 320 | /// jsonString: UserPreferences的序列化string | 358 | /// jsonString: UserPreferences的序列化string |
| 321 | /// baseUrl: 请求地址, https://api.doublefeel.cn | 359 | /// baseUrl: 请求地址, https://api.doublefeel.cn |
| 322 | func updateLoginInfo(jsonString: String, baseUrl: String) throws | 360 | func updateLoginInfo(jsonString: String, baseUrl: String) throws |
| 361 | + /// 设置好友显示到表盘 | ||
| 362 | + func updateWatchOtherUserInfo(otherInfo: WatchAppOtherInfo) throws | ||
| 363 | + /// 刷新表盘 | ||
| 364 | + func refreshWatchSurface() throws | ||
| 323 | /// 请求苹果登录 | 365 | /// 请求苹果登录 |
| 324 | func requestAppleSignIn(completion: @escaping (Result<AppleSignInModel?, Error>) -> Void) | 366 | func requestAppleSignIn(completion: @escaping (Result<AppleSignInModel?, Error>) -> Void) |
| 325 | /// 查询指定id的苹果商品 | 367 | /// 查询指定id的苹果商品 |
| @@ -372,6 +414,36 @@ class PlatformHostApiSetup { | @@ -372,6 +414,36 @@ class PlatformHostApiSetup { | ||
| 372 | } else { | 414 | } else { |
| 373 | updateLoginInfoChannel.setMessageHandler(nil) | 415 | updateLoginInfoChannel.setMessageHandler(nil) |
| 374 | } | 416 | } |
| 417 | + /// 设置好友显示到表盘 | ||
| 418 | + let updateWatchOtherUserInfoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.updateWatchOtherUserInfo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) | ||
| 419 | + if let api = api { | ||
| 420 | + updateWatchOtherUserInfoChannel.setMessageHandler { message, reply in | ||
| 421 | + let args = message as! [Any?] | ||
| 422 | + let otherInfoArg = args[0] as! WatchAppOtherInfo | ||
| 423 | + do { | ||
| 424 | + try api.updateWatchOtherUserInfo(otherInfo: otherInfoArg) | ||
| 425 | + reply(wrapResult(nil)) | ||
| 426 | + } catch { | ||
| 427 | + reply(wrapError(error)) | ||
| 428 | + } | ||
| 429 | + } | ||
| 430 | + } else { | ||
| 431 | + updateWatchOtherUserInfoChannel.setMessageHandler(nil) | ||
| 432 | + } | ||
| 433 | + /// 刷新表盘 | ||
| 434 | + let refreshWatchSurfaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.refreshWatchSurface\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) | ||
| 435 | + if let api = api { | ||
| 436 | + refreshWatchSurfaceChannel.setMessageHandler { _, reply in | ||
| 437 | + do { | ||
| 438 | + try api.refreshWatchSurface() | ||
| 439 | + reply(wrapResult(nil)) | ||
| 440 | + } catch { | ||
| 441 | + reply(wrapError(error)) | ||
| 442 | + } | ||
| 443 | + } | ||
| 444 | + } else { | ||
| 445 | + refreshWatchSurfaceChannel.setMessageHandler(nil) | ||
| 446 | + } | ||
| 375 | /// 请求苹果登录 | 447 | /// 请求苹果登录 |
| 376 | let requestAppleSignInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) | 448 | let requestAppleSignInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec) |
| 377 | if let api = api { | 449 | if let api = api { |
| @@ -6,8 +6,8 @@ | @@ -6,8 +6,8 @@ | ||
| 6 | // | 6 | // |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | +import UIKit | ||
| 9 | import WebKit | 10 | import WebKit |
| 10 | -import DeviceGuru | ||
| 11 | 11 | ||
| 12 | extension UIApplication { | 12 | extension UIApplication { |
| 13 | var currentWindowScene: UIWindowScene? { | 13 | var currentWindowScene: UIWindowScene? { |
| @@ -39,7 +39,7 @@ class UserAgent { | @@ -39,7 +39,7 @@ class UserAgent { | ||
| 39 | func customUA() -> String { | 39 | func customUA() -> String { |
| 40 | let version = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) as! NSString | 40 | let version = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) as! NSString |
| 41 | let bundle = Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "" | 41 | let bundle = Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "" |
| 42 | - let hardware = DeviceGuruImplementation().hardwareString | 42 | + let hardware = Self.hardwareString() |
| 43 | let systemVersion = UIDevice.current.systemVersion | 43 | let systemVersion = UIDevice.current.systemVersion |
| 44 | let height = UIApplication.shared.currentScreen?.bounds.height ?? 0 | 44 | let height = UIApplication.shared.currentScreen?.bounds.height ?? 0 |
| 45 | let width = UIApplication.shared.currentScreen?.bounds.width ?? 0 | 45 | let width = UIApplication.shared.currentScreen?.bounds.width ?? 0 |
| @@ -51,4 +51,14 @@ class UserAgent { | @@ -51,4 +51,14 @@ class UserAgent { | ||
| 51 | return ua | 51 | return ua |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | + private static func hardwareString() -> String { | ||
| 55 | + var systemInfo = utsname() | ||
| 56 | + uname(&systemInfo) | ||
| 57 | + | ||
| 58 | + return withUnsafePointer(to: &systemInfo.machine) { pointer in | ||
| 59 | + pointer.withMemoryRebound(to: CChar.self, capacity: 1) { machine in | ||
| 60 | + String(cString: machine) | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + } | ||
| 54 | } | 64 | } |
| @@ -86,6 +86,57 @@ class AppleSignInModel { | @@ -86,6 +86,57 @@ class AppleSignInModel { | ||
| 86 | ; | 86 | ; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | +class WatchAppOtherInfo { | ||
| 90 | + WatchAppOtherInfo({ | ||
| 91 | + this.userId, | ||
| 92 | + this.nickname, | ||
| 93 | + this.markName, | ||
| 94 | + }); | ||
| 95 | + | ||
| 96 | + int? userId; | ||
| 97 | + | ||
| 98 | + String? nickname; | ||
| 99 | + | ||
| 100 | + String? markName; | ||
| 101 | + | ||
| 102 | + List<Object?> _toList() { | ||
| 103 | + return <Object?>[ | ||
| 104 | + userId, | ||
| 105 | + nickname, | ||
| 106 | + markName, | ||
| 107 | + ]; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + Object encode() { | ||
| 111 | + return _toList(); } | ||
| 112 | + | ||
| 113 | + static WatchAppOtherInfo decode(Object result) { | ||
| 114 | + result as List<Object?>; | ||
| 115 | + return WatchAppOtherInfo( | ||
| 116 | + userId: result[0] as int?, | ||
| 117 | + nickname: result[1] as String?, | ||
| 118 | + markName: result[2] as String?, | ||
| 119 | + ); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + @override | ||
| 123 | + // ignore: avoid_equals_and_hash_code_on_mutable_classes | ||
| 124 | + bool operator ==(Object other) { | ||
| 125 | + if (other is! WatchAppOtherInfo || other.runtimeType != runtimeType) { | ||
| 126 | + return false; | ||
| 127 | + } | ||
| 128 | + if (identical(this, other)) { | ||
| 129 | + return true; | ||
| 130 | + } | ||
| 131 | + return _deepEquals(encode(), other.encode()); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + @override | ||
| 135 | + // ignore: avoid_equals_and_hash_code_on_mutable_classes | ||
| 136 | + int get hashCode => Object.hashAll(_toList()) | ||
| 137 | +; | ||
| 138 | +} | ||
| 139 | + | ||
| 89 | class AppleProductInfo { | 140 | class AppleProductInfo { |
| 90 | AppleProductInfo({ | 141 | AppleProductInfo({ |
| 91 | required this.productId, | 142 | required this.productId, |
| @@ -257,12 +308,15 @@ class _PigeonCodec extends StandardMessageCodec { | @@ -257,12 +308,15 @@ class _PigeonCodec extends StandardMessageCodec { | ||
| 257 | } else if (value is AppleSignInModel) { | 308 | } else if (value is AppleSignInModel) { |
| 258 | buffer.putUint8(129); | 309 | buffer.putUint8(129); |
| 259 | writeValue(buffer, value.encode()); | 310 | writeValue(buffer, value.encode()); |
| 260 | - } else if (value is AppleProductInfo) { | 311 | + } else if (value is WatchAppOtherInfo) { |
| 261 | buffer.putUint8(130); | 312 | buffer.putUint8(130); |
| 262 | writeValue(buffer, value.encode()); | 313 | writeValue(buffer, value.encode()); |
| 263 | - } else if (value is AppleProductPaymentResult) { | 314 | + } else if (value is AppleProductInfo) { |
| 264 | buffer.putUint8(131); | 315 | buffer.putUint8(131); |
| 265 | writeValue(buffer, value.encode()); | 316 | writeValue(buffer, value.encode()); |
| 317 | + } else if (value is AppleProductPaymentResult) { | ||
| 318 | + buffer.putUint8(132); | ||
| 319 | + writeValue(buffer, value.encode()); | ||
| 266 | } else { | 320 | } else { |
| 267 | super.writeValue(buffer, value); | 321 | super.writeValue(buffer, value); |
| 268 | } | 322 | } |
| @@ -274,8 +328,10 @@ class _PigeonCodec extends StandardMessageCodec { | @@ -274,8 +328,10 @@ class _PigeonCodec extends StandardMessageCodec { | ||
| 274 | case 129: | 328 | case 129: |
| 275 | return AppleSignInModel.decode(readValue(buffer)!); | 329 | return AppleSignInModel.decode(readValue(buffer)!); |
| 276 | case 130: | 330 | case 130: |
| 277 | - return AppleProductInfo.decode(readValue(buffer)!); | 331 | + return WatchAppOtherInfo.decode(readValue(buffer)!); |
| 278 | case 131: | 332 | case 131: |
| 333 | + return AppleProductInfo.decode(readValue(buffer)!); | ||
| 334 | + case 132: | ||
| 279 | return AppleProductPaymentResult.decode(readValue(buffer)!); | 335 | return AppleProductPaymentResult.decode(readValue(buffer)!); |
| 280 | default: | 336 | default: |
| 281 | return super.readValueOfType(type, buffer); | 337 | return super.readValueOfType(type, buffer); |
| @@ -352,6 +408,54 @@ class PlatformHostApi { | @@ -352,6 +408,54 @@ class PlatformHostApi { | ||
| 352 | } | 408 | } |
| 353 | } | 409 | } |
| 354 | 410 | ||
| 411 | + /// 设置好友显示到表盘 | ||
| 412 | + Future<void> updateWatchOtherUserInfo(WatchAppOtherInfo otherInfo) async { | ||
| 413 | + final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.updateWatchOtherUserInfo$pigeonVar_messageChannelSuffix'; | ||
| 414 | + final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>( | ||
| 415 | + pigeonVar_channelName, | ||
| 416 | + pigeonChannelCodec, | ||
| 417 | + binaryMessenger: pigeonVar_binaryMessenger, | ||
| 418 | + ); | ||
| 419 | + final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[otherInfo]); | ||
| 420 | + final List<Object?>? pigeonVar_replyList = | ||
| 421 | + await pigeonVar_sendFuture as List<Object?>?; | ||
| 422 | + if (pigeonVar_replyList == null) { | ||
| 423 | + throw _createConnectionError(pigeonVar_channelName); | ||
| 424 | + } else if (pigeonVar_replyList.length > 1) { | ||
| 425 | + throw PlatformException( | ||
| 426 | + code: pigeonVar_replyList[0]! as String, | ||
| 427 | + message: pigeonVar_replyList[1] as String?, | ||
| 428 | + details: pigeonVar_replyList[2], | ||
| 429 | + ); | ||
| 430 | + } else { | ||
| 431 | + return; | ||
| 432 | + } | ||
| 433 | + } | ||
| 434 | + | ||
| 435 | + /// 刷新表盘 | ||
| 436 | + Future<void> refreshWatchSurface() async { | ||
| 437 | + final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.refreshWatchSurface$pigeonVar_messageChannelSuffix'; | ||
| 438 | + final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>( | ||
| 439 | + pigeonVar_channelName, | ||
| 440 | + pigeonChannelCodec, | ||
| 441 | + binaryMessenger: pigeonVar_binaryMessenger, | ||
| 442 | + ); | ||
| 443 | + final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null); | ||
| 444 | + final List<Object?>? pigeonVar_replyList = | ||
| 445 | + await pigeonVar_sendFuture as List<Object?>?; | ||
| 446 | + if (pigeonVar_replyList == null) { | ||
| 447 | + throw _createConnectionError(pigeonVar_channelName); | ||
| 448 | + } else if (pigeonVar_replyList.length > 1) { | ||
| 449 | + throw PlatformException( | ||
| 450 | + code: pigeonVar_replyList[0]! as String, | ||
| 451 | + message: pigeonVar_replyList[1] as String?, | ||
| 452 | + details: pigeonVar_replyList[2], | ||
| 453 | + ); | ||
| 454 | + } else { | ||
| 455 | + return; | ||
| 456 | + } | ||
| 457 | + } | ||
| 458 | + | ||
| 355 | /// 请求苹果登录 | 459 | /// 请求苹果登录 |
| 356 | Future<AppleSignInModel?> requestAppleSignIn() async { | 460 | Future<AppleSignInModel?> requestAppleSignIn() async { |
| 357 | final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn$pigeonVar_messageChannelSuffix'; | 461 | final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn$pigeonVar_messageChannelSuffix'; |
| @@ -14,6 +14,18 @@ class AppleSignInModel { | @@ -14,6 +14,18 @@ class AppleSignInModel { | ||
| 14 | }); | 14 | }); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | +class WatchAppOtherInfo { | ||
| 18 | + final int? userId; | ||
| 19 | + final String? nickname; | ||
| 20 | + final String? markName; | ||
| 21 | + | ||
| 22 | + WatchAppOtherInfo({ | ||
| 23 | + this.userId, | ||
| 24 | + this.nickname, | ||
| 25 | + this.markName, | ||
| 26 | + }); | ||
| 27 | +} | ||
| 28 | + | ||
| 17 | class AppleProductInfo { | 29 | class AppleProductInfo { |
| 18 | /// 苹果商品id | 30 | /// 苹果商品id |
| 19 | final String productId; | 31 | final String productId; |
| @@ -55,6 +67,7 @@ class AppleProductPaymentResult { | @@ -55,6 +67,7 @@ class AppleProductPaymentResult { | ||
| 55 | final String? appAccountToken; | 67 | final String? appAccountToken; |
| 56 | final String? originalTransactionId; | 68 | final String? originalTransactionId; |
| 57 | final String? transactionId; | 69 | final String? transactionId; |
| 70 | + | ||
| 58 | /// success 为空时是支付pending状态,不需要处理 | 71 | /// success 为空时是支付pending状态,不需要处理 |
| 59 | /// 只有 true/false时才是支付结果出来的时候 | 72 | /// 只有 true/false时才是支付结果出来的时候 |
| 60 | final bool? success; | 73 | final bool? success; |
| @@ -103,6 +116,12 @@ abstract class PlatformHostApi { | @@ -103,6 +116,12 @@ abstract class PlatformHostApi { | ||
| 103 | /// baseUrl: 请求地址, https://api.doublefeel.cn | 116 | /// baseUrl: 请求地址, https://api.doublefeel.cn |
| 104 | void updateLoginInfo(String jsonString, String baseUrl); | 117 | void updateLoginInfo(String jsonString, String baseUrl); |
| 105 | 118 | ||
| 119 | + /// 设置好友显示到表盘 | ||
| 120 | + void updateWatchOtherUserInfo(WatchAppOtherInfo otherInfo); | ||
| 121 | + | ||
| 122 | + /// 刷新表盘 | ||
| 123 | + void refreshWatchSurface(); | ||
| 124 | + | ||
| 106 | /// 请求苹果登录 | 125 | /// 请求苹果登录 |
| 107 | @async | 126 | @async |
| 108 | AppleSignInModel? requestAppleSignIn(); | 127 | AppleSignInModel? requestAppleSignIn(); |
-
Please register or login to post a comment