Commit cf089e8c07f9b42b61bb231af1ebf00258e9af39

Authored by 权海
1 parent 7ab53327

feat(ui):增加设置好友到表盘的接口和刷新表盘的接口

//
// Generated file. Do not edit.
//
// clang-format off
#ifndef GeneratedPluginRegistrant_h
#define GeneratedPluginRegistrant_h
#import <Flutter/Flutter.h>
NS_ASSUME_NONNULL_BEGIN
@interface GeneratedPluginRegistrant : NSObject
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry;
@end
NS_ASSUME_NONNULL_END
#endif /* GeneratedPluginRegistrant_h */
... ...
//
// Generated file. Do not edit.
//
// clang-format off
#import "GeneratedPluginRegistrant.h"
#if __has_include(<fluttertoast/FluttertoastPlugin.h>)
#import <fluttertoast/FluttertoastPlugin.h>
#else
@import fluttertoast;
#endif
#if __has_include(<image_cropper/FLTImageCropperPlugin.h>)
#import <image_cropper/FLTImageCropperPlugin.h>
#else
@import image_cropper;
#endif
#if __has_include(<image_picker_ios/FLTImagePickerPlugin.h>)
#import <image_picker_ios/FLTImagePickerPlugin.h>
#else
@import image_picker_ios;
#endif
#if __has_include(<path_provider_foundation/PathProviderPlugin.h>)
#import <path_provider_foundation/PathProviderPlugin.h>
#else
@import path_provider_foundation;
#endif
#if __has_include(<permission_handler_apple/PermissionHandlerPlugin.h>)
#import <permission_handler_apple/PermissionHandlerPlugin.h>
#else
@import permission_handler_apple;
#endif
#if __has_include(<shared_preferences_foundation/SharedPreferencesPlugin.h>)
#import <shared_preferences_foundation/SharedPreferencesPlugin.h>
#else
@import shared_preferences_foundation;
#endif
#if __has_include(<sqflite_darwin/SqflitePlugin.h>)
#import <sqflite_darwin/SqflitePlugin.h>
#else
@import sqflite_darwin;
#endif
#if __has_include(<webview_flutter_wkwebview/WebViewFlutterPlugin.h>)
#import <webview_flutter_wkwebview/WebViewFlutterPlugin.h>
#else
@import webview_flutter_wkwebview;
#endif
@implementation GeneratedPluginRegistrant
+ (void)registerWithRegistry:(NSObject<FlutterPluginRegistry>*)registry {
[FluttertoastPlugin registerWithRegistrar:[registry registrarForPlugin:@"FluttertoastPlugin"]];
[FLTImageCropperPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTImageCropperPlugin"]];
[FLTImagePickerPlugin registerWithRegistrar:[registry registrarForPlugin:@"FLTImagePickerPlugin"]];
[PathProviderPlugin registerWithRegistrar:[registry registrarForPlugin:@"PathProviderPlugin"]];
[PermissionHandlerPlugin registerWithRegistrar:[registry registrarForPlugin:@"PermissionHandlerPlugin"]];
[SharedPreferencesPlugin registerWithRegistrar:[registry registrarForPlugin:@"SharedPreferencesPlugin"]];
[SqflitePlugin registerWithRegistrar:[registry registrarForPlugin:@"SqflitePlugin"]];
[WebViewFlutterPlugin registerWithRegistrar:[registry registrarForPlugin:@"WebViewFlutterPlugin"]];
}
@end
... ...
... ... @@ -117,6 +117,40 @@ data class AppleSignInModel (
}
/** Generated class from Pigeon that represents data sent in messages. */
data class WatchAppOtherInfo (
val userId: Long? = null,
val nickname: String? = null,
val markName: String? = null
)
{
companion object {
fun fromList(pigeonVar_list: List<Any?>): WatchAppOtherInfo {
val userId = pigeonVar_list[0] as Long?
val nickname = pigeonVar_list[1] as String?
val markName = pigeonVar_list[2] as String?
return WatchAppOtherInfo(userId, nickname, markName)
}
}
fun toList(): List<Any?> {
return listOf(
userId,
nickname,
markName,
)
}
override fun equals(other: Any?): Boolean {
if (other !is WatchAppOtherInfo) {
return false
}
if (this === other) {
return true
}
return PlatformApiPigeonUtils.deepEquals(toList(), other.toList()) }
override fun hashCode(): Int = toList().hashCode()
}
/** Generated class from Pigeon that represents data sent in messages. */
data class AppleProductInfo (
/** 苹果商品id */
val productId: String,
... ... @@ -237,11 +271,16 @@ private open class PlatformApiPigeonCodec : StandardMessageCodec() {
}
130.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AppleProductInfo.fromList(it)
WatchAppOtherInfo.fromList(it)
}
}
131.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AppleProductInfo.fromList(it)
}
}
132.toByte() -> {
return (readValue(buffer) as? List<Any?>)?.let {
AppleProductPaymentResult.fromList(it)
}
}
... ... @@ -254,14 +293,18 @@ private open class PlatformApiPigeonCodec : StandardMessageCodec() {
stream.write(129)
writeValue(stream, value.toList())
}
is AppleProductInfo -> {
is WatchAppOtherInfo -> {
stream.write(130)
writeValue(stream, value.toList())
}
is AppleProductPaymentResult -> {
is AppleProductInfo -> {
stream.write(131)
writeValue(stream, value.toList())
}
is AppleProductPaymentResult -> {
stream.write(132)
writeValue(stream, value.toList())
}
else -> super.writeValue(stream, value)
}
}
... ... @@ -281,6 +324,10 @@ interface PlatformHostApi {
* baseUrl: 请求地址, https://api.doublefeel.cn
*/
fun updateLoginInfo(jsonString: String, baseUrl: String)
/** 设置好友显示到表盘 */
fun updateWatchOtherUserInfo(otherInfo: WatchAppOtherInfo)
/** 刷新表盘 */
fun refreshWatchSurface()
/** 请求苹果登录 */
fun requestAppleSignIn(callback: (Result<AppleSignInModel?>) -> Unit)
/**
... ... @@ -338,6 +385,40 @@ interface PlatformHostApi {
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.updateWatchOtherUserInfo$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { message, reply ->
val args = message as List<Any?>
val otherInfoArg = args[0] as WatchAppOtherInfo
val wrapped: List<Any?> = try {
api.updateWatchOtherUserInfo(otherInfoArg)
listOf(null)
} catch (exception: Throwable) {
PlatformApiPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.refreshWatchSurface$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
val wrapped: List<Any?> = try {
api.refreshWatchSurface()
listOf(null)
} catch (exception: Throwable) {
PlatformApiPigeonUtils.wrapError(exception)
}
reply.reply(wrapped)
}
} else {
channel.setMessageHandler(null)
}
}
run {
val channel = BasicMessageChannel<Any?>(binaryMessenger, "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn$separatedMessageChannelSuffix", codec)
if (api != null) {
channel.setMessageHandler { _, reply ->
... ...
#
# Generated file, do not edit.
#
import lldb
def handle_new_rx_page(frame: lldb.SBFrame, bp_loc, extra_args, intern_dict):
"""Intercept NOTIFY_DEBUGGER_ABOUT_RX_PAGES and touch the pages."""
base = frame.register["x0"].GetValueAsAddress()
page_len = frame.register["x1"].GetValueAsUnsigned()
# Note: NOTIFY_DEBUGGER_ABOUT_RX_PAGES will check contents of the
# first page to see if handled it correctly. This makes diagnosing
# misconfiguration (e.g. missing breakpoint) easier.
data = bytearray(page_len)
data[0:8] = b'IHELPED!'
error = lldb.SBError()
frame.GetThread().GetProcess().WriteMemory(base, data, error)
if not error.Success():
print(f'Failed to write into {base}[+{page_len}]', error)
return
def __lldb_init_module(debugger: lldb.SBDebugger, _):
target = debugger.GetDummyTarget()
# Caveat: must use BreakpointCreateByRegEx here and not
# BreakpointCreateByName. For some reasons callback function does not
# get carried over from dummy target for the later.
bp = target.BreakpointCreateByRegex("^NOTIFY_DEBUGGER_ABOUT_RX_PAGES$")
bp.SetScriptCallbackFunction('{}.handle_new_rx_page'.format(__name__))
bp.SetAutoContinue(True)
print("-- LLDB integration loaded --")
... ...
#
# Generated file, do not edit.
#
command script import --relative-to-command-file flutter_lldb_helper.py
... ...
... ... @@ -31,7 +31,6 @@ target 'Runner' do
# pod 'SDWebImage'
# pod 'ThinkingSDK'
pod 'DeviceGuru'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
... ...
PODS:
- DeviceGuru (10.0.11):
- DeviceGuru/DeviceGuru (= 10.0.11)
- DeviceGuru/DeviceGuru (10.0.11):
- DeviceGuru/Resources
- DeviceGuru/Resources (10.0.11)
- Flutter (1.0.0)
- fluttertoast (0.0.2):
- Flutter
... ... @@ -31,7 +26,6 @@ PODS:
- FlutterMacOS
DEPENDENCIES:
- DeviceGuru
- Flutter (from `Flutter`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- image_cropper (from `.symlinks/plugins/image_cropper/ios`)
... ... @@ -45,7 +39,6 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- DeviceGuru
- TOCropViewController
EXTERNAL SOURCES:
... ... @@ -71,7 +64,6 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"
SPEC CHECKSUMS:
DeviceGuru: f0f2bd81953d82777689f22025bca418e0c51d64
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1
image_cropper: c4326ea50132b1e1564499e5d32a84f01fb03537
... ... @@ -84,6 +76,6 @@ SPEC CHECKSUMS:
TOCropViewController: 80b8985ad794298fb69d3341de183f33d1853654
webview_flutter_wkwebview: 1821ceac936eba6f7984d89a9f3bcb4dea99ebb2
PODFILE CHECKSUM: 78d575ea7e6c8cdd99d8856129cd0c16fc5c03f9
PODFILE CHECKSUM: 0c5ef213fb4730cd4252ac64735589552e4ee974
COCOAPODS: 1.16.2
... ...
... ... @@ -150,6 +150,39 @@ struct AppleSignInModel: Hashable {
}
/// Generated class from Pigeon that represents data sent in messages.
struct WatchAppOtherInfo: Hashable {
var userId: Int64? = nil
var nickname: String? = nil
var markName: String? = nil
// swift-format-ignore: AlwaysUseLowerCamelCase
static func fromList(_ pigeonVar_list: [Any?]) -> WatchAppOtherInfo? {
let userId: Int64? = nilOrValue(pigeonVar_list[0])
let nickname: String? = nilOrValue(pigeonVar_list[1])
let markName: String? = nilOrValue(pigeonVar_list[2])
return WatchAppOtherInfo(
userId: userId,
nickname: nickname,
markName: markName
)
}
func toList() -> [Any?] {
return [
userId,
nickname,
markName,
]
}
static func == (lhs: WatchAppOtherInfo, rhs: WatchAppOtherInfo) -> Bool {
return deepEqualsPlatformApi(lhs.toList(), rhs.toList()) }
func hash(into hasher: inout Hasher) {
deepHashPlatformApi(value: toList(), hasher: &hasher)
}
}
/// Generated class from Pigeon that represents data sent in messages.
struct AppleProductInfo: Hashable {
/// 苹果商品id
var productId: String
... ... @@ -270,8 +303,10 @@ private class PlatformApiPigeonCodecReader: FlutterStandardReader {
case 129:
return AppleSignInModel.fromList(self.readValue() as! [Any?])
case 130:
return AppleProductInfo.fromList(self.readValue() as! [Any?])
return WatchAppOtherInfo.fromList(self.readValue() as! [Any?])
case 131:
return AppleProductInfo.fromList(self.readValue() as! [Any?])
case 132:
return AppleProductPaymentResult.fromList(self.readValue() as! [Any?])
default:
return super.readValue(ofType: type)
... ... @@ -284,12 +319,15 @@ private class PlatformApiPigeonCodecWriter: FlutterStandardWriter {
if let value = value as? AppleSignInModel {
super.writeByte(129)
super.writeValue(value.toList())
} else if let value = value as? AppleProductInfo {
} else if let value = value as? WatchAppOtherInfo {
super.writeByte(130)
super.writeValue(value.toList())
} else if let value = value as? AppleProductPaymentResult {
} else if let value = value as? AppleProductInfo {
super.writeByte(131)
super.writeValue(value.toList())
} else if let value = value as? AppleProductPaymentResult {
super.writeByte(132)
super.writeValue(value.toList())
} else {
super.writeValue(value)
}
... ... @@ -320,6 +358,10 @@ protocol PlatformHostApi {
/// jsonString: UserPreferences的序列化string
/// baseUrl: 请求地址, https://api.doublefeel.cn
func updateLoginInfo(jsonString: String, baseUrl: String) throws
/// 设置好友显示到表盘
func updateWatchOtherUserInfo(otherInfo: WatchAppOtherInfo) throws
/// 刷新表盘
func refreshWatchSurface() throws
/// 请求苹果登录
func requestAppleSignIn(completion: @escaping (Result<AppleSignInModel?, Error>) -> Void)
/// 查询指定id的苹果商品
... ... @@ -372,6 +414,36 @@ class PlatformHostApiSetup {
} else {
updateLoginInfoChannel.setMessageHandler(nil)
}
/// 设置好友显示到表盘
let updateWatchOtherUserInfoChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.updateWatchOtherUserInfo\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
updateWatchOtherUserInfoChannel.setMessageHandler { message, reply in
let args = message as! [Any?]
let otherInfoArg = args[0] as! WatchAppOtherInfo
do {
try api.updateWatchOtherUserInfo(otherInfo: otherInfoArg)
reply(wrapResult(nil))
} catch {
reply(wrapError(error))
}
}
} else {
updateWatchOtherUserInfoChannel.setMessageHandler(nil)
}
/// 刷新表盘
let refreshWatchSurfaceChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.refreshWatchSurface\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
refreshWatchSurfaceChannel.setMessageHandler { _, reply in
do {
try api.refreshWatchSurface()
reply(wrapResult(nil))
} catch {
reply(wrapError(error))
}
}
} else {
refreshWatchSurfaceChannel.setMessageHandler(nil)
}
/// 请求苹果登录
let requestAppleSignInChannel = FlutterBasicMessageChannel(name: "dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn\(channelSuffix)", binaryMessenger: binaryMessenger, codec: codec)
if let api = api {
... ...
... ... @@ -6,8 +6,8 @@
//
import Foundation
import UIKit
import WebKit
import DeviceGuru
extension UIApplication {
var currentWindowScene: UIWindowScene? {
... ... @@ -39,7 +39,7 @@ class UserAgent {
func customUA() -> String {
let version = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) as! NSString
let bundle = Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? ""
let hardware = DeviceGuruImplementation().hardwareString
let hardware = Self.hardwareString()
let systemVersion = UIDevice.current.systemVersion
let height = UIApplication.shared.currentScreen?.bounds.height ?? 0
let width = UIApplication.shared.currentScreen?.bounds.width ?? 0
... ... @@ -51,4 +51,14 @@ class UserAgent {
return ua
}
private static func hardwareString() -> String {
var systemInfo = utsname()
uname(&systemInfo)
return withUnsafePointer(to: &systemInfo.machine) { pointer in
pointer.withMemoryRebound(to: CChar.self, capacity: 1) { machine in
String(cString: machine)
}
}
}
}
... ...
... ... @@ -86,6 +86,57 @@ class AppleSignInModel {
;
}
class WatchAppOtherInfo {
WatchAppOtherInfo({
this.userId,
this.nickname,
this.markName,
});
int? userId;
String? nickname;
String? markName;
List<Object?> _toList() {
return <Object?>[
userId,
nickname,
markName,
];
}
Object encode() {
return _toList(); }
static WatchAppOtherInfo decode(Object result) {
result as List<Object?>;
return WatchAppOtherInfo(
userId: result[0] as int?,
nickname: result[1] as String?,
markName: result[2] as String?,
);
}
@override
// ignore: avoid_equals_and_hash_code_on_mutable_classes
bool operator ==(Object other) {
if (other is! WatchAppOtherInfo || other.runtimeType != runtimeType) {
return false;
}
if (identical(this, other)) {
return true;
}
return _deepEquals(encode(), other.encode());
}
@override
// ignore: avoid_equals_and_hash_code_on_mutable_classes
int get hashCode => Object.hashAll(_toList())
;
}
class AppleProductInfo {
AppleProductInfo({
required this.productId,
... ... @@ -257,12 +308,15 @@ class _PigeonCodec extends StandardMessageCodec {
} else if (value is AppleSignInModel) {
buffer.putUint8(129);
writeValue(buffer, value.encode());
} else if (value is AppleProductInfo) {
} else if (value is WatchAppOtherInfo) {
buffer.putUint8(130);
writeValue(buffer, value.encode());
} else if (value is AppleProductPaymentResult) {
} else if (value is AppleProductInfo) {
buffer.putUint8(131);
writeValue(buffer, value.encode());
} else if (value is AppleProductPaymentResult) {
buffer.putUint8(132);
writeValue(buffer, value.encode());
} else {
super.writeValue(buffer, value);
}
... ... @@ -274,8 +328,10 @@ class _PigeonCodec extends StandardMessageCodec {
case 129:
return AppleSignInModel.decode(readValue(buffer)!);
case 130:
return AppleProductInfo.decode(readValue(buffer)!);
return WatchAppOtherInfo.decode(readValue(buffer)!);
case 131:
return AppleProductInfo.decode(readValue(buffer)!);
case 132:
return AppleProductPaymentResult.decode(readValue(buffer)!);
default:
return super.readValueOfType(type, buffer);
... ... @@ -352,6 +408,54 @@ class PlatformHostApi {
}
}
/// 设置好友显示到表盘
Future<void> updateWatchOtherUserInfo(WatchAppOtherInfo otherInfo) async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.updateWatchOtherUserInfo$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(<Object?>[otherInfo]);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
/// 刷新表盘
Future<void> refreshWatchSurface() async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.refreshWatchSurface$pigeonVar_messageChannelSuffix';
final BasicMessageChannel<Object?> pigeonVar_channel = BasicMessageChannel<Object?>(
pigeonVar_channelName,
pigeonChannelCodec,
binaryMessenger: pigeonVar_binaryMessenger,
);
final Future<Object?> pigeonVar_sendFuture = pigeonVar_channel.send(null);
final List<Object?>? pigeonVar_replyList =
await pigeonVar_sendFuture as List<Object?>?;
if (pigeonVar_replyList == null) {
throw _createConnectionError(pigeonVar_channelName);
} else if (pigeonVar_replyList.length > 1) {
throw PlatformException(
code: pigeonVar_replyList[0]! as String,
message: pigeonVar_replyList[1] as String?,
details: pigeonVar_replyList[2],
);
} else {
return;
}
}
/// 请求苹果登录
Future<AppleSignInModel?> requestAppleSignIn() async {
final String pigeonVar_channelName = 'dev.flutter.pigeon.doublefeel_flutter.PlatformHostApi.requestAppleSignIn$pigeonVar_messageChannelSuffix';
... ...
... ... @@ -14,6 +14,18 @@ class AppleSignInModel {
});
}
class WatchAppOtherInfo {
final int? userId;
final String? nickname;
final String? markName;
WatchAppOtherInfo({
this.userId,
this.nickname,
this.markName,
});
}
class AppleProductInfo {
/// 苹果商品id
final String productId;
... ... @@ -55,6 +67,7 @@ class AppleProductPaymentResult {
final String? appAccountToken;
final String? originalTransactionId;
final String? transactionId;
/// success 为空时是支付pending状态,不需要处理
/// 只有 true/false时才是支付结果出来的时候
final bool? success;
... ... @@ -103,6 +116,12 @@ abstract class PlatformHostApi {
/// baseUrl: 请求地址, https://api.doublefeel.cn
void updateLoginInfo(String jsonString, String baseUrl);
/// 设置好友显示到表盘
void updateWatchOtherUserInfo(WatchAppOtherInfo otherInfo);
/// 刷新表盘
void refreshWatchSurface();
/// 请求苹果登录
@async
AppleSignInModel? requestAppleSignIn();
... ...