From 6749f2fc825810bd311f528ced03fe9d022e98f6 Mon Sep 17 00:00:00 2001 From: stewen Date: Fri, 4 Aug 2023 17:56:51 +0800 Subject: [PATCH] fix countrycode --- ios/Classes/Api/MOP_registerSyncExtensionApi.m | 13 +++---------- ios/Classes/Api/PhizLanguageData.m | 4 ++-- ios/Classes/MopPlugin.m | 2 +- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/ios/Classes/Api/MOP_registerSyncExtensionApi.m b/ios/Classes/Api/MOP_registerSyncExtensionApi.m index 57dd751..c399518 100644 --- a/ios/Classes/Api/MOP_registerSyncExtensionApi.m +++ b/ios/Classes/Api/MOP_registerSyncExtensionApi.m @@ -19,16 +19,9 @@ [[FATClient sharedClient] registerSyncExtensionApi:self.name handler:^NSDictionary *(FATAppletInfo *appletInfo, id param) { if([self.name isEqualToString:@"getLanguageCodeSync"]){ NSDictionary *resultDict = [NSDictionary dictionary]; - if([PhizLanguageData sharedInstance].languageCode == nil){ - NSString *languageCode = [[NSLocale preferredLanguages] firstObject]; - NSString *shortCode = [[NSLocale componentsFromLocaleIdentifier:languageCode] objectForKey:NSLocaleLanguageCode]; - NSString *countryCode = [NSString stringWithFormat:@"%@", [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]]; - resultDict = @{@"languageCode":shortCode,@"countryCode":countryCode}; - }else{ - NSString* shortCode = [PhizLanguageData sharedInstance].languageCode; - NSString* countryCode = [PhizLanguageData sharedInstance].countryCode; - resultDict = @{@"languageCode":shortCode,@"countryCode":countryCode}; - } + NSString* shortCode = [PhizLanguageData sharedInstance].languageCode; + NSString* countryCode = [PhizLanguageData sharedInstance].countryCode; + resultDict = @{@"languageCode":shortCode,@"countryCode":countryCode}; return resultDict; } return @{}; diff --git a/ios/Classes/Api/PhizLanguageData.m b/ios/Classes/Api/PhizLanguageData.m index bad11e6..2280122 100644 --- a/ios/Classes/Api/PhizLanguageData.m +++ b/ios/Classes/Api/PhizLanguageData.m @@ -14,8 +14,8 @@ static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedInstance = [[self alloc] init]; - //sharedInstance.languageCode = @"en"; // Set default language code - //sharedInstance.countryCode = @"US"; + sharedInstance.languageCode = @"en"; // Set default language code + sharedInstance.countryCode = @"US"; }); return sharedInstance; } diff --git a/ios/Classes/MopPlugin.m b/ios/Classes/MopPlugin.m index 9218c7f..4b7e617 100644 --- a/ios/Classes/MopPlugin.m +++ b/ios/Classes/MopPlugin.m @@ -143,7 +143,7 @@ static MopPlugin *_instance; } } else if ([@"updateLanguage" isEqualToString:call.method]) { - NSLog(@"updateLanguage"); + NSLog(@"updateLanguage,"); NSString *cCode = call.arguments[@"countryCode"]; NSString *cLang = call.arguments[@"languageCode"]; [PhizLanguageData sharedInstance].countryCode = cCode;