70 lines
3.0 KiB
Objective-C
70 lines
3.0 KiB
Objective-C
//
|
|
// AppDelegate.m
|
|
// xplan-ios
|
|
//
|
|
// Created by zu on 2021/8/31.
|
|
//
|
|
|
|
#import "AppDelegate.h"
|
|
#import "TabbarViewController.h"
|
|
#import "BaseNavigationController.h"
|
|
#import "XplanFlutterBoostDelegate.h"
|
|
#import "XCFlutterKeyConst.h"
|
|
#import "YYUtility.h"
|
|
#import "HttpRequestHelper.h"
|
|
#import "AccountInfoStorage.h"
|
|
|
|
@interface AppDelegate ()
|
|
|
|
@end
|
|
|
|
@implementation AppDelegate
|
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
|
|
XplanFlutterBoostDelegate* delegate=[[XplanFlutterBoostDelegate alloc] init];
|
|
|
|
[[FlutterBoost instance] 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]) {
|
|
// [[GetCore(PurseCore) rac_requestBalanceInfo:GetCore(AuthCore).getUid.userIDValue] subscribeNext:^(id _Nullable x) {
|
|
// BalanceInfo * info = (BalanceInfo *)x;
|
|
// NSNumber *diamonds = [[NSNumber alloc] initWithDouble:info.diamonds.doubleValue];
|
|
// result(diamonds);
|
|
// }];
|
|
} 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);
|
|
}
|
|
}];
|
|
}];
|
|
|
|
TabbarViewController *vc = [[TabbarViewController alloc] init];
|
|
BaseNavigationController *bnc = [[BaseNavigationController alloc] initWithRootViewController:vc];
|
|
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
self.window.rootViewController = bnc;
|
|
[self.window makeKeyAndVisible];
|
|
return YES;
|
|
}
|
|
|
|
@end
|