From ef2bb229fc6009c131ca154f13814d0ca1dfbf58 Mon Sep 17 00:00:00 2001 From: jizelin Date: Fri, 25 Nov 2022 10:14:14 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9AiOS=E8=BD=AC=E5=8F=91=E5=BE=AE?= =?UTF-8?q?=E4=BF=A1=E4=B8=AD=E8=8B=B1=E6=96=87=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/Classes/Api/MOPAppletDelegate.m | 10 ++++++---- ios/Classes/Api/MOP_showBotomSheetModel.m | 8 +++++--- ios/Classes/Utils/MOPTools.h | 2 ++ ios/Classes/Utils/MOPTools.m | 7 +++++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/ios/Classes/Api/MOPAppletDelegate.m b/ios/Classes/Api/MOPAppletDelegate.m index 6fcea3f..6381e36 100644 --- a/ios/Classes/Api/MOPAppletDelegate.m +++ b/ios/Classes/Api/MOPAppletDelegate.m @@ -150,7 +150,8 @@ static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet]; - UIAlertAction *chooseAlbumAction = [UIAlertAction actionWithTitle:@"从相册选择" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) { + NSString *album = [MOPTools fat_currentLanguageIsEn] ? @"Album" : @"从相册选择"; + UIAlertAction *chooseAlbumAction = [UIAlertAction actionWithTitle:album style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) { NSDictionary *params = @{@"name":@"chooseAvatarAlbum"}; FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; @@ -158,7 +159,8 @@ static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme !bindChooseAvatar?: bindChooseAvatar(result); }]; }]; - UIAlertAction *photoAction = [UIAlertAction actionWithTitle:@"拍照" style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) { + NSString *camera = [MOPTools fat_currentLanguageIsEn] ? @"Camera" : @"拍照"; + UIAlertAction *photoAction = [UIAlertAction actionWithTitle:camera style:UIAlertActionStyleDefault handler:^(UIAlertAction *_Nonnull action) { NSDictionary *params = @{@"name":@"chooseAvatarPhoto"}; FlutterMethodChannel *channel = [[MopPlugin instance] methodChannel]; @@ -166,8 +168,8 @@ static NSString *scheme = @"fatae55433be2f62915";//App对应的scheme !bindChooseAvatar?: bindChooseAvatar(result); }]; }]; - - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action){ + NSString *cancel = [MOPTools fat_currentLanguageIsEn] ? @"Cancel" : @"取消"; + UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:cancel style:UIAlertActionStyleCancel handler:^(UIAlertAction *_Nonnull action){ bindChooseAvatar(@{}); }]; [alertController addAction:chooseAlbumAction]; diff --git a/ios/Classes/Api/MOP_showBotomSheetModel.m b/ios/Classes/Api/MOP_showBotomSheetModel.m index f91426b..be12a99 100644 --- a/ios/Classes/Api/MOP_showBotomSheetModel.m +++ b/ios/Classes/Api/MOP_showBotomSheetModel.m @@ -7,7 +7,7 @@ #import "MOP_showBotomSheetModel.h" #import "MopPlugin.h" - +#import "MOPTools.h" @implementation MOP_showBotomSheetModel @@ -75,7 +75,8 @@ returnInsets = inset;\ [self addSubview:self.contentView]; self.cancelButton = [UIButton buttonWithType:UIButtonTypeCustom]; - [self.cancelButton setTitle:@"取消" forState:UIControlStateNormal]; + NSString *cancel = [MOPTools fat_currentLanguageIsEn] ? @"Cancel" : @"取消"; + [self.cancelButton setTitle:cancel forState:UIControlStateNormal]; [self.cancelButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [self.contentView addSubview:self.cancelButton]; self.cancelButton.frame = CGRectMake(0, self.contentView.frame.size.height - kFinoSafeAreaBottom - 50, self.contentView.frame.size.width, 50); @@ -211,7 +212,8 @@ static NSString *cellID = @"cellid"; - (void)setType:(NSInteger)type { _type = type; if (_type == 0) { - self.label.text = @"微信好友"; + NSString *wechat = [MOPTools fat_currentLanguageIsEn] ? @"Wechat" : @"微信好友"; + self.label.text = wechat; self.imageView.image = [UIImage imageNamed:@"turkey_share_wechat"]; } } diff --git a/ios/Classes/Utils/MOPTools.h b/ios/Classes/Utils/MOPTools.h index af53889..37195b2 100644 --- a/ios/Classes/Utils/MOPTools.h +++ b/ios/Classes/Utils/MOPTools.h @@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN + (UIColor *)colorWithRGBHex:(UInt32)hex; + (UIColor *)fat_colorWithHexString:(NSString *)hexColor; + ++ (BOOL)fat_currentLanguageIsEn; @end NS_ASSUME_NONNULL_END diff --git a/ios/Classes/Utils/MOPTools.m b/ios/Classes/Utils/MOPTools.m index 236b2be..d9a2baa 100644 --- a/ios/Classes/Utils/MOPTools.m +++ b/ios/Classes/Utils/MOPTools.m @@ -112,5 +112,12 @@ return [UIColor colorWithRed:red / 255.0f green:green / 255.0f blue:blue / 255.0f alpha:alpha / 255.0f]; } ++ (BOOL)fat_currentLanguageIsEn { + NSString *languageCode = [NSLocale preferredLanguages].firstObject; // 返回的是国际通用语言Code+国际通用国家地区代码 + if ([languageCode hasPrefix:@"zh"]) { + return NO; + } + return YES; +} @end