Files
yinmeng-ios/xplan-ios/Main/Match/FlutterBoost+Xplan.m
2021-10-21 21:50:39 +08:00

58 lines
2.6 KiB
Objective-C

//
// FlutterBoost+Xplan.m
// xplan-ios
//
// Created by zu on 2021/9/9.
//
#import "FlutterBoost+Xplan.h"
#import "XCFlutterKeyConst.h"
#import "XplanFlutterBoostDelegate.h"
#import "YYUtility.h"
#import "HttpRequestHelper.h"
#import "AccountInfoStorage.h"
#import "Api+Mine.h"
#import "WalletInfoModel.h"
@implementation FlutterBoost (Xplan)
- (void)setup:(UIApplication *)application {
XplanFlutterBoostDelegate* delegate = [[XplanFlutterBoostDelegate alloc] init];
[self setup:application delegate:delegate callback:^(FlutterEngine *engine) {
FlutterMethodChannel* methodChannel = [FlutterMethodChannel
methodChannelWithName:@"com.mango.flutter.xplan"
binaryMessenger:engine.binaryMessenger];
[methodChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) {
NSString *method = call.method;
if ([method isEqualToString:YYFlutterGetNativeGetDeviceInfo]) {
NSDictionary *dic = [HttpRequestHelper configBaseParmars:[[NSDictionary alloc] init]];
result(dic);
} else if ([method isEqualToString:YYFlutterGetNativeGetAuth]) {
NSDictionary *dic = @{
@"pub_uid" : [[AccountInfoStorage instance] getUid],
@"pub_ticket" : [[AccountInfoStorage instance] getTicket]
};
result(dic);
} else if ([method isEqualToString:YYFlutterGetNativeGetDiamond]) {
[Api getUserWalletInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
WalletInfoModel* wallet = [WalletInfoModel modelWithJSON:data.data];
NSNumber *diamonds = [[NSNumber alloc] initWithDouble:wallet.diamonds.doubleValue];
result(diamonds);
} uid:[AccountInfoStorage instance].getUid ticket:[AccountInfoStorage instance].getTicket];
} else if([method isEqualToString:YYFlutterGetNativeGetEncodePwd]) {
// if (call.arguments) {
// NSString * password = call.arguments;
// NSString * encrptStr = [DESEncrypt encryptUseDES:password key:keyWithType(KeyType_PwdEncode, NO)];
// result(encrptStr);
// }
} else if([method isEqualToString:YYFlutterGetNativeNotifyShowInvite]) {
// BOOL show = [NSString stringWithFormat:@"%@", call.arguments].boolValue;
// NotifyCoreClient(ShowInviteClient, @selector(onShowInvite:), onShowInvite:show);
}
}];
}];
}
@end