|
|
|
#import "AppDelegate.h"
|
|
|
|
#import "GeneratedPluginRegistrant.h"
|
|
|
|
#import <AMapFoundationKit/AMapFoundationKit.h>
|
|
|
|
#import "DCUniMP.h"
|
|
|
|
#import "MinPlugin.h"
|
|
|
|
|
|
|
|
@implementation AppDelegate
|
|
|
|
|
|
|
|
- (BOOL)application:(UIApplication *)application
|
|
|
|
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
|
|
|
[GeneratedPluginRegistrant registerWithRegistry:self];
|
|
|
|
// Override point for customization after application launch.
|
|
|
|
|
|
|
|
// [GeneratedPluginRegistrant registerWithRegistry:[[MinPlugin alloc] init]];
|
|
|
|
|
|
|
|
// 配置参数
|
|
|
|
NSMutableDictionary *options = [NSMutableDictionary dictionaryWithDictionary:launchOptions];
|
|
|
|
// 设置 debug YES 会在控制台输出 js log,默认不输出 log,注:需要引入 liblibLog.a 库
|
|
|
|
[options setObject:[NSNumber numberWithBool:YES] forKey:@"debug"];
|
|
|
|
|
|
|
|
[DCUniMPSDKEngine initSDKEnvironmentWithLaunchOptions:options];
|
|
|
|
|
|
|
|
// test
|
|
|
|
FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController;
|
|
|
|
FlutterMethodChannel* uniAppChannel = [FlutterMethodChannel methodChannelWithName:@"zsw" binaryMessenger:controller];
|
|
|
|
MinPlugin * plugin = [[MinPlugin alloc] init];
|
|
|
|
[DCUniMPSDKEngine setDelegate:plugin];
|
|
|
|
|
|
|
|
[uniAppChannel setMethodCallHandler:^(FlutterMethodCall * _Nonnull call, FlutterResult _Nonnull result) {
|
|
|
|
NSLog(@"arg:%@",call.arguments);
|
|
|
|
if ([call.method isEqual:@"open"]){
|
|
|
|
[plugin open:call.arguments[0] url:call.arguments[1] param:call.arguments[2] block:nil];
|
|
|
|
} else if ([call.method isEqual:@"openUniApp"]) {
|
|
|
|
NSDictionary * dict = @{@"token":call.arguments[0],@"storeId":@""};
|
|
|
|
[plugin openUniApp:call.arguments[0] dict:dict];
|
|
|
|
}else{
|
|
|
|
result(FlutterMethodNotImplemented);
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
// 小程序
|
|
|
|
|
|
|
|
[AMapServices.sharedServices setApiKey:@"feaae7986201b571cace1b83728be5bb"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return [super application:application didFinishLaunchingWithOptions:launchOptions];
|
|
|
|
}
|
|
|
|
|
|
|
|
#pragma mark - App 生命周期方法
|
|
|
|
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
|
|
|
[DCUniMPSDKEngine applicationDidBecomeActive:application];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)applicationWillResignActive:(UIApplication *)application {
|
|
|
|
[DCUniMPSDKEngine applicationWillResignActive:application];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
|
|
|
[DCUniMPSDKEngine applicationDidEnterBackground:application];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
|
|
|
[DCUniMPSDKEngine applicationWillEnterForeground:application];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void)applicationWillTerminate:(UIApplication *)application {
|
|
|
|
[DCUniMPSDKEngine destory];
|
|
|
|
}
|
|
|
|
|
|
|
|
@end
|