feat:iOS转发微信中英文适配

master
jizelin 2022-11-25 10:14:14 +08:00
parent 6c00cfc418
commit ef2bb229fc
4 changed files with 20 additions and 7 deletions

View File

@ -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];

View File

@ -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"];
}
}

View File

@ -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

View File

@ -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