defined configuration for build variants
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "AppDelegate.h"
|
||||
#include "GeneratedPluginRegistrant.h"
|
||||
#import "Runner-Swift.h"
|
||||
#import "Autobonus-Swift.h"
|
||||
#import "ZBarSDK.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
@@ -16,38 +16,94 @@
|
||||
binaryMessenger:controller];
|
||||
|
||||
__weak FlutterMethodChannel* weekPlatformChannel = platformChannel;
|
||||
|
||||
NSString *bundleIdentifier = [[NSBundle mainBundle] bundleIdentifier];
|
||||
|
||||
NSDictionary *settings = @{
|
||||
@"com.dinect.checker.dinect" : @{
|
||||
@"locale" : @"ru",
|
||||
@"flavor" : @"dinect",
|
||||
@"currency" : @643,
|
||||
@"supportPhone" : @"8-800-77-55-032",
|
||||
@"supportUrl" : @"http://www.dinect.com",
|
||||
@"endPoint" : @"https://pos-api.dinect.com/20130701/",
|
||||
@"appToken" : @"bdea0f3ba9034b688019a7cac753d1209e2b227f",
|
||||
@"appTitle" : @"Dinect",
|
||||
@"showBonus" : @YES,
|
||||
},
|
||||
@"com.dinect.develop" : @{
|
||||
@"locale" : @"ru",
|
||||
@"flavor" : @"develop",
|
||||
@"currency" : @643,
|
||||
@"supportPhone" : @"8 800 555 35 35",
|
||||
@"supportUrl" : @"http://yandex.ru",
|
||||
@"endPoint" : @"https://pos-api-int.dinect.com/20130701/",
|
||||
@"appToken" : @"9fec83cdca38c357e6b65dbb17514cdd36bf2a08",
|
||||
@"appTitle" : @"Autobonus (develop)",
|
||||
@"showBonus" : @YES,
|
||||
},
|
||||
@"com.dinect.checker.autoclub" : @{
|
||||
@"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.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,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
// NSDictionary *dict = [[NSProcessInfo processInfo] environment];
|
||||
// NSLog(@"%@", dict);
|
||||
NSLog(@"%@", buildSettings[@"supportPhone"]);
|
||||
|
||||
if ([@"getLocale" isEqualToString:call.method]) {
|
||||
result(@"ru");
|
||||
result(buildSettings[@"locale"]);
|
||||
} else if ([@"getFlavor" isEqualToString:call.method]) {
|
||||
result(@"autobonus");
|
||||
result(buildSettings[@"flavor"]);
|
||||
} else if ([@"getCurrency" isEqualToString:call.method]) {
|
||||
result(@643);
|
||||
result(buildSettings[@"currency"]);
|
||||
} else if ([@"startScanner" isEqualToString:call.method]) {
|
||||
ScannerViewController *modalViewController = [ScannerViewController new];
|
||||
modalViewController.platformChannel = weekPlatformChannel;
|
||||
[controller presentViewController:modalViewController animated:YES completion:nil];
|
||||
// [weekPlatformChannel invokeMethod:@"purchase" arguments:@[@"semyon", @"49492872388755"]];
|
||||
} else if ([@"isOnline" isEqualToString:call.method]) {
|
||||
result(@YES);
|
||||
} else if ([@"getSupportPhone" isEqualToString:call.method]) {
|
||||
result(@"8 800 555 35 35");
|
||||
result(buildSettings[@"supportPhone"]);
|
||||
} else if ([@"getSupportUrl" isEqualToString:call.method]) {
|
||||
result(@"http://yandex.ru/");
|
||||
result(buildSettings[@"supportUrl"]);
|
||||
} else if ([@"getEndpoint" isEqualToString:call.method]) {
|
||||
result(@"https://pos-api-int.dinect.com/20130701/");
|
||||
result(buildSettings[@"endPoint"]);
|
||||
} else if ([@"getAppToken" isEqualToString:call.method]) {
|
||||
result(@"9fec83cdca38c357e6b65dbb17514cdd36bf2a08");
|
||||
result(buildSettings[@"appToken"]);
|
||||
} else if ([@"getAppTitle" isEqualToString:call.method]) {
|
||||
result(@"Autobonus");
|
||||
result(buildSettings[@"appTitle"]);
|
||||
} else if ([@"showBonus" isEqualToString:call.method]) {
|
||||
result(@YES);
|
||||
result(buildSettings[@"showBonus"]);
|
||||
} else {
|
||||
result(FlutterMethodNotImplemented);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user