#include "AppDelegate.h" #include "GeneratedPluginRegistrant.h" #import "Autobonus-Swift.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [GeneratedPluginRegistrant registerWithRegistry:self]; FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController; FlutterMethodChannel* platformChannel = [FlutterMethodChannel methodChannelWithName:@"com.dinect.checker/instance_id" binaryMessenger:controller]; __weak FlutterMethodChannel* weekPlatformChannel = platformChannel; NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier]; NSDictionary *settings = @{ @"com.dinect.checker.dinect" : @{ @"locale" : @"ru", @"flavor" : @"dinect", @"currency" : @643, @"supportPhone" : @"support@dinect.com", @"supportUrl" : @"http://www.dinect.com", @"endPoint" : @"https://pos-api.dinect.com/20130701/", @"appToken" : @"bdea0f3ba9034b688019a7cac753d1209e2b227f", @"appTitle" : @"Dinect", @"showBonus" : @YES, }, @"com.dinect.develop-iOS" : @{ @"locale" : @"ru", @"flavor" : @"dinect", @"currency" : @643, @"supportPhone" : @"support@dinect.com", @"supportUrl" : @"http://yandex.ru", @"endPoint" : @"https://pos-api-int.dinect.com/20130701/", @"appToken" : @"9fec83cdca38c357e6b65dbb17514cdd36bf2a08", @"appTitle" : @"Dinect (INT)", @"showBonus" : @YES, }, @"com.dinect.checker.autoclub.app" : @{ @"locale" : @"ru", @"flavor" : @"autobonus", @"currency" : @643, @"supportPhone" : @"8-800-234-6064", @"supportUrl" : @"https://www.auto-club.biz", @"endPoint" : @"https://pos-api-autoclub.dinect.com/20130701/", @"appToken" : @"bdea0f3ba9034b688019a7cac753d1209e2b227f", @"appTitle" : @"Autobonus", @"showBonus" : @NO, }, @"com.dinect.checker.dinect" : @{ @"locale" : @"ru", @"flavor" : @"crypto", @"currency" : @643, @"supportPhone" : @"support@dinect.com", @"supportUrl" : @"http://www.dinect.com", @"endPoint" : @"https://pos-api.dinect.com/20130701/", @"appToken" : @"bdea0f3ba9034b688019a7cac753d1209e2b227f", @"appTitle" : @"Crypto", @"showBonus" : @YES, }, @"com.dinect.checker.pip" : @{ @"locale" : @"ua", @"flavor" : @"pip", @"currency" : @980, @"supportPhone" : @"+38 080 030 9997\n+38 044 390 1697", @"supportUrl" : @"http://discount.kiev.ua/", @"endPoint" : @"https://pos-api.discount.kiev.ua/20130701/", @"appToken" : @"bdea0f3ba9034b688019a7cac753d1209e2b227f", @"appTitle" : @"PIP", @"showBonus" : @YES, }, @"com.dinect.checker.crypto" : @{ @"locale" : @"ru", @"flavor" : @"crypto", @"currency" : @643, @"supportPhone" : @"8-800-77-55-032", @"supportUrl" : @"http://www.dinect.com", @"endPoint" : @"https://pos-api-int.dinect.com/20130701/", @"appToken" : @"9fec83cdca38c357e6b65dbb17514cdd36bf2a08", @"appTitle" : @"Dinect Crypto", @"showBonus" : @NO, }, }; NSDictionary *buildSettings = settings[bundleIdentifier]; if (!buildSettings) { NSLog(@"Settings for this bunndle id not defined (%@)", bundleIdentifier); abort(); } [platformChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { NSLog(@"%@", call.method); if ([@"getLocale" isEqualToString:call.method]) { result(buildSettings[@"locale"]); } else if ([@"getFlavor" isEqualToString:call.method]) { result(buildSettings[@"flavor"]); } else if ([@"getCurrency" isEqualToString:call.method]) { result(buildSettings[@"currency"]); } else if ([@"startScanner" isEqualToString:call.method]) { ScannerViewController *modalViewController = [[ScannerViewController alloc] initWithStrings:call.arguments]; modalViewController.platformChannel = weekPlatformChannel; [controller presentViewController:modalViewController animated:YES completion:nil]; } else if ([@"isOnline" isEqualToString:call.method]) { result(@YES); } else if ([@"getSupportPhone" isEqualToString:call.method]) { result(buildSettings[@"supportPhone"]); } else if ([@"getSupportUrl" isEqualToString:call.method]) { result(buildSettings[@"supportUrl"]); } else if ([@"getEndpoint" isEqualToString:call.method]) { result(buildSettings[@"endPoint"]); } else if ([@"getAppToken" isEqualToString:call.method]) { result(buildSettings[@"appToken"]); } else if ([@"getAppTitle" isEqualToString:call.method]) { result(buildSettings[@"appTitle"]); } else if ([@"showBonus" isEqualToString:call.method]) { result(buildSettings[@"showBonus"]); } else if ([@"getVersionName" isEqualToString:call.method]) { result([[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleShortVersionString"]); } else { result(FlutterMethodNotImplemented); } }]; return [super application:application didFinishLaunchingWithOptions:launchOptions]; } @end