AppDelegate.m 4.1 KB
#include "AppDelegate.h"
#include "GeneratedPluginRegistrant.h"
#include <flutter_boost/FlutterBoostPlugin.h>
#include "ALUpLoadManager.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  // Override point for customization after application launch.
    [GeneratedPluginRegistrant registerWithRegistry:self];
    [self flutterMethod];
  return [super application:application didFinishLaunchingWithOptions:launchOptions];

}


- (void)flutterMethod {
    FlutterViewController* controller =
    (FlutterViewController*)self.window.rootViewController;
   
    FlutterMethodChannel* buryChannel = [FlutterMethodChannel
                                         methodChannelWithName:@"flutter_bury_channel"
                                         binaryMessenger:controller];
    
    [buryChannel setMethodCallHandler:^(FlutterMethodCall* call,
                                        FlutterResult result) {
        NSLog(@" ME %@   argue  %@",call.method,call.arguments);
        if([call.method isEqualToString:@"FLUTTER_TO_H5"]){
            NSLog(@"FLUTTER_TO_H5");
        }else if([call.method isEqualToString:@"FLUTTER_TO_NATIVE"]){
            NSLog(@"FLUTTER_TO_NATIVE");
        }else if ([call.method isEqualToString:@"FLUTTER_BURIED"]){
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
            //APPInfo
            [dict setObject:@"alpha" forKey:@"app_name"];
            [dict setObject:@"app_version_name" forKey:@"app_version_name"];
            [dict setObject:@"channel" forKey:@"channel"];
            [dict setObject:@"" forKey:@"current_city_id"];
            [dict setObject:[[NSMutableDictionary alloc] initWithCapacity:0] forKey:@"user_type"];
            [dict setObject:@"" forKey:@"grey_type"];
            
            //DeviceInfo
            [dict setObject:@"device_id" forKey:@"device_id"];
            [dict setObject:@"Apple" forKey:@"manufacturer"];
            [dict setObject:@"lng" forKey:@"lng"];
            [dict setObject:@"lat" forKey:@"lat"];
            [dict setObject:@"is_WiFi" forKey:@"is_WiFi"];
            [dict setObject:@"ip" forKey:@"ip"];
            [dict setObject:@"model" forKey:@"model"];
            [dict setObject:@"sys_version" forKey:@"sys_version"];
            [dict setObject:@"Apple" forKey:@"lng"];
            [dict setObject:@"idfa" forKey:@"idfa"];
            [dict setObject:@"idfv" forKey:@"idfv"];
            
            [dict setObject:@"user_id" forKey:@"user_id"];
            [dict setObject:@"" forKey:@"app_session_id"];
            [dict setObject:@"create_at" forKey:@"create_at"];
            [dict setObject:@"110" forKey:@"version"];
            result(dict);
        }else if([call.method isEqualToString:@"GET_NET_TYPE"]){
            result(@"wifi");
        }else if([call.method isEqualToString:@"INIT_PARAMS"]){
            NSMutableDictionary * map=[[NSMutableDictionary alloc] init];
            NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
            [dict setObject:@"sessionid=9odo0sov71x66ke9dlphibnq9i9gduxj;_gtid=3fbe9b78d2cb11e98bc1525400e82fab5270; _gm_token=db88861568285036" forKey:@"cookie"];
            [dict setObject:@"debug" forKey:@"buildConfig"];
                //HERE
//            [dict setObject:@"172.30.9.84:6666" forKey:@"proxy"];
            result(dict);
        }else if([call.method isEqualToString:@"UPLOAD_IMG"]){
//            NSString* path=call.arguments[@"path"];
//            NSString* token=call.arguments[@"token"];
//            [[ALUpLoadManager shareInstance] setImage:path  token:token block:^(NSString *url) {
//                result(url);
//                NSLog(@"!!!OKK  %@",url);
//            } failBlock:^(NSString *message) {
//                NSLog(@"!!!ERROR  %@",message);
//                result([FlutterError errorWithCode:@"11" message:message details:message]);
//            }];
//            NSData *data = [NSData dataWithContentsOfFile:path];
//            UIImage * printerImg = [UIImage imageWithData:data];
            result(@"2019/10/17/1156/44dbb13ac6d9");
        }
    }];
}


@end