diff --git a/ios-rongimdemo/AddAppKeyViewController.m b/ios-rongimdemo/AddAppKeyViewController.m index 6d8afa81..ae8c28fc 100644 --- a/ios-rongimdemo/AddAppKeyViewController.m +++ b/ios-rongimdemo/AddAppKeyViewController.m @@ -40,7 +40,7 @@ - (void)onSave:(id)sender { int env = [self.devField.text intValue]; if (env != 1 && env != 2) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Alert" - message:@"dev值必须是1或者2" + message:RCDLocalizedString(@"dev_value_must_1_or_2") delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil, nil]; diff --git a/ios-rongimdemo/Debug/RCDDebugTableViewController.m b/ios-rongimdemo/Debug/RCDDebugTableViewController.m index f036d020..78ff747d 100644 --- a/ios-rongimdemo/Debug/RCDDebugTableViewController.m +++ b/ios-rongimdemo/Debug/RCDDebugTableViewController.m @@ -82,16 +82,21 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell.textLabel.text = title; cell.backgroundColor = [UIColor whiteColor]; cell.detailTextLabel.text = @""; - if ([title isEqualToString:@"显示ID"]) { + if ([title isEqualToString:RCDLocalizedString(@"show_ID") +]) { [self setSwitchButtonCell:cell tag:DISPLAY_ID_TAG]; } - if ([title isEqualToString:@"显示在线状态"]) { + if ([title isEqualToString:RCDLocalizedString(@"show_online_status") +]) { [self setSwitchButtonCell:cell tag:DISPLAY_ONLINE_STATUS_TAG]; } - if ([title isEqualToString:@"加入聊天室失败仍停留在会话界面"]) { + if ([title isEqualToString:RCDLocalizedString(@"Joining_the_chat_room_failed_to_stay_in_the_session_interface") +]) { [self setSwitchButtonCell:cell tag:JOIN_CHATROOM_TAG]; } - if ([title isEqualToString:@"设置离线消息补偿时间"] || [title isEqualToString:@"设置全局免打扰时间"]) { + if ([title isEqualToString:RCDLocalizedString(@"Set_offline_message_compensation_time") +] || [title isEqualToString:RCDLocalizedString(@"Set_global_DND_time") +]) { cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; } return cell; @@ -143,9 +148,19 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath #pragma mark init data for tabelview - (void)initdata { self.functions = [NSDictionary dictionaryWithObjectsAndKeys: - @[@"显示ID", @"显示在线状态"], @"显示设置", - @[@"强制Crash", @"发送Log", @"加入聊天室失败仍停留在会话界面"], @"自定义设置", - @[@"设置离线消息补偿时间", @"设置全局免打扰时间"], @"时间设置", nil]; + @[RCDLocalizedString(@"show_ID") +, RCDLocalizedString(@"show_online_status") +], RCDLocalizedString(@"show_setting") +, + @[RCDLocalizedString(@"force_crash") +, RCDLocalizedString(@"send_log") +, RCDLocalizedString(@"Joining_the_chat_room_failed_to_stay_in_the_session_interface") +], RCDLocalizedString(@"custom_setting") +, + @[RCDLocalizedString(@"Set_offline_message_compensation_time") +, RCDLocalizedString(@"Set_global_DND_time") +], RCDLocalizedString(@"time_setting") +, nil]; } #pragma mark UI setting @@ -263,7 +278,8 @@ - (void)doCrash { */ - (void)pushToDebugVC { RCDDebugViewController *vc = [[RCDDebugViewController alloc] init]; - vc.title = @"设置离线消息补偿时间"; + vc.title = RCDLocalizedString(@"Set_offline_message_compensation_time") +; [self.navigationController pushViewController:vc animated:YES]; } diff --git a/ios-rongimdemo/PrefixHeader.pch b/ios-rongimdemo/PrefixHeader.pch new file mode 100644 index 00000000..4bb64b12 --- /dev/null +++ b/ios-rongimdemo/PrefixHeader.pch @@ -0,0 +1,16 @@ +// +// PrefixHeader.pch +// RCloudMessage +// +// Created by zhangke on 2019/2/15. +// Copyright © 2019 RongCloud. All rights reserved. +// + +#ifndef PrefixHeader_pch +#define PrefixHeader_pch + +// Include any system framework and library headers here that should be included in all compilation units. +// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file. +#define RCDLocalizedString(key) NSLocalizedStringFromTable(key, @"SealTalk", nil) + +#endif /* PrefixHeader_pch */ diff --git a/ios-rongimdemo/RCDAboutRongCloudTableViewController.m b/ios-rongimdemo/RCDAboutRongCloudTableViewController.m index 3a397698..c4eba2c6 100644 --- a/ios-rongimdemo/RCDAboutRongCloudTableViewController.m +++ b/ios-rongimdemo/RCDAboutRongCloudTableViewController.m @@ -40,10 +40,12 @@ - (void)viewDidLoad { self.tableView.backgroundColor = [UIColor colorWithHexString:@"f0f0f6" alpha:1.f]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - self.navigationItem.title = @"关于 SealTalk"; + self.navigationItem.title = RCDLocalizedString(@"about_sealtalk") +; RCDUIBarButtonItem *leftBtn = - [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"我" target:self action:@selector(clickBackBtn:)]; + [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"me") + target:self action:@selector(clickBackBtn:)]; self.navigationItem.leftBarButtonItem = leftBtn; } @@ -83,25 +85,29 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case 1: { [cell setCellStyle:DefaultStyle]; - cell.leftLabel.text = @"更新日志"; + cell.leftLabel.text = RCDLocalizedString(@"update_log") +; return cell; } break; case 2: { [cell setCellStyle:DefaultStyle]; - cell.leftLabel.text = @"功能介绍"; + cell.leftLabel.text = RCDLocalizedString(@"function_introduce") +; return cell; } break; case 3: { [cell setCellStyle:DefaultStyle]; - cell.leftLabel.text = @"官方网站"; + cell.leftLabel.text = RCDLocalizedString(@"offical_website") +; return cell; } break; case 4: { [versionCell setCellStyle:DefaultStyle_RightLabel_WithoutRightArrow]; - versionCell.leftLabel.text = @"SealTalk 版本"; + versionCell.leftLabel.text = RCDLocalizedString(@"SealTalk_version") +; NSString *SealTalkVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"SealTalk Version"]; versionCell.rightLabel.text = SealTalkVersion; NSString *isNeedUpdate = [[NSUserDefaults standardUserDefaults] objectForKey:@"isNeedUpdate"]; @@ -113,7 +119,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case 5: { [cell setCellStyle:DefaultStyle_RightLabel_WithoutRightArrow]; - cell.leftLabel.text = @"SDK 版本"; + cell.leftLabel.text = RCDLocalizedString(@"SDK_version") +; NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; cell.rightLabel.text = version; cell.selectionStyle = UITableViewCellSelectionStyleNone; diff --git a/ios-rongimdemo/RCDAddFriendViewController.m b/ios-rongimdemo/RCDAddFriendViewController.m index c66c9fba..eed48bdc 100644 --- a/ios-rongimdemo/RCDAddFriendViewController.m +++ b/ios-rongimdemo/RCDAddFriendViewController.m @@ -26,7 +26,7 @@ - (void)viewDidLoad { self.tableView.backgroundColor = HEXCOLOR(0xf0f0f6); self.tableView.separatorColor = HEXCOLOR(0xdfdfdf); - self.navigationItem.title = @"添加好友"; + self.navigationItem.title = RCDLocalizedString(@"add_contacts"); [self setHeaderView]; [self setFooterView]; @@ -102,13 +102,14 @@ - (void)setFooterView { [self.addFriendBtn setBackgroundColor:[UIColor colorWithHexString:@"0099ff" alpha:1.0]]; self.addFriendBtn.layer.masksToBounds = YES; self.addFriendBtn.layer.cornerRadius = 5.f; - [self.addFriendBtn setTitle:@"添加好友" forState:UIControlStateNormal]; + [self.addFriendBtn setTitle:RCDLocalizedString(@"add_contacts") forState:UIControlStateNormal]; [view addSubview:self.addFriendBtn]; [self.addFriendBtn setTranslatesAutoresizingMaskIntoConstraints:NO]; [self.addFriendBtn addTarget:self action:@selector(actionAddFriend:) forControlEvents:UIControlEventTouchUpInside]; self.startChat = [[UIButton alloc] initWithFrame:CGRectMake(10, 30, self.view.bounds.size.width, 86)]; - [self.startChat setTitle:@"发起会话" forState:UIControlStateNormal]; + [self.startChat setTitle:RCDLocalizedString(@"start_chat") + forState:UIControlStateNormal]; [self.startChat setTintColor:[UIColor blackColor]]; [self.startChat setBackgroundColor:[UIColor colorWithHexString:@"0099ff" alpha:1.0]]; self.startChat.layer.masksToBounds = YES; @@ -185,9 +186,10 @@ - (void)actionAddFriend:(id)sender { if (friend && [friend.status isEqualToString:@"10"]) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"已发送好友邀请" + message:RCDLocalizedString(@"friend_invite_had_send") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; } else { @@ -195,18 +197,20 @@ - (void)actionAddFriend:(id)sender { complete:^(BOOL result) { if (result) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"请求已发送" + message:RCDLocalizedString(@"request_had_send") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [RCDHTTPTOOL getFriendscomplete:^(NSMutableArray *result){ }]; [alertView show]; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"请求失败,请重试" + message:RCDLocalizedString(@"request_fail_retry") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; } diff --git a/ios-rongimdemo/RCDBlackListViewController.m b/ios-rongimdemo/RCDBlackListViewController.m index b31b7726..34750193 100644 --- a/ios-rongimdemo/RCDBlackListViewController.m +++ b/ios-rongimdemo/RCDBlackListViewController.m @@ -43,7 +43,8 @@ - (void)viewDidLoad { self.tableView.tableFooterView = [UIView new]; - self.title = @"黑名单"; + self.title = RCDLocalizedString(@"blacklist") +; } #pragma mark - private diff --git a/ios-rongimdemo/RCDCSEvaluateView.m b/ios-rongimdemo/RCDCSEvaluateView.m index a71f540b..e76be03e 100644 --- a/ios-rongimdemo/RCDCSEvaluateView.m +++ b/ios-rongimdemo/RCDCSEvaluateView.m @@ -91,12 +91,12 @@ - (instancetype)initWithEvaStarDic:(NSDictionary *)evaStarDic{ - (void)didClickSubmitButton{ if (self.model.isTagMust && self.model.tags.count > 0) { if (self.selectTags.count == 0) { - [self showAlertWarning:@"请选择标签"]; + [self showAlertWarning:RCDLocalizedString(@"choose_tag")]; return; } } if (self.model.isInputMust && self.inputView.suggestText.text.length == 0) { - [self showAlertWarning:@"请填写你的想法"]; + [self showAlertWarning:RCDLocalizedString(@"type_idea")]; return; } if (self.delegate && [self.delegate respondsToSelector:@selector(didSubmitEvaluate:star:tagString:suggest:)]) { @@ -347,7 +347,8 @@ - (void)showAtWindow:(BOOL)isShow { } - (void)showAlertWarning:(NSString *)message{ - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:@"我知道了", nil]; + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:nil otherButtonTitles:RCDLocalizedString(@"i_know_it") +, nil]; [alertView show]; } @@ -382,7 +383,7 @@ - (UIView *)titleView{ UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 50)]; titleLabel.textColor = HEXCOLOR(0x333333); - titleLabel.text = @"评价"; + titleLabel.text = RCDLocalizedString(@"remark"); titleLabel.font = [UIFont systemFontOfSize:18]; titleLabel.textAlignment = NSTextAlignmentCenter; @@ -401,7 +402,7 @@ - (UIButton *)submitButton{ _submitButton = [[UIButton alloc] init]; _submitButton.backgroundColor = HEXCOLOR(0x0099ff); _submitButton.titleLabel.font = [UIFont systemFontOfSize:18]; - [_submitButton setTitle:@"提交评价" forState:(UIControlStateNormal)]; + [_submitButton setTitle:RCDLocalizedString(@"submit_remark") forState:(UIControlStateNormal)]; [_submitButton addTarget:self action:@selector(didClickSubmitButton) forControlEvents:(UIControlEventTouchUpInside)]; } return _submitButton; diff --git a/ios-rongimdemo/RCDCSSolveView.m b/ios-rongimdemo/RCDCSSolveView.m index f71e0555..ec0cb7bb 100644 --- a/ios-rongimdemo/RCDCSSolveView.m +++ b/ios-rongimdemo/RCDCSSolveView.m @@ -29,9 +29,9 @@ - (instancetype)init{ } - (void)setSubview{ - self.solveTitle.text = @"请问客服是否解决了您的问题"; - [self.solvedButton setTitle:@"已解决" forState:(UIControlStateNormal)]; - [self.noSolveButton setTitle:@"未解决" forState:(UIControlStateNormal)]; + self.solveTitle.text = RCDLocalizedString(@"cs_evaluate_resolved_title"); + [self.solvedButton setTitle:RCDLocalizedString(@"cs_evaluate_resolved") forState:(UIControlStateNormal)]; + [self.noSolveButton setTitle:RCDLocalizedString(@"cs_evaluate_unresolved") forState:(UIControlStateNormal)]; } - (void)didClickSolveButton:(UIButton *)sender{ diff --git a/ios-rongimdemo/RCDCSStarView.m b/ios-rongimdemo/RCDCSStarView.m index 70287d2d..fbf0d956 100644 --- a/ios-rongimdemo/RCDCSStarView.m +++ b/ios-rongimdemo/RCDCSStarView.m @@ -65,7 +65,7 @@ - (void)starTapBtn:(UIButton *)btn{ - (void)setStarTitle{ self.starTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 20)]; self.starTitle.textColor = HEXCOLOR(0x3c4d65); - self.starTitle.text = @"请您对客服进行评价"; + self.starTitle.text = RCDLocalizedString(@"remark_customer"); self.starTitle.font = [UIFont systemFontOfSize:16]; self.starTitle.textAlignment = NSTextAlignmentCenter; [self addSubview:self.starTitle]; diff --git a/ios-rongimdemo/RCDCSTagView.m b/ios-rongimdemo/RCDCSTagView.m index 4bddbd9b..c950358d 100644 --- a/ios-rongimdemo/RCDCSTagView.m +++ b/ios-rongimdemo/RCDCSTagView.m @@ -26,7 +26,7 @@ - (instancetype)init{ - (void)settagTitle{ self.tagTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 20)]; self.tagTitle.textColor = HEXCOLOR(0x3c4d65); - self.tagTitle.text = @"存在哪些问题"; + self.tagTitle.text = RCDLocalizedString(@"cs_evaluate_problem_title"); self.tagTitle.font = [UIFont systemFontOfSize:16]; self.tagTitle.textAlignment = NSTextAlignmentCenter; [self addSubview:self.tagTitle]; @@ -72,9 +72,9 @@ - (void)didSelectTag:(UIButton *)sender{ - (void)isMustSelect:(BOOL)isMustSelect{ dispatch_async(dispatch_get_main_queue(), ^{ if (isMustSelect) { - self.tagTitle.text = @"存在哪些问题(必选)"; + self.tagTitle.text = RCDLocalizedString(@"cs_evaluate_problem_must_title"); }else{ - self.tagTitle.text = @"存在哪些问题"; + self.tagTitle.text = RCDLocalizedString(@"cs_evaluate_problem_title"); } }); } diff --git a/ios-rongimdemo/RCDChangePasswordViewController.m b/ios-rongimdemo/RCDChangePasswordViewController.m index 3ae1a8ea..ce3ed10b 100644 --- a/ios-rongimdemo/RCDChangePasswordViewController.m +++ b/ios-rongimdemo/RCDChangePasswordViewController.m @@ -38,7 +38,8 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - self.navigationItem.title = @"密码修改"; + self.navigationItem.title = RCDLocalizedString(@"change_password") +; [self initialize]; [self setNavigationButton]; @@ -57,23 +58,25 @@ - (void)didReceiveMemoryWarning { } - (void)initialize { - self.oldPwdLabel = [self setLabel:@"原密码"]; + self.oldPwdLabel = [self setLabel:RCDLocalizedString(@"old_password")]; self.oldPwdView = [self setSubView]; self.oldPwdTextField = [self setTextField:nil]; [self.view addSubview:self.oldPwdLabel]; [self.view addSubview:self.oldPwdView]; [self.oldPwdView addSubview:self.oldPwdTextField]; - self.newsPwdLabel = [self setLabel:@"新密码"]; + self.newsPwdLabel = [self setLabel:RCDLocalizedString(@"new_password") +]; self.newsPwdView = [self setSubView]; - self.newsPwdTextField = [self setTextField:@"6-16位字符,区分大小写"]; + self.newsPwdTextField = [self setTextField:RCDLocalizedString(@"password_hint")]; [self.view addSubview:self.newsPwdLabel]; [self.view addSubview:self.newsPwdView]; [self.newsPwdView addSubview:self.newsPwdTextField]; - self.confirmPwdLabel = [self setLabel:@"确认密码"]; + self.confirmPwdLabel = [self setLabel:RCDLocalizedString(@"confirm_new_password") +]; self.confirmPwdView = [self setSubView]; - self.confirmPwdTextField = [self setTextField:@"6-16位字符,区分大小写"]; + self.confirmPwdTextField = [self setTextField:RCDLocalizedString(@"password_hint")]; [self.view addSubview:self.confirmPwdLabel]; [self.view addSubview:self.confirmPwdView]; [self.confirmPwdView addSubview:self.confirmPwdTextField]; @@ -82,10 +85,11 @@ - (void)initialize { } - (void)setNavigationButton { - self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"设置" target:self action:@selector(clickBackBtn)]; + self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"settings") target:self action:@selector(clickBackBtn)]; self.navigationItem.leftBarButtonItem = self.leftBtn; - self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:@"完成" + self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:RCDLocalizedString(@"done") + titleColor:[UIColor colorWithHexString:@"9fcdfd" alpha:1.0] buttonFrame:CGRectMake(0, 0, 50, 30) target:self @@ -218,7 +222,8 @@ - (void)saveNewPassword:(id)sender { if ([userPwd isEqualToString:self.oldPwdTextField.text]) { NSInteger newPwdLength = self.newsPwdTextField.text.length; if (newPwdLength < 6 || newPwdLength > 20) { - [self AlertShow:@"密码必须为6-16位字符,区分大小写"]; + [self AlertShow:RCDLocalizedString(@"password_alert") +]; } else { if ([self.newsPwdTextField.text isEqualToString:self.confirmPwdTextField.text]) { [AFHttpTool changePassword:self.oldPwdTextField.text @@ -235,12 +240,14 @@ - (void)saveNewPassword:(id)sender { }]; } else { - [self AlertShow:@"填写的确认密码与新密码不一致"]; + [self AlertShow:RCDLocalizedString(@"old_and_new_friend_different") +]; } } } else { - [self AlertShow:@"原密码填写错误"]; + [self AlertShow:RCDLocalizedString(@"old_password_error") +]; } } @@ -248,7 +255,8 @@ - (void)AlertShow:(NSString *)content { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:content delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } diff --git a/ios-rongimdemo/RCDChatListCell.m b/ios-rongimdemo/RCDChatListCell.m index 7f2d53ce..f5ed16b9 100644 --- a/ios-rongimdemo/RCDChatListCell.m +++ b/ios-rongimdemo/RCDChatListCell.m @@ -42,12 +42,12 @@ - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSStr _lblDetail = [UILabel new]; [_lblDetail setFont:[UIFont systemFontOfSize:14.f]]; [_lblDetail setTextColor:HEXCOLOR(0x8c8c8c)]; - _lblDetail.text = [NSString stringWithFormat:@"来自%@的好友请求", _userName]; + _lblDetail.text = [NSString stringWithFormat:RCDLocalizedString(@"from_someone_friend_request"), _userName]; _lblName = [UILabel new]; [_lblName setFont:[UIFont boldSystemFontOfSize:16.f]]; [_lblName setTextColor:HEXCOLOR(0x252525)]; - _lblName.text = @"好友消息"; + _lblName.text = RCDLocalizedString(@"friend_news"); _labelTime = [[UILabel alloc] init]; _labelTime.backgroundColor = [UIColor clearColor]; diff --git a/ios-rongimdemo/RCDContactSelectedTableViewController.m b/ios-rongimdemo/RCDContactSelectedTableViewController.m index e6d41d48..59d29f82 100644 --- a/ios-rongimdemo/RCDContactSelectedTableViewController.m +++ b/ios-rongimdemo/RCDContactSelectedTableViewController.m @@ -93,7 +93,8 @@ - (void)viewDidLoad { self.matchSearchList = [NSMutableArray new]; //自定义rightBarButtonItem - self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:@"确定" + self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:RCDLocalizedString(@"confirm") + titleColor:[UIColor colorWithHexString:@"000000" alpha:1.0] buttonFrame:CGRectMake(0, 0, 90, 30) target:self @@ -132,6 +133,11 @@ - (void)viewWillAppear:(BOOL)animated { } } +- (void)viewDidLayoutSubviews { + self.noFriendView.frame = CGRectMake(0, 0, RCDscreenWidth, RCDscreenHeight - 64); + self.tableView.frame = CGRectMake(0, 54, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 64 - 54 - RCDExtraTopHeight - RCDExtraBottomHeight); +} + - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.rightBtn buttonIsCanClick:YES buttonColor:[UIColor whiteColor] barButtonItem:self.rightBtn]; @@ -145,6 +151,7 @@ - (void)createTableView { self.tableView.translatesAutoresizingMaskIntoConstraints = NO; self.tableView.frame = CGRectMake(0, 54, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height - 64 - 54 - RCDExtraTopHeight - RCDExtraBottomHeight); + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; [self.view addSubview:self.tableView]; //控制多选 @@ -228,7 +235,7 @@ - (void)setCollectonViewAndSearchBarFrame:(NSInteger)count { self.selectedUsersCollectionView.frame = frame; self.searchBar.frame = [self getSearchBarFrame:frame]; self.searchField.leftView = self.searchBarLeftView; - self.searchBar.text = @"搜索"; + self.searchBar.text = RCDLocalizedString(@"search"); } else if (count == 1) { frame = CGRectMake(0, 0, 46, 54); self.selectedUsersCollectionView.frame = frame; @@ -296,10 +303,11 @@ - (void)clickedDone:(id)sender { [self.navigationController popViewControllerAnimated:YES]; } else { [hud hide:YES]; - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"添加成员失败" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"add_member_fail") message:nil delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alert show]; [self.rightBtn buttonIsCanClick:YES @@ -317,10 +325,11 @@ - (void)clickedDone:(id)sender { [self.navigationController popViewControllerAnimated:YES]; } else { [hud hide:YES]; - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"删除成员失败" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"delete_member_fail") message:nil delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alert show]; [self.rightBtn buttonIsCanClick:YES @@ -367,7 +376,7 @@ - (void)clickedDone:(id)sender { chat.targetId = discussion.discussionId; chat.userName = discussion.discussionName; chat.conversationType = ConversationType_DISCUSSION; - chat.title = @"讨论组"; + chat.title = RCDLocalizedString(@"discuss_group"); chat.needPopToRootView = YES; [self.navigationController pushViewController:chat animated:YES]; }); @@ -419,7 +428,7 @@ - (void)clickedDone:(id)sender { chat.targetId = discussion.discussionId; chat.userName = discussion.discussionName; chat.conversationType = ConversationType_DISCUSSION; - chat.title = @"讨论组"; + chat.title = RCDLocalizedString(@"discuss_group"); chat.needPopToRootView = YES; [self.navigationController pushViewController:chat animated:YES]; }); @@ -438,7 +447,7 @@ - (void)setDefaultDisplay { if (self.collectionViewResource.count < 1) { self.searchField.leftView = self.searchBarLeftView; } - self.searchBar.text = @"搜索"; + self.searchBar.text = RCDLocalizedString(@"search"); self.searchContent = @""; [self.searchBar resignFirstResponder]; } @@ -456,9 +465,10 @@ - (void)setMaxCountForDevice { - (void)setRightButton { NSString *titleStr; if (self.selecteUserIdList.count > 0) { - titleStr = [NSString stringWithFormat:@"确定(%zd)", [self.selecteUserIdList count]]; + titleStr = [NSString stringWithFormat:@"%@(%zd)",RCDLocalizedString(@"confirm"), [self.selecteUserIdList count]]; } else { - titleStr = @"确定"; + titleStr = RCDLocalizedString(@"confirm") +; [self.rightBtn buttonIsCanClick:NO buttonColor:[UIColor colorWithHexString:@"9fcdfd" alpha:1.0] barButtonItem:self.rightBtn]; @@ -474,7 +484,7 @@ - (void)closeKeyboard { self.searchField.leftView = self.searchBarLeftView; } if (self.searchContent.length < 1) { - self.searchBar.text = @"搜索"; + self.searchBar.text = RCDLocalizedString(@"search"); } if (self.isSearchResult == YES) { dispatch_async(dispatch_get_main_queue(), ^{ @@ -738,7 +748,7 @@ - (void)dealWithFriendList { if (_friendsArr.count < 1) { CGRect frame = CGRectMake(0, 0, RCDscreenWidth, RCDscreenHeight - 64); self.noFriendView = [[RCDNoFriendView alloc] initWithFrame:frame]; - self.noFriendView.displayLabel.text = @"暂无好友"; + self.noFriendView.displayLabel.text = RCDLocalizedString(@"no_friend"); [self.view addSubview:self.noFriendView]; [self.view bringSubviewToFront:self.noFriendView]; } else { @@ -887,7 +897,7 @@ - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText } - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { - if ([self.searchField.text isEqualToString:@"搜索"] || [self.searchField.text isEqualToString:@"Search"]) { + if ([self.searchField.text isEqualToString:RCDLocalizedString(@"search")] || [self.searchField.text isEqualToString:@"Search"]) { self.searchField.leftView = nil; self.searchField.text = @""; } diff --git a/ios-rongimdemo/RCDContactViewController.m b/ios-rongimdemo/RCDContactViewController.m index c6c9e0f2..e3bd9ca9 100644 --- a/ios-rongimdemo/RCDContactViewController.m +++ b/ios-rongimdemo/RCDContactViewController.m @@ -16,7 +16,7 @@ #import "RCDPersonDetailViewController.h" #import "RCDPublicServiceListViewController.h" #import "RCDRCIMDataSource.h" -#import "RCDSearchFriendViewController.h" +#import "RCDSearchFriendController.h" #import "RCDataBaseManager.h" #import "UIImageView+WebCache.h" @@ -130,15 +130,19 @@ - (void)viewDidLoad { searchField.layer.borderWidth = 0.5f; searchField.layer.borderColor = [HEXCOLOR(0xdfdfdf) CGColor]; searchField.layer.cornerRadius = 5.f; - self.searchFriendsBar.placeholder = @"搜索"; + self.searchFriendsBar.placeholder = RCDLocalizedString(@"search"); - self.defaultCellsTitle = [NSArray arrayWithObjects:@"新朋友", @"群组", @"公众号", nil]; + self.defaultCellsTitle = [NSArray arrayWithObjects:RCDLocalizedString(@"new_friend") +, RCDLocalizedString(@"group") +, RCDLocalizedString(@"public_account") +, nil]; self.defaultCellsPortrait = [NSArray arrayWithObjects:@"newFriend", @"defaultGroup", @"publicNumber", nil]; self.isBeginSearch = NO; if ([RCDForwardMananer shareInstance].isForward) { - UIBarButtonItem *left = [[UIBarButtonItem alloc] initWithTitle:@"取消" style:(UIBarButtonItemStylePlain) target:self action:@selector(onCancelAction)]; + UIBarButtonItem *left = [[UIBarButtonItem alloc] initWithTitle:RCDLocalizedString(@"cancel") + style:(UIBarButtonItemStylePlain) target:self action:@selector(onCancelAction)]; self.navigationItem.leftBarButtonItem = left; } self.queue = dispatch_queue_create("sealtalksearch", DISPATCH_QUEUE_SERIAL); @@ -161,7 +165,12 @@ - (void)viewWillAppear:(BOOL)animated { action:@selector(pushAddFriend:)]; self.tabBarController.navigationItem.rightBarButtonItems = [rightBtn setTranslation:rightBtn translation:-6]; - self.tabBarController.navigationItem.title = @"通讯录"; + self.tabBarController.navigationItem.title = RCDLocalizedString(@"contacts"); +} + +- (void)viewDidLayoutSubviews { + self.searchFriendsBar.frame = CGRectMake(0, 0, self.view.bounds.size.width, 44); + self.friendsTabelView.frame = CGRectMake(0, CGRectGetMaxY(self.searchFriendsBar.frame), self.view.bounds.size.width, self.view.bounds.size.height - CGRectGetMaxY(self.searchFriendsBar.frame)); } - (void)viewWillDisappear:(BOOL)animated { @@ -471,7 +480,7 @@ - (void)sortAndRefreshWithList:(NSArray *)friendList { * @param sender sender description */ - (void)pushAddFriend:(id)sender { - RCDSearchFriendViewController *searchFirendVC = [RCDSearchFriendViewController searchFriendViewController]; + RCDSearchFriendController *searchFirendVC = [[RCDSearchFriendController alloc] init]; [self.navigationController pushViewController:searchFirendVC animated:YES]; } diff --git a/ios-rongimdemo/RCDCountry.h b/ios-rongimdemo/RCDCountry.h new file mode 100644 index 00000000..5aa2e29e --- /dev/null +++ b/ios-rongimdemo/RCDCountry.h @@ -0,0 +1,30 @@ +// +// RCDCountry.h +// SealTalk +// +// Created by 张改红 on 2019/2/18. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RCDCountry : NSObject +//国家中文名字 +@property(nonatomic, strong, readonly) NSString *countryName; + +//国家电话代码 +@property(nonatomic, strong) NSString *phoneCode; + +/** + 国家初始化方法 + + @param dict 传入的字典信息 + @return 国家信息对象 + */ +- (instancetype)initWithDict:(NSDictionary *)dict; +- (NSDictionary *)getModelJson; +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RCDCountry.m b/ios-rongimdemo/RCDCountry.m new file mode 100644 index 00000000..37ce2527 --- /dev/null +++ b/ios-rongimdemo/RCDCountry.m @@ -0,0 +1,43 @@ +// +// RCDCountry.m +// SealTalk +// +// Created by 张改红 on 2019/2/18. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import "RCDCountry.h" +@interface RCDCountry () +@property (nonatomic, strong) NSDictionary *locale; +@property(nonatomic, strong) NSString *countryName; +@end +@implementation RCDCountry +- (instancetype)initWithDict:(NSDictionary *)dict { + self = [super init]; + if (self) { + self.phoneCode = [dict objectForKey:@"region"]; + NSDictionary *locale = [dict objectForKey:@"locale"]; + self.locale = locale; + } + return self; +} + +- (NSDictionary *)getModelJson{ + NSMutableDictionary *dic = [NSMutableDictionary dictionary]; + [dic setObject:self.phoneCode forKey:@"region"]; + [dic setObject:self.locale forKey:@"locale"]; + return dic.copy; +} + +- (NSString *)countryName{ + NSArray *languages = [NSLocale preferredLanguages]; + NSString *currentLanguage = [languages objectAtIndex:0]; + if ([currentLanguage containsString:@"zh-Hans"]) { + return self.locale[@"zh"]; + }else{ + return self.locale[@"en"]; + } + return nil; +} + +@end diff --git a/ios-rongimdemo/RCDCountryListController.h b/ios-rongimdemo/RCDCountryListController.h new file mode 100644 index 00000000..325e28fc --- /dev/null +++ b/ios-rongimdemo/RCDCountryListController.h @@ -0,0 +1,27 @@ +// +// RCDCountryListController.h +// SealTalk +// +// Created by 张改红 on 2019/2/18. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import +@class RCDCountry; +NS_ASSUME_NONNULL_BEGIN + +@protocol RCDCountryListControllerDelegate + +- (void)fetchCountryPhoneCode:(RCDCountry *)country; + +@end + +@interface RCDCountryListController : UITableViewController + +@property (nonatomic, assign) BOOL showNavigationBarWhenBack; + +@property(nonatomic, weak) id delegate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RCDCountryListController.m b/ios-rongimdemo/RCDCountryListController.m new file mode 100644 index 00000000..daf4941e --- /dev/null +++ b/ios-rongimdemo/RCDCountryListController.m @@ -0,0 +1,254 @@ +// +// RCDCountryListController.m +// SealTalk +// +// Created by 张改红 on 2019/2/18. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import "RCDCountryListController.h" +#import "RCDUtilities.h" +#import "RCDCountry.h" +#import "UIColor+RCColor.h" +#import "RCDCommonDefine.h" +#import "AFHttpTool.h" +@interface RCDCountryListController () + +@property(nonatomic, retain) UISearchController *searchController; + +//数据源 +@property(nonatomic, strong) NSMutableArray *countryArray; +@property(nonatomic, strong) NSMutableArray *searchListArry; + +@property(nonatomic, strong) NSMutableDictionary *resultDic; +@property(nonatomic, strong) NSMutableDictionary *searchResultDic; +@property(nonatomic, strong) NSDictionary *allCountryDic; +@property(nonatomic, strong) NSDictionary *allSearchCountryDic; + +@end + +@implementation RCDCountryListController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.extendedLayoutIncludesOpaqueBars = YES; + self.edgesForExtendedLayout = UIRectEdgeNone; + self.automaticallyAdjustsScrollViewInsets = NO; + self.title = RCDLocalizedString(@"select_country"); + [self.navigationController setNavigationBarHidden:NO animated:YES]; + [self configCountryData]; + //设置右侧索引 + self.tableView.sectionIndexBackgroundColor = [UIColor clearColor]; + self.tableView.sectionIndexColor = HEXCOLOR(0x2B73EB); + // 添加 searchbar 到 headerview + self.definesPresentationContext = YES; + self.tableView.tableHeaderView = self.searchController.searchBar; + [self.tableView setTableFooterView:[UIView new]]; + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; +} + +- (void)viewWillDisappear:(BOOL)animated { + [super viewWillDisappear:animated]; + if (!self.showNavigationBarWhenBack) { + [self.navigationController setNavigationBarHidden:YES animated:YES]; + } + [self.searchController setActive:NO]; +} + +- (void)configCountryData { + self.countryArray = [[NSMutableArray alloc] init]; + self.allCountryDic = [[NSDictionary alloc] init]; + self.allSearchCountryDic = [[NSDictionary alloc] init]; + __weak typeof(self) weakSelf = self; + [AFHttpTool getRegionlist:^(id response) { + if([response[@"code"] intValue] == 200){ + NSDictionary *dic = response[@"result"]; + for (NSDictionary *regionJson in dic) { + RCDCountry *country = [[RCDCountry alloc] initWithDict:regionJson]; + [weakSelf.countryArray addObject:country]; + } + weakSelf.resultDic = [weakSelf sortedArrayWithPinYinDic:self.countryArray]; + dispatch_async(dispatch_get_main_queue(), ^{ + weakSelf.allCountryDic = weakSelf.resultDic[@"infoDic"]; + [weakSelf.tableView reloadData]; + }); + } + } failure:^(NSError *err) { + + }]; +} + +- (NSArray *)sectionCountryTitles { + if (self.searchController.isActive) { + return self.searchResultDic[@"allKeys"]; + } else { + return self.resultDic[@"allKeys"]; + } +} + +- (NSArray *)countriesInSection:(NSInteger)section { + NSString *letter = [self sectionCountryTitles][section]; + + NSArray *countries; + if (self.searchController.active) { + countries = self.allSearchCountryDic[letter]; + } else { + countries = self.allCountryDic[letter]; + } + return countries; +} + +#pragma mark - Table view data source +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 55.5; +} + +- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView { + return [self sectionCountryTitles]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return 21.f; +} + +- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + UIView *view = [[UIView alloc] initWithFrame:CGRectZero]; + view.frame = CGRectMake(0, 0, self.view.frame.size.width, 19); + view.backgroundColor = HEXCOLOR(0xF5F5F5); + + UILabel *title = [[UILabel alloc] initWithFrame:CGRectZero]; + title.frame = CGRectMake(13, 3, 15, 15); + title.font = [UIFont systemFontOfSize:15.f]; + title.textColor = HEXCOLOR(0x808080); + [view addSubview:title]; + + NSArray *sectionTitles = [self sectionCountryTitles]; + title.text = sectionTitles[section]; + + return view; +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return [self sectionCountryTitles].count; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self countriesInSection:section].count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *flag = @"cell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:flag]; + if (cell == nil) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:flag]; + } + + NSArray *sectionUserInfoList = [self countriesInSection:indexPath.section]; + + RCDCountry *countryInfo = sectionUserInfoList[indexPath.row]; + if (countryInfo) { + [cell.textLabel setText:countryInfo.countryName]; + cell.detailTextLabel.text = [NSString stringWithFormat:@"+%@",countryInfo.phoneCode]; + } + return cell; +} + +#pragma mark - UITableView Delegate +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSArray *sectionUserInfoList = [self countriesInSection:indexPath.section]; + RCDCountry *countryInfo = sectionUserInfoList[indexPath.row]; + + if ([self.delegate respondsToSelector:@selector(fetchCountryPhoneCode:)]) { + [[NSUserDefaults standardUserDefaults] setObject:[countryInfo getModelJson] forKey:@"currentCountry"]; + [self.delegate fetchCountryPhoneCode:countryInfo]; + } + [self.navigationController popViewControllerAnimated:NO]; + [self.searchController setActive:NO]; + [self.navigationController setNavigationBarHidden:YES animated:YES]; +} + +#pragma mark - UISearchController Delegate - +- (void)updateSearchResultsForSearchController:(UISearchController *)searchController { + //谓词搜索过滤 + NSString *searchString = [self.searchController.searchBar text]; + NSPredicate *preicate = [NSPredicate predicateWithFormat:@"countryName CONTAINS[cd] %@", searchString]; + if (self.searchListArry != nil) { + [self.searchListArry removeAllObjects]; + } + //过滤数据 + self.searchListArry = [NSMutableArray arrayWithArray:[self.countryArray filteredArrayUsingPredicate:preicate]]; + + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + self.searchResultDic = [self sortedArrayWithPinYinDic:self.searchListArry]; + dispatch_async(dispatch_get_main_queue(), ^{ + self.allSearchCountryDic = self.searchResultDic[@"infoDic"]; + [self.tableView reloadData]; + }); + }); + + [self.tableView reloadData]; +} + +#pragma mark - 属性初始化 - +- (UISearchController *)searchController { + if(!_searchController){ + _searchController = [[UISearchController alloc] initWithSearchResultsController:nil]; + _searchController.delegate = self; + _searchController.searchResultsUpdater = self; + //提醒字眼 + _searchController.searchBar.placeholder = @"搜索"; + _searchController.searchBar.backgroundImage = [UIColor imageWithColor:[UIColor clearColor]]; + [_searchController.searchBar setBackgroundColor:HEXCOLOR(0xE4E5E7)]; + _searchController.dimsBackgroundDuringPresentation = NO; + } + return _searchController; +} +- (NSMutableDictionary *)sortedArrayWithPinYinDic:(NSArray *)countryList { + if (!countryList) + return nil; + NSArray *_keys = @[ + @"A", @"B", @"C", @"D", @"E", @"F", @"G", @"H", @"I", @"J", @"K", @"L", @"M", @"N", + @"O", @"P", @"Q", @"R", @"S", @"T", @"U", @"V", @"W", @"X", @"Y", @"Z", @"#" + ]; + NSMutableArray *mutableList = [countryList mutableCopy]; + + NSMutableDictionary *infoDic = [NSMutableDictionary new]; + + for (RCDCountry *model in mutableList) { + NSString *firstLetter; + if (model.countryName.length > 0 && ![model.countryName isEqualToString:@""]) { + firstLetter = [RCDUtilities getFirstUpperLetter:model.countryName]; + } else { + firstLetter = [RCDUtilities getFirstUpperLetter:model.countryName]; + } + if ([_keys containsObject:firstLetter]) { + NSMutableArray *array = infoDic[firstLetter]; + if (array) { + [array addObject:model]; + [infoDic setObject:array forKey:firstLetter]; + }else{ + [infoDic setObject:@[model].mutableCopy forKey:firstLetter]; + } + }else{ + NSMutableArray *array = infoDic[@"#"]; + if (array) { + [array addObject:model]; + [infoDic setObject:array forKey:@"#"]; + }else{ + [infoDic setObject:@[model].mutableCopy forKey:@"#"]; + } + } + } + NSArray *keys = [[infoDic allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) { + return [obj1 compare:obj2 options:NSNumericSearch]; + }]; + NSMutableArray *allKeys = [[NSMutableArray alloc] initWithArray:keys]; + + NSMutableDictionary *resultDic = [NSMutableDictionary new]; + [resultDic setObject:infoDic forKey:@"infoDic"]; + [resultDic setObject:allKeys forKey:@"allKeys"]; + return resultDic; +} +@end diff --git a/ios-rongimdemo/RCDCreateGroupViewController.m b/ios-rongimdemo/RCDCreateGroupViewController.m index 6beb6df0..f4beb01c 100644 --- a/ios-rongimdemo/RCDCreateGroupViewController.m +++ b/ios-rongimdemo/RCDCreateGroupViewController.m @@ -78,7 +78,7 @@ - (void)initSubViews { self.GroupName = [[UITextField alloc] initWithFrame:CGRectMake(groupNameX, groupNameY, groupNameWidth, groupNameHeight)]; self.GroupName.font = [UIFont systemFontOfSize:14]; - self.GroupName.placeholder = @"填写群名称(2-10个字符)"; + self.GroupName.placeholder = RCDLocalizedString(@"type_croup_name_hint"); self.GroupName.textAlignment = NSTextAlignmentCenter; self.GroupName.delegate = self; self.GroupName.returnKeyType = UIReturnKeyDone; @@ -101,7 +101,8 @@ - (void)initSubViews { [self.view addGestureRecognizer:resetBottomTapGesture]; //创建rightBarButtonItem - UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"完成" + UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:RCDLocalizedString(@"done") + style:UIBarButtonItemStylePlain target:self action:@selector(ClickDoneBtn:)]; @@ -150,7 +151,8 @@ - (void)viewDidLoad { // [self.view addGestureRecognizer:resetBottomTapGesture]; // // UIBarButtonItem *item = - // [[UIBarButtonItem alloc] initWithTitle:@"完成" + // [[UIBarButtonItem alloc] initWithTitle:RCDLocalizedString(@"done") + // style:UIBarButtonItemStylePlain // target:self // action:@selector(ClickDoneBtn:)]; @@ -244,17 +246,17 @@ - (IBAction)ClickDoneBtn:(id)sender { //群组名称需要大于2位 if ([nameStr length] == 0) { - [self Alert:@"群组名称不能为空"]; + [self Alert:RCDLocalizedString(@"group_name_can_not_nil")]; self.navigationItem.rightBarButtonItem.enabled = YES; } //群组名称需要大于2个字 else if ([nameStr length] < 2) { - [self Alert:@"群组名称过短"]; + [self Alert:RCDLocalizedString(@"Group_name_is_too_short")]; self.navigationItem.rightBarButtonItem.enabled = YES; } //群组名称需要小于10个字 else if ([nameStr length] > 10) { - [self Alert:@"群组名称不能超过10个字"]; + [self Alert:RCDLocalizedString(@"Group_name_cannot_exceed_10_words")]; self.navigationItem.rightBarButtonItem.enabled = YES; } else { BOOL isAddedcurrentUserID = false; @@ -271,7 +273,7 @@ - (IBAction)ClickDoneBtn:(id)sender { hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.color = [UIColor colorWithHexString:@"343637" alpha:0.5]; - hud.labelText = @"创建中..."; + hud.labelText = RCDLocalizedString(@"creating_group"); [hud show:YES]; [[RCDHttpTool shareInstance] @@ -319,8 +321,7 @@ - (IBAction)ClickDoneBtn:(id)sender { self.navigationItem.rightBarButtonItem .enabled = YES; //关闭HUD [hud hide:YES]; - [self Alert:@"创建群组失败,请检查你的网" - @"络设置。"]; + [self Alert:RCDLocalizedString(@"create_group_fail")]; } }]; }); @@ -335,7 +336,7 @@ - (IBAction)ClickDoneBtn:(id)sender { self.navigationItem.rightBarButtonItem.enabled = YES; //关闭HUD [hud hide:YES]; - [self Alert:@"创建群组失败,请检查你的网络设置。"]; + [self Alert:RCDLocalizedString(@"create_group_fail")]; }]; } else { @@ -354,7 +355,7 @@ - (IBAction)ClickDoneBtn:(id)sender { } else { [hud hide:YES]; self.navigationItem.rightBarButtonItem.enabled = YES; - [self Alert:@"创建群组失败,请检查你的网络设置。"]; + [self Alert:RCDLocalizedString(@"create_group_fail")]; } }]; } @@ -375,7 +376,8 @@ - (void)Alert:(NSString *)alertContent { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:alertContent delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } @@ -385,9 +387,12 @@ - (void)chosePortrait { [_GroupName resignFirstResponder]; UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"拍照" - otherButtonTitles:@"我的相册", nil]; + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"take_picture") + + otherButtonTitles:RCDLocalizedString(@"my_album") +, nil]; [actionSheet showInView:self.view]; } diff --git a/ios-rongimdemo/RCDDebugNoDisturbViewController.m b/ios-rongimdemo/RCDDebugNoDisturbViewController.m index 6c6da826..262ddb4e 100644 --- a/ios-rongimdemo/RCDDebugNoDisturbViewController.m +++ b/ios-rongimdemo/RCDDebugNoDisturbViewController.m @@ -24,7 +24,7 @@ - (void)viewDidLoad { [self.view setBackgroundColor:[UIColor lightGrayColor]]; UILabel *startTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 100, 130, 44)]; - startTimeLabel.text = @"开始时间:"; + startTimeLabel.text = RCDLocalizedString(@"Start_time1"); [self.view addSubview:startTimeLabel]; self.startTimeTextField = [[UITextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX(startTimeLabel.frame), 100, 160, 44)]; @@ -33,7 +33,8 @@ - (void)viewDidLoad { [self.view addSubview:self.startTimeTextField]; UILabel *endTimeLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(self.startTimeTextField.frame)+20, 130, 44)]; - endTimeLabel.text = @"持续时间(分):"; + endTimeLabel.text = RCDLocalizedString(@"continue_times") +; [self.view addSubview:endTimeLabel]; self.durationTimeTextField = [[UITextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX(endTimeLabel.frame), endTimeLabel.frame.origin.y, 160, 44)]; @@ -41,7 +42,8 @@ - (void)viewDidLoad { [self.view addSubview:self.durationTimeTextField]; UIButton *confirmButton = [[UIButton alloc] initWithFrame:CGRectMake(50, CGRectGetMaxY(self.durationTimeTextField.frame)+40, self.view.bounds.size.width-100, 44)]; - [confirmButton setTitle:@"确定" forState:UIControlStateNormal]; + [confirmButton setTitle:RCDLocalizedString(@"confirm") + forState:UIControlStateNormal]; [confirmButton addTarget:self action:@selector(confirmButtonAction:) forControlEvents:UIControlEventTouchUpInside]; [confirmButton setBackgroundColor:[UIColor blueColor]]; [self.view addSubview:confirmButton]; @@ -60,12 +62,14 @@ - (void)confirmButtonAction:(UIButton *)button { [[RCIMClient sharedRCIMClient] setNotificationQuietHours:startTime spanMins:spanMins success:^{ dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"设置成功" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"setting_success") message:nil delegate:nil cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alert show]; }); } error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"设置失败" message:nil delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"set_fail") message:nil delegate:nil cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alert show]; }); }]; diff --git a/ios-rongimdemo/RCDDebugViewController.m b/ios-rongimdemo/RCDDebugViewController.m index ffa0ed72..d488ea8e 100644 --- a/ios-rongimdemo/RCDDebugViewController.m +++ b/ios-rongimdemo/RCDDebugViewController.m @@ -29,19 +29,22 @@ - (void)viewDidLoad { self.offLineMessageTimeLabel.textAlignment = NSTextAlignmentCenter; self.offLineMessageTimeLabel.textColor = [UIColor blackColor]; [self.offLineMessageTimeLabel - setText:[NSString stringWithFormat:@"%d 天", [[RCIMClient sharedRCIMClient] getOfflineMessageDuration]]]; + setText:[NSString stringWithFormat:RCDLocalizedString(@"xday") +, [[RCIMClient sharedRCIMClient] getOfflineMessageDuration]]]; [self.view addSubview:self.offLineMessageTimeLabel]; self.setTimeTextField = [[UITextField alloc] initWithFrame:CGRectMake(50, 150, self.view.bounds.size.width - 100, 50)]; - self.setTimeTextField.placeholder = @"离线消息补偿时间,范围【1~7天】"; + self.setTimeTextField.placeholder = RCDLocalizedString(@"Set_offline_message_compensation_hint") +; [self.setTimeTextField setFont:[UIFont systemFontOfSize:13]]; self.setTimeTextField.borderStyle = UITextBorderStyleRoundedRect; [self.view addSubview:self.setTimeTextField]; self.confirmBtn = [[UIButton alloc] initWithFrame:CGRectMake((self.view.bounds.size.width - 100) / 2, 250, 100, 50)]; - [self.confirmBtn setTitle:@"确定" forState:UIControlStateNormal]; + [self.confirmBtn setTitle:RCDLocalizedString(@"confirm") + forState:UIControlStateNormal]; self.confirmBtn.backgroundColor = [UIColor blueColor]; [self.confirmBtn addTarget:self action:@selector(confirm) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:self.confirmBtn]; @@ -54,20 +57,22 @@ - (void)confirm { [[RCIMClient sharedRCIMClient] setOfflineMessageDuration:time1 success:^{ dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"设置成功" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"setting_success") delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; }); } failure:^(RCErrorCode nErrorCode) { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"设置失败" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"set_fail") delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; }); diff --git a/ios-rongimdemo/RCDEditGroupNameViewController.m b/ios-rongimdemo/RCDEditGroupNameViewController.m index 51bbd323..50aae656 100644 --- a/ios-rongimdemo/RCDEditGroupNameViewController.m +++ b/ios-rongimdemo/RCDEditGroupNameViewController.m @@ -51,7 +51,8 @@ - (void)initSubViews { _groupNameTextField.delegate = self; //自定义rightBarButtonItem - self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:@"保存" + self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:RCDLocalizedString(@"save") + titleColor:[UIColor colorWithHexString:@"9fcdfd" alpha:1.0] buttonFrame:CGRectMake(0, 0, 50, 30) target:self @@ -86,17 +87,17 @@ - (void)clickDone:(id)sender { //群组名称需要大于2位 if ([nameStr length] == 0) { - [self Alert:@"群组名称不能为空"]; + [self Alert:RCDLocalizedString(@"group_name_can_not_nil")]; return; } //群组名称需要大于2个字 if ([nameStr length] < 2) { - [self Alert:@"群组名称过短"]; + [self Alert:RCDLocalizedString(@"Group_name_is_too_short")]; return; } //群组名称需要小于10个字 if ([nameStr length] > 10) { - [self Alert:@"群组名称不能超过10个字"]; + [self Alert:RCDLocalizedString(@"Group_name_cannot_exceed_10_words")]; return; } @@ -117,7 +118,7 @@ - (void)clickDone:(id)sender { [self.navigationController popViewControllerAnimated:YES]; } if (result == NO) { - [self Alert:@"群组名称修改失败"]; + [self Alert:RCDLocalizedString(@"Group_name_modification_failed")]; } }]; } @@ -126,7 +127,8 @@ - (void)Alert:(NSString *)alertContent { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:alertContent delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } diff --git a/ios-rongimdemo/RCDFrienfRemarksViewController.m b/ios-rongimdemo/RCDFrienfRemarksViewController.m index 74e447fc..2cca0054 100644 --- a/ios-rongimdemo/RCDFrienfRemarksViewController.m +++ b/ios-rongimdemo/RCDFrienfRemarksViewController.m @@ -34,7 +34,8 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - self.navigationItem.title = @"设置备注"; + self.navigationItem.title = RCDLocalizedString(@"set_remarks") +; [self setNavigationButtons]; @@ -56,7 +57,8 @@ - (void)didReceiveMemoryWarning { - (void)setNavigationButtons { self.rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 34)]; self.rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(22.5, 0, 50, 34)]; - self.rightLabel.text = @"完成"; + self.rightLabel.text = RCDLocalizedString(@"done") +; [self.rightBtn addSubview:self.rightLabel]; [self.rightBtn addTarget:self action:@selector(clickRightBtn:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithCustomView:self.rightBtn]; @@ -64,7 +66,7 @@ - (void)setNavigationButtons { self.rightBtn.userInteractionEnabled = NO; self.navigationItem.rightBarButtonItem = rightButton; - RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(clickBackBtn:)]; + RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(clickBackBtn:)]; [self.navigationItem setLeftBarButtonItem:leftButton]; } @@ -76,7 +78,7 @@ - (void)clickRightBtn:(id)sender { [self.navigationController popViewControllerAnimated:YES]; } else { self.hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; - self.hud.labelText = @"设置中..."; + self.hud.labelText = RCDLocalizedString(@"setting"); [self.hud show:YES]; [RCDHTTPTOOL setFriendDisplayName:self.friendInfo.userId displayName:remarksStr @@ -98,7 +100,7 @@ - (void)clickRightBtn:(id)sender { } else { self.rightBtn.userInteractionEnabled = YES; [self.hud hide:YES]; - [self aletrInfo:@"设置失败"]; + [self aletrInfo:RCDLocalizedString(@"set_fail")]; } }]; } @@ -114,7 +116,7 @@ - (void)setLayouts { titleLabel.textColor = [UIColor colorWithHexString:@"999999" alpha:1.f]; titleLabel.translatesAutoresizingMaskIntoConstraints = NO; [self.view addSubview:titleLabel]; - titleLabel.text = @"备注名"; + titleLabel.text = RCDLocalizedString(@"Remark_name"); UIView *inputView = [[UIView alloc] init]; inputView.translatesAutoresizingMaskIntoConstraints = NO; @@ -175,7 +177,8 @@ - (void)aletrInfo:(NSString *)infoStr { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:infoStr delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } diff --git a/ios-rongimdemo/RCDGroupAnnouncementViewController.m b/ios-rongimdemo/RCDGroupAnnouncementViewController.m index 572e4b25..e331711a 100644 --- a/ios-rongimdemo/RCDGroupAnnouncementViewController.m +++ b/ios-rongimdemo/RCDGroupAnnouncementViewController.m @@ -34,7 +34,8 @@ - (instancetype)init { self.AnnouncementContent.delegate = self; self.AnnouncementContent.font = [UIFont systemFontOfSize:16.f]; self.AnnouncementContent.textColor = [UIColor colorWithHexString:@"000000" alpha:1.0]; - self.AnnouncementContent.myPlaceholder = @"请编辑群公告"; + self.AnnouncementContent.myPlaceholder = RCDLocalizedString(@"Please_edit_the_group_announcement") +; self.AnnouncementContent.frame = CGRectMake(4.5, 8, self.view.frame.size.width - 5, self.view.frame.size.height - self.navigationController.navigationBar.frame.size.height - 90); @@ -50,7 +51,8 @@ - (void)viewDidLoad { self.rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 34)]; self.rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(22.5, 0, 50, 34)]; - self.rightLabel.text = @"完成"; + self.rightLabel.text = RCDLocalizedString(@"done") +; [self.rightBtn addSubview:self.rightLabel]; [self.rightBtn addTarget:self action:@selector(clickRightBtn:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithCustomView:self.rightBtn]; @@ -60,7 +62,8 @@ - (void)viewDidLoad { self.leftBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 34)]; UILabel *leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(-6.5, 0, 50, 34)]; - leftLabel.text = @"取消"; + leftLabel.text = RCDLocalizedString(@"cancel") +; [self.leftBtn addSubview:leftLabel]; [leftLabel setTextColor:[UIColor whiteColor]]; [self.leftBtn addTarget:self action:@selector(clickLeftBtn:) forControlEvents:UIControlEventTouchUpInside]; @@ -70,7 +73,8 @@ - (void)viewDidLoad { self.view.backgroundColor = [UIColor whiteColor]; - self.navigationItem.title = @"群公告"; + self.navigationItem.title = RCDLocalizedString(@"group_announcement") +; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) @@ -144,10 +148,10 @@ - (void)clickLeftBtn:(id)sender { [self navigationButtonIsCanClick:NO]; if (self.AnnouncementContent.text.length > 0) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"退出本次编辑" + message:RCDLocalizedString(@"Exit_this_edit") delegate:self - cancelButtonTitle:@"继续编辑" - otherButtonTitles:@"退出", nil]; + cancelButtonTitle:RCDLocalizedString(@"Continue_editing") + otherButtonTitles:RCDLocalizedString(@"quit"), nil]; alert.tag = 101; [alert show]; } else { @@ -164,10 +168,11 @@ - (void)clickRightBtn:(id)sender { } UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"该公告会通知全部群成员,是否发布?" + message:RCDLocalizedString(@"The_announcement_will_notify_all_members_of_the_group") delegate:self - cancelButtonTitle:@"取消" - otherButtonTitles:@"发布", nil]; + cancelButtonTitle:RCDLocalizedString(@"cancel") + + otherButtonTitles:RCDLocalizedString(@"send"), nil]; alert.tag = 102; [alert show]; } @@ -231,7 +236,7 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto self.hud.margin = 0; [self.hud show:YES]; //发布成功后,使用自定义图片 - NSString *txt = [NSString stringWithFormat:@"@所有人\n%@", self.AnnouncementContent.text]; + NSString *txt = [NSString stringWithFormat:@"%@\n%@", RCDLocalizedString(@"mention_all"),self.AnnouncementContent.text]; //去除收尾的空格 txt = [txt stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; //去除收尾的换行 @@ -263,9 +268,10 @@ - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)butto dispatch_async(dispatch_get_main_queue(), ^{ [self.hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"群公告发送失败" + message:RCDLocalizedString(@"Group_announcement_failed_to_be_sent") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; }); diff --git a/ios-rongimdemo/RCDGroupMembersTableViewController.m b/ios-rongimdemo/RCDGroupMembersTableViewController.m index 407f4f54..7472ba9c 100644 --- a/ios-rongimdemo/RCDGroupMembersTableViewController.m +++ b/ios-rongimdemo/RCDGroupMembersTableViewController.m @@ -34,10 +34,11 @@ - (void)viewDidLoad { // self.navigationItem.rightBarButtonItem = self.editButtonItem; self.tableView.tableFooterView = [UIView new]; - self.title = [NSString stringWithFormat:@"群组成员(%lu)", (unsigned long)[_GroupMembers count]]; + self.title = [NSString stringWithFormat:RCDLocalizedString(@"group_members_x") +, (unsigned long)[_GroupMembers count]]; - self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(clickBackBtn)]; + self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(clickBackBtn)]; self.navigationItem.leftBarButtonItem = self.leftBtn; } diff --git a/ios-rongimdemo/RCDGroupSettingsTableViewCell.m b/ios-rongimdemo/RCDGroupSettingsTableViewCell.m index 5bcbfb8a..dbeb2032 100644 --- a/ios-rongimdemo/RCDGroupSettingsTableViewCell.m +++ b/ios-rongimdemo/RCDGroupSettingsTableViewCell.m @@ -38,44 +38,48 @@ - (void)initSubviewsWithIndexPath:(NSIndexPath *)indexPath andGroupInfo:(RCDGrou if (indexPath.section == 0) { [self setCellStyle:DefaultStyle]; self.tag = RCDGroupSettingsTableViewCellGroupNameTag; - self.leftLabel.text = [NSString stringWithFormat:@"全部群成员(%@)", groupInfo.number]; + self.leftLabel.text = [NSString stringWithFormat:RCDLocalizedString(@"all_group_member_z") +, groupInfo.number]; } else if (indexPath.section == 1) { switch (indexPath.row) { case 0: { [self setCellStyle:DefaultStyle]; self.tag = RCDGroupSettingsTableViewCellGroupPortraitTag; - self.leftLabel.text = @"群组头像"; + self.leftLabel.text = RCDLocalizedString(@"group_portrait"); } break; case 1: [self setCellStyle:DefaultStyle_RightLabel]; - self.leftLabel.text = @"群组名称"; + self.leftLabel.text = RCDLocalizedString(@"group_name") +; self.rightLabel.text = groupInfo.groupName; break; case 2: [self setCellStyle:DefaultStyle]; - self.leftLabel.text = @"群公告"; + self.leftLabel.text = RCDLocalizedString(@"group_announcement") +; break; default: break; } } else if (indexPath.section == 2) { [self setCellStyle:DefaultStyle]; - self.leftLabel.text = @"查找聊天记录"; + self.leftLabel.text = RCDLocalizedString(@"search_chat_history"); } else { switch (indexPath.row) { case 0: [self setCellStyle:SwitchStyle]; - self.leftLabel.text = @"消息免打扰"; + self.leftLabel.text = RCDLocalizedString(@"mute_notifications"); self.switchButton.tag = SwitchButtonTag; break; case 1: [self setCellStyle:SwitchStyle]; - self.leftLabel.text = @"会话置顶"; + self.leftLabel.text = RCDLocalizedString(@"stick_on_top") +; self.switchButton.tag = SwitchButtonTag + 1; break; case 2: [self setCellStyle:DefaultStyle]; - self.leftLabel.text = @"清除聊天记录"; + self.leftLabel.text = RCDLocalizedString(@"clear_chat_history"); break; default: break; diff --git a/ios-rongimdemo/RCDGroupSettingsTableViewController.m b/ios-rongimdemo/RCDGroupSettingsTableViewController.m index 4e911546..528d85bc 100644 --- a/ios-rongimdemo/RCDGroupSettingsTableViewController.m +++ b/ios-rongimdemo/RCDGroupSettingsTableViewController.m @@ -96,7 +96,7 @@ - (void)viewDidLoad { // bar for this view controller. // self.navigationItem.rightBarButtonItem = self.editButtonItem; numberOfSections = 0; - RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(backBarButtonItemClicked:)]; + RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(backBarButtonItemClicked:)]; [self.navigationItem setLeftBarButtonItem:leftButton]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -125,9 +125,10 @@ - (void)viewWillAppear:(BOOL)animated { [self startLoad]; } if (self.Group.number) { - self.title = [NSString stringWithFormat:@"群组信息(%@)", self.Group.number]; + self.title = [NSString stringWithFormat:RCDLocalizedString(@"group_information_x"),self.Group.number]; } else { - self.title = @"群组信息"; + self.title = RCDLocalizedString(@"group_information") +; } } @@ -209,12 +210,12 @@ - (void)startLoad { if ([result count] > 0) { dispatch_async(dispatch_get_main_queue(), ^{ weakSelf.title = [NSString - stringWithFormat:@"群组信息(%lu)", (unsigned long)result.count]; + stringWithFormat:RCDLocalizedString(@"group_information_x"),[NSString stringWithFormat:@"%lu",(unsigned long)result.count]]; RCDGroupSettingsTableViewCell *cell = (RCDGroupSettingsTableViewCell *)[weakSelf.tableView viewWithTag:RCDGroupSettingsTableViewCellGroupNameTag]; cell.leftLabel.text = [NSString - stringWithFormat:@"全部群成员(%lu)", (unsigned long)result.count]; + stringWithFormat:RCDLocalizedString(@"all_group_member_z"),[NSString stringWithFormat:@"%lu",(unsigned long)result.count]]; }); collectionViewResource = [NSMutableArray new]; NSMutableArray *tempArray = result; @@ -245,7 +246,8 @@ - (void)startLoad { _btJoinOrQuitGroup = [[UIButton alloc] init]; [_btJoinOrQuitGroup setBackgroundImage:quitImage forState:UIControlStateNormal]; [_btJoinOrQuitGroup setBackgroundImage:quitImageSelected forState:UIControlStateSelected]; - [_btJoinOrQuitGroup setTitle:@"删除并退出" forState:UIControlStateNormal]; + [_btJoinOrQuitGroup setTitle:RCDLocalizedString(@"delete_and_exit") + forState:UIControlStateNormal]; [_btJoinOrQuitGroup setCenter:CGPointMake(view.bounds.size.width / 2, view.bounds.size.height / 2)]; [_btJoinOrQuitGroup addTarget:self action:@selector(btnJOQAction:) forControlEvents:UIControlEventTouchUpInside]; _btJoinOrQuitGroup.layer.cornerRadius = 5.f; @@ -257,7 +259,7 @@ - (void)startLoad { _btDismissGroup = [[UIButton alloc] init]; [_btDismissGroup setBackgroundImage:quitImage forState:UIControlStateNormal]; [_btDismissGroup setBackgroundImage:quitImageSelected forState:UIControlStateSelected]; - [_btDismissGroup setTitle:@"解散并删除" forState:UIControlStateNormal]; + [_btDismissGroup setTitle:RCDLocalizedString(@"DisbandAndDelete") forState:UIControlStateNormal]; [_btDismissGroup setBackgroundColor:[UIColor orangeColor]]; [_btDismissGroup setCenter:CGPointMake(view.bounds.size.width / 2, view.bounds.size.height / 2)]; [_btDismissGroup addTarget:self action:@selector(btnDismissAction:) forControlEvents:UIControlEventTouchUpInside]; @@ -307,10 +309,12 @@ - (void)buttonChatAction:(id)sender { } - (void)btnJOQAction:(id)sender { - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"确定退出群组?" + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:RCDLocalizedString(@"delete_group_alert") delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [actionSheet showInView:self.view]; @@ -318,10 +322,12 @@ - (void)btnJOQAction:(id)sender { } - (void)btnDismissAction:(id)sender { - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"确定解散群组?" + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:RCDLocalizedString(@"Disband_group_alert") delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [actionSheet showInView:self.view]; @@ -348,7 +354,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.color = [UIColor colorWithHexString:@"343637" alpha:0.5]; - hud.labelText = @"上传头像中..."; + hud.labelText = RCDLocalizedString(@"Uploading_avatar"); [hud show:YES]; __weak typeof(self) weakSelf = self; [RCDHTTPTOOL uploadImageToQiNiu:[RCIM sharedRCIM].currentUserInfo.userId @@ -382,9 +388,10 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking //关闭HUD [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"上传头像失败" + message:RCDLocalizedString(@"Upload_avatar_fail") delegate:weakSelf - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } @@ -394,9 +401,10 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking //关闭HUD [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"上传头像失败" + message:RCDLocalizedString(@"Upload_avatar_fail") delegate:weakSelf - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } @@ -405,9 +413,10 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking //关闭HUD [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"上传头像失败" + message:RCDLocalizedString(@"Upload_avatar_fail") delegate:weakSelf - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; }]; @@ -445,9 +454,12 @@ - (UIImage *)scaleImage:(UIImage *)Image toScale:(float)scaleSize { - (void)chosePortrait { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"拍照" - otherButtonTitles:@"我的相册", nil]; + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"take_picture") + + otherButtonTitles:RCDLocalizedString(@"my_album") +, nil]; actionSheet.tag = 200; [actionSheet showInView:self.view]; } @@ -483,7 +495,8 @@ - (void)clearCacheAlertMessage:(NSString *)msg { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; } @@ -516,7 +529,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger targetId:groupId success:^{ [weakSelf performSelectorOnMainThread:@selector(clearCacheAlertMessage:) - withObject:@"清除聊天记录成功!" + withObject:RCDLocalizedString(@"clear_chat_history_success") waitUntilDone:YES]; [[NSNotificationCenter defaultCenter] postNotificationName:@"ClearHistoryMsg" object:nil]; dispatch_async(dispatch_get_main_queue(), ^{ @@ -529,7 +542,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger } error:^(RCErrorCode status) { [weakSelf performSelectorOnMainThread:@selector(clearCacheAlertMessage:) - withObject:@"清除聊天记录失败!" + withObject:RCDLocalizedString(@"clear_chat_history_fail") waitUntilDone:YES]; dispatch_async(dispatch_get_main_queue(), ^{ [loadingView removeFromSuperview]; @@ -586,9 +599,10 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger [self.navigationController popToRootViewControllerAnimated:YES]; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"退出失败!" + message:RCDLocalizedString(@"quit_fail") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; } @@ -623,9 +637,10 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger [self.navigationController popToRootViewControllerAnimated:YES]; } else { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"解散群组失败!" + message:RCDLocalizedString(@"Disband_group_fail") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; } @@ -712,7 +727,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath if (isCreator == YES) { [self chosePortrait]; } else { - [self showAlert:@"只有群主可以修改群组头像"]; + [self showAlert:RCDLocalizedString(@"Only_the_owner_can_change_the_group_portrait")]; } } break; @@ -725,7 +740,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath editGroupNameVC.groupInfo = _Group; [self.navigationController pushViewController:editGroupNameVC animated:YES]; } else { - [self showAlert:@"只有群主可以修改群组名称"]; + [self showAlert:RCDLocalizedString(@"Only_the_owner_can_edit_the_group_name")]; } } break; @@ -741,7 +756,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } else { - [self showAlert:@"只有群主可以发布群公告"]; + [self showAlert:RCDLocalizedString(@"Only_the_group_owner_can_post_a_group_announcement")]; } */ } break; @@ -759,10 +774,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath case 3: { switch (indexPath.row) { case 2: { - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"确定清除聊天记录?" + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:RCDLocalizedString(@"clear_chat_history_alert") delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [actionSheet showInView:self.view]; @@ -856,7 +873,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa if (isCreator == YES) { //点加号 if (indexPath.row == collectionViewResource.count - 2) { - contactSelectedVC.titleStr = @"选择联系人"; + contactSelectedVC.titleStr = RCDLocalizedString(@"select_contact"); contactSelectedVC.addGroupMembers = membersId; [self.navigationController pushViewController:contactSelectedVC animated:YES]; return; @@ -866,7 +883,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa if (collectionViewResource.count == 3) { return; } - contactSelectedVC.titleStr = @"移除成员"; + contactSelectedVC.titleStr = RCDLocalizedString(@"remove_member"); NSMutableArray *members = [NSMutableArray new]; for (id user in groupMemberList) { if ([user isKindOfClass:[RCUserInfo class]]) { @@ -882,7 +899,7 @@ - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPa } else { if (indexPath.row == collectionViewResource.count - 1) { NSLog(@"点加号"); - contactSelectedVC.titleStr = @"选择联系人"; + contactSelectedVC.titleStr = RCDLocalizedString(@"select_contact"); contactSelectedVC.addGroupMembers = membersId; [self.navigationController pushViewController:contactSelectedVC animated:YES]; return; @@ -932,8 +949,8 @@ - (void)didReceiveMessageNotification:(NSNotification *)notification { complete:^(BOOL results) { dispatch_async(dispatch_get_main_queue(), ^{ self.title = [NSString - stringWithFormat:@"群组信息(%lu)", - (unsigned long)result.count]; + stringWithFormat:RCDLocalizedString(@"group_information_x"), + [NSString stringWithFormat:@"%lu",(unsigned long)result.count]]; [self refreshHeaderView]; [self refreshTabelViewInfo]; }); @@ -977,7 +994,8 @@ - (void)showAlert:(NSString *)alertContent { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:alertContent delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } diff --git a/ios-rongimdemo/RCDHttpTool.h b/ios-rongimdemo/RCDHttpTool.h index b40db331..75c96e27 100644 --- a/ios-rongimdemo/RCDHttpTool.h +++ b/ios-rongimdemo/RCDHttpTool.h @@ -69,7 +69,7 @@ - (void)getFriendscomplete:(void (^)(NSMutableArray *))friendList; //通过手机号搜索好友 -- (void)searchUserByPhone:(NSString *)phone complete:(void (^)(NSMutableArray *))userList; +- (void)searchUserByPhone:(NSString *)phone region:(NSString *)region complete:(void (^)(NSMutableArray *))userList; //请求加好友 - (void)requestFriend:(NSString *)userId complete:(void (^)(BOOL result))result; diff --git a/ios-rongimdemo/RCDHttpTool.m b/ios-rongimdemo/RCDHttpTool.m index eab8cf78..531d8131 100644 --- a/ios-rongimdemo/RCDHttpTool.m +++ b/ios-rongimdemo/RCDHttpTool.m @@ -484,9 +484,9 @@ - (void)getFriendscomplete:(void (^)(NSMutableArray *))friendList { }]; } -- (void)searchUserByPhone:(NSString *)phone complete:(void (^)(NSMutableArray *))userList { +- (void)searchUserByPhone:(NSString *)phone region:(NSString *)region complete:(void (^)(NSMutableArray *))userList { NSMutableArray *list = [NSMutableArray new]; - [AFHttpTool findUserByPhone:phone + [AFHttpTool findUserByPhone:phone region:region success:^(id response) { if (userList && [response[@"code"] intValue] == 200) { id result = response[@"result"]; diff --git a/ios-rongimdemo/RCDIndicateTextField.h b/ios-rongimdemo/RCDIndicateTextField.h new file mode 100644 index 00000000..2dd1f1a6 --- /dev/null +++ b/ios-rongimdemo/RCDIndicateTextField.h @@ -0,0 +1,25 @@ +// +// RCDIndicateTextField.h +// SealTalk +// +// Created by 张改红 on 2019/2/18. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^ClickedTextField)(void); + +@interface RCDIndicateTextField : UIView + +@property (nonatomic, strong) UILabel *indicateInfoLabel; +@property (nonatomic, strong) UITextField *textField; +@property (nonatomic, strong) UIImageView *indicateIcon; + +- (instancetype)initWithLineColor:(UIColor *)color; +- (void)indicateIconShow:(BOOL)isShow; +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RCDIndicateTextField.m b/ios-rongimdemo/RCDIndicateTextField.m new file mode 100644 index 00000000..8f3bee3a --- /dev/null +++ b/ios-rongimdemo/RCDIndicateTextField.m @@ -0,0 +1,182 @@ +// +// RCDIndicateTextField.m +// SealTalk +// +// Created by 张改红 on 2019/2/18. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import "RCDIndicateTextField.h" +@interface RCDIndicateTextField () +@property (nonatomic, strong) UIColor *lineColor; +@end +@implementation RCDIndicateTextField +- (instancetype)initWithLineColor:(UIColor *)color{ + self = [super init]; + if (self) { + [self initialize]; + self.lineColor = color; + } + return self; +} + + +- (id)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + [self initialize]; + } + return self; +} + +- (void)drawRect:(CGRect)rect { + + // Get the current drawing context + CGContextRef context = UIGraphicsGetCurrentContext(); + + // Set the line color and width + CGContextSetStrokeColorWithColor(context, self.lineColor.CGColor); + CGContextSetLineWidth(context, 1.0f); + + // Start a new Path + CGContextBeginPath(context); + + // Find the number of lines in our textView + add a bit more height to draw + // lines in the empty part of the view + // NSUInteger numberOfLines = (self.contentSize.height + + // self.bounds.size.height) / self.font.leading; + + // Set the line offset from the baseline. (I'm sure there's a concrete way to + // calculate this.) + CGFloat baselineOffset = 45.0f; + + // iterate over numberOfLines and draw each line + // for (int x = 1; x < numberOfLines; x++) { + + // 0.5f offset lines up line with pixel boundary + CGContextMoveToPoint(context, self.bounds.origin.x, baselineOffset); + CGContextAddLineToPoint(context, self.bounds.size.width - 10, baselineOffset); + //} + + // Close our Path and Stroke (draw) it + CGContextClosePath(context); + CGContextStrokePath(context); +} + +#pragma mark - 初始化与布局 + +//初始化 +- (void)initialize { + self.lineColor = [UIColor colorWithRed:161 green:163 blue:168 alpha:0.2f]; + self.backgroundColor = [UIColor clearColor]; + [self addSubview:self.indicateInfoLabel]; + [self addSubview:self.textField]; + [self addSubview:self.indicateIcon]; + + self.indicateInfoLabel.translatesAutoresizingMaskIntoConstraints = NO; + self.textField.translatesAutoresizingMaskIntoConstraints = NO; + self.indicateIcon.translatesAutoresizingMaskIntoConstraints = NO; + + NSDictionary *subviews = NSDictionaryOfVariableBindings(_indicateInfoLabel, _textField, _indicateIcon); + + [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_indicateInfoLabel(44)]" + options:0 + metrics:nil + views:subviews]]; + + [self addConstraint:[NSLayoutConstraint constraintWithItem:_indicateInfoLabel + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0]]; + + + [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_textField(44)]" + options:0 + metrics:nil + views:subviews]]; + + [self addConstraint:[NSLayoutConstraint constraintWithItem:_textField + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:1]]; + + [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_indicateIcon(14)]" + options:0 + metrics:nil + views:subviews]]; + + [self addConstraint:[NSLayoutConstraint constraintWithItem:_indicateIcon + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0]]; + + [self addConstraints:[NSLayoutConstraint + constraintsWithVisualFormat: + @"H:|-0-[_indicateInfoLabel]-10-[_textField(>=100)]|" + options:0 + metrics:nil + views:subviews]]; + [self addConstraints:[NSLayoutConstraint + constraintsWithVisualFormat: + @"H:[_indicateIcon(9)]-10-|" + options:0 + metrics:nil + views:subviews]]; +} + +- (void)indicateIconShow:(BOOL)isShow{ + self.indicateIcon.hidden = !isShow; + if (isShow) { + [self updateLayout]; + } +} + +- (void)updateLayout{ +// NSDictionary *subviews = NSDictionaryOfVariableBindings(_indicateInfoLabel, _textField, _indicateIcon); +// [self addConstraints:[NSLayoutConstraint +// constraintsWithVisualFormat: +// @"H:|[_indicateIcon]-0-|" +// options:0 +// metrics:nil +// views:subviews]]; +// [self setNeedsLayout]; +// [self layoutIfNeeded]; +} + +#pragma mark -控件属性初始化 + +- (UILabel *)indicateInfoLabel { + if (_indicateInfoLabel == nil) { + _indicateInfoLabel = [[UILabel alloc] init]; + _indicateInfoLabel.textColor = [UIColor whiteColor]; + [_indicateInfoLabel sizeToFit]; + } + return _indicateInfoLabel; +} + +- (UITextField *)textField { + if (_textField == nil) { + _textField = [[UITextField alloc] init]; + _textField.textColor = [UIColor whiteColor]; + } + return _textField; +} + +- (UIImageView *)indicateIcon{ + if (_indicateIcon == nil) { + _indicateIcon = [[UIImageView alloc] init]; + _indicateIcon.image = [UIImage imageNamed:@"location_arrow"]; + _indicateIcon.hidden = YES; + } + return _indicateIcon; +} +@end diff --git a/ios-rongimdemo/RCDMainTabBarViewController.m b/ios-rongimdemo/RCDMainTabBarViewController.m index 84babcb8..23f6fff9 100644 --- a/ios-rongimdemo/RCDMainTabBarViewController.m +++ b/ios-rongimdemo/RCDMainTabBarViewController.m @@ -73,25 +73,26 @@ - (void)setTabBarItems { [self.viewControllers enumerateObjectsUsingBlock:^(__kindof UIViewController *_Nonnull obj, NSUInteger idx, BOOL *_Nonnull stop) { if ([obj isKindOfClass:[RCDChatListViewController class]]) { - obj.tabBarItem.title = @"会话"; + obj.tabBarItem.title = RCDLocalizedString(@"conversation"); obj.tabBarItem.image = [[UIImage imageNamed:@"icon_chat"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; obj.tabBarItem.selectedImage = [[UIImage imageNamed:@"icon_chat_hover"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; } else if ([obj isKindOfClass:[RCDContactViewController class]]) { - obj.tabBarItem.title = @"通讯录"; + obj.tabBarItem.title = RCDLocalizedString(@"contacts"); obj.tabBarItem.image = [[UIImage imageNamed:@"contact_icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; obj.tabBarItem.selectedImage = [[UIImage imageNamed:@"contact_icon_hover"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; } else if ([obj isKindOfClass:[RCDSquareTableViewController class]]) { - obj.tabBarItem.title = @"发现"; + obj.tabBarItem.title = RCDLocalizedString(@"discover"); obj.tabBarItem.image = [[UIImage imageNamed:@"square"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; obj.tabBarItem.selectedImage = [[UIImage imageNamed:@"square_hover"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; } else if ([obj isKindOfClass:[RCDMeTableViewController class]]) { - obj.tabBarItem.title = @"我"; + obj.tabBarItem.title = RCDLocalizedString(@"me") +; obj.tabBarItem.image = [[UIImage imageNamed:@"icon_me"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; obj.tabBarItem.selectedImage = diff --git a/ios-rongimdemo/RCDMeCell.h b/ios-rongimdemo/RCDMeCell.h index de00e6c0..ffa018da 100644 --- a/ios-rongimdemo/RCDMeCell.h +++ b/ios-rongimdemo/RCDMeCell.h @@ -12,7 +12,7 @@ - (id)initWithImageName:(NSString *)imageName labelName:(NSString *)labelName; -- (void)setCellWithImageName:(NSString *)imageName labelName:(NSString *)labelName; +- (void)setCellWithImageName:(NSString *)imageName labelName:(NSString *)labelName rightLabelName:(NSString *)rightLabelName; - (void)addRedpointImageView; @end diff --git a/ios-rongimdemo/RCDMeCell.m b/ios-rongimdemo/RCDMeCell.m index 6525657d..bf2c9e03 100644 --- a/ios-rongimdemo/RCDMeCell.m +++ b/ios-rongimdemo/RCDMeCell.m @@ -18,9 +18,13 @@ - (void)drawRect:(CGRect)rect { } */ -- (void)setCellWithImageName:(NSString *)imageName labelName:(NSString *)labelName { +- (void)setCellWithImageName:(NSString *)imageName labelName:(NSString *)labelName rightLabelName:(NSString *)rightLabelName { [self setImageView:self.leftImageView ImageStr:imageName imageSize:CGSizeMake(18, 18) LeftOrRight:0]; self.leftLabel.text = labelName; + if (rightLabelName) { + [self addRightLabel]; + self.rightLabel.text = rightLabelName; + } } - (id)initWithImageName:(NSString *)imageName labelName:(NSString *)labelName { @@ -30,11 +34,36 @@ - (id)initWithImageName:(NSString *)imageName labelName:(NSString *)labelName { rightImaeStr:nil rightImageSize:CGSizeZero]; self.leftLabel.text = labelName; + self.rightLabel.text = labelName; // [self setCellStyle:DefaultStyle]; } return self; } +- (void)addRightLabel { + if (self.leftLabelConstraints != nil) { + [self.contentView removeConstraints:self.leftLabelConstraints]; + } + UILabel *leftLabel = self.leftLabel; + UILabel *rightLabel = self.rightLabel; + UIImageView *leftImageView = self.leftImageView; + UIImageView *rightArrow = self.rightArrow; + NSDictionary *views = NSDictionaryOfVariableBindings(leftLabel, leftImageView, rightLabel, rightArrow); + [self.contentView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @"H:|-10-[leftImageView(width)]-8-[leftLabel]-(>=10)-[rightLabel]-13-[rightArrow(8)]-10-|" options:0 metrics:@{ @"width" : @(self.leftImageView.frame.size.width) } views:views]]; + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[rightLabel(12)]" + options:0 + metrics:nil + views:views]]; + [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:rightLabel + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self.contentView + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0]]; +} + + - (void)addRedpointImageView { if (self.leftLabelConstraints != nil) { [self.contentView removeConstraints:self.leftLabelConstraints]; diff --git a/ios-rongimdemo/RCDMessageNoDisturbSettingController.m b/ios-rongimdemo/RCDMessageNoDisturbSettingController.m index 4562ce8f..14d1c199 100644 --- a/ios-rongimdemo/RCDMessageNoDisturbSettingController.m +++ b/ios-rongimdemo/RCDMessageNoDisturbSettingController.m @@ -96,7 +96,7 @@ - (void)getNoDisturbStaus { - (void)viewDidLoad { [super viewDidLoad]; _swch = [[UISwitch alloc] init]; - self.title = @"免打扰设置"; + self.title = RCDLocalizedString(@"Do_not_disturb_setting"); self.datePicker = [[UIDatePicker alloc] init]; self.datePicker.datePickerMode = UIDatePickerModeCountDownTimer; NSDateFormatter *formatterE = [[NSDateFormatter alloc] init]; @@ -116,9 +116,15 @@ - (void)viewDidLoad { [self.tableView selectRowAtIndexPath:self.startIndexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle]; + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; self.endIndexPath = [NSIndexPath indexPathForRow:2 inSection:0]; } +- (void)viewDidLayoutSubviews { + self.tableView.frame = self.view.frame; + [self.swch setFrame:CGRectMake(self.view.frame.size.width - self.swch.frame.size.width - 15, 6, 0, 0)]; +} + - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; UITableViewCell *startCell = [self.tableView cellForRowAtIndexPath:self.startIndexPath]; @@ -152,10 +158,11 @@ - (void)viewWillDisappear:(BOOL)animated { } error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"设置失败" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"set_fail") delegate:nil - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + otherButtonTitles:nil, nil]; [alert show]; }); @@ -196,16 +203,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N switch (indexPath.row) { case 0: { cell.selectionStyle = UITableViewCellSelectionStyleNone; - cell.textLabel.text = @"开启消息免打扰"; + cell.textLabel.text = RCDLocalizedString(@"Turn_on_message_do_not_disturb"); [_swch setFrame:CGRectMake(self.view.frame.size.width - _swch.frame.size.width - 15, 6, 0, 0)]; [_swch addTarget:self action:@selector(setSwitchState:) forControlEvents:UIControlEventValueChanged]; [cell.contentView addSubview:_swch]; } break; case 1: { - cell.textLabel.text = @"开始时间"; + cell.textLabel.text = RCDLocalizedString(@"Start_time"); } break; case 2: { - cell.textLabel.text = @"结束时间"; + cell.textLabel.text = RCDLocalizedString(@"end_time") +; } break; default: break; @@ -272,7 +280,7 @@ - (void)datePickerValueChanged:(UIDatePicker *)datePicker { // // UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil // message:@"开始时间不能大于等于结束时间" delegate:nil - // cancelButtonTitle:@"确定" otherButtonTitles:nil, nil]; + // cancelButtonTitle:RCDLocalizedString(@"confirm") otherButtonTitles:nil, nil]; // [alertView show]; // return; // } @@ -319,10 +327,11 @@ - (void)setSwitchState:(UISwitch *)swich { } error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"设置失败" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"set_fail") delegate:nil - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + otherButtonTitles:nil, nil]; [alert show]; blockSelf.swch.on = NO; @@ -334,10 +343,12 @@ - (void)setSwitchState:(UISwitch *)swich { } error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"关闭失败" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"shut_down_failed") + delegate:nil - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + otherButtonTitles:nil, nil]; [alert show]; blockSelf.swch.on = YES; diff --git a/ios-rongimdemo/RCDPersonDetailViewController.m b/ios-rongimdemo/RCDPersonDetailViewController.m index 7826b69c..a1df9b4b 100644 --- a/ios-rongimdemo/RCDPersonDetailViewController.m +++ b/ios-rongimdemo/RCDPersonDetailViewController.m @@ -70,7 +70,8 @@ - (void)viewDidLoad { self.conversationBtn = [[UIButton alloc] init]; self.conversationBtn.backgroundColor = [UIColor colorWithHexString:@"0099ff" alpha:1.f]; self.conversationBtn.translatesAutoresizingMaskIntoConstraints = NO; - [self.conversationBtn setTitle:@"发起会话" forState:UIControlStateNormal]; + [self.conversationBtn setTitle:RCDLocalizedString(@"start_chat") + forState:UIControlStateNormal]; [self.conversationBtn addTarget:self action:@selector(btnConversation:) forControlEvents:UIControlEventTouchUpInside]; @@ -79,7 +80,8 @@ - (void)viewDidLoad { self.audioCallBtn = [[UIButton alloc] init]; self.audioCallBtn.backgroundColor = [UIColor whiteColor]; - [self.audioCallBtn setTitle:@"语音通话" forState:UIControlStateNormal]; + [self.audioCallBtn setTitle:RCDLocalizedString(@"voice_call") + forState:UIControlStateNormal]; // [self.audioCallBtn setTintColor:[UIColor blackColor]]; [self.audioCallBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [self.audioCallBtn addTarget:self action:@selector(btnVoIP:) forControlEvents:UIControlEventTouchUpInside]; @@ -88,7 +90,8 @@ - (void)viewDidLoad { self.videoCallBtn = [[UIButton alloc] init]; self.videoCallBtn.backgroundColor = [UIColor whiteColor]; - [self.videoCallBtn setTitle:@"视频通话" forState:UIControlStateNormal]; + [self.videoCallBtn setTitle:RCDLocalizedString(@"video_call") + forState:UIControlStateNormal]; [self.videoCallBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [self.videoCallBtn addTarget:self action:@selector(btnVideoCall:) forControlEvents:UIControlEventTouchUpInside]; self.videoCallBtn.translatesAutoresizingMaskIntoConstraints = NO; @@ -153,8 +156,9 @@ - (void)viewDidLoad { } - (void)setNavigationButtons { - RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(clickBackBtn:)]; - self.navigationItem.title = @"详细资料"; + RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(clickBackBtn:)]; + self.navigationItem.title = RCDLocalizedString(@"detailed_information") +; } - (void)clickBackBtn:(id)sender { @@ -214,16 +218,20 @@ - (void)rightBarButtonItemClicked:(id)sender { if (self.inBlackList) { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + destructiveButtonTitle:nil - otherButtonTitles:@"取消黑名单", nil]; + otherButtonTitles:RCDLocalizedString(@"cancel_block") +, nil]; [actionSheet showInView:self.view]; } else { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + destructiveButtonTitle:nil - otherButtonTitles:@"加入黑名单", nil]; + otherButtonTitles:RCDLocalizedString(@"add_to_blacklist") +, nil]; [actionSheet showInView:self.view]; } } @@ -242,7 +250,8 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger //黑名单 __weak RCDPersonDetailViewController *weakSelf = self; if (!self.inBlackList) { - hud.labelText = @"正在加入黑名单"; + hud.labelText = RCDLocalizedString(@"adding_to_blacklist") +; [[RCIMClient sharedRCIMClient] addToBlacklist:self.friendInfo.userId success:^{ weakSelf.inBlackList = YES; @@ -256,9 +265,11 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger dispatch_async(dispatch_get_main_queue(), ^{ [hud hide:YES]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"加入黑名单失败" + message:RCDLocalizedString(@"fail_to_add_to_blacklist") + delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; }); @@ -266,7 +277,8 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger weakSelf.inBlackList = NO; }]; } else { - hud.labelText = @"正在从黑名单移除"; + hud.labelText = RCDLocalizedString(@"removing_from_blacklist") +; [[RCIMClient sharedRCIMClient] removeFromBlacklist:self.friendInfo.userId success:^{ dispatch_async(dispatch_get_main_queue(), ^{ @@ -280,9 +292,11 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger dispatch_async(dispatch_get_main_queue(), ^{ [hud hide:YES]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"从黑名单移除失败" + message:RCDLocalizedString(@"fail_to_remove_from_blacklist") + delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; }); @@ -349,7 +363,8 @@ - (void)setLayoutForFriend { remarkLabel.textColor = [UIColor colorWithHexString:@"000000" alpha:1.f]; remarkLabel.translatesAutoresizingMaskIntoConstraints = NO; [remarksView addSubview:remarkLabel]; - remarkLabel.text = @"设置备注"; + remarkLabel.text = RCDLocalizedString(@"set_remarks") +; UIImageView *rightArrow = [[UIImageView alloc] init]; rightArrow.translatesAutoresizingMaskIntoConstraints = NO; @@ -533,7 +548,7 @@ - (void)setLayoutIsHaveRemarks:(BOOL)isHaveRemarks { self.displayNameLabel.text = self.friendInfo.displayName; [self.infoView addSubview:self.displayNameLabel]; - self.lblName.text = [NSString stringWithFormat:@"昵称: %@", self.friendInfo.name]; + self.lblName.text = [NSString stringWithFormat:RCDLocalizedString(@"someone_nickname"), self.friendInfo.name]; self.lblName.textColor = [UIColor colorWithHexString:@"999999" alpha:1.f]; self.lblName.font = [UIFont systemFontOfSize:14.f]; @@ -625,7 +640,7 @@ - (void)setPhoneNumber { [[NSMutableAttributedString alloc] initWithString:self.phoneNumberLabel.text]; [attributedStr addAttribute:NSForegroundColorAttributeName value:[UIColor colorWithHexString:@"0099ff" alpha:1.f] - range:NSMakeRange(5, 11)]; + range:NSMakeRange(5, self.phoneNumberLabel.text.length-5)]; self.phoneNumberLabel.attributedText = attributedStr; self.phonenumber = [NSString stringWithFormat:@"%@", [infoDic objectForKey:@"phone"]]; diff --git a/ios-rongimdemo/RCDPrivacyTableViewController.m b/ios-rongimdemo/RCDPrivacyTableViewController.m index 60942e14..b4555fe9 100644 --- a/ios-rongimdemo/RCDPrivacyTableViewController.m +++ b/ios-rongimdemo/RCDPrivacyTableViewController.m @@ -20,7 +20,8 @@ @implementation RCDPrivacyTableViewController - (void)viewDidLoad { [super viewDidLoad]; - self.navigationItem.title = @"隐私"; + self.navigationItem.title = RCDLocalizedString(@"privacy") +; self.tableView.tableFooterView = [UIView new]; @@ -28,6 +29,10 @@ - (void)viewDidLoad { self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } +- (void)viewDidLayoutSubviews { + self.tableView.frame = self.view.frame; +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. @@ -58,7 +63,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N switch (indexPath.row) { case 0: { [cell setCellStyle:DefaultStyle]; - cell.leftLabel.text = @"黑名单"; + cell.leftLabel.text = RCDLocalizedString(@"blacklist") +; } break; default: diff --git a/ios-rongimdemo/RCDPrivateSettingsTableViewController.m b/ios-rongimdemo/RCDPrivateSettingsTableViewController.m index 6745e740..d118d81c 100644 --- a/ios-rongimdemo/RCDPrivateSettingsTableViewController.m +++ b/ios-rongimdemo/RCDPrivateSettingsTableViewController.m @@ -51,9 +51,9 @@ - (void)viewWillAppear:(BOOL)animated { - (void)viewDidLoad { [super viewDidLoad]; - RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(leftBarButtonItemPressed:)]; + RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(leftBarButtonItemPressed:)]; [self.navigationItem setLeftBarButtonItem:leftButton]; - self.title = @"聊天详情"; + self.title = RCDLocalizedString(@"chat_detail"); self.tableView.tableFooterView = [UIView new]; self.tableView.backgroundColor = HEXCOLOR(0xf0f0f6); @@ -160,7 +160,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (self.userInfo.displayName.length > 0) { infoCell = [[RCDPrivateSettingsUserInfoCell alloc] initWithIsHaveDisplayName:YES]; infoCell.NickNameLabel.text = self.userInfo.displayName; - infoCell.displayNameLabel.text = [NSString stringWithFormat:@"昵称: %@", self.userInfo.name]; + infoCell.displayNameLabel.text = [NSString stringWithFormat:RCDLocalizedString(@"someone_nickname"), self.userInfo.name]; } else { infoCell = [[RCDPrivateSettingsUserInfoCell alloc] initWithIsHaveDisplayName:NO]; infoCell.NickNameLabel.text = self.userInfo.name; @@ -191,7 +191,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N if (!cell) { cell = [[RCDBaseSettingTableViewCell alloc] init]; } - cell.leftLabel.text = @"查找聊天记录"; + cell.leftLabel.text = RCDLocalizedString(@"search_chat_history"); [cell setCellStyle:DefaultStyle]; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; @@ -200,7 +200,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N switch (indexPath.row) { case 0: { [cell setCellStyle:SwitchStyle]; - cell.leftLabel.text = @"消息免打扰"; + cell.leftLabel.text = RCDLocalizedString(@"mute_notifications"); cell.switchButton.hidden = NO; cell.switchButton.on = !enableNotification; [cell.switchButton removeTarget:self @@ -215,7 +215,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case 1: { [cell setCellStyle:SwitchStyle]; - cell.leftLabel.text = @"会话置顶"; + cell.leftLabel.text = RCDLocalizedString(@"stick_on_top") +; cell.switchButton.hidden = NO; cell.switchButton.on = currentConversation.isTop; [cell.switchButton addTarget:self @@ -225,7 +226,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case 2: { [cell setCellStyle:SwitchStyle]; - cell.leftLabel.text = @"清除聊天记录"; + cell.leftLabel.text = RCDLocalizedString(@"clear_chat_history"); cell.switchButton.hidden = YES; } break; @@ -243,7 +244,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N // if (self.userInfo.displayName.length > 0 && ![self.userInfo.displayName isEqualToString:@""]) { // infoCell = [[RCDPrivateSettingsUserInfoCell alloc] initWithIsHaveDisplayName:YES]; // infoCell.NickNameLabel.text = self.userInfo.displayName; - // infoCell.displayNameLabel.text = [NSString stringWithFormat:@"昵称: %@",self.userInfo.name]; + // infoCell.displayNameLabel.text = [NSString stringWithFormat:RCDLocalizedString(@"someone_nickname"),self.userInfo.name]; // } else { // infoCell = [[RCDPrivateSettingsUserInfoCell alloc] initWithIsHaveDisplayName:NO]; // infoCell.NickNameLabel.text = self.userInfo.name; @@ -282,7 +283,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N // // switch (indexPath.row) { // case 0: { - // cell.TitleLabel.text = @"消息免打扰"; + // cell.TitleLabel.text = RCDLocalizedString(@"mute_notifications"); // cell.SwitchButton.hidden = NO; // cell.SwitchButton.on = !enableNotification; // [cell.SwitchButton removeTarget:self @@ -296,7 +297,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N // } break; // // case 1: { - // cell.TitleLabel.text = @"会话置顶"; + // cell.TitleLabel.text = RCDLocalizedString(@"stick_on_top") +; // cell.SwitchButton.hidden = NO; // cell.SwitchButton.on = currentConversation.isTop; // [cell.SwitchButton addTarget:self @@ -305,7 +307,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N // } break; // // case 2: { - // cell.TitleLabel.text = @"清除聊天记录"; + // cell.TitleLabel.text = RCDLocalizedString(@"clear_chat_history"); // cell.SwitchButton.hidden = YES; // } break; // @@ -326,10 +328,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } if (indexPath.section == 2) { if (indexPath.row == 2) { - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"确定清除聊天记录?" + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:RCDLocalizedString(@"clear_chat_history_alert") delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [actionSheet showInView:self.view]; @@ -366,7 +370,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger targetId:_userId success:^{ [weakSelf performSelectorOnMainThread:@selector(clearCacheAlertMessage:) - withObject:@"清除聊天记录成功!" + withObject:RCDLocalizedString(@"clear_chat_history_success") waitUntilDone:YES]; [[NSNotificationCenter defaultCenter] postNotificationName:@"ClearHistoryMsg" object:nil]; dispatch_async(dispatch_get_main_queue(), ^{ @@ -379,7 +383,7 @@ - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger } error:^(RCErrorCode status) { [weakSelf performSelectorOnMainThread:@selector(clearCacheAlertMessage:) - withObject:@"清除聊天记录失败!" + withObject:RCDLocalizedString(@"clear_chat_history_fail") waitUntilDone:YES]; dispatch_async(dispatch_get_main_queue(), ^{ [loadingView removeFromSuperview]; @@ -396,7 +400,8 @@ - (void)clearCacheAlertMessage:(NSString *)msg { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; } diff --git a/ios-rongimdemo/RCDPublicServiceListViewController.m b/ios-rongimdemo/RCDPublicServiceListViewController.m index 2f329bc0..a7b0dedf 100644 --- a/ios-rongimdemo/RCDPublicServiceListViewController.m +++ b/ios-rongimdemo/RCDPublicServiceListViewController.m @@ -26,6 +26,12 @@ - (void)viewDidLoad { UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithCustomView:rightBtn]; [rightBtn setTintColor:[UIColor whiteColor]]; self.navigationItem.rightBarButtonItem = rightButton; + + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; +} + +- (void)viewDidLayoutSubviews { + self.tableView.frame = self.view.frame; } - (void)didReceiveMemoryWarning { diff --git a/ios-rongimdemo/RCDPushSettingViewController.m b/ios-rongimdemo/RCDPushSettingViewController.m index d5b48972..1bedb549 100644 --- a/ios-rongimdemo/RCDPushSettingViewController.m +++ b/ios-rongimdemo/RCDPushSettingViewController.m @@ -31,9 +31,10 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. - self.navigationItem.title = @"推送设置"; + self.navigationItem.title = RCDLocalizedString(@"push_setting") +; RCDUIBarButtonItem *leftBtn = - [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"我" target:self action:@selector(clickBackBtn:)]; + [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"me") target:self action:@selector(clickBackBtn:)]; self.navigationItem.leftBarButtonItem = leftBtn; self.tableView = [[UITableView alloc] init]; @@ -46,6 +47,10 @@ - (void)viewDidLoad { [self setActionSheetLayout]; } +- (void)viewDidLayoutSubviews { + self.tableView.frame = self.view.bounds; +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. @@ -74,7 +79,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N [cell setCellStyle:SwitchStyle]; cell.switchButton.tag = 101; cell.switchButton.on = [RCIMClient sharedRCIMClient].pushProfile.isShowPushContent; - cell.leftLabel.text = @"显示远程推送的内容"; + cell.leftLabel.text = RCDLocalizedString(@"Display_remotely_pushed_content") +; } break; @@ -151,11 +157,11 @@ - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row f NSString *title; switch (row) { case 0: - title = @"汉语"; + title = RCDLocalizedString(@"chinese"); break; case 1: - title = @"英语"; + title = RCDLocalizedString(@"english"); break; default: @@ -194,7 +200,8 @@ - (void)setActionSheetLayout { self.actionSheet.delegate = self; self.actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + destructiveButtonTitle:nil otherButtonTitles:@"中文", @"英文", nil]; } @@ -244,24 +251,24 @@ - (void)onClickSwitchButton:(id)sender { [[RCIMClient sharedRCIMClient].pushProfile updateShowPushContentStatus:YES success:^{ dispatch_async(dispatch_get_main_queue(), ^{ - [self AlertMessage:@"设置成功"]; + [self AlertMessage:RCDLocalizedString(@"setting_success")]; }); } error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - [self AlertMessage:@"设置失败"]; + [self AlertMessage:RCDLocalizedString(@"set_fail")]; }); }]; } else { [[RCIMClient sharedRCIMClient].pushProfile updateShowPushContentStatus:NO success:^{ dispatch_async(dispatch_get_main_queue(), ^{ - [self AlertMessage:@"设置成功"]; + [self AlertMessage:RCDLocalizedString(@"setting_success")]; }); } error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - [self AlertMessage:@"设置失败"]; + [self AlertMessage:RCDLocalizedString(@"set_fail")]; }); }]; } @@ -271,20 +278,20 @@ - (void)onClickSwitchButton:(id)sender { // if (switchButton.on == YES) { // [[RCIMClient sharedRCIMClient].pushProfile updateMultiDevicePushStatus:YES success:^{ // dispatch_async(dispatch_get_main_queue(), ^{ - // [self AlertMessage:@"设置成功"]; + // [self AlertMessage:RCDLocalizedString(@"setting_success")]; // }); // } error:^(RCErrorCode status) { // dispatch_async(dispatch_get_main_queue(), ^{ - // [self AlertMessage:@"设置失败"]; + // [self AlertMessage:RCDLocalizedString(@"set_fail")]; // }); // }]; } else { // [[RCIMClient sharedRCIMClient].pushProfile updateMultiDevicePushStatus:NO success:^{ // dispatch_async(dispatch_get_main_queue(), ^{ - // [self AlertMessage:@"设置成功"]; + // [self AlertMessage:RCDLocalizedString(@"setting_success")]; // }); // } error:^(RCErrorCode status) { // dispatch_async(dispatch_get_main_queue(), ^{ - // [self AlertMessage:@"设置失败"]; + // [self AlertMessage:RCDLocalizedString(@"set_fail")]; // }); // }]; } } break; @@ -303,7 +310,8 @@ - (void)AlertMessage:(NSString *)message { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:message delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; }); diff --git a/ios-rongimdemo/RCDReceiptDetailsTableViewCell.m b/ios-rongimdemo/RCDReceiptDetailsTableViewCell.m index e19b1e47..b1ae8408 100644 --- a/ios-rongimdemo/RCDReceiptDetailsTableViewCell.m +++ b/ios-rongimdemo/RCDReceiptDetailsTableViewCell.m @@ -51,7 +51,7 @@ - (void)initialize { [self.contentView addSubview:self.verticalLine]; self.hasReadButton = - [self createButton:[NSString stringWithFormat:@"%lu人已读", (unsigned long)self.userList.count]]; + [self createButton:[NSString stringWithFormat:RCDLocalizedString(@"x_people_had_read"), (unsigned long)self.userList.count]]; [self.hasReadButton addTarget:self action:@selector(clickHasReadButton:) forControlEvents:UIControlEventTouchUpInside]; @@ -61,7 +61,7 @@ - (void)initialize { self.leftSelectLine = [self createLine:[UIColor colorWithHexString:@"0099ff" alpha:1.f]]; [self.hasReadButton addSubview:self.leftSelectLine]; - self.unReadButton = [self createButton:@"0人未读"]; + self.unReadButton = [self createButton:RCDLocalizedString(@"zero_people_unread")]; [self.unReadButton addTarget:self action:@selector(clickUnreadButton:) forControlEvents:UIControlEventTouchUpInside]; @@ -245,12 +245,12 @@ - (void)setDisplayHasreadUsers:(BOOL)displayHasreadUsers { } - (void)setHasReadUsersCount:(NSUInteger)hasReadUsersCount { - [self.hasReadButton setTitle:[NSString stringWithFormat:@"%lu人已读", (unsigned long)hasReadUsersCount] + [self.hasReadButton setTitle:[NSString stringWithFormat:RCDLocalizedString(@"x_people_had_read"), (unsigned long)hasReadUsersCount] forState:UIControlStateNormal]; } - (void)setUnreadUsersCount:(NSUInteger)unreadUsersCount { - [self.unReadButton setTitle:[NSString stringWithFormat:@"%lu人未读", (unsigned long)unreadUsersCount] + [self.unReadButton setTitle:[NSString stringWithFormat:RCDLocalizedString(@"x_people_unread"), (unsigned long)unreadUsersCount] forState:UIControlStateNormal]; } #pragma mark - UICollectionViewDelegateFlowLayout diff --git a/ios-rongimdemo/RCDReceiptDetailsTableViewController.m b/ios-rongimdemo/RCDReceiptDetailsTableViewController.m index e83fe560..0c57a521 100644 --- a/ios-rongimdemo/RCDReceiptDetailsTableViewController.m +++ b/ios-rongimdemo/RCDReceiptDetailsTableViewController.m @@ -56,9 +56,9 @@ @implementation RCDReceiptDetailsTableViewController - (void)viewDidLoad { [super viewDidLoad]; - self.navigationItem.title = @"回执详情"; + self.navigationItem.title = RCDLocalizedString(@"Receipt_details"); - self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(clickBackBtn)]; + self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(clickBackBtn)]; self.navigationItem.leftBarButtonItem = self.leftBtn; [self setHeaderView]; diff --git a/ios-rongimdemo/RCDSearchBar.m b/ios-rongimdemo/RCDSearchBar.m index ea334306..0742b49e 100644 --- a/ios-rongimdemo/RCDSearchBar.m +++ b/ios-rongimdemo/RCDSearchBar.m @@ -14,7 +14,7 @@ @implementation RCDSearchBar - (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { - self.placeholder = @"搜索"; + self.placeholder = RCDLocalizedString(@"search"); self.keyboardType = UIKeyboardTypeDefault; self.backgroundImage = [RCDUtilities getImageWithColor:[UIColor clearColor] andHeight:44.0f]; //设置顶部搜索栏的背景色 diff --git a/ios-rongimdemo/RCDSearchDataManager.m b/ios-rongimdemo/RCDSearchDataManager.m index 01ecf7cd..5161578d 100644 --- a/ios-rongimdemo/RCDSearchDataManager.m +++ b/ios-rongimdemo/RCDSearchDataManager.m @@ -33,22 +33,24 @@ - (void)searchDataWithSearchText:(NSString *)searchText if (searchType == RCDSearchFriend || searchType == RCDSearchAll) { NSArray *friendArray = [self searchFriendBysearchText:searchText]; if (friendArray.count > 0) { - [dic setObject:friendArray forKey:@"联系人"]; - [array addObject:@"联系人"]; + [dic setObject:friendArray forKey:RCDLocalizedString(@"all_contacts")]; + [array addObject:RCDLocalizedString(@"all_contacts")]; } } if (searchType == RCDSearchGroup || searchType == RCDSearchAll) { NSArray *groupArray = [self searchGroupBysearchText:searchText]; if (groupArray.count > 0) { - [dic setObject:groupArray forKey:@"群组"]; - [array addObject:@"群组"]; + [dic setObject:groupArray forKey:RCDLocalizedString(@"group") +]; + [array addObject:RCDLocalizedString(@"group") +]; } } if (searchType == RCDSearchChatHistory || searchType == RCDSearchAll) { NSArray *messsageResult = [self searchMessageBysearchText:searchText]; if (messsageResult.count > 0) { - [dic setObject:messsageResult forKey:@"聊天记录"]; - [array addObject:@"聊天记录"]; + [dic setObject:messsageResult forKey:RCDLocalizedString(@"chat_history")]; + [array addObject:RCDLocalizedString(@"chat_history")]; } } result(dic.copy, array.copy); @@ -150,7 +152,7 @@ - (NSArray *)searchMessageBysearchText:(NSString *)searchText { model.conversationType = result.conversation.conversationType; model.targetId = result.conversation.targetId; if (result.matchCount > 1) { - model.otherInformation = [NSString stringWithFormat:@"%d条相关的记录", result.matchCount]; + model.otherInformation = [NSString stringWithFormat:RCDLocalizedString(@"total_related_message"), result.matchCount]; } else { NSString *string = nil; model.objectName = result.conversation.objectName; diff --git a/ios-rongimdemo/RCDSearchHistoryMessageController.m b/ios-rongimdemo/RCDSearchHistoryMessageController.m index 80e0abbb..78789378 100644 --- a/ios-rongimdemo/RCDSearchHistoryMessageController.m +++ b/ios-rongimdemo/RCDSearchHistoryMessageController.m @@ -16,6 +16,8 @@ #import "RCDSearchResultViewCell.h" #import "RCDataBaseManager.h" #import "UIColor+RCColor.h" +#import "RCDLanguageManager.h" + @interface RCDSearchHistoryMessageController () @property(nonatomic, strong) NSArray *resultArray; @property(nonatomic, strong) RCDSearchBar *searchBars; @@ -76,12 +78,13 @@ - (void)loadSearchView { _searchBars.delegate = self; _searchBars.tintColor = [UIColor blueColor]; [_searchBars becomeFirstResponder]; - _searchBars.frame = CGRectMake(0, 0, self.searchView.frame.size.width - 55, 44); + _searchBars.frame = CGRectMake(0, 0, self.searchView.frame.size.width - 75, 44); [self.searchView addSubview:self.searchBars]; _cancelButton = [[UIButton alloc] - initWithFrame:CGRectMake(CGRectGetMaxX(_searchBars.frame) - 3, CGRectGetMinY(self.searchBars.frame), 55, 44)]; - [_cancelButton setTitle:@"取消" forState:UIControlStateNormal]; + initWithFrame:CGRectMake(CGRectGetMaxX(_searchBars.frame) - 3, CGRectGetMinY(self.searchBars.frame),60, 44)]; + [_cancelButton setTitle:RCDLocalizedString(@"cancel") + forState:UIControlStateNormal]; [_cancelButton setTitleColor:HEXCOLOR(0x0099ff) forState:UIControlStateNormal]; _cancelButton.titleLabel.font = [UIFont systemFontOfSize:18.]; [_cancelButton addTarget:self action:@selector(cancelButtonClicked) forControlEvents:UIControlEventTouchUpInside]; @@ -179,12 +182,20 @@ - (void)refreshSearchView:(NSString *)searchText { [self.tableView reloadData]; NSString *searchStr = [searchText stringByReplacingOccurrencesOfString:@" " withString:@""]; if (!self.resultArray.count && searchText.length > 0 && searchStr.length > 0) { - NSString *str = [NSString stringWithFormat:@"没有搜索到“%@”相关的内容", searchText]; + NSString *text = RCDLocalizedString(@"no_search_result"); + NSString *str = [NSString stringWithFormat:text, searchText]; self.emptyLabel.textColor = HEXCOLOR(0x999999); NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str]; + int index; + NSString *currentlanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentlanguage isEqualToString:@"en"]) { + index = 24; + }else if ([currentlanguage isEqualToString:@"zh-Hans"]){ + index = 6; + } [attributedString addAttribute:NSForegroundColorAttributeName value:HEXCOLOR(0x0099ff) - range:NSMakeRange(6, searchText.length)]; + range:NSMakeRange(index, searchText.length)]; self.emptyLabel.attributedText = attributedString; CGFloat height = [self labelAdaptive:str]; CGRect rect = self.emptyLabel.frame; diff --git a/ios-rongimdemo/RCDSearchMoreController.m b/ios-rongimdemo/RCDSearchMoreController.m index 757da58a..c0e772ab 100644 --- a/ios-rongimdemo/RCDSearchMoreController.m +++ b/ios-rongimdemo/RCDSearchMoreController.m @@ -16,6 +16,8 @@ #import "RCDSearchResultViewCell.h" #import "UIColor+RCColor.h" #import "RCDUIBarButtonItem.h" +#import "RCDLanguageManager.h" + @interface RCDSearchMoreController () @property(nonatomic, strong) RCDSearchBar *searchBars; @property(nonatomic, strong) UIButton *cancelButton; @@ -97,12 +99,13 @@ - (void)loadSearchView { _searchBars.delegate = self; _searchBars.placeholder = nil; _searchBars.tintColor = [UIColor blueColor]; - _searchBars.frame = CGRectMake(-17, 0, self.searchView.frame.size.width - 55, 44); + _searchBars.frame = CGRectMake(-17, 0, self.searchView.frame.size.width -75, 44); [self.searchView addSubview:self.searchBars]; _cancelButton = [[UIButton alloc] - initWithFrame:CGRectMake(CGRectGetMaxX(_searchBars.frame) - 3, CGRectGetMinY(self.searchBars.frame), 55, 44)]; - [_cancelButton setTitle:@"取消" forState:UIControlStateNormal]; + initWithFrame:CGRectMake(CGRectGetMaxX(_searchBars.frame) - 3, CGRectGetMinY(self.searchBars.frame),60, 44)]; + [_cancelButton setTitle:RCDLocalizedString(@"cancel") + forState:UIControlStateNormal]; [_cancelButton setTitleColor:HEXCOLOR(0x0099ff) forState:UIControlStateNormal]; _cancelButton.titleLabel.font = [UIFont systemFontOfSize:18.]; [_cancelButton addTarget:self action:@selector(cancelButtonClicked) forControlEvents:UIControlEventTouchUpInside]; @@ -168,7 +171,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath if (model.count > 1) { RCDSearchMoreController *viewController = [[RCDSearchMoreController alloc] init]; viewController.searchString = self.searchBars.text; - viewController.type = [NSString stringWithFormat:@"共%d条相关的聊天记录", model.count]; + viewController.type = [NSString stringWithFormat:RCDLocalizedString(@"total_related_message"), model.count]; NSArray *array = [[RCIMClient sharedRCIMClient] searchMessages:model.conversationType targetId:model.targetId keyword:self.searchBars.text @@ -233,11 +236,11 @@ - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { self.resultArray = nil; NSInteger type; - if ([self.type isEqualToString:@"联系人"]) { + if ([self.type isEqualToString:RCDLocalizedString(@"all_contacts")]) { type = RCDSearchFriend; - } else if ([self.type isEqualToString:@"群组"]) { + } else if ([self.type isEqualToString:RCDLocalizedString(@"group")]) { type = RCDSearchGroup; - } else if ([self.type isEqualToString:@"聊天记录"]) { + } else if ([self.type isEqualToString:RCDLocalizedString(@"chat_history")]) { type = RCDSearchChatHistory; } __weak typeof(self) weakSelf = self; @@ -259,12 +262,20 @@ - (void)refreshSearchView:(NSString *)searchText { [self.tableView reloadData]; NSString *searchStr = [searchText stringByReplacingOccurrencesOfString:@" " withString:@""]; if (!self.resultArray.count && searchText.length > 0 && searchStr.length > 0) { - NSString *str = [NSString stringWithFormat:@"没有搜索到“%@”相关的内容", searchText]; + NSString *text = RCDLocalizedString(@"no_search_result"); + NSString *str = [NSString stringWithFormat:text, searchText]; self.emptyLabel.textColor = HEXCOLOR(0x999999); NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str]; + int index; + NSString *currentlanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentlanguage isEqualToString:@"en"]) { + index = 24; + }else if ([currentlanguage isEqualToString:@"zh-Hans"]){ + index = 6; + } [attributedString addAttribute:NSForegroundColorAttributeName value:HEXCOLOR(0x0099ff) - range:NSMakeRange(6, searchText.length)]; + range:NSMakeRange(index, searchText.length)]; self.emptyLabel.attributedText = attributedString; CGFloat height = [self labelAdaptive:str]; CGRect rect = self.emptyLabel.frame; diff --git a/ios-rongimdemo/RCDSearchResultViewCell.m b/ios-rongimdemo/RCDSearchResultViewCell.m index 42ed43b3..c1458eee 100644 --- a/ios-rongimdemo/RCDSearchResultViewCell.m +++ b/ios-rongimdemo/RCDSearchResultViewCell.m @@ -62,14 +62,14 @@ - (void)setDataModel:(RCDSearchResultModel *)model { self.otherLabel.frame = CGRectMake(width, height, 35, 16); self.additionalLabel.frame = CGRectMake(width + 35, height, additionalLabelWidth - CGRectGetWidth(self.otherLabel.frame), 16); - self.otherLabel.text = @"包含:"; + self.otherLabel.text = RCDLocalizedString(@"include"); [self.additionalLabel attributedText:model.otherInformation byHighlightedText:self.searchString]; self.nameLabel.text = model.name; } else if (model.searchType == RCDSearchFriend) { self.otherLabel.frame = CGRectMake(width, height, 35, 16); self.additionalLabel.frame = CGRectMake(width + 35, height, additionalLabelWidth - CGRectGetWidth(self.otherLabel.frame), 16); - self.otherLabel.text = @"昵称:"; + self.otherLabel.text = RCDLocalizedString(@"nickname"); [self.additionalLabel attributedText:model.name byHighlightedText:self.searchString]; self.nameLabel.text = model.otherInformation; } else { @@ -77,9 +77,9 @@ - (void)setDataModel:(RCDSearchResultModel *)model { self.additionalLabel.frame = CGRectMake(width + 40, height, additionalLabelWidth - CGRectGetWidth(self.otherLabel.frame), 16); if ([model.objectName isEqualToString:@"RC:FileMsg"]) { - self.otherLabel.text = @"[文件]"; + self.otherLabel.text = RCDLocalizedString(@"file"); } else if ([model.objectName isEqualToString:@"RC:ImgTextMsg"]) { - self.otherLabel.text = @"[链接]"; + self.otherLabel.text = RCDLocalizedString(@"link"); } else { self.otherLabel.frame = CGRectZero; CGRect rect = self.additionalLabel.frame; diff --git a/ios-rongimdemo/RCDSearchViewController.m b/ios-rongimdemo/RCDSearchViewController.m index fadb2b6a..241957af 100644 --- a/ios-rongimdemo/RCDSearchViewController.m +++ b/ios-rongimdemo/RCDSearchViewController.m @@ -17,6 +17,7 @@ #import "RCDSearchResultModel.h" #import "RCDSearchResultViewCell.h" #import "UIColor+RCColor.h" +#import "RCDLanguageManager.h" @interface RCDSearchViewController () @property(nonatomic, strong) NSMutableDictionary *resultDictionary; @@ -101,12 +102,12 @@ - (void)loadSearchView { _searchBars.delegate = self; _searchBars.tintColor = [UIColor blueColor]; [_searchBars becomeFirstResponder]; - _searchBars.frame = CGRectMake(0, 0, self.searchView.frame.size.width - 65, 44); + _searchBars.frame = CGRectMake(0, 0, self.searchView.frame.size.width - 75, 44); [self.searchView addSubview:self.searchBars]; _cancelButton = [[UIButton alloc] - initWithFrame:CGRectMake(CGRectGetMaxX(_searchBars.frame) - 3, CGRectGetMinY(self.searchBars.frame), 55, 44)]; - [_cancelButton setTitle:@"取消" forState:UIControlStateNormal]; + initWithFrame:CGRectMake(CGRectGetMaxX(_searchBars.frame) - 3, CGRectGetMinY(self.searchBars.frame), 60, 44)]; + [_cancelButton setTitle:RCDLocalizedString(@"cancel") forState:UIControlStateNormal]; [_cancelButton setTitleColor:HEXCOLOR(0x0099ff) forState:UIControlStateNormal]; _cancelButton.titleLabel.font = [UIFont systemFontOfSize:18.]; [_cancelButton addTarget:self action:@selector(cancelButtonClicked) forControlEvents:UIControlEventTouchUpInside]; @@ -132,7 +133,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N cell = [[RCDSearchMoreViewCell alloc] initWithStyle:UITableViewCellStyleValue2 reuseIdentifier:@"moreCell"]; } cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; - cell.moreLabel.text = [NSString stringWithFormat:@"查看更多%@", self.groupTypeArray[indexPath.section]]; + cell.moreLabel.text = [NSString stringWithFormat:RCDLocalizedString(@"see_more"), self.groupTypeArray[indexPath.section]]; return cell; } else { RCDSearchResultViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; @@ -210,7 +211,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath if (model.count > 1) { RCDSearchMoreController *viewController = [[RCDSearchMoreController alloc] init]; viewController.searchString = self.searchBars.text; - viewController.type = [NSString stringWithFormat:@"共%d条相关的聊天记录", model.count]; + viewController.type = [NSString stringWithFormat:RCDLocalizedString(@"total_related_message"), model.count]; NSArray *array = [[RCIMClient sharedRCIMClient] searchMessages:model.conversationType targetId:model.targetId keyword:self.searchBars.text @@ -298,12 +299,20 @@ - (void)refreshSearchView:(NSString *)searchText { [self.resultTableView reloadData]; NSString *searchStr = [searchText stringByReplacingOccurrencesOfString:@" " withString:@""]; if (!self.groupTypeArray.count && searchText.length > 0 && searchStr.length > 0) { - NSString *str = [NSString stringWithFormat:@"没有搜索到“%@”相关的内容", searchText]; + NSString *text = RCDLocalizedString(@"no_search_result"); + NSString *str = [NSString stringWithFormat:text, searchText]; self.emptyLabel.textColor = HEXCOLOR(0x999999); NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:str]; + int index; + NSString *currentlanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentlanguage isEqualToString:@"en"]) { + index = 24; + }else if ([currentlanguage isEqualToString:@"zh-Hans"]){ + index = 6; + } [attributedString addAttribute:NSForegroundColorAttributeName value:HEXCOLOR(0x0099ff) - range:NSMakeRange(6, searchText.length)]; + range:NSMakeRange(index, searchText.length)]; self.emptyLabel.attributedText = attributedString; CGFloat height = [self labelAdaptive:str]; CGRect rect = self.emptyLabel.frame; diff --git a/ios-rongimdemo/RCDSettingServerUrlViewController.m b/ios-rongimdemo/RCDSettingServerUrlViewController.m index e60bbc72..8d7aec3e 100644 --- a/ios-rongimdemo/RCDSettingServerUrlViewController.m +++ b/ios-rongimdemo/RCDSettingServerUrlViewController.m @@ -54,7 +54,7 @@ - (void)viewDidLoad { UIButton *registerHeadButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 80, 0, 70, 50)]; - [registerHeadButton setTitle:@"登录" forState:UIControlStateNormal]; + [registerHeadButton setTitle:RCDLocalizedString(@"Login") forState:UIControlStateNormal]; [registerHeadButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; [registerHeadButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; @@ -72,9 +72,9 @@ - (void)viewDidLoad { rongLogoSmallImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight; rongLogoSmallImageView.clipsToBounds = YES; [_headBackground addSubview:rongLogoSmallImageView]; - UIButton *forgetPswHeadButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 80, 50)]; + UIButton *forgetPswHeadButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 120, 50)]; - [forgetPswHeadButton setTitle:@"找回密码" forState:UIControlStateNormal]; + [forgetPswHeadButton setTitle:RCDLocalizedString(@"forgot_password") forState:UIControlStateNormal]; [forgetPswHeadButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; [forgetPswHeadButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; @@ -110,7 +110,7 @@ - (void)viewDidLoad { //_account.placeholder=[NSString stringWithFormat:@"Email"]; UIColor *color = [UIColor whiteColor]; demoServerTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"请输入demo服务器地址" + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"please_type_demo_server") attributes:@{NSForegroundColorAttributeName : color}]; demoServerTextField.textColor = [UIColor whiteColor]; self.view.translatesAutoresizingMaskIntoConstraints = YES; @@ -138,7 +138,7 @@ - (void)viewDidLoad { naviServerTextField.backgroundColor = [UIColor clearColor]; naviServerTextField.tag = naviServerTextFieldTag; naviServerTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"请输入导航服务器地址" + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"please_type_navigation_server") attributes:@{NSForegroundColorAttributeName : color}]; naviServerTextField.textColor = [UIColor whiteColor]; self.view.translatesAutoresizingMaskIntoConstraints = YES; @@ -162,14 +162,14 @@ - (void)viewDidLoad { // fileServerTextField.secureTextEntry = YES; fileServerTextField.delegate = self; fileServerTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"请输入文件服务器地址" + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"please_type_file_server_address") attributes:@{NSForegroundColorAttributeName : color}]; fileServerTextField.translatesAutoresizingMaskIntoConstraints = NO; fileServerTextField.adjustsFontSizeToFitWidth = YES; fileServerTextField.text = [RCDSettingUserDefaults getRCFileServer]; [_inputBackground addSubview:fileServerTextField]; UILabel *pswMsgLb = [[UILabel alloc] initWithFrame:CGRectZero]; - // pswMsgLb.text = @"6-16位字符区分大小写"; + // pswMsgLb.text = RCDLocalizedString(@"char_section_case_sensitive_from6_t16"); pswMsgLb.font = [UIFont fontWithName:@"Heiti SC" size:10.0]; pswMsgLb.translatesAutoresizingMaskIntoConstraints = NO; pswMsgLb.textColor = [[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5]; @@ -185,7 +185,7 @@ - (void)viewDidLoad { appKeyTextField.adjustsFontSizeToFitWidth = YES; appKeyTextField.clearButtonMode = UITextFieldViewModeWhileEditing; appKeyTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"请输入App Key" + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"please_type_appKey") attributes:@{NSForegroundColorAttributeName : color}]; appKeyTextField.translatesAutoresizingMaskIntoConstraints = NO; appKeyTextField.text = [RCDSettingUserDefaults getRCAppKey]; @@ -203,7 +203,7 @@ - (void)viewDidLoad { [_inputBackground addSubview:confirmButton]; UILabel *tipLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - tipLabel.text = @"注:服务器地址请不要输入'http://'"; + tipLabel.text = RCDLocalizedString(@"note_server_can_not_type_http"); tipLabel.textColor = [UIColor whiteColor]; tipLabel.translatesAutoresizingMaskIntoConstraints = NO; tipLabel.font = [UIFont systemFontOfSize:12]; @@ -227,7 +227,7 @@ - (void)viewDidLoad { bottomBackground.translatesAutoresizingMaskIntoConstraints = NO; UIButton *registerButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 100, -16, 80, 50)]; - [registerButton setTitle:@"登录" forState:UIControlStateNormal]; + [registerButton setTitle:RCDLocalizedString(@"Login") forState:UIControlStateNormal]; [registerButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; [registerButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; @@ -235,8 +235,8 @@ - (void)viewDidLoad { [bottomBackground addSubview:registerButton]; - UIButton *forgetPswButton = [[UIButton alloc] initWithFrame:CGRectMake(-10, -16, 80, 50)]; - [forgetPswButton setTitle:@"找回密码" forState:UIControlStateNormal]; + UIButton *forgetPswButton = [[UIButton alloc] initWithFrame:CGRectMake(-10, -16, 120, 50)]; + [forgetPswButton setTitle:RCDLocalizedString(@"forgot_password") forState:UIControlStateNormal]; [forgetPswButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; forgetPswButton.titleLabel.font = [UIFont systemFontOfSize:18]; @@ -510,7 +510,7 @@ - (IBAction)btnDoneClicked:(id)sender { RCNetworkStatus status = [[RCIMClient sharedRCIMClient] getCurrentNetworkStatus]; if (RC_NotReachable == status) { - _errorMsgLb.text = @"当前网络不可用,请检查!"; + _errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); } NSString *appKeyString = [(UITextField *)[self.view viewWithTag:appKeyTextFieldTag] text]; NSString *demoServerString = [(UITextField *)[self.view viewWithTag:demoServerTextFieldTag] text]; @@ -545,19 +545,19 @@ - (BOOL)checkContent { NSString *fileServer = [(UITextField *)[self.view viewWithTag:fileServerTextFieldTag] text]; if (appKey.length == 0) { - _errorMsgLb.text = @"appKey不能为空"; + _errorMsgLb.text = RCDLocalizedString(@"appKey_can_not_nil"); return NO; } if (demoServer.length == 0) { - _errorMsgLb.text = @"demo server不能为空!"; + _errorMsgLb.text = RCDLocalizedString(@"demo_server_can_not_nil"); return NO; } if (naviServer.length == 0) { - _errorMsgLb.text = @"导航server不能为空"; + _errorMsgLb.text = RCDLocalizedString(@"navi_server_can_not_nil"); return NO; } if (fileServer.length == 0) { - _errorMsgLb.text = @"文件server不能为空!"; + _errorMsgLb.text = RCDLocalizedString(@"file_server_can_not_nil"); return NO; } return YES; diff --git a/ios-rongimdemo/RCDSquareTableViewController.m b/ios-rongimdemo/RCDSquareTableViewController.m index 4059d3ab..84e2ab66 100644 --- a/ios-rongimdemo/RCDSquareTableViewController.m +++ b/ios-rongimdemo/RCDSquareTableViewController.m @@ -68,7 +68,7 @@ - (void)viewDidLoad { - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - self.tabBarController.navigationItem.title = @"发现"; + self.tabBarController.navigationItem.title = RCDLocalizedString(@"discover"); self.tabBarController.navigationItem.rightBarButtonItems = nil; } @@ -137,7 +137,7 @@ - (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:( [sectionHeaderView addSubview:Title]; switch (section) { case 0: - Title.text = @"聊天室"; + Title.text = RCDLocalizedString(@"chatroom"); break; default: break; @@ -171,21 +171,4 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath [self.navigationController pushViewController:chatVC animated:YES]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; } - -#pragma mark - 本类私有方法 - -- (void)gotoChatRoomConversation:(UITapGestureRecognizer *)recognizer { - NSArray *chatRoomNameArr = [[NSArray alloc] initWithObjects:@"聊天室1", @"聊天室2", @"聊天室3", @"聊天室4", nil]; - if (chatRoomIdList.count == 0) { - return; - } - NSString *chatroomId; - NSInteger tag = recognizer.view.tag; - chatroomId = chatRoomIdList[tag - 10]; - RCDChatViewController *chatVC = - [[RCDChatViewController alloc] initWithConversationType:ConversationType_CHATROOM targetId:chatroomId]; - chatVC.title = chatRoomNameArr[tag - 10]; - [self.navigationController pushViewController:chatVC animated:YES]; -} - @end diff --git a/ios-rongimdemo/RCloudMessage.xcodeproj/project.pbxproj b/ios-rongimdemo/RCloudMessage.xcodeproj/project.pbxproj index 32abe06f..f300786f 100644 --- a/ios-rongimdemo/RCloudMessage.xcodeproj/project.pbxproj +++ b/ios-rongimdemo/RCloudMessage.xcodeproj/project.pbxproj @@ -7,7 +7,9 @@ objects = { /* Begin PBXBuildFile section */ + 0A1DDD9B22169C9700A9FE21 /* SealTalk.strings in Resources */ = {isa = PBXBuildFile; fileRef = 0A1DDD9D22169C9700A9FE21 /* SealTalk.strings */; }; 17034A2A1FA3105600E04042 /* RCDDebugNoDisturbViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17034A291FA3105600E04042 /* RCDDebugNoDisturbViewController.m */; }; + 170615DC22277D860063A96D /* RCDSearchFriendController.m in Sources */ = {isa = PBXBuildFile; fileRef = 170615DB22277D860063A96D /* RCDSearchFriendController.m */; }; 17244C181B56553B000EFF79 /* RCDMessageNoDisturbSettingController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17244C171B56553B000EFF79 /* RCDMessageNoDisturbSettingController.m */; }; 172B89F220747C58005481D7 /* RCDForwardAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 172B89F120747C57005481D7 /* RCDForwardAlertView.m */; }; 174151F51CBE516A00A4B23B /* RCDPublicServiceListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 174151F41CBE516A00A4B23B /* RCDPublicServiceListViewController.m */; }; @@ -34,6 +36,9 @@ 17E018C71D59BCBB0093D3A0 /* TFHpple.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E018C21D59BCBB0093D3A0 /* TFHpple.m */; }; 17E018C81D59BCBB0093D3A0 /* TFHppleElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E018C41D59BCBB0093D3A0 /* TFHppleElement.m */; }; 17E018C91D59BCBB0093D3A0 /* XPathQuery.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E018C61D59BCBB0093D3A0 /* XPathQuery.m */; }; + 17E50276221A881100250D1F /* RCDCountryListController.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E50275221A881100250D1F /* RCDCountryListController.m */; }; + 17E50279221A89FA00250D1F /* RCDCountry.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E50278221A89FA00250D1F /* RCDCountry.m */; }; + 17E5027C221A951500250D1F /* RCDIndicateTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 17E5027B221A951500250D1F /* RCDIndicateTextField.m */; }; 17F7A8461DAE187200E27D25 /* RCDLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F7A8371DAE187200E27D25 /* RCDLabel.m */; }; 17F7A8471DAE187200E27D25 /* RCDSearchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F7A8391DAE187200E27D25 /* RCDSearchBar.m */; }; 17F7A8481DAE187200E27D25 /* RCDSearchDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 17F7A83B1DAE187200E27D25 /* RCDSearchDataManager.m */; }; @@ -46,6 +51,8 @@ 1D3A232C212D540A009514F1 /* RongSticker.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1D3A2327212D5409009514F1 /* RongSticker.strings */; }; 1D3A232D212D540A009514F1 /* RongSticker.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 1D3A232A212D5409009514F1 /* RongSticker.bundle */; }; 1D3A232E212D540A009514F1 /* RongSticker.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D3A232B212D5409009514F1 /* RongSticker.framework */; }; + 1D5551FB223A30F700887BD0 /* libopencore-amrwb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D5551F9223A30F700887BD0 /* libopencore-amrwb.a */; }; + 1D5551FC223A30F700887BD0 /* libvo-amrwbenc.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D5551FA223A30F700887BD0 /* libvo-amrwbenc.a */; }; 270EE2A321EF59BA001DFDED /* JrmfInfo.strings in Resources */ = {isa = PBXBuildFile; fileRef = 270EE2A121EF59BA001DFDED /* JrmfInfo.strings */; }; 2724CCD71FF34411006FFC86 /* Contacts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2724CCD61FF34411006FFC86 /* Contacts.framework */; }; 27AADC261DDC4DB800E1AE31 /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27AADC251DDC4DB800E1AE31 /* AddressBook.framework */; }; @@ -65,6 +72,14 @@ 2E7A36E21E03A876005231BE /* jrmf.cer in Resources */ = {isa = PBXBuildFile; fileRef = 2E7A36DC1E03A876005231BE /* jrmf.cer */; }; 2E7A36E41E03A876005231BE /* JrmfWalletKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2E7A36DE1E03A876005231BE /* JrmfWalletKit.framework */; }; 2E7A36E61E03A876005231BE /* WalletResource.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 2E7A36E01E03A876005231BE /* WalletResource.bundle */; }; + 3B3DED11221D62E40079DFE6 /* RCDLanguageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B3DED0D221D62E40079DFE6 /* RCDLanguageManager.m */; }; + 3B3DED12221D62E40079DFE6 /* NSBundle+RCUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B3DED0F221D62E40079DFE6 /* NSBundle+RCUtils.m */; }; + 3B3DED16221E3D330079DFE6 /* RCDLanguageSettingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B3DED15221E3D330079DFE6 /* RCDLanguageSettingViewController.m */; }; + 3B3DED1A221E3F990079DFE6 /* RCDLanguageSettingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B3DED19221E3F990079DFE6 /* RCDLanguageSettingTableViewCell.m */; }; + 3B7D8F2322326312009E1417 /* Bugly.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B7D8F2222326311009E1417 /* Bugly.framework */; }; + 3B7D8F2622326634009E1417 /* Bugly.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B7D8F2522326634009E1417 /* Bugly.framework */; }; + 3B7D8F2822326670009E1417 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B7D8F2722326670009E1417 /* Security.framework */; }; + 3B7D8F2B223266B8009E1417 /* RCDBuglyManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 3B7D8F2A223266B8009E1417 /* RCDBuglyManager.m */; }; 466684241B5DEA10000B7504 /* RCDSettingBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 466684231B5DEA10000B7504 /* RCDSettingBaseViewController.m */; }; 466684271B5DEA5B000B7504 /* RCDConversationSettingBaseViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 466684261B5DEA5B000B7504 /* RCDConversationSettingBaseViewController.m */; }; 4666842A1B5DEC04000B7504 /* RCDConversationSettingClearMessageCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 466684291B5DEC04000B7504 /* RCDConversationSettingClearMessageCell.m */; }; @@ -236,7 +251,6 @@ E4BFAE651A1219EA007165B1 /* RCDAddressBookViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BFAE641A1219EA007165B1 /* RCDAddressBookViewController.m */; }; E4BFAE681A1219FC007165B1 /* RCDChatListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BFAE671A1219FC007165B1 /* RCDChatListViewController.m */; }; E4BFAE6B1A121A13007165B1 /* RCDGroupViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BFAE6A1A121A13007165B1 /* RCDGroupViewController.m */; }; - E4BFAE6E1A121A22007165B1 /* RCDChatRoomViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BFAE6D1A121A22007165B1 /* RCDChatRoomViewController.m */; }; E4BFAE711A121A5E007165B1 /* RCDRCIMDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = E4BFAE701A121A5E007165B1 /* RCDRCIMDataSource.m */; }; E4C330F21A0C721D00E31B9A /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C330F11A0C721D00E31B9A /* AVFoundation.framework */; }; E4C330F41A0C722300E31B9A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E4C330F31A0C722300E31B9A /* AudioToolbox.framework */; }; @@ -307,7 +321,6 @@ E4E939AC1AD65CC2001E0AC6 /* RCDSearchResultTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E939AA1AD65CC2001E0AC6 /* RCDSearchResultTableViewCell.m */; }; E4E939B11AD65CD6001E0AC6 /* RCDSelectPersonTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E939AE1AD65CD6001E0AC6 /* RCDSelectPersonTableViewCell.m */; }; E4E939B81AD65CFD001E0AC6 /* RCDGroupTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E939B61AD65CFD001E0AC6 /* RCDGroupTableViewCell.m */; }; - E4E939BB1AD65D18001E0AC6 /* RCDChatRoomTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E939BA1AD65D18001E0AC6 /* RCDChatRoomTableViewCell.m */; }; E4E939BE1AD65D30001E0AC6 /* RCDMessageNotifySettingTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E939BD1AD65D30001E0AC6 /* RCDMessageNotifySettingTableViewController.m */; }; E4E939C11AD65D41001E0AC6 /* RCDMeTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E939C01AD65D41001E0AC6 /* RCDMeTableViewController.m */; }; E4E939CA1AD65E1E001E0AC6 /* UIColor+RCColor.m in Sources */ = {isa = PBXBuildFile; fileRef = E4E939C51AD65E1E001E0AC6 /* UIColor+RCColor.m */; }; @@ -384,8 +397,13 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0A1DDD9C22169C9700A9FE21 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/SealTalk.strings; sourceTree = ""; }; + 0A1DDD9E22169C9F00A9FE21 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/SealTalk.strings"; sourceTree = ""; }; + 0A1DDD9F22169D7300A9FE21 /* PrefixHeader.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = SOURCE_ROOT; }; 17034A281FA3105600E04042 /* RCDDebugNoDisturbViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDDebugNoDisturbViewController.h; sourceTree = SOURCE_ROOT; }; 17034A291FA3105600E04042 /* RCDDebugNoDisturbViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDDebugNoDisturbViewController.m; sourceTree = SOURCE_ROOT; }; + 170615DA22277D860063A96D /* RCDSearchFriendController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDSearchFriendController.h; sourceTree = ""; }; + 170615DB22277D860063A96D /* RCDSearchFriendController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDSearchFriendController.m; sourceTree = ""; }; 17244C161B56553B000EFF79 /* RCDMessageNoDisturbSettingController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = RCDMessageNoDisturbSettingController.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 17244C171B56553B000EFF79 /* RCDMessageNoDisturbSettingController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RCDMessageNoDisturbSettingController.m; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 172B89F020747C56005481D7 /* RCDForwardAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCDForwardAlertView.h; sourceTree = ""; }; @@ -430,6 +448,12 @@ 17E018C41D59BCBB0093D3A0 /* TFHppleElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TFHppleElement.m; sourceTree = ""; }; 17E018C51D59BCBB0093D3A0 /* XPathQuery.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XPathQuery.h; sourceTree = ""; }; 17E018C61D59BCBB0093D3A0 /* XPathQuery.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPathQuery.m; sourceTree = ""; }; + 17E50274221A881100250D1F /* RCDCountryListController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDCountryListController.h; sourceTree = SOURCE_ROOT; }; + 17E50275221A881100250D1F /* RCDCountryListController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDCountryListController.m; sourceTree = SOURCE_ROOT; }; + 17E50277221A89FA00250D1F /* RCDCountry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDCountry.h; sourceTree = SOURCE_ROOT; }; + 17E50278221A89FA00250D1F /* RCDCountry.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDCountry.m; sourceTree = SOURCE_ROOT; }; + 17E5027A221A951500250D1F /* RCDIndicateTextField.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDIndicateTextField.h; sourceTree = SOURCE_ROOT; }; + 17E5027B221A951500250D1F /* RCDIndicateTextField.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDIndicateTextField.m; sourceTree = SOURCE_ROOT; }; 17F7A8361DAE187200E27D25 /* RCDLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCDLabel.h; sourceTree = SOURCE_ROOT; }; 17F7A8371DAE187200E27D25 /* RCDLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCDLabel.m; sourceTree = SOURCE_ROOT; }; 17F7A8381DAE187200E27D25 /* RCDSearchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCDSearchBar.h; sourceTree = SOURCE_ROOT; }; @@ -452,6 +476,8 @@ 1D3A2329212D5409009514F1 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/RongSticker.strings; sourceTree = ""; }; 1D3A232A212D5409009514F1 /* RongSticker.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = RongSticker.bundle; sourceTree = ""; }; 1D3A232B212D5409009514F1 /* RongSticker.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = RongSticker.framework; sourceTree = ""; }; + 1D5551F9223A30F700887BD0 /* libopencore-amrwb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libopencore-amrwb.a"; path = "framework/libopencore-amrwb.a"; sourceTree = SOURCE_ROOT; }; + 1D5551FA223A30F700887BD0 /* libvo-amrwbenc.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libvo-amrwbenc.a"; path = "framework/libvo-amrwbenc.a"; sourceTree = SOURCE_ROOT; }; 270EE2A221EF59BA001DFDED /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/JrmfInfo.strings; sourceTree = ""; }; 270EE2A421EF59C3001DFDED /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/JrmfInfo.strings"; sourceTree = ""; }; 2724CCD61FF34411006FFC86 /* Contacts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Contacts.framework; path = System/Library/Frameworks/Contacts.framework; sourceTree = SDKROOT; }; @@ -474,6 +500,19 @@ 2E7A36DC1E03A876005231BE /* jrmf.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = jrmf.cer; sourceTree = ""; }; 2E7A36DE1E03A876005231BE /* JrmfWalletKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JrmfWalletKit.framework; sourceTree = ""; }; 2E7A36E01E03A876005231BE /* WalletResource.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = WalletResource.bundle; sourceTree = ""; }; + 3B3DED0D221D62E40079DFE6 /* RCDLanguageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCDLanguageManager.m; sourceTree = ""; }; + 3B3DED0E221D62E40079DFE6 /* NSBundle+RCUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSBundle+RCUtils.h"; sourceTree = ""; }; + 3B3DED0F221D62E40079DFE6 /* NSBundle+RCUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSBundle+RCUtils.m"; sourceTree = ""; }; + 3B3DED10221D62E40079DFE6 /* RCDLanguageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCDLanguageManager.h; sourceTree = ""; }; + 3B3DED14221E3D330079DFE6 /* RCDLanguageSettingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDLanguageSettingViewController.h; sourceTree = ""; }; + 3B3DED15221E3D330079DFE6 /* RCDLanguageSettingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDLanguageSettingViewController.m; sourceTree = ""; }; + 3B3DED18221E3F990079DFE6 /* RCDLanguageSettingTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDLanguageSettingTableViewCell.h; sourceTree = ""; }; + 3B3DED19221E3F990079DFE6 /* RCDLanguageSettingTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDLanguageSettingTableViewCell.m; sourceTree = ""; }; + 3B7D8F2222326311009E1417 /* Bugly.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bugly.framework; path = "../../../../../../Downloads/Bugly-v2.5.0/Bugly.framework"; sourceTree = ""; }; + 3B7D8F2522326634009E1417 /* Bugly.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Bugly.framework; sourceTree = ""; }; + 3B7D8F2722326670009E1417 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 3B7D8F29223266B8009E1417 /* RCDBuglyManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCDBuglyManager.h; sourceTree = ""; }; + 3B7D8F2A223266B8009E1417 /* RCDBuglyManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCDBuglyManager.m; sourceTree = ""; }; 466684221B5DEA10000B7504 /* RCDSettingBaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = RCDSettingBaseViewController.h; path = RCloudMessage/RCDSettingBaseViewController.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 466684231B5DEA10000B7504 /* RCDSettingBaseViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = RCDSettingBaseViewController.m; path = RCloudMessage/RCDSettingBaseViewController.m; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 466684251B5DEA5B000B7504 /* RCDConversationSettingBaseViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = RCDConversationSettingBaseViewController.h; path = RCloudMessage/RCDConversationSettingBaseViewController.h; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -792,8 +831,6 @@ E4BFAE671A1219FC007165B1 /* RCDChatListViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDChatListViewController.m; path = RCloudMessage/RCDChatListViewController.m; sourceTree = SOURCE_ROOT; }; E4BFAE691A121A13007165B1 /* RCDGroupViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCDGroupViewController.h; path = RCloudMessage/RCDGroupViewController.h; sourceTree = SOURCE_ROOT; }; E4BFAE6A1A121A13007165B1 /* RCDGroupViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDGroupViewController.m; path = RCloudMessage/RCDGroupViewController.m; sourceTree = SOURCE_ROOT; }; - E4BFAE6C1A121A22007165B1 /* RCDChatRoomViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCDChatRoomViewController.h; path = RCloudMessage/RCDChatRoomViewController.h; sourceTree = SOURCE_ROOT; }; - E4BFAE6D1A121A22007165B1 /* RCDChatRoomViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDChatRoomViewController.m; path = RCloudMessage/RCDChatRoomViewController.m; sourceTree = SOURCE_ROOT; }; E4BFAE6F1A121A5E007165B1 /* RCDRCIMDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCDRCIMDataSource.h; path = RCloudMessage/RCDRCIMDataSource.h; sourceTree = SOURCE_ROOT; }; E4BFAE701A121A5E007165B1 /* RCDRCIMDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDRCIMDataSource.m; path = RCloudMessage/RCDRCIMDataSource.m; sourceTree = SOURCE_ROOT; }; E4C330F11A0C721D00E31B9A /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; @@ -934,8 +971,6 @@ E4E939AE1AD65CD6001E0AC6 /* RCDSelectPersonTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDSelectPersonTableViewCell.m; path = RCloudMessage/RCDSelectPersonTableViewCell.m; sourceTree = SOURCE_ROOT; }; E4E939B51AD65CFD001E0AC6 /* RCDGroupTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCDGroupTableViewCell.h; path = RCloudMessage/RCDGroupTableViewCell.h; sourceTree = SOURCE_ROOT; }; E4E939B61AD65CFD001E0AC6 /* RCDGroupTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDGroupTableViewCell.m; path = RCloudMessage/RCDGroupTableViewCell.m; sourceTree = SOURCE_ROOT; }; - E4E939B91AD65D18001E0AC6 /* RCDChatRoomTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCDChatRoomTableViewCell.h; path = RCloudMessage/RCDChatRoomTableViewCell.h; sourceTree = SOURCE_ROOT; }; - E4E939BA1AD65D18001E0AC6 /* RCDChatRoomTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDChatRoomTableViewCell.m; path = RCloudMessage/RCDChatRoomTableViewCell.m; sourceTree = SOURCE_ROOT; }; E4E939BC1AD65D30001E0AC6 /* RCDMessageNotifySettingTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCDMessageNotifySettingTableViewController.h; path = RCloudMessage/RCDMessageNotifySettingTableViewController.h; sourceTree = SOURCE_ROOT; }; E4E939BD1AD65D30001E0AC6 /* RCDMessageNotifySettingTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCDMessageNotifySettingTableViewController.m; path = RCloudMessage/RCDMessageNotifySettingTableViewController.m; sourceTree = SOURCE_ROOT; }; E4E939BF1AD65D41001E0AC6 /* RCDMeTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCDMeTableViewController.h; path = RCloudMessage/RCDMeTableViewController.h; sourceTree = SOURCE_ROOT; }; @@ -1003,10 +1038,14 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3B7D8F2822326670009E1417 /* Security.framework in Frameworks */, + 3B7D8F2322326312009E1417 /* Bugly.framework in Frameworks */, F1E7784C21A622B00005C37D /* UserNotifications.framework in Frameworks */, B2A68D7A212FDBA9006FADEC /* RongSight.framework in Frameworks */, 1D3A232E212D540A009514F1 /* RongSticker.framework in Frameworks */, A6BD6E2220A5AD880063F51D /* Bailingquic.framework in Frameworks */, + 3B7D8F2622326634009E1417 /* Bugly.framework in Frameworks */, + 1D5551FB223A30F700887BD0 /* libopencore-amrwb.a in Frameworks */, 9870725020A17AC3008EE653 /* GLKit.framework in Frameworks */, 9870724E20A17AB9008EE653 /* OpenGLES.framework in Frameworks */, 771BB16221B155B40066AE4A /* JYangToolKit.framework in Frameworks */, @@ -1048,6 +1087,7 @@ 5111B07B1AE6A11A00317E71 /* RongIMKit.framework in Frameworks */, 7755B4BC2106CE9F000C2DA8 /* JrmfPacketKit.framework in Frameworks */, F8B7DBD21BAC189700E9F9BD /* libopencore-amrnb.a in Frameworks */, + 1D5551FC223A30F700887BD0 /* libvo-amrwbenc.a in Frameworks */, E4C330FE1A0C725200E31B9A /* CoreVideo.framework in Frameworks */, 2E7A36E41E03A876005231BE /* JrmfWalletKit.framework in Frameworks */, 27C42EEC1DE30637003E2306 /* iflyMSC.framework in Frameworks */, @@ -1235,6 +1275,46 @@ path = framework/AlipaySDK; sourceTree = SOURCE_ROOT; }; + 3B3DED0C221D62E40079DFE6 /* LanguageUtility */ = { + isa = PBXGroup; + children = ( + 3B3DED10221D62E40079DFE6 /* RCDLanguageManager.h */, + 3B3DED0D221D62E40079DFE6 /* RCDLanguageManager.m */, + 3B3DED0E221D62E40079DFE6 /* NSBundle+RCUtils.h */, + 3B3DED0F221D62E40079DFE6 /* NSBundle+RCUtils.m */, + ); + path = LanguageUtility; + sourceTree = ""; + }; + 3B3DED13221E3D030079DFE6 /* LanguageSettings */ = { + isa = PBXGroup; + children = ( + 3B3DED17221E3F800079DFE6 /* Cell */, + 3B3DED14221E3D330079DFE6 /* RCDLanguageSettingViewController.h */, + 3B3DED15221E3D330079DFE6 /* RCDLanguageSettingViewController.m */, + ); + path = LanguageSettings; + sourceTree = ""; + }; + 3B3DED17221E3F800079DFE6 /* Cell */ = { + isa = PBXGroup; + children = ( + 3B3DED18221E3F990079DFE6 /* RCDLanguageSettingTableViewCell.h */, + 3B3DED19221E3F990079DFE6 /* RCDLanguageSettingTableViewCell.m */, + ); + name = Cell; + sourceTree = ""; + }; + 3B7D8F242232661C009E1417 /* Monitor */ = { + isa = PBXGroup; + children = ( + 3B7D8F2522326634009E1417 /* Bugly.framework */, + 3B7D8F29223266B8009E1417 /* RCDBuglyManager.h */, + 3B7D8F2A223266B8009E1417 /* RCDBuglyManager.m */, + ); + path = Monitor; + sourceTree = ""; + }; 46A831B81AC014B2001A533F /* FindPsw */ = { isa = PBXGroup; children = ( @@ -1685,6 +1765,8 @@ children = ( E4E939A71AD65CC2001E0AC6 /* RCDSearchFriendViewController.h */, E4E939A81AD65CC2001E0AC6 /* RCDSearchFriendViewController.m */, + 170615DA22277D860063A96D /* RCDSearchFriendController.h */, + 170615DB22277D860063A96D /* RCDSearchFriendController.m */, E4E939A91AD65CC2001E0AC6 /* RCDSearchResultTableViewCell.h */, E4E939AA1AD65CC2001E0AC6 /* RCDSearchResultTableViewCell.m */, E412BD251ADFA2A0000DCA7A /* RCDAddFriendViewController.h */, @@ -1779,7 +1861,6 @@ E4C4E7CD1A09FC3A00140067 /* Register */, E4C4E7CE1A09FD0B00140067 /* ChatList */, E4C4E7CF1A09FD2A00140067 /* Group */, - E4C4E7D01A09FD3E00140067 /* ChatRoom */, E4C4E7D21A0A125D00140067 /* Service */, E4C4E7D11A09FD5B00140067 /* Me */, ); @@ -1810,6 +1891,12 @@ children = ( E4E939A41AD65CA3001E0AC6 /* RCDRegisterViewController.h */, E4E939A51AD65CA3001E0AC6 /* RCDRegisterViewController.m */, + 17E50274221A881100250D1F /* RCDCountryListController.h */, + 17E50275221A881100250D1F /* RCDCountryListController.m */, + 17E5027A221A951500250D1F /* RCDIndicateTextField.h */, + 17E5027B221A951500250D1F /* RCDIndicateTextField.m */, + 17E50277221A89FA00250D1F /* RCDCountry.h */, + 17E50278221A89FA00250D1F /* RCDCountry.m */, ); name = Register; sourceTree = ""; @@ -1848,20 +1935,10 @@ name = Group; sourceTree = ""; }; - E4C4E7D01A09FD3E00140067 /* ChatRoom */ = { - isa = PBXGroup; - children = ( - E4BFAE6C1A121A22007165B1 /* RCDChatRoomViewController.h */, - E4BFAE6D1A121A22007165B1 /* RCDChatRoomViewController.m */, - E4E939B91AD65D18001E0AC6 /* RCDChatRoomTableViewCell.h */, - E4E939BA1AD65D18001E0AC6 /* RCDChatRoomTableViewCell.m */, - ); - name = ChatRoom; - sourceTree = ""; - }; E4C4E7D11A09FD5B00140067 /* Me */ = { isa = PBXGroup; children = ( + 3B3DED13221E3D030079DFE6 /* LanguageSettings */, 9891E8D91D82638400E874AB /* HomePage */, 98F7B0A21D825F61005B2E42 /* PersonalInfor */, E411721B1A1D9D120025EE4E /* AccountSettings */, @@ -1888,6 +1965,10 @@ E4C4E7E71A0A309100140067 /* Frameworks */ = { isa = PBXGroup; children = ( + 1D5551F9223A30F700887BD0 /* libopencore-amrwb.a */, + 1D5551FA223A30F700887BD0 /* libvo-amrwbenc.a */, + 3B7D8F2722326670009E1417 /* Security.framework */, + 3B7D8F2222326311009E1417 /* Bugly.framework */, F1E7784B21A622B00005C37D /* UserNotifications.framework */, E84C4F98215A5BBE004A469D /* Bailingquic.framework */, E84C4F99215A5BBE004A469D /* GPUImage.framework */, @@ -2008,6 +2089,8 @@ E4BFAE221A121839007165B1 /* Images.xcassets */, E4BFAE241A121839007165B1 /* main.m */, 987653621D796C5B008A6BF0 /* Launch Screen.storyboard */, + 0A1DDD9D22169C9700A9FE21 /* SealTalk.strings */, + 0A1DDD9F22169D7300A9FE21 /* PrefixHeader.pch */, ); name = "Supporting Files"; sourceTree = ""; @@ -2034,6 +2117,8 @@ E4E938CB1AD65A95001E0AC6 /* Utilities */ = { isa = PBXGroup; children = ( + 3B7D8F242232661C009E1417 /* Monitor */, + 3B3DED0C221D62E40079DFE6 /* LanguageUtility */, 983B736C20A598170059B047 /* SSZipArchive */, 172B89F020747C56005481D7 /* RCDForwardAlertView.h */, 172B89F120747C57005481D7 /* RCDForwardAlertView.m */, @@ -2498,6 +2583,7 @@ A6CF8A351BD4CB6E00F3EA1A /* RCConfig.plist in Resources */, E4BFAE251A121839007165B1 /* Images.xcassets in Resources */, 270EE2A321EF59BA001DFDED /* JrmfInfo.strings in Resources */, + 0A1DDD9B22169C9700A9FE21 /* SealTalk.strings in Resources */, 510624851AD63A9E00348452 /* RongCloudKit.strings in Resources */, 2E7A36E61E03A876005231BE /* WalletResource.bundle in Resources */, 1D3A232D212D540A009514F1 /* RongSticker.bundle in Resources */, @@ -2630,6 +2716,7 @@ 27D6FF9F1DFE4D2C00053F69 /* RCDSettingUserDefaults.m in Sources */, E4E939AB1AD65CC2001E0AC6 /* RCDSearchFriendViewController.m in Sources */, E4E939721AD65A95001E0AC6 /* UIView+WebCacheOperation.m in Sources */, + 3B3DED12221D62E40079DFE6 /* NSBundle+RCUtils.m in Sources */, E4E939D21AD6805E001E0AC6 /* RCDPersonDetailViewController.m in Sources */, A677D69B1B81EBB9007D5D90 /* RCAnnotationView.m in Sources */, E4E939671AD65A95001E0AC6 /* SDWebImageDecoder.m in Sources */, @@ -2649,6 +2736,7 @@ E4E9399A1AD65C3B001E0AC6 /* RCDFindPswViewController.m in Sources */, 98FFECB71D267140001DBB0D /* UITabBar+badge.m in Sources */, E4E9394F1AD65A95001E0AC6 /* UIImageView+AFNetworking.m in Sources */, + 17E50279221A89FA00250D1F /* RCDCountry.m in Sources */, 175F17981F5FF30A004572D7 /* RCDCSButton.m in Sources */, A65C1C8F1C7C13F400EBB601 /* RCDCustomerServiceViewController.m in Sources */, 983B739820A598180059B047 /* aescrypt.c in Sources */, @@ -2656,6 +2744,7 @@ A677D69A1B81EBB9007D5D90 /* RCAnnotation.m in Sources */, E4E939791AD65AEB001E0AC6 /* RCDChatRoomInfo.m in Sources */, E4E939421AD65A95001E0AC6 /* AFHTTPRequestOperation.m in Sources */, + 3B3DED16221E3D330079DFE6 /* RCDLanguageSettingViewController.m in Sources */, 9C2763371F6BF2AF006C9680 /* RCDDebugViewController.m in Sources */, E4E9394B1AD65A95001E0AC6 /* AFNetworkActivityIndicatorManager.m in Sources */, E4BFAE681A1219FC007165B1 /* RCDChatListViewController.m in Sources */, @@ -2664,6 +2753,7 @@ 98A3E70A1D45F961007989E7 /* RCDNavigationViewController.m in Sources */, E4E939B81AD65CFD001E0AC6 /* RCDGroupTableViewCell.m in Sources */, 466684361B5DF36E000B7504 /* RCDUtilities.m in Sources */, + 3B3DED1A221E3F990079DFE6 /* RCDLanguageSettingTableViewCell.m in Sources */, E4E939441AD65A95001E0AC6 /* AFHTTPSessionManager.m in Sources */, 17D7D1FB1D535272000AEC54 /* DefaultPortraitView.m in Sources */, E4E939A01AD65C74001E0AC6 /* RCDDiscussGroupSettingViewController.m in Sources */, @@ -2684,6 +2774,7 @@ A677D6A01B81EBB9007D5D90 /* RealTimeLocationStatusView.m in Sources */, 98AB3C091D38940600C3B87C /* SortForTime.m in Sources */, 466684331B5DEC7C000B7504 /* RCDConversationSettingTableViewHeaderItem.m in Sources */, + 3B3DED11221D62E40079DFE6 /* RCDLanguageManager.m in Sources */, 17F7A8481DAE187200E27D25 /* RCDSearchDataManager.m in Sources */, 17034A2A1FA3105600E04042 /* RCDDebugNoDisturbViewController.m in Sources */, E4BFAE271A121839007165B1 /* main.m in Sources */, @@ -2716,6 +2807,7 @@ 9B447DE91CF82926005D3ED5 /* RCDContactTableViewCell.m in Sources */, 178998271F629A2E00FC44D3 /* RCDCSEvaluateModel.m in Sources */, 17244C181B56553B000EFF79 /* RCDMessageNoDisturbSettingController.m in Sources */, + 17E5027C221A951500250D1F /* RCDIndicateTextField.m in Sources */, 98E4A6021DC08980007C3D1C /* RCDSquareCell.m in Sources */, 175F17951F5FA357004572D7 /* RCDCSInputView.m in Sources */, 17F7A84A1DAE187200E27D25 /* RCDSearchMoreViewCell.m in Sources */, @@ -2737,11 +2829,11 @@ 1763AB171F57E63D00BC96D9 /* RCDCSAnnounceView.m in Sources */, E4E939521AD65A95001E0AC6 /* UIWebView+AFNetworking.m in Sources */, E4E939641AD65A95001E0AC6 /* NSData+ImageContentType.m in Sources */, + 17E50276221A881100250D1F /* RCDCountryListController.m in Sources */, E4E9394C1AD65A95001E0AC6 /* UIActivityIndicatorView+AFNetworking.m in Sources */, E4E939811AD65B27001E0AC6 /* RCDDiscussSettingCell.m in Sources */, 983B73A420A598180059B047 /* minishared.c in Sources */, 983B73A720A598180059B047 /* SSZipArchive.m in Sources */, - E4E939BB1AD65D18001E0AC6 /* RCDChatRoomTableViewCell.m in Sources */, F836AB0E1C2262C400A1A5D2 /* RCDTestMessage.m in Sources */, E4E939471AD65A95001E0AC6 /* AFURLConnectionOperation.m in Sources */, E4E9396C1AD65A95001E0AC6 /* UIButton+WebCache.m in Sources */, @@ -2756,13 +2848,13 @@ E412BD271ADFA2A0000DCA7A /* RCDAddFriendViewController.m in Sources */, E4E939701AD65A95001E0AC6 /* UIImageView+HighlightedWebCache.m in Sources */, 27C7A2701F7A066500B59418 /* RCDTableViewController.m in Sources */, - E4BFAE6E1A121A22007165B1 /* RCDChatRoomViewController.m in Sources */, E4E939621AD65A95001E0AC6 /* RCUnderlineTextField.m in Sources */, E4E939681AD65A95001E0AC6 /* SDWebImageDownloader.m in Sources */, 175F178F1F5FA21E004572D7 /* RCDCSSolveView.m in Sources */, F836AB151C226A7F00A1A5D2 /* RCDTestMessageCell.m in Sources */, E4E939AC1AD65CC2001E0AC6 /* RCDSearchResultTableViewCell.m in Sources */, 175F17891F5FA062004572D7 /* RCDCSEvaluateView.m in Sources */, + 3B7D8F2B223266B8009E1417 /* RCDBuglyManager.m in Sources */, E4E939511AD65A95001E0AC6 /* UIRefreshControl+AFNetworking.m in Sources */, E4E939CB1AD65E1E001E0AC6 /* UIImage+RCImage.m in Sources */, E4E939711AD65A95001E0AC6 /* UIImageView+WebCache.m in Sources */, @@ -2780,6 +2872,7 @@ 466684271B5DEA5B000B7504 /* RCDConversationSettingBaseViewController.m in Sources */, 9B447DE81CF82926005D3ED5 /* RCDContactSelectedTableViewController.m in Sources */, 174151F51CBE516A00A4B23B /* RCDPublicServiceListViewController.m in Sources */, + 170615DC22277D860063A96D /* RCDSearchFriendController.m in Sources */, A6447A3F1B1DC12500EA2CEE /* RCWKSharedUserDefault.m in Sources */, 983B73A520A598180059B047 /* unzip.c in Sources */, E4E939971AD65C15001E0AC6 /* RCDGroupInfo.m in Sources */, @@ -2822,6 +2915,15 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ + 0A1DDD9D22169C9700A9FE21 /* SealTalk.strings */ = { + isa = PBXVariantGroup; + children = ( + 0A1DDD9C22169C9700A9FE21 /* en */, + 0A1DDD9E22169C9F00A9FE21 /* zh-Hans */, + ); + name = SealTalk.strings; + sourceTree = SOURCE_ROOT; + }; 17D7D1DD1D534F56000AEC54 /* MainInterface.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -3038,8 +3140,10 @@ "$(PROJECT_DIR)/framework/RCSticker", "$(inherited)", "$(PROJECT_DIR)/Blink", + "$(PROJECT_DIR)/RCloudMessage/Utilities/Monitor", ); GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/PrefixHeader.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; INFOPLIST_FILE = "$(SRCROOT)/RCloudMessage/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -3192,8 +3296,10 @@ "$(PROJECT_DIR)/framework/RCSticker", "$(inherited)", "$(PROJECT_DIR)/Blink", + "$(PROJECT_DIR)/RCloudMessage/Utilities/Monitor", ); GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/PrefixHeader.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; INFOPLIST_FILE = "$(SRCROOT)/RCloudMessage/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -3505,8 +3611,10 @@ "$(PROJECT_DIR)/framework/RCSticker", "$(inherited)", "$(PROJECT_DIR)/Blink", + "$(PROJECT_DIR)/RCloudMessage/Utilities/Monitor", ); GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/PrefixHeader.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; INFOPLIST_FILE = "$(SRCROOT)/RCloudMessage/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; @@ -3555,8 +3663,10 @@ "$(PROJECT_DIR)/framework/RCSticker", "$(inherited)", "$(PROJECT_DIR)/Blink", + "$(PROJECT_DIR)/RCloudMessage/Utilities/Monitor", ); GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_PREFIX_HEADER = "$(SRCROOT)/PrefixHeader.pch"; GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; INFOPLIST_FILE = "$(SRCROOT)/RCloudMessage/Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; diff --git a/ios-rongimdemo/RCloudMessage/AFHttpTool.h b/ios-rongimdemo/RCloudMessage/AFHttpTool.h index 1b8c5e08..c2558c55 100644 --- a/ios-rongimdemo/RCloudMessage/AFHttpTool.h +++ b/ios-rongimdemo/RCloudMessage/AFHttpTool.h @@ -79,6 +79,9 @@ typedef NS_ENUM(NSInteger, RequestMethodType) { RequestMethodTypePost = 1, Reque success:(void (^)(id response))success failure:(void (^)(NSError *err))failure; ++ (void)getRegionlist:(void (^)(id response))success + failure:(void (^)(NSError *err))failure; + // get user info + (void)getUserInfo:(NSString *)userId success:(void (^)(id response))success failure:(void (^)(NSError *err))failure; @@ -92,6 +95,7 @@ typedef NS_ENUM(NSInteger, RequestMethodType) { RequestMethodTypePost = 1, Reque // find user by phone + (void)findUserByPhone:(NSString *)Phone + region:(NSString *)region success:(void (^)(id response))success failure:(void (^)(NSError *err))failure; diff --git a/ios-rongimdemo/RCloudMessage/AFHttpTool.m b/ios-rongimdemo/RCloudMessage/AFHttpTool.m index 9d6d8374..caa4cb43 100644 --- a/ios-rongimdemo/RCloudMessage/AFHttpTool.m +++ b/ios-rongimdemo/RCloudMessage/AFHttpTool.m @@ -141,7 +141,7 @@ + (void)getVerificationCode:(NSString *)region NSDictionary *params = @{@"region" : region, @"phone" : phoneNumber}; [AFHttpTool requestWihtMethod:RequestMethodTypePost - url:@"user/send_code" + url:@"user/send_code_yp" params:params success:success failure:failure]; @@ -156,7 +156,7 @@ + (void)verifyVerificationCode:(NSString *)region NSDictionary *params = @{@"region" : region, @"phone" : phoneNumber, @"code" : verificationCode}; [AFHttpTool requestWihtMethod:RequestMethodTypePost - url:@"user/verify_code" + url:@"user/verify_code_yp" params:params success:success failure:failure]; @@ -234,6 +234,14 @@ + (void)resetPassword:(NSString *)password failure:failure]; } ++ (void)getRegionlist:(void (^)(id response))success failure:(void (^)(NSError *))failure{ + [AFHttpTool requestWihtMethod:RequestMethodTypeGet + url:@"user/regionlist" + params:nil + success:success + failure:failure]; +} + // get user info + (void)getUserInfo:(NSString *)userId success:(void (^)(id response))success failure:(void (^)(NSError *err))failure { [AFHttpTool requestWihtMethod:RequestMethodTypeGet @@ -270,10 +278,11 @@ + (void)inviteUser:(NSString *)userId success:(void (^)(id response))success fai // find user by phone + (void)findUserByPhone:(NSString *)Phone + region:(NSString *)region success:(void (^)(id response))success failure:(void (^)(NSError *err))failure { [AFHttpTool requestWihtMethod:RequestMethodTypeGet - url:[NSString stringWithFormat:@"user/find/86/%@", Phone] + url:[NSString stringWithFormat:@"user/find/%@/%@", region,Phone] params:nil success:success failure:failure]; diff --git a/ios-rongimdemo/RCloudMessage/AppDelegate.m b/ios-rongimdemo/RCloudMessage/AppDelegate.m index a320c7bb..ae10ab9e 100644 --- a/ios-rongimdemo/RCloudMessage/AppDelegate.m +++ b/ios-rongimdemo/RCloudMessage/AppDelegate.m @@ -23,13 +23,16 @@ #import "RCWKNotifier.h" #import "RCWKRequestHandler.h" #import "UIColor+RCColor.h" +#import "RCDBuglyManager.h" #define RONGCLOUD_IM_APPKEY @"n19jmcy59f1q9" // online key +#import "RCDCountry.h" //#define RONGCLOUD_IM_APPKEY @"c9kqb3rdkbb8j" // pre key //#define RONGCLOUD_IM_APPKEY @"e0x9wycfx7flq" // offline key #define UMENG_APPKEY @"563755cbe0f55a5cb300139c" +#define BUGLY_APPID @"84247f1866" #define LOG_EXPIRE_TIME -7 * 24 * 60 * 60 @@ -52,7 +55,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; - + NSDictionary *dic = [[NSUserDefaults standardUserDefaults] objectForKey:@"currentCountry"]; + RCDCountry *currentCountry; + if (!dic) { + currentCountry = [[RCDCountry alloc] initWithDict:@{@"region": @"86", + @"locale": @{@"en":@"China",@"zh":@"中国"}}]; + [[NSUserDefaults standardUserDefaults] setObject:[currentCountry getModelJson] forKey:@"currentCountry"]; + } //重定向log到本地问题 //在info.plist中打开Application supports iTunes file sharing // if (![[[UIDevice currentDevice] model] isEqualToString:@"iPhone @@ -65,6 +74,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( //为了在启动页面不显示statusBar,所以在工程设置里面把statusBar隐藏了,在启动页面过后,显示statusBar。 application.statusBarHidden = NO; + [RCDBuglyManager startWithAppId:BUGLY_APPID]; [self umengTrack]; /** * 推送说明: @@ -117,7 +127,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( // 注册自定义测试消息 [[RCIM sharedRCIM] registerMessageType:[RCDTestMessage class]]; - + + // 设置语音消息采样率为 16KHZ + [RCIMClient sharedRCIMClient].sampleRate = RCSample_Rate_16000; + //设置会话列表头像和会话页面头像 [[RCIM sharedRCIM] setConnectionStatusDelegate:self]; @@ -185,7 +198,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( NSString *password = [DEFAULTS objectForKey:@"userPwd"]; NSString *userNickName = [DEFAULTS objectForKey:@"userNickName"]; NSString *userPortraitUri = [DEFAULTS objectForKey:@"userPortraitUri"]; - if (token.length && userId.length && password.length) { RCDMainTabBarViewController *mainTabBarVC = [[RCDMainTabBarViewController alloc] init]; RCDNavigationViewController *rootNavi = @@ -210,6 +222,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( [DEFAULTS setObject:user.name forKey:@"userNickName"]; [DEFAULTS synchronize]; [RCIMClient sharedRCIMClient].currentUserInfo = user; + [RCDBuglyManager setUserIdentifier:[NSString stringWithFormat:@"%@ - %@", user.userId,user.name]]; }]; //登录demoserver成功之后才能调demo 的接口 [RCDDataSource syncGroups]; @@ -247,7 +260,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( password:password]; } error:^(RCConnectErrorCode status) { - [self gotoLoginViewAndDisplayReasonInfo:@"登录失效,请重新登录。"]; + [self gotoLoginViewAndDisplayReasonInfo:RCDLocalizedString(@"Login_is_invalid_please_login_again") +]; } tokenIncorrect:^{ [self gotoLoginViewAndDisplayReasonInfo:@"无法连接到服务器"]; @@ -623,11 +637,11 @@ - (BOOL)getLoginStatus { */ - (void)onRCIMConnectionStatusChanged:(RCConnectionStatus)status { if (status == ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT) { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"您的帐号在别的设备上登录," - @"您被迫下线!" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"accout_kicked") delegate:nil - cancelButtonTitle:@"知道了" + cancelButtonTitle:RCDLocalizedString(@"i_know") + otherButtonTitles:nil, nil]; [alert show]; RCDLoginViewController *loginVC = [[RCDLoginViewController alloc] init]; @@ -652,10 +666,12 @@ - (void)onRCIMConnectionStatusChanged:(RCConnectionStatus)status { }]; } else if (status == ConnectionStatus_DISCONN_EXCEPTION) { [[RCIMClient sharedRCIMClient] disconnect]; - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"您的帐号被封禁" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"Your_account_has_been_banned") + delegate:nil - cancelButtonTitle:@"知道了" + cancelButtonTitle:RCDLocalizedString(@"i_know") + otherButtonTitles:nil, nil]; [alert show]; RCDLoginViewController *loginVC = [[RCDLoginViewController alloc] init]; @@ -838,7 +854,8 @@ - (void)gotoLoginViewAndDisplayReasonInfo:(NSString *)reason { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:reason delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; ; [alertView show]; diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join-1.imageset/Join.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/Join-1.imageset/Join.png deleted file mode 100644 index b5738134..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join-1.imageset/Join.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join_hover-1.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/Join_hover-1.imageset/Contents.json deleted file mode 100644 index b5b76ba3..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join_hover-1.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "Join_hover.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join_hover-1.imageset/Join_hover.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/Join_hover-1.imageset/Join_hover.png deleted file mode 100644 index d7346ab7..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join_hover-1.imageset/Join_hover.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/chat.imageset/Contents.json deleted file mode 100644 index 3b1bdef4..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "chat.png" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat.imageset/chat.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/chat.imageset/chat.png deleted file mode 100644 index 1b72aeb1..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat.imageset/chat.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat_hover.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/chat_hover.imageset/Contents.json deleted file mode 100644 index 9417a152..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat_hover.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "chat_hover.png" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat_hover.imageset/chat_hover.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/chat_hover.imageset/chat_hover.png deleted file mode 100644 index 31f1bbd2..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/chat_hover.imageset/chat_hover.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/contact_me.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/contact_me.imageset/Contents.json deleted file mode 100644 index 4077d246..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/contact_me.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "contact_me.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/contact_me.imageset/contact_me.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/contact_me.imageset/contact_me.png deleted file mode 100644 index d8e0755f..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/contact_me.imageset/contact_me.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join-1.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_ multilingual.imageset/Contents.json similarity index 85% rename from ios-rongimdemo/RCloudMessage/Images.xcassets/Join-1.imageset/Contents.json rename to ios-rongimdemo/RCloudMessage/Images.xcassets/icon_ multilingual.imageset/Contents.json index 48819c82..c4ec3674 100644 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/Join-1.imageset/Contents.json +++ b/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_ multilingual.imageset/Contents.json @@ -6,7 +6,7 @@ }, { "idiom" : "universal", - "filename" : "Join.png", + "filename" : "icon_ multilingual.png", "scale" : "2x" }, { diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_ multilingual.imageset/icon_ multilingual.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_ multilingual.imageset/icon_ multilingual.png new file mode 100644 index 00000000..6d15634d Binary files /dev/null and b/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_ multilingual.imageset/icon_ multilingual.png differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_server_button.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_server_button.imageset/Contents.json deleted file mode 100644 index 8b7479ee..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_server_button.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "Icon_server_buttom.png" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_server_button.imageset/Icon_server_buttom.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_server_button.imageset/Icon_server_buttom.png deleted file mode 100644 index 8e638429..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/icon_server_button.imageset/Icon_server_buttom.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/join.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/join.imageset/Contents.json deleted file mode 100644 index 897cacf0..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/join.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "join.png" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/join.imageset/join.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/join.imageset/join.png deleted file mode 100644 index 3929f623..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/join.imageset/join.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/join_hover.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/join_hover.imageset/Contents.json deleted file mode 100644 index 0eaea33d..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/join_hover.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "join_hover.png" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/join_hover.imageset/join_hover.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/join_hover.imageset/join_hover.png deleted file mode 100644 index d83fdfad..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/join_hover.imageset/join_hover.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/rongcloud_logo.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/rongcloud_logo.imageset/Contents.json deleted file mode 100644 index 0b7404ea..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/rongcloud_logo.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x", - "filename" : "rongcloud_logo.png" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/rongcloud_logo.imageset/rongcloud_logo.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/rongcloud_logo.imageset/rongcloud_logo.png deleted file mode 100644 index 6fa30e5f..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/rongcloud_logo.imageset/rongcloud_logo.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/service_icon.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/service_icon.imageset/Contents.json deleted file mode 100644 index 5bee3c8c..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/service_icon.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "service_icon.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "service_icon-1.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/service_icon.imageset/service_icon.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/service_icon.imageset/service_icon.png deleted file mode 100644 index b08400e3..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/service_icon.imageset/service_icon.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/services_bg.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/services_bg.imageset/Contents.json deleted file mode 100644 index ab537a24..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/services_bg.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "filename" : "services_bg.png", - "scale" : "1x" - }, - { - "idiom" : "universal", - "filename" : "services_bg-1.png", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/services_bg.imageset/services_bg.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/services_bg.imageset/services_bg.png deleted file mode 100644 index 0e5d367d..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/services_bg.imageset/services_bg.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/title_logo.imageset/Contents.json b/ios-rongimdemo/RCloudMessage/Images.xcassets/title_logo.imageset/Contents.json deleted file mode 100644 index 793f0b3d..00000000 --- a/ios-rongimdemo/RCloudMessage/Images.xcassets/title_logo.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x", - "filename" : "title_logo.png" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/ios-rongimdemo/RCloudMessage/Images.xcassets/title_logo.imageset/title_logo.png b/ios-rongimdemo/RCloudMessage/Images.xcassets/title_logo.imageset/title_logo.png deleted file mode 100644 index e40aff7d..00000000 Binary files a/ios-rongimdemo/RCloudMessage/Images.xcassets/title_logo.imageset/title_logo.png and /dev/null differ diff --git a/ios-rongimdemo/RCloudMessage/Info.plist b/ios-rongimdemo/RCloudMessage/Info.plist index d6425113..493e014e 100644 --- a/ios-rongimdemo/RCloudMessage/Info.plist +++ b/ios-rongimdemo/RCloudMessage/Info.plist @@ -19,7 +19,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.9.10 Dev + 2.9.12 Dev CFBundleSignature ???? CFBundleURLTypes @@ -42,7 +42,7 @@ CFBundleVersion - 201901251505 + 201903201910 LSRequiresIPhoneOS NSAppTransportSecurity @@ -63,7 +63,7 @@ NSPhotoLibraryAddUsageDescription 访问相册 SealTalk Version - 1.3.10 + 1.3.13 UIBackgroundModes audio diff --git a/ios-rongimdemo/RCloudMessage/RCDAddressBookTableViewCell.m b/ios-rongimdemo/RCloudMessage/RCDAddressBookTableViewCell.m index f8b7aa63..934fc288 100644 --- a/ios-rongimdemo/RCloudMessage/RCDAddressBookTableViewCell.m +++ b/ios-rongimdemo/RCloudMessage/RCDAddressBookTableViewCell.m @@ -56,13 +56,14 @@ - (void)initSubviews { self.arrow.image = [UIImage imageNamed:@"grayarrow"]; //右侧label - CGFloat rightLabelWidth = 53; + CGFloat rightLabelWidth = 80; CGFloat rightLabelHeight = cellHeight - 16.5 - 16; CGFloat rightLabelX = CGRectGetMaxX(self.arrow.frame) - 20 - rightLabelWidth; CGFloat rightLabelY = 16.5; self.rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(rightLabelX, rightLabelY, rightLabelWidth, rightLabelHeight)]; self.rightLabel.font = [UIFont systemFontOfSize:14]; + self.rightLabel.textAlignment = NSTextAlignmentRight; //“接受”按钮 CGFloat acceptBtnWidth = rightLabelWidth - 15; @@ -71,7 +72,7 @@ - (void)initSubviews { CGFloat acceptBtnY = rightLabelY + 5; _acceptBtn = [[UIButton alloc] initWithFrame:CGRectMake(acceptBtnX, acceptBtnY, acceptBtnWidth, acceptBtnHeight)]; _acceptBtn.tag = self.tag; - [_acceptBtn setTitle:@"接受" forState:UIControlStateNormal]; + [_acceptBtn setTitle:RCDLocalizedString(@"accept") forState:UIControlStateNormal]; [_acceptBtn setTintColor:[UIColor whiteColor]]; [_acceptBtn setBackgroundColor:[[UIColor alloc] initWithRed:23 / 255.f green:136 / 255.f blue:213 / 255.f alpha:1]]; _acceptBtn.translatesAutoresizingMaskIntoConstraints = NO; @@ -84,6 +85,28 @@ - (void)initSubviews { [self.contentView addSubview:_acceptBtn]; } +- (void)layoutSubviews { + [super layoutSubviews]; + + CGFloat cellWidth = self.frame.size.width; + CGFloat screenWidth = RCDscreenWidth; + if (cellWidth < screenWidth) { + cellWidth = screenWidth; + } + CGFloat arrowX = cellWidth - 15 - 8; + CGRect arrowFrame = self.arrow.frame; + arrowFrame.origin.x = arrowX; + self.arrow.frame = arrowFrame; + + CGRect rightLabelFrame = self.rightLabel.frame; + rightLabelFrame.origin.x = CGRectGetMaxX(self.arrow.frame) - 20 - 80; + self.rightLabel.frame = rightLabelFrame; + + CGRect acceptFrame = self.acceptBtn.frame; + acceptFrame.origin.x = rightLabelFrame.origin.x; + self.acceptBtn.frame = acceptFrame; +} + - (void)setModel:(RCDUserInfo *)user { if (user) { self.nameLabel.text = user.name; @@ -99,12 +122,12 @@ - (void)setModel:(RCDUserInfo *)user { } } if ([user.status intValue] == 20) { - self.rightLabel.text = @"已接受"; + self.rightLabel.text = RCDLocalizedString(@"had_accept"); self.acceptBtn.hidden = YES; self.arrow.hidden = NO; } if ([user.status intValue] == 10) { - self.rightLabel.text = @"已邀请"; + self.rightLabel.text = RCDLocalizedString(@"had_invite"); self.selected = NO; self.arrow.hidden = YES; self.acceptBtn.hidden = YES; diff --git a/ios-rongimdemo/RCloudMessage/RCDAddressBookViewController.m b/ios-rongimdemo/RCloudMessage/RCDAddressBookViewController.m index 352d74e3..a0beb8b0 100644 --- a/ios-rongimdemo/RCloudMessage/RCDAddressBookViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDAddressBookViewController.m @@ -50,9 +50,10 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; - self.navigationItem.title = @"新朋友"; + self.navigationItem.title = RCDLocalizedString(@"new_friend"); self.tableView.tableFooterView = [UIView new]; + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; _friendsDic = [[NSMutableDictionary alloc] init]; @@ -66,6 +67,10 @@ - (void)viewWillAppear:(BOOL)animated { [self getAllData]; } +- (void)viewDidLayoutSubviews { + self.noFriendView.frame = self.view.bounds; +} + //删除已选中用户 - (void)removeSelectedUsers:(NSArray *)selectedUsers { for (RCUserInfo *user in selectedUsers) { @@ -92,7 +97,7 @@ - (void)getAllData { } else { CGRect frame = CGRectMake(0, 0, RCDscreenWidth, RCDscreenHeight - 64); self.noFriendView = [[RCDNoFriendView alloc] initWithFrame:frame]; - self.noFriendView.displayLabel.text = @"暂无数据"; + self.noFriendView.displayLabel.text = RCDLocalizedString(@"no_invite"); [self.view addSubview:self.noFriendView]; [self.view bringSubviewToFront:self.noFriendView]; } @@ -169,7 +174,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath - (void)doAccept:(UIButton *)sender { hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.color = [UIColor colorWithHexString:@"343637" alpha:0.5]; - hud.labelText = @"添加好友中..."; + hud.labelText = RCDLocalizedString(@"adding_friend"); [hud show:YES]; NSInteger tempTag = sender.tag; tempTag -= 5000; @@ -186,7 +191,7 @@ - (void)doAccept:(UIButton *)sender { cell.acceptBtn.hidden = YES; cell.arrow.hidden = NO; cell.rightLabel.hidden = NO; - cell.rightLabel.text = @"已接受"; + cell.rightLabel.text = RCDLocalizedString(@"had_accept"); cell.selected = YES; [hud hide:YES]; }); @@ -197,10 +202,11 @@ - (void)doAccept:(UIButton *)sender { } else { dispatch_async(dispatch_get_main_queue(), ^{ [hud hide:YES]; - UIAlertView *failAlert = [[UIAlertView alloc] initWithTitle:@"添加失败" + UIAlertView *failAlert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"add_fail") message:nil delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [failAlert show]; }); diff --git a/ios-rongimdemo/RCloudMessage/RCDChatListViewController.m b/ios-rongimdemo/RCloudMessage/RCDChatListViewController.m index 1aa508dc..50c53569 100644 --- a/ios-rongimdemo/RCloudMessage/RCDChatListViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDChatListViewController.m @@ -16,13 +16,12 @@ #import "RCDHttpTool.h" #import "RCDPublicServiceListViewController.h" #import "RCDSearchBar.h" -#import "RCDSearchFriendViewController.h" #import "RCDSearchViewController.h" #import "RCDUIBarButtonItem.h" #import "UIColor+RCColor.h" #import "UIImageView+WebCache.h" #import "UITabBar+badge.h" - +#import "RCDSearchFriendController.h" @interface RCDChatListViewController () @property(nonatomic, strong) UINavigationController *searchNavigationController; @property(nonatomic, strong) UIView *headerView; @@ -144,6 +143,12 @@ - (void)viewDidLoad { [self checkVersion]; } +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + self.searchBar.frame = CGRectMake(0, 0, self.conversationListTableView.frame.size.width, 44); + [self updateBadgeValueForTabBarItem]; +} + - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; self.navigationController.navigationBar.translucent = NO; @@ -159,7 +164,7 @@ - (void)viewWillAppear:(BOOL)animated { target:self action:@selector(showMenu:)]; self.tabBarController.navigationItem.rightBarButtonItems = @[rightBtn]; - self.tabBarController.navigationItem.title = @"会话"; + self.tabBarController.navigationItem.title = RCDLocalizedString(@"conversation"); // [self notifyUpdateUnreadMessageCount]; [[NSNotificationCenter defaultCenter] addObserver:self @@ -229,8 +234,8 @@ - (void)onSelectedTableRow:(RCConversationModelType)conversationModelType _conversationVC.enableNewComingMessageIcon = YES; //开启消息提醒 _conversationVC.enableUnreadMessageIcon = YES; if (model.conversationType == ConversationType_SYSTEM) { - _conversationVC.userName = @"系统消息"; - _conversationVC.title = @"系统消息"; + _conversationVC.userName = RCDLocalizedString(@"de_actionbar_sub_system"); + _conversationVC.title = RCDLocalizedString(@"de_actionbar_sub_system"); } if ([model.objectName isEqualToString:@"RC:ContactNtf"]) { RCDAddressBookViewController *addressBookVC = [RCDAddressBookViewController addressBookViewController]; @@ -277,22 +282,23 @@ - (void)onSelectedTableRow:(RCConversationModelType)conversationModelType - (void)showMenu:(UIButton *)sender { NSArray *menuItems = @[ - [KxMenuItem menuItem:@"发起聊天" + [KxMenuItem menuItem:RCDLocalizedString(@"start_chatting") image:[UIImage imageNamed:@"startchat_icon"] target:self action:@selector(pushChat:)], - [KxMenuItem menuItem:@"创建群组" + [KxMenuItem menuItem:RCDLocalizedString(@"create_groups") image:[UIImage imageNamed:@"creategroup_icon"] target:self action:@selector(pushContactSelected:)], - [KxMenuItem menuItem:@"添加好友" + [KxMenuItem menuItem:RCDLocalizedString(@"add_contacts") + image:[UIImage imageNamed:@"addfriend_icon"] target:self action:@selector(pushAddFriend:)], #if RCDDebugTestFunction - [KxMenuItem menuItem:@"创建讨论组" + [KxMenuItem menuItem:RCDLocalizedString(@"create_discussion_group") image:[UIImage imageNamed:@"addfriend_icon"] target:self action:@selector(pushToCreateDiscussion:)], @@ -322,7 +328,7 @@ - (void)pushChat:(id)sender { RCDContactSelectedTableViewController *contactSelectedVC = [[RCDContactSelectedTableViewController alloc] init]; // contactSelectedVC.forCreatingDiscussionGroup = YES; contactSelectedVC.isAllowsMultipleSelection = NO; - contactSelectedVC.titleStr = @"发起聊天"; + contactSelectedVC.titleStr = RCDLocalizedString(@"start_chatting"); [self.navigationController pushViewController:contactSelectedVC animated:YES]; } @@ -335,7 +341,7 @@ - (void)pushContactSelected:(id)sender { RCDContactSelectedTableViewController *contactSelectedVC = [[RCDContactSelectedTableViewController alloc] init]; contactSelectedVC.forCreatingGroup = YES; contactSelectedVC.isAllowsMultipleSelection = YES; - contactSelectedVC.titleStr = @"选择联系人"; + contactSelectedVC.titleStr = RCDLocalizedString(@"select_contact"); [self.navigationController pushViewController:contactSelectedVC animated:YES]; } @@ -355,7 +361,7 @@ - (void)pushPublicService:(id)sender { * @param sender sender description */ - (void)pushAddFriend:(id)sender { - RCDSearchFriendViewController *searchFirendVC = [RCDSearchFriendViewController searchFriendViewController]; + RCDSearchFriendController *searchFirendVC = [[RCDSearchFriendController alloc] init]; [self.navigationController pushViewController:searchFirendVC animated:YES]; } @@ -447,7 +453,7 @@ - (RCConversationBaseCell *)rcConversationListTableView:(UITableView *)tableView if (_contactNotificationMsg.sourceUserId == nil) { RCDChatListCell *cell = [[RCDChatListCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@""]; - cell.lblDetail.text = @"好友请求"; + cell.lblDetail.text = RCDLocalizedString(@"friend_request"); [cell.ivAva sd_setImageWithURL:[NSURL URLWithString:portraitUri] placeholderImage:[UIImage imageNamed:@"system_notice"]]; return cell; @@ -498,9 +504,9 @@ - (RCConversationBaseCell *)rcConversationListTableView:(UITableView *)tableView NSString *operation = _contactNotificationMsg.operation; NSString *operationContent; if ([operation isEqualToString:@"Request"]) { - operationContent = [NSString stringWithFormat:@"来自%@的好友请求", userName]; + operationContent = [NSString stringWithFormat:RCDLocalizedString(@"from_someone_friend_request"), userName]; } else if ([operation isEqualToString:@"AcceptResponse"]) { - operationContent = [NSString stringWithFormat:@"%@通过了你的好友请求", userName]; + operationContent = [NSString stringWithFormat:RCDLocalizedString(@"someone_accept_you_friend_request"), userName]; } cell.lblDetail.text = operationContent; [cell.ivAva sd_setImageWithURL:[NSURL URLWithString:portraitUri] @@ -597,8 +603,8 @@ - (void)didTapCellPortrait:(RCConversationModel *)model { _conversationVC.enableNewComingMessageIcon = YES; //开启消息提醒 _conversationVC.enableUnreadMessageIcon = YES; if (model.conversationType == ConversationType_SYSTEM) { - _conversationVC.userName = @"系统消息"; - _conversationVC.title = @"系统消息"; + _conversationVC.userName = RCDLocalizedString(@"de_actionbar_sub_system"); + _conversationVC.title = RCDLocalizedString(@"de_actionbar_sub_system"); } if ([model.objectName isEqualToString:@"RC:ContactNtf"]) { RCDAddressBookViewController *addressBookVC = [RCDAddressBookViewController addressBookViewController]; @@ -690,7 +696,7 @@ - (void)pushToCreateDiscussion:(id)sender { RCDContactSelectedTableViewController *contactSelectedVC = [[RCDContactSelectedTableViewController alloc] init]; contactSelectedVC.forCreatingDiscussionGroup = YES; contactSelectedVC.isAllowsMultipleSelection = YES; - contactSelectedVC.titleStr = @"选择联系人"; + contactSelectedVC.titleStr = RCDLocalizedString(@"select_contact"); [self.navigationController pushViewController:contactSelectedVC animated:YES]; } diff --git a/ios-rongimdemo/RCloudMessage/RCDChatRoomTableViewCell.h b/ios-rongimdemo/RCloudMessage/RCDChatRoomTableViewCell.h deleted file mode 100644 index f550e567..00000000 --- a/ios-rongimdemo/RCloudMessage/RCDChatRoomTableViewCell.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// RCDChatRoomTableViewCell.h -// RCloudMessage -// -// Created by 杜立召 on 15/3/26. -// Copyright (c) 2015年 RongCloud. All rights reserved. -// - -#import - -@interface RCDChatRoomTableViewCell : UITableViewCell -@property(weak, nonatomic) IBOutlet UILabel *lbChatroom; -@property(weak, nonatomic) IBOutlet UIImageView *ivChatRoomPortrait; -@property(weak, nonatomic) IBOutlet UILabel *lbNumber; -@property(weak, nonatomic) IBOutlet UILabel *lbDescription; - -@end diff --git a/ios-rongimdemo/RCloudMessage/RCDChatRoomTableViewCell.m b/ios-rongimdemo/RCloudMessage/RCDChatRoomTableViewCell.m deleted file mode 100644 index 8a439a6e..00000000 --- a/ios-rongimdemo/RCloudMessage/RCDChatRoomTableViewCell.m +++ /dev/null @@ -1,32 +0,0 @@ -// -// RCDChatRoomTableViewCell.m -// RCloudMessage -// -// Created by 杜立召 on 15/3/26. -// Copyright (c) 2015年 RongCloud. All rights reserved. -// - -#import "RCDChatRoomTableViewCell.h" - -@implementation RCDChatRoomTableViewCell - -- (instancetype)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - self.ivChatRoomPortrait.layer.cornerRadius = 5.f; - self.ivChatRoomPortrait.layer.masksToBounds = YES; - } - return self; -} - -- (void)awakeFromNib { - [super awakeFromNib]; -} - -- (void)setSelected:(BOOL)selected animated:(BOOL)animated { - [super setSelected:selected animated:animated]; - - // Configure the view for the selected state -} - -@end diff --git a/ios-rongimdemo/RCloudMessage/RCDChatRoomViewController.h b/ios-rongimdemo/RCloudMessage/RCDChatRoomViewController.h deleted file mode 100644 index d4996905..00000000 --- a/ios-rongimdemo/RCloudMessage/RCDChatRoomViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ChatRoomViewController.h -// RongCloud -// -// Created by Liv on 14/10/31. -// Copyright (c) 2014年 RongCloud. All rights reserved. -// - -#import - -@interface RCDChatRoomViewController : UITableViewController - -@end diff --git a/ios-rongimdemo/RCloudMessage/RCDChatRoomViewController.m b/ios-rongimdemo/RCloudMessage/RCDChatRoomViewController.m deleted file mode 100644 index 60a004c4..00000000 --- a/ios-rongimdemo/RCloudMessage/RCDChatRoomViewController.m +++ /dev/null @@ -1,140 +0,0 @@ -// -// ChatRoomViewController.m -// RongCloud -// -// Created by Liv on 14/10/31. -// Copyright (c) 2014年 RongCloud. All rights reserved. -// - -#import "RCDChatRoomViewController.h" -#import "RCDChatRoomInfo.h" -#import "RCDChatRoomTableViewCell.h" -#import "RCDChatViewController.h" -#import "UIColor+RCColor.h" - -@interface RCDChatRoomViewController () -@property(nonatomic, strong) NSMutableArray *chatRoomList; -@end - -@implementation RCDChatRoomViewController - -- (id)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - //设置为不用默认渲染方式 - self.tabBarItem.image = - [[UIImage imageNamed:@"icon_room"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; - self.tabBarItem.selectedImage = - [[UIImage imageNamed:@"icon_room_hover"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view. - - //设置tableView样式 - self.tableView.separatorColor = [UIColor colorWithHexString:@"dfdfdf" alpha:1.0f]; - self.tableView.tableFooterView = [UIView new]; - // self.tableView.tableHeaderView = [[UIView alloc] - // initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, - // 12)]; - - _chatRoomList = [[NSMutableArray alloc] init]; - RCDChatRoomInfo *chatRoom1 = [[RCDChatRoomInfo alloc] init]; - chatRoom1.chatRoomId = @"chatroom001"; - chatRoom1.introduce = @"多年专注于移动互联网即时通"; - chatRoom1.chatRoomName = @"Chatroom A"; - chatRoom1.category = @"# 在线服务 #"; - chatRoom1.maxNumber = @"500"; - chatRoom1.portrait = @"icon_1"; - [_chatRoomList addObject:chatRoom1]; - - RCDChatRoomInfo *chatRoom2 = [[RCDChatRoomInfo alloc] init]; - chatRoom2.chatRoomId = @"chatroom002"; - chatRoom2.introduce = @"单聊群聊多种使用场景"; - chatRoom2.chatRoomName = @"Chatroom B"; - chatRoom2.category = @"# 云服务 #"; - chatRoom2.maxNumber = @"500"; - chatRoom2.portrait = @"icon_2"; - [_chatRoomList addObject:chatRoom2]; - - RCDChatRoomInfo *chatRoom3 = [[RCDChatRoomInfo alloc] init]; - chatRoom3.chatRoomId = @"chatroom003"; - chatRoom3.introduce = @"提供文字表情防语音片段等..."; - chatRoom3.chatRoomName = @"Chatroom C"; - chatRoom3.category = @"# 设计 #"; - chatRoom3.maxNumber = @"500"; - chatRoom3.portrait = @"icon_3"; - [_chatRoomList addObject:chatRoom3]; - - // RCDChatRoomInfo *chatRoom4=[[RCDChatRoomInfo alloc]init]; - // chatRoom4.chatRoomId=@"chatroom004"; - // chatRoom4.introduce=@"各类时尚资讯"; - // chatRoom4.chatRoomName=@"DaveDing"; - // chatRoom4.category=@"# 时尚 #"; - // chatRoom4.maxNumber=@"500"; - // chatRoom4.portrait=@"icon_3"; - // [_chatRoomList addObject:chatRoom4]; - // - // RCDChatRoomInfo *chatRoom5=[[RCDChatRoomInfo alloc]init]; - // chatRoom5.chatRoomId=@"chatroom005"; - // chatRoom5.introduce=@"多年专注于移动互联网即时通"; - // chatRoom5.chatRoomName=@"lovry"; - // chatRoom5.category=@"# 文艺 #"; - // chatRoom5.maxNumber=@"500"; - // chatRoom5.portrait=@"icon_3"; - // [_chatRoomList addObject:chatRoom5]; -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - UILabel *titleView = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, 44)]; - titleView.backgroundColor = [UIColor clearColor]; - titleView.font = [UIFont boldSystemFontOfSize:19]; - titleView.textColor = [UIColor whiteColor]; - titleView.textAlignment = NSTextAlignmentCenter; - titleView.text = @"聊天室"; - self.tabBarController.navigationItem.titleView = titleView; - // self.tabBarController.navigationItem.title = @"聊天室"; - self.tabBarController.navigationItem.rightBarButtonItem = nil; -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -#pragma mark--UITableViewDataSource -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return _chatRoomList.count; -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *CellIdentifier = @"RCDChatRoomTableViewCell"; - RCDChatRoomTableViewCell *cell = - (RCDChatRoomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - - RCDChatRoomInfo *chatRoom = _chatRoomList[indexPath.row]; - cell.lbChatroom.text = chatRoom.chatRoomName; - cell.lbNumber.text = chatRoom.category; - cell.lbDescription.text = chatRoom.introduce; - UIImage *img = [UIImage imageNamed:chatRoom.portrait]; - cell.ivChatRoomPortrait.image = img; - cell.ivChatRoomPortrait.layer.cornerRadius = 5.f; - cell.ivChatRoomPortrait.layer.masksToBounds = YES; - return cell; -} - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - RCDChatRoomInfo *chatRoom = _chatRoomList[indexPath.row]; - RCDChatViewController *temp = [[RCDChatViewController alloc] init]; - temp.targetId = chatRoom.chatRoomId; - temp.conversationType = ConversationType_CHATROOM; - temp.userName = chatRoom.chatRoomName; - temp.title = chatRoom.chatRoomName; - [self.navigationController pushViewController:temp animated:YES]; -} - -@end diff --git a/ios-rongimdemo/RCloudMessage/RCDChatViewController.m b/ios-rongimdemo/RCloudMessage/RCDChatViewController.m index 8412f035..90e8c95d 100644 --- a/ios-rongimdemo/RCloudMessage/RCDChatViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDChatViewController.m @@ -264,6 +264,11 @@ - (void)viewDidLoad { [self addToolbarItems]; } +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + self.realTimeLocationStatusView.frame = CGRectMake(0, 62, self.view.frame.size.width, 0); +} + - (void)willMoveToParentViewController:(UIViewController*)parent{ [super willMoveToParentViewController:parent]; if (!parent) { @@ -359,10 +364,13 @@ - (void)leftBarButtonItemPressed:(id)sender { [self.realTimeLocation getStatus] == RC_REAL_TIME_LOCATION_STATUS_CONNECTED) { [self.chatSessionInputBarControl resetToDefaultStatus]; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"离开聊天,位置共享也会结束,确认离开" + message:RCDLocalizedString(@"leave_location_share_when_leave_chat") + delegate:self - cancelButtonTitle:@"取消" - otherButtonTitles:@"确定", nil]; + cancelButtonTitle:RCDLocalizedString(@"cancel") + + otherButtonTitles:RCDLocalizedString(@"confirm") +, nil]; alertView.tag = 101; [alertView show]; } else { @@ -478,7 +486,7 @@ - (void)didLongTouchMessageCell:(RCMessageModel *)model inView:(UIView *)view { - (void)setLeftNavigationItem { - RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(leftBarButtonItemPressed:)]; + RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(leftBarButtonItemPressed:)]; [self.navigationItem setLeftBarButtonItem:leftButton]; } @@ -497,11 +505,11 @@ - (void)notifyUpdateUnreadMessageCount { dispatch_async(dispatch_get_main_queue(), ^{ NSString *backString = nil; if (count > 0 && count < 1000) { - backString = [NSString stringWithFormat:@"返回(%d)", count]; + backString = [NSString stringWithFormat:@"%@(%d)",RCDLocalizedString(@"back"),count]; } else if (count >= 1000) { - backString = @"返回(...)"; + backString = [NSString stringWithFormat:@"%@(...)",RCDLocalizedString(@"back")]; } else { - backString = @"返回"; + backString = RCDLocalizedString(@"back"); } RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:backString target:self action:@selector(leftBarButtonItemPressed:)]; [self.navigationItem setLeftBarButtonItem:leftButton]; @@ -527,9 +535,10 @@ - (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag: if (self.realTimeLocation) { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + destructiveButtonTitle:nil - otherButtonTitles:@"发送位置", @"位置实时共享", nil]; + otherButtonTitles:RCDLocalizedString(@"send_location"), RCDLocalizedString(@"location_share"), nil]; [actionSheet showInView:self.view]; } else { [super pluginBoardView:pluginBoardView clickedItemWithTag:tag]; @@ -725,16 +734,17 @@ - (void)onReceiveLocation:(CLLocation *)location type:(RCRealTimeLocationType)ty - (void)onParticipantsJoin:(NSString *)userId { __weak typeof(self) weakSelf = self; if ([userId isEqualToString:[RCIMClient sharedRCIMClient].currentUserInfo.userId]) { - [self notifyParticipantChange:@"你加入了地理位置共享"]; + [self notifyParticipantChange:RCDLocalizedString(@"you_join_location_share")]; } else { [[RCIM sharedRCIM].userInfoDataSource getUserInfoWithUserId:userId completion:^(RCUserInfo *userInfo) { if (userInfo.name.length) { - [weakSelf notifyParticipantChange:[NSString stringWithFormat:@"%@加入地理位置共享", + [weakSelf notifyParticipantChange:[NSString stringWithFormat:RCDLocalizedString(@"someone_join_share_location"), userInfo.name]]; } else { - [weakSelf notifyParticipantChange:[NSString stringWithFormat:@"user<%@>加入地理位置共享", + [weakSelf notifyParticipantChange:[NSString stringWithFormat:RCDLocalizedString(@"user_join_share_location") +, userId]]; } }]; @@ -744,16 +754,16 @@ - (void)onParticipantsJoin:(NSString *)userId { - (void)onParticipantsQuit:(NSString *)userId { __weak typeof(self) weakSelf = self; if ([userId isEqualToString:[RCIMClient sharedRCIMClient].currentUserInfo.userId]) { - [self notifyParticipantChange:@"你退出地理位置共享"]; + [self notifyParticipantChange:RCDLocalizedString(@"you_quit_location_share")]; } else { [[RCIM sharedRCIM].userInfoDataSource getUserInfoWithUserId:userId completion:^(RCUserInfo *userInfo) { if (userInfo.name.length) { - [weakSelf notifyParticipantChange:[NSString stringWithFormat:@"%@退出地理位置共享", + [weakSelf notifyParticipantChange:[NSString stringWithFormat:RCDLocalizedString(@"someone_quit_location_share"), userInfo.name]]; } else { - [weakSelf notifyParticipantChange:[NSString stringWithFormat:@"user<%@>退出地理位置共享", + [weakSelf notifyParticipantChange:[NSString stringWithFormat:RCDLocalizedString(@"user_quit_location_share"), userId]]; } }]; @@ -832,7 +842,7 @@ - (void)updateRealTimeLocationStatus { NSArray *participants = nil; switch ([self.realTimeLocation getStatus]) { case RC_REAL_TIME_LOCATION_STATUS_OUTGOING: - [self.realTimeLocationStatusView updateText:@"你正在共享位置"]; + [self.realTimeLocationStatusView updateText:RCDLocalizedString(@"you_location_sharing")]; break; case RC_REAL_TIME_LOCATION_STATUS_CONNECTED: case RC_REAL_TIME_LOCATION_STATUS_INCOMING: @@ -840,14 +850,14 @@ - (void)updateRealTimeLocationStatus { if (participants.count == 1) { NSString *userId = participants[0]; [weakSelf.realTimeLocationStatusView - updateText:[NSString stringWithFormat:@"user<%@>正在共享位置", userId]]; + updateText:[NSString stringWithFormat:RCDLocalizedString(@"user_location_sharing"), userId]]; [[RCIM sharedRCIM].userInfoDataSource getUserInfoWithUserId:userId completion:^(RCUserInfo *userInfo) { if (userInfo.name.length) { dispatch_async(dispatch_get_main_queue(), ^{ [weakSelf.realTimeLocationStatusView - updateText:[NSString stringWithFormat:@"%@正在共享位置", userInfo.name]]; + updateText:[NSString stringWithFormat:RCDLocalizedString(@"someone_location_sharing"), userInfo.name]]; }); } }]; @@ -1119,16 +1129,17 @@ - (void)forwardMessage{ [RCDForwardMananer shareInstance].isForward = YES; [RCDForwardMananer shareInstance].selectedMessages = self.selectedMessages; RCDContactViewController *contactViewController = [[RCDContactViewController alloc] init]; - contactViewController.title = @"选择一个聊天"; + contactViewController.title = RCDLocalizedString(@"select_contact"); UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:contactViewController]; [self.navigationController presentViewController:navi animated:YES completion:nil]; return; } UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"语音、表情、红包、发送失败的消息和其它特殊消息类型不支持转发。" + message:RCDLocalizedString(@"Forwarding_is_not_supported") delegate:nil cancelButtonTitle:nil - otherButtonTitles:@"确定", nil]; + otherButtonTitles:RCDLocalizedString(@"confirm") +, nil]; [alertView show]; } diff --git a/ios-rongimdemo/RCloudMessage/RCDConversationSettingBaseViewController.m b/ios-rongimdemo/RCloudMessage/RCDConversationSettingBaseViewController.m index 21d94065..3337880e 100644 --- a/ios-rongimdemo/RCloudMessage/RCDConversationSettingBaseViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDConversationSettingBaseViewController.m @@ -136,7 +136,8 @@ - (NSArray *)defaultCells { forControlEvents:UIControlEventValueChanged]; _cell_newMessageNotify.swich.on = _switch_newMessageNotify; _cell_newMessageNotify.label.text = - NSLocalizedStringFromTable(@"NewMsgNotification", @"RongCloudKit", nil); //@"新消息通知"; + NSLocalizedStringFromTable(@"NewMsgNotification", @"RongCloudKit", nil); //RCDLocalizedString(@"new_message_notification") +; RCDConversationSettingClearMessageCell *cell_clearHistory = [[RCDConversationSettingClearMessageCell alloc] initWithFrame:CGRectZero]; @@ -144,7 +145,7 @@ - (NSArray *)defaultCells { action:@selector(onClickClearMessageHistory:) forControlEvents:UIControlEventTouchUpInside]; cell_clearHistory.nameLabel.text = - NSLocalizedStringFromTable(@"ClearRecord", @"RongCloudKit", nil); //@"清除聊天记录"; + NSLocalizedStringFromTable(@"ClearRecord", @"RongCloudKit", nil); //RCDLocalizedString(@"clear_chat_history"); NSArray *_defaultCells = @[ _cell_isTop, _cell_newMessageNotify, cell_clearHistory ]; diff --git a/ios-rongimdemo/RCloudMessage/RCDCustomerServiceViewController.m b/ios-rongimdemo/RCloudMessage/RCDCustomerServiceViewController.m index 7786e73c..2f528cb5 100644 --- a/ios-rongimdemo/RCloudMessage/RCDCustomerServiceViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDCustomerServiceViewController.m @@ -10,6 +10,7 @@ #import "RCDCSAnnounceView.h" #import "RCDCSEvaluateView.h" #import "RCDCSEvaluateModel.h" +#import "RCDCommonDefine.h" @interface RCDCustomerServiceViewController () //*********应用自定义评价界面开始1************* @property (nonatomic, strong)NSString *commentId; @@ -51,6 +52,20 @@ -(void)viewWillAppear:(BOOL)animated { self.navigationItem.rightBarButtonItems = nil; } +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + + CGRect collectionViewFrame = self.conversationMessageCollectionView.frame; + CGRect frame = CGRectMake(0, collectionViewFrame.origin.y, self.view.frame.size.width, 44); + if (RCDIsIPad) { + frame.origin.y += 20; + collectionViewFrame.origin.y += 64; + collectionViewFrame.size.height -= 64; + self.conversationMessageCollectionView.frame = collectionViewFrame; + } + self.announceView.frame = frame; +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. @@ -104,9 +119,9 @@ - (void)clickLeftBarButtonItem:(id)sender { } else if (serviceStatus == 2) { //机器人评价结果 UIAlertView *alert = [[UIAlertView alloc] - initWithTitle:@"请评价我们的机器人服务" - message:@"如果您满意就按是,不满意就按否" delegate:self - cancelButtonTitle:@"是" otherButtonTitles:@"否", nil]; + initWithTitle:RCDLocalizedString(@"remark_rebot_service") + message:RCDLocalizedString(@"satisfaction") delegate:self + cancelButtonTitle:RCDLocalizedString(@"yes") otherButtonTitles:RCDLocalizedString(@"no"), nil]; [alert show]; } } @@ -192,7 +207,7 @@ - (void) createNavLeftBarButtonItem { UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom]; backBtn.frame = CGRectMake(0, 6, 72, 23); UILabel *backText = [[UILabel alloc] initWithFrame:CGRectMake(12, 0, 70, 22)]; - backText.text = @"返回"; + backText.text = RCDLocalizedString(@"back"); backText.font = [UIFont systemFontOfSize:17]; [backText setBackgroundColor:[UIColor clearColor]]; [backText setTextColor:[RCIM sharedRCIM].globalNavigationBarTintColor]; diff --git a/ios-rongimdemo/RCloudMessage/RCDDiscussGroupSettingViewController.m b/ios-rongimdemo/RCloudMessage/RCDDiscussGroupSettingViewController.m index 5aac049a..898152a0 100644 --- a/ios-rongimdemo/RCloudMessage/RCDDiscussGroupSettingViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDDiscussGroupSettingViewController.m @@ -24,6 +24,7 @@ @interface RCDDiscussGroupSettingViewController () @property(nonatomic, copy) NSString *creatorId; @property(nonatomic, strong) NSMutableDictionary *members; @property(nonatomic, strong) NSMutableArray *userList; +@property(nonatomic, strong) UIButton *button; @property(nonatomic) BOOL isOwner; @property(nonatomic, assign) BOOL isClick; @end @@ -100,11 +101,14 @@ - (void)viewDidLoad { UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width - 42, 90 / 2)]; [button setBackgroundImage:image forState:UIControlStateNormal]; - [button setTitle:@"删除并退出" forState:UIControlStateNormal]; + [button setTitle:RCDLocalizedString(@"delete_and_exit") + forState:UIControlStateNormal]; [button setCenter:CGPointMake(view.bounds.size.width / 2, view.bounds.size.height / 2)]; [button addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside]; [view addSubview:button]; + self.button = button; self.tableView.tableFooterView = view; + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshHeaderView:) @@ -117,11 +121,19 @@ - (void)viewWillAppear:(BOOL)animated { _isClick = YES; } +- (void)viewDidLayoutSubviews { + self.button.frame = CGRectMake(0, 0, self.view.frame.size.width - 42, 90 / 2); + [self.button setCenter:CGPointMake(self.view.bounds.size.width / 2, 45 / 2)]; +} + - (void)buttonAction:(UIButton *)sender { - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"删除并且退出讨论组" + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:RCDLocalizedString(@"delete_and_exit_discuss_group") + delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [actionSheet showInView:self.view]; } @@ -175,14 +187,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case 0: { RCDDiscussSettingCell *discussCell = [[RCDDiscussSettingCell alloc] initWithFrame:CGRectZero]; discussCell.lblDiscussName.text = self.conversationTitle; - discussCell.lblTitle.text = @"讨论组名称"; + discussCell.lblTitle.text = RCDLocalizedString(@"discussion_group_name"); cell = discussCell; _discussTitle = discussCell.lblDiscussName.text; } break; case 1: { if (self.isOwner) { RCDDiscussSettingSwitchCell *switchCell = [[RCDDiscussSettingSwitchCell alloc] initWithFrame:CGRectZero]; - switchCell.label.text = @"开放成员邀请"; + switchCell.label.text = RCDLocalizedString(@"open_member_invite"); [[RCIMClient sharedRCIMClient] getDiscussion:self.targetId success:^(RCDiscussion *discussion) { if (discussion.inviteStatus == 0) { @@ -319,7 +331,7 @@ - (void)openMemberInv:(UISwitch *)swch { [[RCIM sharedRCIM] setDiscussionInviteStatus:self.targetId isOpen:swch.on success:^{ - // DebugLog(@"设置成功"); + // DebugLog(RCDLocalizedString(@"setting_success")); } error:^(RCErrorCode status){ @@ -337,7 +349,7 @@ - (void)viewWillDisappear:(BOOL)animated { - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row == 0) { RCDDiscussSettingCell *discussCell = (RCDDiscussSettingCell *)[tableView cellForRowAtIndexPath:indexPath]; - discussCell.lblTitle.text = @"讨论组名称"; + discussCell.lblTitle.text = RCDLocalizedString(@"discussion_group_name"); RCDUpdateNameViewController *updateNameViewController = [RCDUpdateNameViewController updateNameViewController]; updateNameViewController.targetId = self.targetId; updateNameViewController.displayText = discussCell.lblDiscussName.text; diff --git a/ios-rongimdemo/RCloudMessage/RCDEditUserNameViewController.m b/ios-rongimdemo/RCloudMessage/RCDEditUserNameViewController.m index 68061e60..b2a74259 100644 --- a/ios-rongimdemo/RCloudMessage/RCDEditUserNameViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDEditUserNameViewController.m @@ -42,7 +42,7 @@ - (void)viewDidLoad { self.view.backgroundColor = [UIColor colorWithHexString:@"f0f0f6" alpha:1.f]; [self setNavigationButton]; [self setSubViews]; - self.navigationItem.title = @"昵称修改"; + self.navigationItem.title = RCDLocalizedString(@"modify_nickname"); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldEditChanged:) name:@"UITextFieldTextDidChangeNotification" @@ -56,16 +56,17 @@ - (void)saveUserName:(id)sender { __weak __typeof(self) weakSelf = self; NSString *errorMsg = @""; if (self.userName.text.length == 0) { - errorMsg = @"用户名不能为空!"; + errorMsg = RCDLocalizedString(@"username_can_not_nil"); } else if (self.userName.text.length > 32) { - errorMsg = @"用户名不能大于32位!"; + errorMsg = RCDLocalizedString(@"Username_cannot_be_greater_than_32_digits"); } if ([errorMsg length] > 0) { [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:errorMsg delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alert show]; } else { @@ -86,9 +87,10 @@ - (void)saveUserName:(id)sender { failure:^(NSError *err) { [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"修改失败,请检查输入的名称" + message:RCDLocalizedString(@"modify_nickname_fail") delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alert show]; }]; @@ -100,10 +102,11 @@ - (void)didReceiveMemoryWarning { } - (void)setNavigationButton { - self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(clickBackBtn)]; + self.leftBtn = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(clickBackBtn)]; self.navigationItem.leftBarButtonItem = self.leftBtn; - self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:@"保存" + self.rightBtn = [[RCDUIBarButtonItem alloc] initWithbuttonTitle:RCDLocalizedString(@"save") + titleColor:[UIColor colorWithHexString:@"9fcdfd" alpha:1.0] buttonFrame:CGRectMake(0, 0, 50, 30) target:self diff --git a/ios-rongimdemo/RCloudMessage/RCDFindPswViewController.m b/ios-rongimdemo/RCloudMessage/RCDFindPswViewController.m index 4856487d..81fe3c90 100644 --- a/ios-rongimdemo/RCloudMessage/RCDFindPswViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDFindPswViewController.m @@ -13,16 +13,20 @@ #import "RCDRegisterViewController.h" #import "RCUnderlineTextField.h" #import "UIColor+RCColor.h" +#import "RCDIndicateTextField.h" +#import "RCDCountryListController.h" +#import "RCDCountry.h" +#import "RCDLanguageManager.h" +#import "AppDelegate.h" +@interface RCDFindPswViewController () +@property(nonatomic, strong) RCDCountry *currentRegion; + +@property(nonatomic, strong) RCDIndicateTextField *countryTextField; +@property(nonatomic, strong) RCDIndicateTextField *phoneTextField; -@interface RCDFindPswViewController () -@property(unsafe_unretained, nonatomic) IBOutlet UITextField *tfEmail; -@property(unsafe_unretained, nonatomic) IBOutlet UITextField *tfNickName; -@property(unsafe_unretained, nonatomic) IBOutlet UITextField *tfPassword; -@property(unsafe_unretained, nonatomic) IBOutlet UITextField *tfRePassword; @property(nonatomic, strong) UIView *headBackground; @property(nonatomic, strong) UIImageView *rongLogo; @property(nonatomic, strong) UIView *inputBackground; -@property(weak, nonatomic) IBOutlet UITextField *tfMobile; @property(strong, nonatomic) RCAnimatedImagesView *animatedImagesView; @property(nonatomic, strong) UIView *statusBarView; @property(nonatomic, strong) UILabel *licenseLb; @@ -44,6 +48,7 @@ @implementation RCDFindPswViewController { @synthesize inputBackground = _inputBackground; - (void)viewDidLoad { [super viewDidLoad]; + self.currentRegion = [[RCDCountry alloc] initWithDict:[[NSUserDefaults standardUserDefaults] objectForKey:@"currentCountry"]]; [self.navigationController setNavigationBarHidden:YES animated:YES]; self.animatedImagesView = [[RCAnimatedImagesView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; @@ -56,14 +61,26 @@ - (void)viewDidLoad { [self.view addSubview:_headBackground]; UIButton *registerHeadButton = - [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 80, 0, 70, 50)]; - [registerHeadButton setTitle:@"登录" forState:UIControlStateNormal]; + [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 90, 0, 80, 50)]; + [registerHeadButton setTitle:RCDLocalizedString(@"Login") forState:UIControlStateNormal]; [registerHeadButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + registerHeadButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; [registerHeadButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [registerHeadButton addTarget:self action:@selector(loginPageEvent) forControlEvents:UIControlEventTouchUpInside]; - [_headBackground addSubview:registerHeadButton]; + + UIButton *switchLanguage = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 80,30, 70, 40)]; + [switchLanguage setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; + switchLanguage.titleLabel.font = [UIFont systemFontOfSize:16.]; + NSString *currentlanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentlanguage isEqualToString:@"en"]) { + [switchLanguage setTitle:@"简体中文" forState:(UIControlStateNormal)]; + }else if ([currentlanguage isEqualToString:@"zh-Hans"]){ + [switchLanguage setTitle:@"EN" forState:(UIControlStateNormal)]; + } + [switchLanguage addTarget:self action:@selector(didTapSwitchLanguage:) forControlEvents:(UIControlEventTouchUpInside)]; + [self.animatedImagesView addSubview:switchLanguage]; UIImage *rongLogoSmallImage = [UIImage imageNamed:@"title_logo_small"]; UIImageView *rongLogoSmallImageView = @@ -75,11 +92,12 @@ - (void)viewDidLoad { rongLogoSmallImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight; rongLogoSmallImageView.clipsToBounds = YES; [_headBackground addSubview:rongLogoSmallImageView]; - UIButton *forgetPswHeadButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 80, 50)]; + UIButton *forgetPswHeadButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 0, 80, 50)]; - [forgetPswHeadButton setTitle:@"新用户" forState:UIControlStateNormal]; + [forgetPswHeadButton setTitle:RCDLocalizedString(@"new_user") forState:UIControlStateNormal]; [forgetPswHeadButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + forgetPswHeadButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; [forgetPswHeadButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [forgetPswHeadButton addTarget:self action:@selector(registerEvent) forControlEvents:UIControlEventTouchUpInside]; [_headBackground addSubview:forgetPswHeadButton]; @@ -106,33 +124,21 @@ - (void)viewDidLoad { _errorMsgLb.translatesAutoresizingMaskIntoConstraints = NO; _errorMsgLb.textColor = [UIColor colorWithRed:204.0f / 255.0f green:51.0f / 255.0f blue:51.0f / 255.0f alpha:1]; [self.view addSubview:_errorMsgLb]; - RCUnderlineTextField *userNameTextField = [[RCUnderlineTextField alloc] initWithFrame:CGRectZero]; - - userNameTextField.backgroundColor = [UIColor clearColor]; - userNameTextField.tag = UserTextFieldTag; - //_account.placeholder=[NSString stringWithFormat:@"Email"]; + UIColor *color = [UIColor whiteColor]; - userNameTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"手机号" attributes:@{NSForegroundColorAttributeName : color}]; - userNameTextField.textColor = [UIColor whiteColor]; - self.view.translatesAutoresizingMaskIntoConstraints = YES; - userNameTextField.translatesAutoresizingMaskIntoConstraints = NO; - userNameTextField.delegate = self; - userNameTextField.keyboardType = UIKeyboardTypeNumberPad; - [_inputBackground addSubview:userNameTextField]; - if (userNameTextField.text.length > 0) { - [userNameTextField setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; + self.countryTextField.translatesAutoresizingMaskIntoConstraints = NO; + [_inputBackground addSubview:self.countryTextField]; + self.phoneTextField.translatesAutoresizingMaskIntoConstraints = NO; + [_inputBackground addSubview:self.phoneTextField]; + if (self.phoneTextField.textField.text.length > 0) { + [self.phoneTextField.textField setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; } - [userNameTextField addTarget:self - action:@selector(textFieldDidChange:) - forControlEvents:UIControlEventEditingChanged]; - RCUnderlineTextField *verificationCodeField = [[RCUnderlineTextField alloc] initWithFrame:CGRectZero]; verificationCodeField.backgroundColor = [UIColor clearColor]; verificationCodeField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"验证码" attributes:@{NSForegroundColorAttributeName : color}]; + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"verification_code") attributes:@{NSForegroundColorAttributeName : color}]; verificationCodeField.textColor = [UIColor whiteColor]; verificationCodeField.delegate = self; verificationCodeField.translatesAutoresizingMaskIntoConstraints = NO; @@ -143,7 +149,7 @@ - (void)viewDidLoad { UIButton *sendCodeButton = [[UIButton alloc] initWithFrame:CGRectZero]; [sendCodeButton setBackgroundColor:[[UIColor alloc] initWithRed:133 / 255.f green:133 / 255.f blue:133 / 255.f alpha:1]]; - [sendCodeButton setTitle:@"发送验证码" forState:UIControlStateNormal]; + [sendCodeButton setTitle:RCDLocalizedString(@"send_verification_code") forState:UIControlStateNormal]; [sendCodeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; sendCodeButton.titleLabel.font = [UIFont systemFontOfSize:13]; [sendCodeButton addTarget:self action:@selector(sendCodeEvent) forControlEvents:UIControlEventTouchUpInside]; @@ -169,7 +175,7 @@ - (void)viewDidLoad { //[_inputBackground addSubview:reSendCodeButton]; UILabel *vCodeTimerLb = [[UILabel alloc] initWithFrame:CGRectZero]; - vCodeTimerLb.text = @"60秒后获取"; + vCodeTimerLb.text = RCDLocalizedString(@"after_60_seconds_obtain"); vCodeTimerLb.font = [UIFont fontWithName:@"Heiti SC" size:13.0]; vCodeTimerLb.translatesAutoresizingMaskIntoConstraints = NO; // vCodeTimerLb.textColor = @@ -190,11 +196,12 @@ - (void)viewDidLoad { passwordTextField.secureTextEntry = YES; passwordTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"新密码" attributes:@{NSForegroundColorAttributeName : color}]; + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"new_password") + attributes:@{NSForegroundColorAttributeName : color}]; passwordTextField.translatesAutoresizingMaskIntoConstraints = NO; [_inputBackground addSubview:passwordTextField]; UILabel *pswMsgLb = [[UILabel alloc] initWithFrame:CGRectZero]; - pswMsgLb.text = @"6-16位字符区分大小写"; + pswMsgLb.text = RCDLocalizedString(@"char_section_case_sensitive_from6_t16"); pswMsgLb.font = [UIFont fontWithName:@"Heiti SC" size:10.0]; pswMsgLb.translatesAutoresizingMaskIntoConstraints = NO; pswMsgLb.textColor = [[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5]; @@ -202,8 +209,11 @@ - (void)viewDidLoad { UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeCustom]; [loginButton addTarget:self action:@selector(btnDoneClicked:) forControlEvents:UIControlEventTouchUpInside]; - [loginButton setBackgroundImage:[UIImage imageNamed:@"confirm_button"] forState:UIControlStateNormal]; - loginButton.imageView.contentMode = UIViewContentModeScaleAspectFill; + [loginButton setTitle:RCDLocalizedString(@"confirm") forState:UIControlStateNormal]; + loginButton.backgroundColor = [UIColor colorWithRed:28 / 255.0 green:119 / 255.0 blue:211 / 255.0 alpha:0.95]; + [loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + loginButton.layer.cornerRadius = 3; + loginButton.titleLabel.font = [UIFont systemFontOfSize:23]; loginButton.translatesAutoresizingMaskIntoConstraints = NO; [_inputBackground addSubview:loginButton]; @@ -211,16 +221,18 @@ - (void)viewDidLoad { bottomBackground.translatesAutoresizingMaskIntoConstraints = NO; UIButton *registerButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 100, -16, 80, 50)]; - [registerButton setTitle:@"登录" forState:UIControlStateNormal]; + [registerButton setTitle:RCDLocalizedString(@"Login") forState:UIControlStateNormal]; [registerButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + registerButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; [registerButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [registerButton addTarget:self action:@selector(loginPageEvent) forControlEvents:UIControlEventTouchUpInside]; - UIButton *forgetPswButton = [[UIButton alloc] initWithFrame:CGRectMake(-10, -16, 80, 50)]; - [forgetPswButton setTitle:@"新用户" forState:UIControlStateNormal]; + UIButton *forgetPswButton = [[UIButton alloc] initWithFrame:CGRectMake(0, -16, 80, 50)]; + [forgetPswButton setTitle:RCDLocalizedString(@"new_user") forState:UIControlStateNormal]; [forgetPswButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + forgetPswButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; forgetPswButton.titleLabel.font = [UIFont systemFontOfSize:18]; [forgetPswButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [forgetPswButton addTarget:self action:@selector(registerEvent) forControlEvents:UIControlEventTouchUpInside]; @@ -351,7 +363,7 @@ - (void)viewDidLoad { arrayByAddingObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-70-[_rongLogo(100)]-[_" @"errorMsgLb(==15)]-[_" @"inputBackground(" - @"==235)]" + @"==295)]" options:0 metrics:nil views:views]] @@ -375,13 +387,17 @@ - (void)viewDidLoad { [self.view addConstraints:viewConstraints]; NSDictionary *inputViews = - NSDictionaryOfVariableBindings(verificationCodeField, pswMsgLb, userNameTextField, passwordTextField, + NSDictionaryOfVariableBindings(verificationCodeField, pswMsgLb, _countryTextField, _phoneTextField, passwordTextField, loginButton, vCodeTimerLb, sendCodeButton, vCodeTimerLb); - NSArray *inputViewConstraints = [[[[[[[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[userNameTextField]|" + NSArray *inputViewConstraints = [[[[[[[[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_countryTextField]|" options:0 metrics:nil views:inputViews] + arrayByAddingObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_phoneTextField]|" + options:0 + metrics:nil + views:inputViews]] arrayByAddingObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[passwordTextField]|" options:0 metrics:nil @@ -402,7 +418,7 @@ - (void)viewDidLoad { metrics:nil views:inputViews]] arrayByAddingObjectsFromArray: - [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[userNameTextField(60)]-[verificationCodeField(50)]-[" + [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[_countryTextField(60)]-[_phoneTextField(60)]-[verificationCodeField(50)]-[" @"passwordTextField(55)]-[loginButton(50)]" options:0 metrics:nil @@ -430,6 +446,13 @@ - (void)viewDidLoad { [self.view setNeedsUpdateConstraints]; } +#pragma mark - RCDCountryListControllerDelegate +- (void)fetchCountryPhoneCode:(RCDCountry *)country{ + self.currentRegion = country; + self.countryTextField.textField.text = country.countryName; + self.phoneTextField.indicateInfoLabel.text = [NSString stringWithFormat:@"+%@",self.currentRegion.phoneCode]; +} + - (void)textFieldDidChange:(UITextField *)textField { if (textField.tag == UserTextFieldTag) { if (textField.text.length > 0) { @@ -525,10 +548,10 @@ - (void)sendCodeEvent { hud.color = [UIColor colorWithHexString:@"343637" alpha:0.8]; [hud show:YES]; _errorMsgLb.text = @""; - NSString *phoneNumber = [(UITextField *)[self.view viewWithTag:UserTextFieldTag] text]; - if (phoneNumber.length == 11) { + NSString *phoneNumber = self.phoneTextField.textField.text; + if (phoneNumber.length > 0) { [AFHttpTool - checkPhoneNumberAvailable:@"86" + checkPhoneNumberAvailable:self.currentRegion.phoneCode phoneNumber:phoneNumber success:^(id response) { if ([response[@"code"] intValue] == 200) { @@ -537,7 +560,7 @@ - (void)sendCodeEvent { // isEqualToString:@"Phone number has already // existed."]) { if ([response[@"result"] integerValue] == 0) { - [AFHttpTool getVerificationCode:@"86" + [AFHttpTool getVerificationCode:self.currentRegion.phoneCode phoneNumber:phoneNumber success:^(id response) { [hud hide:YES]; @@ -547,9 +570,17 @@ - (void)sendCodeEvent { ((UIButton *)[self.view viewWithTag:SendCodeButtonTag]).hidden = YES; [self countDown:60]; + }else{ + if([response[@"code"] intValue] == 3102){ + _errorMsgLb.text = RCDLocalizedString(@"phone_number_type_error"); + }else{ + _errorMsgLb.text = response[@"result"][@"msg"]; + } } } failure:^(NSError *err) { + [hud hide:YES]; + _errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); NSLog(@"%@", err); }]; @@ -557,14 +588,19 @@ - (void)sendCodeEvent { [hud hide:YES]; _errorMsgLb.text = @"手机号未注册"; } + }else{ + [hud hide:YES]; + _errorMsgLb.text = RCDLocalizedString(@"phone_number_type_error"); } } failure:^(NSError *err){ + [hud hide:YES]; + _errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); }]; } else { [hud hide:YES]; - _errorMsgLb.text = @"手机号输入有误"; + _errorMsgLb.text = RCDLocalizedString(@"phone_number_type_error"); } } - (void)registerEvent { @@ -572,35 +608,14 @@ - (void)registerEvent { [self.navigationController pushViewController:temp animated:YES]; } -/** - * 获取默认用户 - * - * @return 是否获取到数据 - */ -- (BOOL)getDefaultUser { - NSString *userName = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]; - NSString *userPwd = [[NSUserDefaults standardUserDefaults] objectForKey:@"userPwd"]; - return userName && userPwd; -} -/*获取用户账号*/ -- (NSString *)getDefaultUserName { - NSString *defaultUser = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]; - return defaultUser; -} -/*获取用户密码*/ -- (NSString *)getDefaultUserPwd { - NSString *defaultUserPwd = [[NSUserDefaults standardUserDefaults] objectForKey:@"userPwd"]; - return defaultUserPwd; -} - - (IBAction)btnDoneClicked:(id)sender { _errorMsgLb.text = @""; if (![self checkContent]) return; - NSString *phone = [(UITextField *)[self.view viewWithTag:UserTextFieldTag] text]; + NSString *phone = self.phoneTextField.textField.text; NSString *userPwd = [(UITextField *)[self.view viewWithTag:PassWordFieldTag] text]; NSString *vCode = [(UITextField *)[self.view viewWithTag:VerificationCodeField] text]; - [AFHttpTool verifyVerificationCode:@"86" + [AFHttpTool verifyVerificationCode:self.currentRegion.phoneCode phoneNumber:phone verificationCode:vCode success:^(id response) { @@ -611,7 +626,7 @@ - (IBAction)btnDoneClicked:(id)sender { vToken:vToken success:^(id response) { if ([response[@"code"] intValue] == 200) { - _errorMsgLb.text = @"修改成功!"; + _errorMsgLb.text = RCDLocalizedString(@"change_success"); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ @@ -638,8 +653,6 @@ - (IBAction)btnDoneClicked:(id)sender { * @return 是否合法输入 */ - (BOOL)checkContent { - // NSString *userName = - // [(UITextField *)[self.view viewWithTag:UserTextFieldTag] text]; NSString *userPwd = [(UITextField *)[self.view viewWithTag:PassWordFieldTag] text]; NSString *vCode = [(UITextField *)[self.view viewWithTag:VerificationCodeField] text]; @@ -650,21 +663,21 @@ - (BOOL)checkContent { // if (userName.length == 0) { // - // _errorMsgLb.text = @"用户名不能为空!"; + // _errorMsgLb.text = RCDLocalizedString(@"username_can_not_nil"); // return NO; // } // if (userPwd.length < 6) { // _errorMsgLb.text = @"密码不能小于6位!"; // } if (userPwd.length > 20) { - _errorMsgLb.text = @"密码不能大于20位!"; + _errorMsgLb.text = RCDLocalizedString(@"password_can_not_more_than_20"); } if (userPwd.length == 0) { - _errorMsgLb.text = @"密码不能为空!"; + _errorMsgLb.text = RCDLocalizedString(@"password_can_not_nil"); return NO; } if (vCode.length == 0) { - _errorMsgLb.text = @"验证码不能为空!"; + _errorMsgLb.text = RCDLocalizedString(@"verification_code_can_not_nil"); return NO; } return YES; @@ -688,24 +701,71 @@ - (void)countDown:(int)seconds { } - (void)timeFireMethod { _seconds--; - ((UILabel *)[self.view viewWithTag:vCodeTimerLabelTag]).text = [NSString stringWithFormat:@"%d秒后发送", _seconds]; + ((UILabel *)[self.view viewWithTag:vCodeTimerLabelTag]).text = [NSString stringWithFormat:RCDLocalizedString(@"after_x_seconds_send"), _seconds]; if (_seconds == 0) { [_countDownTimer invalidate]; ((UILabel *)[self.view viewWithTag:vCodeTimerLabelTag]).hidden = YES; ((UIButton *)[self.view viewWithTag:SendCodeButtonTag]).hidden = NO; - ((UILabel *)[self.view viewWithTag:vCodeTimerLabelTag]).text = @"60秒后发送"; + ((UILabel *)[self.view viewWithTag:vCodeTimerLabelTag]).text = RCDLocalizedString(@"after_60_seconds_send"); } } -/* - #pragma mark - Navigation +- (void)didTapCountryTextField{ + RCDCountryListController *countryListVC = [[RCDCountryListController alloc] init]; + countryListVC.delegate = self; + [self.navigationController pushViewController:countryListVC animated:YES]; +} - // In a storyboard-based application, you will often want to do a little - preparation before navigation - - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. - } - */ +- (void)didTapSwitchLanguage:(UIButton *)button{ + NSString *currentLanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentLanguage isEqualToString:@"en"]) { + [[RCDLanguageManager sharedRCDLanguageManager] setLocalizableLanguage:@"zh-Hans"]; + }else if ([currentLanguage isEqualToString:@"zh-Hans"]){ + [[RCDLanguageManager sharedRCDLanguageManager] setLocalizableLanguage:@"en"]; + } + RCDFindPswViewController *temp = [[RCDFindPswViewController alloc] init]; + CATransition *transition = [CATransition animation]; + transition.type = kCATransitionPush; //可更改为其他方式 + transition.subtype = kCATransitionFromLeft; //可更改为其他方式 + [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; + [self.navigationController pushViewController:temp animated:NO]; +} + +#pragma mark - Getters and setters +-(RCDIndicateTextField *)countryTextField{ + if (!_countryTextField) { + _countryTextField = [[RCDIndicateTextField alloc] init]; + _countryTextField.indicateInfoLabel.text = RCDLocalizedString(@"country"); + _countryTextField.textField.text = self.currentRegion.countryName; + _countryTextField.textField.userInteractionEnabled = NO; + [_countryTextField indicateIconShow:YES]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapCountryTextField)]; + [_countryTextField addGestureRecognizer:tap]; + _countryTextField.userInteractionEnabled = YES; + } + return _countryTextField; +} + +- (RCDIndicateTextField *)phoneTextField{ + if (!_phoneTextField) { + _phoneTextField = [[RCDIndicateTextField alloc] initWithFrame:CGRectZero]; + _phoneTextField.backgroundColor = [UIColor clearColor]; + _phoneTextField.textField.tag = UserTextFieldTag; + [_phoneTextField.textField addTarget:self + action:@selector(textFieldDidChange:) + forControlEvents:UIControlEventEditingChanged]; + _phoneTextField.indicateInfoLabel.text = [NSString stringWithFormat:@"+%@",self.currentRegion.phoneCode]; + _phoneTextField.userInteractionEnabled = YES; + _phoneTextField.translatesAutoresizingMaskIntoConstraints = NO; + _phoneTextField.textField.adjustsFontSizeToFitWidth = YES; + _phoneTextField.textField.clearButtonMode = UITextFieldViewModeWhileEditing; + _phoneTextField.textField.keyboardType = UIKeyboardTypeNumberPad; + _phoneTextField.textField.delegate = self; + if (_phoneTextField.textField.text.length > 0) { + [_phoneTextField.textField setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; + } + } + return _phoneTextField; +} @end diff --git a/ios-rongimdemo/RCloudMessage/RCDGroupViewController.m b/ios-rongimdemo/RCloudMessage/RCDGroupViewController.m index 4414ff30..b4d419b3 100644 --- a/ios-rongimdemo/RCloudMessage/RCDGroupViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDGroupViewController.m @@ -36,6 +36,7 @@ - (instancetype)init { //设置tableView样式 self.tableView.separatorColor = [UIColor colorWithHexString:@"dfdfdf" alpha:1.0f]; self.tableView.tableFooterView = [UIView new]; + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; __weak RCDGroupViewController *weakSelf = self; @@ -73,7 +74,8 @@ - (id)initWithCoder:(NSCoder *)aDecoder { - (void)viewDidLoad { [super viewDidLoad]; - self.navigationItem.title = @"群组"; + self.navigationItem.title = RCDLocalizedString(@"group") +; } - (void)viewWillAppear:(BOOL)animated { @@ -82,6 +84,10 @@ - (void)viewWillAppear:(BOOL)animated { self.tabBarController.navigationItem.rightBarButtonItem = nil; } +- (void)viewDidLayoutSubviews { + self.tableView.frame = self.view.frame; +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. diff --git a/ios-rongimdemo/RCloudMessage/RCDLoginViewController.m b/ios-rongimdemo/RCloudMessage/RCDLoginViewController.m index 95af86ff..cab1c330 100644 --- a/ios-rongimdemo/RCloudMessage/RCDLoginViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDLoginViewController.m @@ -23,12 +23,18 @@ #import "RCUnderlineTextField.h" #import "UIColor+RCColor.h" #import "UITextFiled+Shake.h" - -@interface RCDLoginViewController () +#import "RCDIndicateTextField.h" +#import "RCDCountryListController.h" +#import "RCDCountry.h" +#import "RCDLanguageManager.h" +#import "AppDelegate.h" +#import "RCDBuglyManager.h" +@interface RCDLoginViewController () @property(retain, nonatomic) IBOutlet RCAnimatedImagesView *animatedImagesView; -@property(weak, nonatomic) IBOutlet UITextField *emailTextField; +@property(nonatomic, strong) RCDIndicateTextField *countryTextField; +@property(nonatomic, strong) RCDIndicateTextField *phoneTextField; @property(weak, nonatomic) IBOutlet UITextField *pwdTextField; @@ -52,6 +58,7 @@ @interface RCDLoginViewController () 0) { - UITextField *PhoneNumber = (UITextField *)[self.view viewWithTag:UserTextFieldTag]; - PhoneNumber.text = @""; + self.phoneTextField.textField.text = @""; UITextField *Password = (UITextField *)[self.view viewWithTag:PassWordFieldTag]; Password.text = @""; } if (userName.length > 0) { - [(UITextField *)[self.view viewWithTag:UserTextFieldTag] setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; + [self.phoneTextField.textField setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; } [super viewWillAppear:animated]; [self.animatedImagesView startAnimating]; @@ -457,16 +484,7 @@ - (void)forgetPswEvent { RCDFindPswViewController *temp = [[RCDFindPswViewController alloc] init]; [self.navigationController pushViewController:temp animated:YES]; } -/** - * 获取默认用户 - * - * @return 是否获取到数据 - */ -- (BOOL)getDefaultUser { - NSString *userName = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]; - NSString *userPwd = [[NSUserDefaults standardUserDefaults] objectForKey:@"userPwd"]; - return userName && userPwd; -} + /*获取用户账号*/ - (NSString *)getDefaultUserName { NSString *defaultUser = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]; @@ -480,7 +498,7 @@ - (NSString *)getDefaultUserPwd { } - (IBAction)actionLogin:(id)sender { - NSString *userName = [(UITextField *)[self.view viewWithTag:UserTextFieldTag] text]; + NSString *userName = self.phoneTextField.textField.text; NSString *userPwd = [(UITextField *)[self.view viewWithTag:PassWordFieldTag] text]; if (self.retryTime) { @@ -523,7 +541,7 @@ - (void)loginSuccess:(NSString *)userName [DEFAULTS setObject:result forKey:@"SquareInfoList"]; [DEFAULTS synchronize]; }]; - + [AFHttpTool getUserInfo:userId success:^(id response) { if ([response[@"code"] intValue] == 200) { @@ -538,6 +556,7 @@ - (void)loginSuccess:(NSString *)userName [[RCDataBaseManager shareInstance] insertUserToDB:user]; [[RCIM sharedRCIM] refreshUserInfoCache:user withUserId:userId]; [RCIM sharedRCIM].currentUserInfo = user; + [RCDBuglyManager setUserIdentifier:[NSString stringWithFormat:@"%@ - %@", user.userId,user.name]]; [DEFAULTS setObject:user.portraitUri forKey:@"userPortraitUri"]; [DEFAULTS setObject:user.name forKey:@"userNickName"]; [DEFAULTS synchronize]; @@ -595,7 +614,7 @@ - (void)loginRongCloud:(NSString *)userName //关闭HUD [hud hide:YES]; NSLog(@"RCConnectErrorCode is %ld", (long)status); - _errorMsgLb.text = [NSString stringWithFormat:@"登录失败!Status: %zd", status]; + _errorMsgLb.text = [NSString stringWithFormat:@"%@ Status: %zd",RCDLocalizedString(@"Login_fail"), status]; [_pwdTextField shake]; // SDK会自动重连登录,这时候需要监听连接状态 @@ -618,7 +637,7 @@ - (void)loginRongCloud:(NSString *)userName dispatch_async(dispatch_get_main_queue(), ^{ [hud hide:YES]; NSLog(@"Token无效"); - _errorMsgLb.text = @"无法连接到服务器!"; + _errorMsgLb.text = RCDLocalizedString(@"can_not_connect_server"); }); }]; } @@ -633,7 +652,7 @@ - (void)login:(NSString *)userName password:(NSString *)password { RCNetworkStatus status = [[RCIMClient sharedRCIMClient] getCurrentNetworkStatus]; if (RC_NotReachable == status) { - _errorMsgLb.text = @"当前网络不可用,请检查!"; + _errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); return; } else { _errorMsgLb.text = @""; @@ -643,13 +662,13 @@ - (void)login:(NSString *)userName password:(NSString *)password { hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.color = [UIColor colorWithHexString:@"343637" alpha:0.8]; - hud.labelText = @"登录中..."; + hud.labelText = RCDLocalizedString(@"logining"); [hud show:YES]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"UserCookies"]; // [[RCIM sharedRCIM] initWithAppKey:@"p5tvi9dst25b4"]; [AFHttpTool loginWithPhone:userName password:password - region:@"86" + region:self.currentRegion.phoneCode success:^(id response) { if ([response[@"code"] intValue] == 200) { NSString *token = response[@"result"][@"token"]; @@ -661,17 +680,17 @@ - (void)login:(NSString *)userName password:(NSString *)password { int _errCode = [response[@"code"] intValue]; NSLog(@"NSError is %d", _errCode); if (_errCode == 1000) { - _errorMsgLb.text = @"手机号或密码错误!"; + _errorMsgLb.text = RCDLocalizedString(@"mobile_number_or_password_error"); } [_pwdTextField shake]; } } failure:^(NSError *err) { [hud hide:YES]; - _errorMsgLb.text = @"登录失败,请检查网络。"; + _errorMsgLb.text = RCDLocalizedString(@"Login_fail_please_check_network"); }]; } else { - _errorMsgLb.text = @"请检查手机号和密码"; + _errorMsgLb.text = RCDLocalizedString(@"please_check_mobile_number_and_password"); } } @@ -679,10 +698,10 @@ - (void)login:(NSString *)userName password:(NSString *)password { - (BOOL)validateUserName:(NSString *)userName userPwd:(NSString *)userPwd { NSString *alertMessage = nil; if (userName.length == 0) { - alertMessage = @"用户名不能为空!"; + alertMessage = RCDLocalizedString(@"username_can_not_nil"); return NO; } else if (userPwd.length == 0) { - alertMessage = @"密码不能为空!"; + alertMessage = RCDLocalizedString(@"password_can_not_nil"); return NO; } @@ -691,9 +710,6 @@ - (BOOL)validateUserName:(NSString *)userName userPwd:(NSString *)userPwd { [_pwdTextField shake]; return NO; } - if (userName.length != 11) { - return NO; - } if ([RCDTextFieldValidate validatePassword:userPwd] == NO) { return NO; } @@ -710,12 +726,12 @@ - (void)onRCIMConnectionStatusChanged:(RCConnectionStatus)status { token:self.loginToken password:self.loginPassword]; } else if (status == ConnectionStatus_NETWORK_UNAVAILABLE) { - self.errorMsgLb.text = @"当前网络不可用,请检查!"; + self.errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); } else if (status == ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT) { - self.errorMsgLb.text = @"您的帐号在别的设备上登录,您被迫下线!"; + self.errorMsgLb.text = RCDLocalizedString(@"accout_kicked"); } else if (status == ConnectionStatus_TOKEN_INCORRECT) { NSLog(@"Token无效"); - self.errorMsgLb.text = @"无法连接到服务器!"; + self.errorMsgLb.text = RCDLocalizedString(@"can_not_connect_server"); if (self.loginFailureTimes < 1) { self.loginFailureTimes++; [AFHttpTool getTokenSuccess:^(id response) { @@ -730,7 +746,7 @@ - (void)onRCIMConnectionStatusChanged:(RCConnectionStatus)status { dispatch_async(dispatch_get_main_queue(), ^{ [hud hide:YES]; NSLog(@"Token无效"); - self.errorMsgLb.text = @"无法连接到服务器!"; + self.errorMsgLb.text = RCDLocalizedString(@"can_not_connect_server"); }); }]; } @@ -748,6 +764,27 @@ - (UIImage *)animatedImagesView:(RCAnimatedImagesView *)animatedImagesView image return [UIImage imageNamed:@"login_background.png"]; } +- (void)didTapCountryTextField{ + RCDCountryListController *countryListVC = [[RCDCountryListController alloc] init]; + countryListVC.delegate = self; + [self.navigationController pushViewController:countryListVC animated:YES]; +} + +- (void)didTapSwitchLanguage:(UIButton *)button{ + NSString *currentLanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentLanguage isEqualToString:@"en"]) { + [[RCDLanguageManager sharedRCDLanguageManager] setLocalizableLanguage:@"zh-Hans"]; + }else if ([currentLanguage isEqualToString:@"zh-Hans"]){ + [[RCDLanguageManager sharedRCDLanguageManager] setLocalizableLanguage:@"en"]; + } + RCDLoginViewController *temp = [[RCDLoginViewController alloc] init]; + CATransition *transition = [CATransition animation]; + transition.type = kCATransitionPush; //可更改为其他方式 + transition.subtype = kCATransitionFromLeft; //可更改为其他方式 + [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; + [self.navigationController pushViewController:temp animated:NO]; +} + #pragma mark - UI - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation { @@ -765,4 +802,36 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; } +#pragma mark - Getters and setters +-(RCDIndicateTextField *)countryTextField{ + if (!_countryTextField) { + _countryTextField = [[RCDIndicateTextField alloc] init]; + _countryTextField.indicateInfoLabel.text = RCDLocalizedString(@"country"); + _countryTextField.textField.text = self.currentRegion.countryName; + _countryTextField.textField.userInteractionEnabled = NO; + [_countryTextField indicateIconShow:YES]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapCountryTextField)]; + [_countryTextField addGestureRecognizer:tap]; + _countryTextField.userInteractionEnabled = YES; + } + return _countryTextField; +} + +- (RCDIndicateTextField *)phoneTextField{ + if (!_phoneTextField) { + _phoneTextField = [[RCDIndicateTextField alloc] initWithFrame:CGRectZero]; + _phoneTextField.backgroundColor = [UIColor clearColor]; + _phoneTextField.tag = UserTextFieldTag; + _phoneTextField.indicateInfoLabel.text = [NSString stringWithFormat:@"+%@",self.currentRegion.phoneCode]; + _phoneTextField.userInteractionEnabled = YES; + _phoneTextField.translatesAutoresizingMaskIntoConstraints = NO; + _phoneTextField.textField.adjustsFontSizeToFitWidth = YES; + _phoneTextField.textField.clearButtonMode = UITextFieldViewModeWhileEditing; + _phoneTextField.textField.keyboardType = UIKeyboardTypeNumberPad; + if (_phoneTextField.textField.text.length > 0) { + [_phoneTextField.textField setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; + } + } + return _phoneTextField; +} @end diff --git a/ios-rongimdemo/RCloudMessage/RCDMeInfoTableViewController.m b/ios-rongimdemo/RCloudMessage/RCDMeInfoTableViewController.m index 3eca7794..c04221cc 100644 --- a/ios-rongimdemo/RCloudMessage/RCDMeInfoTableViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDMeInfoTableViewController.m @@ -42,10 +42,11 @@ - (void)viewDidLoad { self.tableView.backgroundColor = [UIColor colorWithHexString:@"f0f0f6" alpha:1.f]; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; - self.navigationItem.title = @"个人信息"; + self.navigationItem.title = RCDLocalizedString(@"Personal_information"); RCDUIBarButtonItem *leftBtn = - [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"我" target:self action:@selector(clickBackBtn:)]; + [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"me") + target:self action:@selector(clickBackBtn:)]; self.navigationItem.leftBarButtonItem = leftBtn; } @@ -83,20 +84,22 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } [cell setImageView:cell.rightImageView ImageStr:portraitUrl imageSize:CGSizeMake(65, 65) LeftOrRight:1]; cell.rightImageCornerRadius = 5.f; - cell.leftLabel.text = @"头像"; + cell.leftLabel.text = RCDLocalizedString(@"portrait"); return cell; } break; case 1: { [cell setCellStyle:DefaultStyle_RightLabel]; - cell.leftLabel.text = @"昵称"; + cell.leftLabel.text = RCDLocalizedString(@"nickname") +; cell.rightLabel.text = [DEFAULTS stringForKey:@"userNickName"]; return cell; } break; case 2: { [cell setCellStyle:DefaultStyle_RightLabel_WithoutRightArrow]; - cell.leftLabel.text = @"手机号"; + cell.leftLabel.text = RCDLocalizedString(@"mobile_number") +; cell.rightLabel.text = [DEFAULTS stringForKey:@"userName"]; cell.selectionStyle = UITableViewCellSelectionStyleNone; return cell; @@ -162,9 +165,12 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath - (void)changePortrait { UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"拍照" - otherButtonTitles:@"我的相册", nil]; + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"take_picture") + + otherButtonTitles:RCDLocalizedString(@"my_album") +, nil]; [actionSheet showInView:self.view]; } @@ -213,7 +219,7 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking [self dismissViewControllerAnimated:YES completion:nil]; hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; hud.color = [UIColor colorWithHexString:@"343637" alpha:0.5]; - hud.labelText = @"上传头像中..."; + hud.labelText = RCDLocalizedString(@"Uploading_avatar"); [hud show:YES]; [RCDHTTPTOOL uploadImageToQiNiu:[RCIM sharedRCIM].currentUserInfo.userId @@ -245,9 +251,10 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking //关闭HUD [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"上传头像失败" + message:RCDLocalizedString(@"Upload_avatar_fail") delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } @@ -256,9 +263,10 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking //关闭HUD [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"上传头像失败" + message:RCDLocalizedString(@"Upload_avatar_fail") delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } @@ -267,9 +275,10 @@ - (void)imagePickerController:(UIImagePickerController *)picker didFinishPicking //关闭HUD [hud hide:YES]; UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"上传头像失败" + message:RCDLocalizedString(@"Upload_avatar_fail") delegate:self - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; }]; @@ -307,9 +316,10 @@ - (BOOL)dealWithNetworkStatus { RCNetworkStatus networkStatus = [[RCIMClient sharedRCIMClient] getCurrentNetworkStatus]; if (networkStatus == 0) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"当前网络不可用,请检查你的网络设置" + message:NSLocalizedStringFromTable(@"ConnectionIsNotReachable", @"RongCloudKit", nil) delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; return isconnected; diff --git a/ios-rongimdemo/RCloudMessage/RCDMeTableViewController.m b/ios-rongimdemo/RCloudMessage/RCDMeTableViewController.m index 735adeaa..2ee0206a 100644 --- a/ios-rongimdemo/RCloudMessage/RCDMeTableViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDMeTableViewController.m @@ -17,6 +17,8 @@ #import "RCDMeInfoTableViewController.h" #import "RCDSettingsTableViewController.h" #import "UIColor+RCColor.h" +#import "RCDLanguageManager.h" +#import "RCDLanguageSettingViewController.h" /* RedPacket_FTR */ #import @@ -32,6 +34,7 @@ @interface RCDMeTableViewController () @property(nonatomic, strong) NSURLConnection *connection; @property(nonatomic, strong) NSMutableData *receiveData; +@property (nonatomic, strong) NSDictionary *languageDic; @end @@ -43,6 +46,8 @@ @implementation RCDMeTableViewController { - (void)viewDidLoad { [super viewDidLoad]; + self.languageDic = @{@"en":@"English", @"zh-Hans":@"简体中文"}; + self.edgesForExtendedLayout = UIRectEdgeNone; self.navigationController.navigationBar.translucent = NO; self.tableView.tableFooterView = [UIView new]; @@ -62,7 +67,7 @@ - (void)viewDidLoad { - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - self.tabBarController.navigationItem.title = @"我"; + self.tabBarController.navigationItem.title =RCDLocalizedString(@"me"); self.tabBarController.navigationItem.rightBarButtonItems = nil; [self.tableView reloadData]; } @@ -81,7 +86,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger case 1: /* RedPacket_FTR */ //添加了红包,row+=1; - rows = 2; + rows = 3; break; case 2: @@ -129,13 +134,20 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case 1: { switch (indexPath.row) { case 0: { - [cell setCellWithImageName:@"setting_up" labelName:@"帐号设置"]; + [cell setCellWithImageName:@"setting_up" labelName:RCDLocalizedString(@"account_setting") rightLabelName:@""]; } break; - /* RedPacket_FTR */ // wallet cell case 1: { - [cell setCellWithImageName:@"wallet" labelName:@"我的钱包"]; + NSString *currentLanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + NSString *currentLanguageString =self.languageDic[currentLanguage]; + NSString *rightString = currentLanguageString ? currentLanguageString : RCDLocalizedString(@"language"); + [cell setCellWithImageName:@"icon_ multilingual" labelName:RCDLocalizedString(@"language") rightLabelName:rightString]; + break; } + /* RedPacket_FTR */ // wallet cell + case 2: { + [cell setCellWithImageName:@"wallet" labelName:RCDLocalizedString(@"my_wallet") rightLabelName:@""]; + }break; default: break; } @@ -145,12 +157,12 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N case 2: { switch (indexPath.row) { case 0: { - [cell setCellWithImageName:@"sevre_inactive" labelName:@"意见反馈"]; + [cell setCellWithImageName:@"sevre_inactive" labelName:RCDLocalizedString(@"feedback") rightLabelName:@""]; return cell; } break; case 1: { - [cell setCellWithImageName:@"about_rongcloud" labelName:@"关于 SealTalk"]; + [cell setCellWithImageName:@"about_rongcloud" labelName:RCDLocalizedString(@"about_sealtalk") rightLabelName:@""]; NSString *isNeedUpdate = [[NSUserDefaults standardUserDefaults] objectForKey:@"isNeedUpdate"]; if ([isNeedUpdate isEqualToString:@"YES"]) { [cell addRedpointImageView]; @@ -159,11 +171,11 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } break; #if RCDDebugTestFunction case 2: { - [cell setCellWithImageName:@"sevre_inactive" labelName:@"小能客服"]; + [cell setCellWithImageName:@"sevre_inactive" labelName:RCDLocalizedString(@"customer_service_xn") rightLabelName:@""]; return cell; } break; case 3: { - [cell setCellWithImageName:@"sevre_inactive" labelName:@"佳信"]; + [cell setCellWithImageName:@"sevre_inactive" labelName:RCDLocalizedString(@"customer_service_jx") rightLabelName:@""]; return cell; } break; #endif @@ -208,6 +220,11 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath } break; /* RedPacket_FTR */ // open my wallet case 1: { + RCDLanguageSettingViewController *vc = [[RCDLanguageSettingViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; + break; + } + case 2: { Class walletSDKClass = NSClassFromString(@"JrmfWalletSDK"); if (walletSDKClass) { [walletSDKClass performSelector:@selector(openWallet)]; @@ -266,7 +283,8 @@ - (void)chatWithCustomerService:(NSString *)kefuId { //上传用户信息,nickname是必须要填写的 RCCustomerServiceInfo *csInfo = [[RCCustomerServiceInfo alloc] init]; csInfo.userId = [RCIMClient sharedRCIMClient].currentUserInfo.userId; - csInfo.nickName = @"昵称"; + csInfo.nickName = RCDLocalizedString(@"nickname") +; csInfo.loginName = @"登录名称"; csInfo.name = [RCIMClient sharedRCIMClient].currentUserInfo.name; csInfo.grade = @"11级"; @@ -294,7 +312,7 @@ - (void)chatWithCustomerService:(NSString *)kefuId { csInfo.define = @"自定义信息"; chatService.csInfo = csInfo; - chatService.title = @"客服"; + chatService.title = RCDLocalizedString(@"customer"); [self.navigationController pushViewController:chatService animated:YES]; } diff --git a/ios-rongimdemo/RCloudMessage/RCDMessageNotifySettingTableViewController.m b/ios-rongimdemo/RCloudMessage/RCDMessageNotifySettingTableViewController.m index 617a66c9..065b2dc2 100644 --- a/ios-rongimdemo/RCloudMessage/RCDMessageNotifySettingTableViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDMessageNotifySettingTableViewController.m @@ -44,7 +44,8 @@ - (void)viewWillAppear:(BOOL)animated { - (void)viewDidLoad { [super viewDidLoad]; - self.navigationItem.title = @"新消息通知"; + self.navigationItem.title = RCDLocalizedString(@"new_message_notification") +; self.tableView.tableFooterView = [UIView new]; self.tableView.backgroundColor = [UIColor colorWithHexString:@"f0f0f6" alpha:1.f]; @@ -77,13 +78,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N switch (indexPath.row) { case 0: { [cell setCellStyle:SwitchStyle]; - cell.leftLabel.text = @"接收新消息通知"; + cell.leftLabel.text = RCDLocalizedString(@"Receive_new_message_notifications") +; cell.switchButton.on = self.isReceiveNotification; } break; case 1: { [cell setCellStyle:DefaultStyle]; - cell.leftLabel.text = @"消息免打扰"; + cell.leftLabel.text = RCDLocalizedString(@"mute_notifications"); if (self.isReceiveNotification == YES) { cell.backgroundColor = [UIColor whiteColor]; } else { @@ -120,7 +122,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSIntege - (void)onClickSwitchButton:(id)sender { MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES]; - hud.labelText = @"设置中..."; + hud.labelText = RCDLocalizedString(@"setting"); UISwitch *switchBtn = (UISwitch *)sender; if (!switchBtn.on) { [[RCIMClient sharedRCIMClient] setNotificationQuietHours:@"00:00:00" @@ -136,10 +138,11 @@ - (void)onClickSwitchButton:(id)sender { } error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" - message:@"设置失败" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") + message:RCDLocalizedString(@"set_fail") delegate:nil - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + otherButtonTitles:nil, nil]; [alert show]; dispatch_async(dispatch_get_main_queue(), ^{ @@ -160,10 +163,11 @@ - (void)onClickSwitchButton:(id)sender { error:^(RCErrorCode status) { dispatch_async(dispatch_get_main_queue(), ^{ - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"alert") message:@"取消失败" delegate:nil - cancelButtonTitle:@"取消" + cancelButtonTitle:RCDLocalizedString(@"cancel") + otherButtonTitles:nil, nil]; [alert show]; dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/ios-rongimdemo/RCloudMessage/RCDRegisterViewController.m b/ios-rongimdemo/RCloudMessage/RCDRegisterViewController.m index ea46c879..32cdebed 100644 --- a/ios-rongimdemo/RCloudMessage/RCDRegisterViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDRegisterViewController.m @@ -14,8 +14,14 @@ #import "RCUnderlineTextField.h" #import "UIColor+RCColor.h" #import - -@interface RCDRegisterViewController () +#import "RCDIndicateTextField.h" +#import "RCDCountryListController.h" +#import "RCDCountry.h" +#import "RCDLanguageManager.h" +#import "AppDelegate.h" +@interface RCDRegisterViewController () +@property(nonatomic, strong) RCDIndicateTextField *countryTextField; +@property(nonatomic, strong) RCDIndicateTextField *phoneTextField; @property(unsafe_unretained, nonatomic) IBOutlet UITextField *tfEmail; @property(unsafe_unretained, nonatomic) IBOutlet UITextField *tfNickName; @property(unsafe_unretained, nonatomic) IBOutlet UITextField *tfPassword; @@ -30,6 +36,7 @@ @interface RCDRegisterViewController () @property(nonatomic, strong) UILabel *errorMsgLb; @property(strong, nonatomic) IBOutlet UILabel *countDownLable; @property(strong, nonatomic) IBOutlet UIButton *getVerificationCodeBt; +@property(nonatomic, strong) RCDCountry *currentRegion; @end @implementation RCDRegisterViewController { @@ -47,6 +54,7 @@ @implementation RCDRegisterViewController { @synthesize inputBackground = _inputBackground; - (void)viewDidLoad { [super viewDidLoad]; + self.currentRegion = [[RCDCountry alloc] initWithDict:[[NSUserDefaults standardUserDefaults] objectForKey:@"currentCountry"]]; [self.navigationController setNavigationBarHidden:YES animated:YES]; self.animatedImagesView = [[RCAnimatedImagesView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)]; @@ -59,14 +67,28 @@ - (void)viewDidLoad { [self.view addSubview:_headBackground]; UIButton *registerHeadButton = - [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 80, 0, 70, 50)]; - [registerHeadButton setTitle:@"登录" forState:UIControlStateNormal]; + [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 90, 0, 80, 50)]; + [registerHeadButton setTitle:RCDLocalizedString(@"Login") forState:UIControlStateNormal]; [registerHeadButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + registerHeadButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; [registerHeadButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [registerHeadButton addTarget:self action:@selector(loginPageEvent) forControlEvents:UIControlEventTouchUpInside]; [_headBackground addSubview:registerHeadButton]; + + UIButton *switchLanguage = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 80,30, 70, 40)]; + [switchLanguage setTitleColor:[UIColor whiteColor] forState:(UIControlStateNormal)]; + switchLanguage.titleLabel.font = [UIFont systemFontOfSize:16.]; + NSString *currentlanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentlanguage isEqualToString:@"en"]) { + [switchLanguage setTitle:@"简体中文" forState:(UIControlStateNormal)]; + }else if ([currentlanguage isEqualToString:@"zh-Hans"]){ + [switchLanguage setTitle:@"EN" forState:(UIControlStateNormal)]; + } + [switchLanguage addTarget:self action:@selector(didTapSwitchLanguage:) forControlEvents:(UIControlEventTouchUpInside)]; + [self.animatedImagesView addSubview:switchLanguage]; + UIImage *rongLogoSmallImage = [UIImage imageNamed:@"title_logo_small"]; UIImageView *rongLogoSmallImageView = @@ -78,11 +100,12 @@ - (void)viewDidLoad { rongLogoSmallImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight; rongLogoSmallImageView.clipsToBounds = YES; [_headBackground addSubview:rongLogoSmallImageView]; - UIButton *forgetPswHeadButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 80, 50)]; + UIButton *forgetPswHeadButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 0, 120, 50)]; - [forgetPswHeadButton setTitle:@"找回密码" forState:UIControlStateNormal]; + [forgetPswHeadButton setTitle:RCDLocalizedString(@"forgot_password") forState:UIControlStateNormal]; [forgetPswHeadButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + forgetPswHeadButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; [forgetPswHeadButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [forgetPswHeadButton addTarget:self action:@selector(forgetPswEvent) forControlEvents:UIControlEventTouchUpInside]; [_headBackground addSubview:forgetPswHeadButton]; @@ -109,44 +132,28 @@ - (void)viewDidLoad { _errorMsgLb.translatesAutoresizingMaskIntoConstraints = NO; _errorMsgLb.textColor = [UIColor colorWithRed:204.0f / 255.0f green:51.0f / 255.0f blue:51.0f / 255.0f alpha:1]; [self.view addSubview:_errorMsgLb]; - RCUnderlineTextField *userNameTextField = [[RCUnderlineTextField alloc] initWithFrame:CGRectZero]; - - userNameTextField.backgroundColor = [UIColor clearColor]; - userNameTextField.tag = UserTextFieldTag; - //_account.placeholder=[NSString stringWithFormat:@"Email"]; - UIColor *color = [UIColor whiteColor]; - userNameTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"手机号" attributes:@{NSForegroundColorAttributeName : color}]; - userNameTextField.textColor = [UIColor whiteColor]; - self.view.translatesAutoresizingMaskIntoConstraints = YES; - userNameTextField.translatesAutoresizingMaskIntoConstraints = NO; - userNameTextField.adjustsFontSizeToFitWidth = YES; - userNameTextField.clearButtonMode = UITextFieldViewModeWhileEditing; - [_inputBackground addSubview:userNameTextField]; - userNameTextField.keyboardType = UIKeyboardTypeNumberPad; - if (userNameTextField.text.length > 0) { - [userNameTextField setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; - } - - [userNameTextField addTarget:self - action:@selector(textFieldDidChange:) - forControlEvents:UIControlEventEditingChanged]; + + self.countryTextField.translatesAutoresizingMaskIntoConstraints = NO; + [_inputBackground addSubview:self.countryTextField]; + + self.phoneTextField.translatesAutoresizingMaskIntoConstraints = NO; + [_inputBackground addSubview:self.phoneTextField]; UILabel *userNameMsgLb = [[UILabel alloc] initWithFrame:CGRectZero]; - userNameMsgLb.text = @"手机号码"; + userNameMsgLb.text = RCDLocalizedString(@"mobile_number"); userNameMsgLb.font = [UIFont fontWithName:@"Heiti SC" size:10.0]; userNameMsgLb.translatesAutoresizingMaskIntoConstraints = NO; userNameMsgLb.textColor = [[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5]; [_inputBackground addSubview:userNameMsgLb]; - _PhoneNumber = userNameTextField.text; - userNameTextField.delegate = self; + _PhoneNumber = self.phoneTextField.textField.text; RCUnderlineTextField *verificationCodeField = [[RCUnderlineTextField alloc] initWithFrame:CGRectZero]; verificationCodeField.backgroundColor = [UIColor clearColor]; verificationCodeField.tag = VerificationCodeFieldTag; + UIColor *color = [UIColor whiteColor]; verificationCodeField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"短信验证码" attributes:@{NSForegroundColorAttributeName : color}]; + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"code") attributes:@{NSForegroundColorAttributeName : color}]; verificationCodeField.textColor = [UIColor whiteColor]; self.view.translatesAutoresizingMaskIntoConstraints = YES; verificationCodeField.translatesAutoresizingMaskIntoConstraints = NO; @@ -162,7 +169,7 @@ - (void)viewDidLoad { action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; UILabel *verificationCodeLb = [[UILabel alloc] initWithFrame:CGRectZero]; - verificationCodeLb.text = @"验证码"; + verificationCodeLb.text = RCDLocalizedString(@"verification_code"); verificationCodeLb.hidden = YES; verificationCodeLb.font = [UIFont fontWithName:@"Heiti SC" size:10.0]; @@ -174,7 +181,7 @@ - (void)viewDidLoad { _getVerificationCodeBt = [[UIButton alloc] init]; [_getVerificationCodeBt setBackgroundColor:[[UIColor alloc] initWithRed:133 / 255.f green:133 / 255.f blue:133 / 255.f alpha:1]]; - [_getVerificationCodeBt setTitle:@"发送验证码" forState:UIControlStateNormal]; + [_getVerificationCodeBt setTitle:RCDLocalizedString(@"send_verification_code") forState:UIControlStateNormal]; [_getVerificationCodeBt setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; [_getVerificationCodeBt addTarget:self action:@selector(getVerficationCode) @@ -192,7 +199,7 @@ - (void)viewDidLoad { setBackgroundColor:[[UIColor alloc] initWithRed:133 / 255.f green:133 / 255.f blue:133 / 255.f alpha:1]]; _countDownLable.textAlignment = UITextAlignmentCenter; [_countDownLable setFont:[UIFont fontWithName:@"Heiti SC" size:13.0]]; - _countDownLable.text = @"60秒后发送"; + _countDownLable.text = RCDLocalizedString(@"after_60_seconds_send"); _countDownLable.translatesAutoresizingMaskIntoConstraints = NO; _countDownLable.hidden = YES; _countDownLable.layer.masksToBounds = YES; @@ -207,12 +214,11 @@ - (void)viewDidLoad { passwordTextField.secureTextEntry = YES; passwordTextField.delegate = self; passwordTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"密码" attributes:@{NSForegroundColorAttributeName : color}]; + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"password") attributes:@{NSForegroundColorAttributeName : color}]; passwordTextField.translatesAutoresizingMaskIntoConstraints = NO; - // passwordTextField.text = [self getDefaultUserPwd]; [_inputBackground addSubview:passwordTextField]; UILabel *pswMsgLb = [[UILabel alloc] initWithFrame:CGRectZero]; - pswMsgLb.text = @"6-16位字符区分大小写"; + pswMsgLb.text = RCDLocalizedString(@"char_section_case_sensitive_from6_t16"); pswMsgLb.font = [UIFont fontWithName:@"Heiti SC" size:10.0]; pswMsgLb.translatesAutoresizingMaskIntoConstraints = NO; pswMsgLb.textColor = [[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5]; @@ -228,9 +234,8 @@ - (void)viewDidLoad { rePasswordTextField.adjustsFontSizeToFitWidth = YES; rePasswordTextField.clearButtonMode = UITextFieldViewModeWhileEditing; rePasswordTextField.attributedPlaceholder = - [[NSAttributedString alloc] initWithString:@"昵 称" attributes:@{NSForegroundColorAttributeName : color}]; + [[NSAttributedString alloc] initWithString:RCDLocalizedString(@"nickname") attributes:@{NSForegroundColorAttributeName : color}]; rePasswordTextField.translatesAutoresizingMaskIntoConstraints = NO; - // passwordTextField.text = [self getDefaultUserPwd]; [rePasswordTextField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; @@ -242,8 +247,11 @@ - (void)viewDidLoad { // UIEdgeInsets buttonEdgeInsets = UIEdgeInsetsMake(0, 7.f, 0, 7.f); UIButton *loginButton = [UIButton buttonWithType:UIButtonTypeCustom]; [loginButton addTarget:self action:@selector(btnDoneClicked:) forControlEvents:UIControlEventTouchUpInside]; - [loginButton setBackgroundImage:[UIImage imageNamed:@"register_button"] forState:UIControlStateNormal]; - loginButton.imageView.contentMode = UIViewContentModeScaleAspectFill; + [loginButton setTitle:RCDLocalizedString(@"register") forState:UIControlStateNormal]; + loginButton.backgroundColor = [UIColor colorWithRed:28 / 255.0 green:119 / 255.0 blue:211 / 255.0 alpha:0.95]; + [loginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + loginButton.layer.cornerRadius = 3; + loginButton.titleLabel.font = [UIFont systemFontOfSize:23]; loginButton.translatesAutoresizingMaskIntoConstraints = NO; [_inputBackground addSubview:loginButton]; @@ -265,18 +273,21 @@ - (void)viewDidLoad { bottomBackground.translatesAutoresizingMaskIntoConstraints = NO; UIButton *registerButton = [[UIButton alloc] initWithFrame:CGRectMake(self.view.bounds.size.width - 100, -16, 80, 50)]; - [registerButton setTitle:@"登录" forState:UIControlStateNormal]; + [registerButton setTitle:RCDLocalizedString(@"Login") forState:UIControlStateNormal]; [registerButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + registerButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight; + [registerButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [registerButton addTarget:self action:@selector(loginPageEvent) forControlEvents:UIControlEventTouchUpInside]; [bottomBackground addSubview:registerButton]; - UIButton *forgetPswButton = [[UIButton alloc] initWithFrame:CGRectMake(-10, -16, 80, 50)]; - [forgetPswButton setTitle:@"找回密码" forState:UIControlStateNormal]; + UIButton *forgetPswButton = [[UIButton alloc] initWithFrame:CGRectMake(0, -16, 120, 50)]; + [forgetPswButton setTitle:RCDLocalizedString(@"forgot_password") forState:UIControlStateNormal]; [forgetPswButton setTitleColor:[[UIColor alloc] initWithRed:153 green:153 blue:153 alpha:0.5] forState:UIControlStateNormal]; + forgetPswButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft; forgetPswButton.titleLabel.font = [UIFont systemFontOfSize:18]; [forgetPswButton.titleLabel setFont:[UIFont fontWithName:@"Heiti SC" size:14.0]]; [forgetPswButton addTarget:self action:@selector(forgetPswEvent) forControlEvents:UIControlEventTouchUpInside]; @@ -294,16 +305,16 @@ - (void)viewDidLoad { [self.view addSubview:bottomBackground]; [self.view addConstraint:[NSLayoutConstraint constraintWithItem:userNameMsgLb - attribute:NSLayoutAttributeBottom + attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual - toItem:userNameTextField + toItem:self.phoneTextField attribute:NSLayoutAttributeBottom multiplier:1.0 - constant:0]]; + constant:-6]]; [self.view addConstraint:[NSLayoutConstraint constraintWithItem:userNameMsgLb attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual - toItem:userNameTextField + toItem:self.phoneTextField attribute:NSLayoutAttributeRight multiplier:1.0 constant:-7]]; @@ -327,7 +338,7 @@ - (void)viewDidLoad { toItem:verificationCodeField attribute:NSLayoutAttributeBottom multiplier:1.0 - constant:-15]]; + constant:-10]]; [self.view addConstraint:[NSLayoutConstraint constraintWithItem:_countDownLable attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual @@ -357,12 +368,12 @@ - (void)viewDidLoad { multiplier:1.0 constant:0]]; [self.view addConstraint:[NSLayoutConstraint constraintWithItem:pswMsgLb - attribute:NSLayoutAttributeBottom + attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:passwordTextField attribute:NSLayoutAttributeBottom multiplier:1.0 - constant:0]]; + constant:-6]]; [self.view addConstraint:[NSLayoutConstraint constraintWithItem:pswMsgLb attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual @@ -401,9 +412,9 @@ - (void)viewDidLoad { // metrics:nil // views:views]] arrayByAddingObjectsFromArray:[NSLayoutConstraint - constraintsWithVisualFormat:@"V:|-70-[_rongLogo(100)]-10-[_errorMsgLb(==" - @"12)]-1-[_inputBackground(==315)]-" - @"80-[userProtocolButton(==20)]" + constraintsWithVisualFormat:@"V:|-60-[_rongLogo(100)]-10-[_errorMsgLb(==" + @"12)]-1-[_inputBackground(==350)]-" + @"(>=0)-[userProtocolButton(==20)]-10-|" options:0 metrics:nil views:views]] @@ -441,13 +452,18 @@ - (void)viewDidLoad { constant:0]; [self.view addConstraint:userProtocolLabelConstraint]; NSDictionary *inputViews = NSDictionaryOfVariableBindings( - userNameMsgLb, pswMsgLb, userNameTextField, passwordTextField, loginButton, rePasswordTextField, + userNameMsgLb, pswMsgLb, _countryTextField,_phoneTextField, passwordTextField, loginButton, rePasswordTextField, verificationCodeField, verificationCodeLb, _getVerificationCodeBt); - NSArray *inputViewConstraints = [[[[[[[[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[userNameTextField]|" + NSArray *inputViewConstraints = [[[[[[[[[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_phoneTextField]|" options:0 metrics:nil views:inputViews] + arrayByAddingObjectsFromArray: + [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[_countryTextField]|" + options:0 + metrics:nil + views:inputViews]] arrayByAddingObjectsFromArray: [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[verificationCodeField][_getVerificationCodeBt]|" options:0 @@ -475,9 +491,10 @@ - (void)viewDidLoad { views:inputViews]] arrayByAddingObjectsFromArray:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[" @"rePasswordTextField(50)]-[" - @"userNameTextField(60)]-[" - @"verificationCodeField(60)]-[" - @"passwordTextField(60)]-[" + @"_countryTextField(50)]-[" + @"_phoneTextField(50)]-[" + @"verificationCodeField(50)]-[" + @"passwordTextField(50)]-[" @"loginButton(50)]" options:0 metrics:nil @@ -510,11 +527,33 @@ - (void)viewDidLoad { [self.view setNeedsLayout]; [self.view setNeedsUpdateConstraints]; } + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + + [self.animatedImagesView startAnimating]; +} + +- (void)viewDidDisappear:(BOOL)animated { + [super viewDidDisappear:animated]; + + [self.animatedImagesView stopAnimating]; +} + +#pragma mark - RCDCountryListControllerDelegate +- (void)fetchCountryPhoneCode:(RCDCountry *)country{ + self.countryTextField.textField.text = country.countryName; + self.currentRegion = country; + self.phoneTextField.indicateInfoLabel.text = [NSString stringWithFormat:@"+%@",self.currentRegion.phoneCode]; +} + +#pragma mark - UITextFieldDelegate - (BOOL)textFieldShouldReturn:(UITextField *)textField { NSLog(@"textFieldShouldReturn"); [textField resignFirstResponder]; return YES; } + - (void)textFieldDidChange:(UITextField *)textField { if (textField.tag == UserTextFieldTag) { if (textField.text.length > 0) { @@ -545,6 +584,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { [self.view endEditing:YES]; } +#pragma mark - noti - (void)keyboardWillShow:(NSNotification *)notif { [UIView animateWithDuration:0.25 @@ -573,23 +613,8 @@ - (void)keyboardWillHide:(NSNotification *)notif { } completion:nil]; } -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -- (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - [self.animatedImagesView startAnimating]; -} - -- (void)viewDidDisappear:(BOOL)animated { - [super viewDidDisappear:animated]; - - [self.animatedImagesView stopAnimating]; -} +#pragma mark - Target action /*阅读用户协议*/ - (void)userProtocolEvent { } @@ -609,9 +634,9 @@ - (void)getVerficationCode { hud.color = [UIColor colorWithHexString:@"343637" alpha:0.8]; [hud show:YES]; _errorMsgLb.text = @""; - if (_PhoneNumber.length == 11) { + if (_PhoneNumber.length > 0) { NSString *phone = [NSString stringWithFormat:@"%@", _PhoneNumber]; - [AFHttpTool checkPhoneNumberAvailable:@"86" + [AFHttpTool checkPhoneNumberAvailable:self.currentRegion.phoneCode phoneNumber:phone success:^(id response) { if ([response[@"code"] intValue] == 200) { @@ -622,31 +647,54 @@ - (void)getVerficationCode { // existed."]) { if ([response[@"result"] integerValue] == 0) { [hud hide:YES]; - _errorMsgLb.text = @"手机号已被注册"; + _errorMsgLb.text = RCDLocalizedString(@"phone_number_has_been_registered"); return; } else { - [AFHttpTool getVerificationCode:@"86" + [AFHttpTool getVerificationCode:self.currentRegion.phoneCode phoneNumber:phone success:^(id response) { [hud hide:YES]; - _getVerificationCodeBt.hidden = YES; - _countDownLable.hidden = NO; - [self CountDown:60]; + if ([response[@"code"] intValue] == 200) { + _getVerificationCodeBt.hidden = YES; + _countDownLable.hidden = NO; + [self CountDown:60]; + }else{ + if([response[@"code"] intValue] == 3102){ + _errorMsgLb.text = RCDLocalizedString(@"phone_number_type_error"); + }else{ + _errorMsgLb.text = response[@"result"][@"msg"]; + } + } + NSLog(@"Get verification code successfully"); } failure:^(NSError *err) { + [hud hide:YES]; + _errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); NSLog(@"%@", err); }]; } + }else{ + [hud hide:YES]; + _errorMsgLb.text = RCDLocalizedString(@"phone_number_type_error"); } - } failure:^(NSError *err){ + [hud hide:YES]; + //由于 contentType 是文本类型,所以用 jsonx 形式无法解析,所以自行解析错误码。判断如果是 400 ,就是手机号错误。 + NSDictionary *userInfo = err.userInfo; + NSString *localizedDescription = userInfo[NSLocalizedDescriptionKey]; + if ([localizedDescription rangeOfString:@"400"].location != NSNotFound) { + _errorMsgLb.text = RCDLocalizedString(@"phone_number_type_error"); + } else { + _errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); + NSLog(@"%@", err); + } }]; } else { [hud hide:YES]; - _errorMsgLb.text = @"手机号输入有误"; + _errorMsgLb.text = RCDLocalizedString(@"phone_number_type_error"); } } @@ -656,27 +704,6 @@ - (void)forgetPswEvent { [self.navigationController pushViewController:temp animated:YES]; } -/** - * 获取默认用户 - * - * @return 是否获取到数据 - */ -- (BOOL)getDefaultUser { - NSString *userName = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]; - NSString *userPwd = [[NSUserDefaults standardUserDefaults] objectForKey:@"userPwd"]; - return userName && userPwd; -} -/*获取用户账号*/ -- (NSString *)getDefaultUserName { - NSString *defaultUser = [[NSUserDefaults standardUserDefaults] objectForKey:@"userName"]; - return defaultUser; -} -/*获取用户密码*/ -- (NSString *)getDefaultUserPwd { - NSString *defaultUserPwd = [[NSUserDefaults standardUserDefaults] objectForKey:@"userPwd"]; - return defaultUserPwd; -} - - (IBAction)btnDoneClicked:(id)sender { if (![self checkContent]) return; @@ -684,14 +711,14 @@ - (IBAction)btnDoneClicked:(id)sender { RCNetworkStatus status = [[RCIMClient sharedRCIMClient] getCurrentNetworkStatus]; if (RC_NotReachable == status) { - _errorMsgLb.text = @"当前网络不可用,请检查!"; + _errorMsgLb.text = RCDLocalizedString(@"network_can_not_use_please_check"); } - NSString *userName = [(UITextField *)[self.view viewWithTag:UserTextFieldTag] text]; + NSString *userName = self.phoneTextField.textField.text; NSString *verificationCode = [(UITextField *)[self.view viewWithTag:VerificationCodeFieldTag] text]; NSString *userPwd = [(UITextField *)[self.view viewWithTag:PassWordFieldTag] text]; NSString *nickName = [(UITextField *)[self.view viewWithTag:RePassWordFieldTag] text]; //验证验证码是否有效 - [AFHttpTool verifyVerificationCode:@"86" + [AFHttpTool verifyVerificationCode:self.currentRegion.phoneCode phoneNumber:userName verificationCode:verificationCode success:^(id response) { @@ -710,7 +737,7 @@ - (IBAction)btnDoneClicked:(id)sender { NSString *code = [NSString stringWithFormat:@"%@", [regResults objectForKey:@"code"]]; if (code.intValue == 200) { - _errorMsgLb.text = @"注册成功"; + _errorMsgLb.text = RCDLocalizedString(@"register_success"); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{ [self.navigationController popViewControllerAnimated:YES]; @@ -720,19 +747,19 @@ - (IBAction)btnDoneClicked:(id)sender { } failure:^(NSError *err) { NSLog(@""); - _errorMsgLb.text = @"注册失败"; + _errorMsgLb.text = RCDLocalizedString(@"register_fail"); }]; } if (code.intValue == 1000) { - _errorMsgLb.text = @"验证码错误"; + _errorMsgLb.text = RCDLocalizedString(@"verification_code_error"); } if (code.intValue == 2000) { - _errorMsgLb.text = @"验证码过期"; + _errorMsgLb.text = RCDLocalizedString(@"captcha_overdue"); } } failure:^(NSError *err) { - _errorMsgLb.text = @"验证码无效"; + _errorMsgLb.text = RCDLocalizedString(@"verification_code_invail"); }]; } @@ -742,34 +769,34 @@ - (IBAction)btnDoneClicked:(id)sender { * @return 是否合法输入 */ - (BOOL)checkContent { - NSString *userName = [(UITextField *)[self.view viewWithTag:UserTextFieldTag] text]; + NSString *userName = self.phoneTextField.textField.text; NSString *userPwd = [(UITextField *)[self.view viewWithTag:PassWordFieldTag] text]; NSString *reUserPwd = [(UITextField *)[self.view viewWithTag:RePassWordFieldTag] text]; if (userName.length == 0) { - _errorMsgLb.text = @"手机号不能为空!"; + _errorMsgLb.text = RCDLocalizedString(@"phone_number_can_not_nil"); return NO; } if (userPwd.length > 20) { - _errorMsgLb.text = @"密码不能大于20位!"; + _errorMsgLb.text = RCDLocalizedString(@"password_can_not_more_than_20"); return NO; } if (userPwd.length == 0) { - _errorMsgLb.text = @"密码不能为空!"; + _errorMsgLb.text = RCDLocalizedString(@"password_can_not_nil"); return NO; } if (reUserPwd.length == 0) { - _errorMsgLb.text = @"昵称不能为空!"; + _errorMsgLb.text = RCDLocalizedString(@"nickname_can_not_nil"); return NO; } if (reUserPwd.length > 32) { - _errorMsgLb.text = @"昵称不能大于32位!"; + _errorMsgLb.text = RCDLocalizedString(@"nickname_can_not_over_32"); return NO; } NSRange _range = [reUserPwd rangeOfString:@" "]; if (_range.location != NSNotFound) { - _errorMsgLb.text = @"昵称中不能有空格!"; + _errorMsgLb.text = RCDLocalizedString(@"nickname_can_not_contain_space"); return NO; } return YES; @@ -793,24 +820,69 @@ - (void)CountDown:(int)seconds { } - (void)timeFireMethod { _Seconds--; - _countDownLable.text = [NSString stringWithFormat:@"%d秒后发送", _Seconds]; + _countDownLable.text = [NSString stringWithFormat:RCDLocalizedString(@"after_x_seconds_send"), _Seconds]; if (_Seconds == 0) { [_CountDownTimer invalidate]; _countDownLable.hidden = YES; _getVerificationCodeBt.hidden = NO; - _countDownLable.text = @"60秒后发送"; + _countDownLable.text = RCDLocalizedString(@"after_60_seconds_send"); } } -/* -#pragma mark - Navigation +- (void)didTapCountryTextField{ + RCDCountryListController *countryListVC = [[RCDCountryListController alloc] init]; + countryListVC.delegate = self; + [self.navigationController pushViewController:countryListVC animated:YES]; +} + +- (void)didTapSwitchLanguage:(UIButton *)button{ + NSString *currentLanguage = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + if ([currentLanguage isEqualToString:@"en"]) { + [[RCDLanguageManager sharedRCDLanguageManager] setLocalizableLanguage:@"zh-Hans"]; + }else if ([currentLanguage isEqualToString:@"zh-Hans"]){ + [[RCDLanguageManager sharedRCDLanguageManager] setLocalizableLanguage:@"en"]; + } + RCDRegisterViewController *temp = [[RCDRegisterViewController alloc] init]; + CATransition *transition = [CATransition animation]; + transition.type = kCATransitionPush; //可更改为其他方式 + transition.subtype = kCATransitionFromLeft; //可更改为其他方式 + [self.navigationController.view.layer addAnimation:transition forKey:kCATransition]; + [self.navigationController pushViewController:temp animated:NO]; +} -// In a storyboard-based application, you will often want to do a little -preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. +#pragma mark - Getters and setters +-(RCDIndicateTextField *)countryTextField{ + if (!_countryTextField) { + _countryTextField = [[RCDIndicateTextField alloc] init]; + _countryTextField.indicateInfoLabel.text = RCDLocalizedString(@"country"); + _countryTextField.textField.text = self.currentRegion.countryName; + _countryTextField.textField.userInteractionEnabled = NO; + [_countryTextField indicateIconShow:YES]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapCountryTextField)]; + [_countryTextField addGestureRecognizer:tap]; + _countryTextField.userInteractionEnabled = YES; + } + return _countryTextField; } -*/ +- (RCDIndicateTextField *)phoneTextField{ + if (!_phoneTextField) { + _phoneTextField = [[RCDIndicateTextField alloc] initWithFrame:CGRectZero]; + _phoneTextField.backgroundColor = [UIColor clearColor]; + _phoneTextField.textField.tag = UserTextFieldTag; + _phoneTextField.indicateInfoLabel.text = [NSString stringWithFormat:@"+%@",self.currentRegion.phoneCode]; + _phoneTextField.userInteractionEnabled = YES; + _phoneTextField.translatesAutoresizingMaskIntoConstraints = NO; + _phoneTextField.textField.adjustsFontSizeToFitWidth = YES; + _phoneTextField.textField.clearButtonMode = UITextFieldViewModeWhileEditing; + _phoneTextField.textField.keyboardType = UIKeyboardTypeNumberPad; + [_phoneTextField.textField addTarget:self + action:@selector(textFieldDidChange:) + forControlEvents:UIControlEventEditingChanged]; + if (_phoneTextField.textField.text.length > 0) { + [_phoneTextField.textField setFont:[UIFont fontWithName:@"Heiti SC" size:25.0]]; + } + } + return _phoneTextField; +} @end diff --git a/ios-rongimdemo/RCloudMessage/RCDSearchFriendViewController.m b/ios-rongimdemo/RCloudMessage/RCDSearchFriendViewController.m index b21b929e..3fd52288 100644 --- a/ios-rongimdemo/RCloudMessage/RCDSearchFriendViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDSearchFriendViewController.m @@ -39,6 +39,7 @@ - (void)viewDidLoad { [self.navigationController.view setBackgroundColor:color]; self.tableView.tableHeaderView = self.searchBar; self.tableView.tableFooterView = [UIView new]; + self.searchBar.placeholder = RCDLocalizedString(@"add_friend_placeholder"); self.searchDisplayController = [[UISearchDisplayController alloc] initWithSearchBar:self.searchBar contentsController:self]; [self setSearchDisplayController:self.searchDisplayController]; @@ -46,7 +47,8 @@ - (void)viewDidLoad { [self.searchDisplayController setSearchResultsDataSource:self]; [self.searchDisplayController setSearchResultsDelegate:self]; - self.navigationItem.title = @"添加好友"; + self.navigationItem.title = RCDLocalizedString(@"add_contacts") +; self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; // initial data @@ -134,9 +136,10 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath if ([userInfo.userId isEqualToString:[RCIM sharedRCIM].currentUserInfo.userId]) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil - message:@"你不能添加自己到通讯录" + message:RCDLocalizedString(@"can_not_add_self_to_address_book") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alert show]; } else if (user && tableView == self.searchDisplayController.searchResultsTableView) { @@ -169,35 +172,68 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath * @param searchText searchText description */ - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { + [[self class] cancelPreviousPerformRequestsWithTarget:self]; + [self performSelector:@selector(searchFriend:) withObject:searchText afterDelay:0.3]; + +} + +- (void)searchFriend:(NSString *)searchText{ + NSLog(@"============searchFriend"); [_searchResult removeAllObjects]; - if ([searchText length] == 11) { + if ([searchText length] > 0) { + NSString *region, *phone; + if ([searchText containsString:@")"] && [searchText hasPrefix:@"("] && searchText.length > 2) { + NSArray *array = [[searchText stringByReplacingOccurrencesOfString:@"(" withString:@""] componentsSeparatedByString:@")"]; + if (array.count == 2) { + region = array[0]; + phone = array[1]; + }else{ + region = @"86"; + phone = searchText; + } + }else if([searchText hasPrefix:@"("] && [searchText containsString:@")"] && searchText.length > 2){ + NSArray *array = [[searchText stringByReplacingOccurrencesOfString:@"(" withString:@""] componentsSeparatedByString:@")"]; + if (array.count == 2) { + region = array[0]; + phone = array[1]; + }else{ + region = @"86"; + phone = searchText; + } + } else{ + region = @"86"; + phone = searchText; + } + if (phone.length == 0) { + [self.searchDisplayController.searchResultsTableView reloadData]; + } [RCDHTTPTOOL - searchUserByPhone:searchText - complete:^(NSMutableArray *result) { - if (result) { - for (RCDUserInfo *user in result) { - if ([user.userId isEqualToString:[RCIM sharedRCIM].currentUserInfo.userId]) { - [[RCDUserInfoManager shareInstance] - getUserInfo:user.userId - completion:^(RCUserInfo *user) { - [_searchResult addObject:user]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self.searchDisplayController.searchResultsTableView reloadData]; - }); - }]; - } else { - [[RCDUserInfoManager shareInstance] - getFriendInfo:user.userId - completion:^(RCUserInfo *user) { - [_searchResult addObject:user]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self.searchDisplayController.searchResultsTableView reloadData]; - }); - }]; - } - } - } - }]; + searchUserByPhone:phone region:region + complete:^(NSMutableArray *result) { + if (result) { + for (RCDUserInfo *user in result) { + if ([user.userId isEqualToString:[RCIM sharedRCIM].currentUserInfo.userId]) { + [[RCDUserInfoManager shareInstance] + getUserInfo:user.userId + completion:^(RCUserInfo *user) { + [_searchResult addObject:user]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.searchDisplayController.searchResultsTableView reloadData]; + }); + }]; + } else { + [[RCDUserInfoManager shareInstance] + getFriendInfo:user.userId + completion:^(RCUserInfo *user) { + [_searchResult addObject:user]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self.searchDisplayController.searchResultsTableView reloadData]; + }); + }]; + } + } + } + }]; } } diff --git a/ios-rongimdemo/RCloudMessage/RCDServiceViewController.m b/ios-rongimdemo/RCloudMessage/RCDServiceViewController.m index aa9b802a..c0696d83 100644 --- a/ios-rongimdemo/RCloudMessage/RCDServiceViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDServiceViewController.m @@ -24,7 +24,7 @@ - (IBAction)acService:(UIButton *)sender { RCDCustomerServiceViewController *chatService = [[RCDCustomerServiceViewController alloc] init]; //#define SERVICE_ID @"KEFU145801184889727" #define SERVICE_ID @"KEFU146001495753714" - chatService.userName = @"客服"; + chatService.userName = RCDLocalizedString(@"customer"); chatService.conversationType = ConversationType_CUSTOMERSERVICE; #if RCDDebugTestFunction NSString *kefuId = self.kefuIdField.text; @@ -37,7 +37,8 @@ - (IBAction)acService:(UIButton *)sender { //上传用户信息,nickname是必须要填写的 RCCustomerServiceInfo *csInfo = [[RCCustomerServiceInfo alloc] init]; csInfo.userId = [RCIMClient sharedRCIMClient].currentUserInfo.userId; - csInfo.nickName = @"昵称"; + csInfo.nickName = RCDLocalizedString(@"nickname") +; csInfo.loginName = @"登录名称"; csInfo.name = @"用户名称"; csInfo.grade = @"11级"; @@ -94,9 +95,9 @@ - (void)viewWillAppear:(BOOL)animated { // titleView.font = [UIFont boldSystemFontOfSize:19]; // titleView.textColor = [UIColor whiteColor]; // titleView.textAlignment = NSTextAlignmentCenter; - // titleView.text = @"客服"; + // titleView.text = RCDLocalizedString(@"customer"); // self.tabBarController.navigationItem.titleView = titleView; - self.tabBarController.navigationItem.title = @"客服"; + self.tabBarController.navigationItem.title = RCDLocalizedString(@"customer"); self.tabBarController.navigationItem.rightBarButtonItem = nil; } // live800 KEFU146227005669524 diff --git a/ios-rongimdemo/RCloudMessage/RCDSettingBaseViewController.m b/ios-rongimdemo/RCloudMessage/RCDSettingBaseViewController.m index d4a88465..b3ee6774 100644 --- a/ios-rongimdemo/RCloudMessage/RCDSettingBaseViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDSettingBaseViewController.m @@ -25,7 +25,7 @@ - (void)viewDidLoad { self.navigationController.navigationBar.tintColor = [UIColor whiteColor]; self.navigationItem.title = NSLocalizedStringFromTable(@"Setting", @"RongCloudKit", nil); //@"设置"; - RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"返回" target:self action:@selector(backBarButtonItemClicked:)]; + RCDUIBarButtonItem *leftButton = [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"back") target:self action:@selector(backBarButtonItemClicked:)]; [self.navigationItem setLeftBarButtonItem:leftButton]; } diff --git a/ios-rongimdemo/RCloudMessage/RCDSettingsTableViewController.m b/ios-rongimdemo/RCloudMessage/RCDSettingsTableViewController.m index 45d4531e..c427a3ae 100644 --- a/ios-rongimdemo/RCloudMessage/RCDSettingsTableViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDSettingsTableViewController.m @@ -30,13 +30,18 @@ - (void)viewDidLoad { self.tableView.tableFooterView = [UIView new]; self.tableView.backgroundColor = [UIColor colorWithHexString:@"f0f0f6" alpha:1.f]; - self.navigationItem.title = @"帐号设置"; + self.navigationItem.title = RCDLocalizedString(@"account_setting"); RCDUIBarButtonItem *leftBtn = - [[RCDUIBarButtonItem alloc] initWithLeftBarButton:@"我" target:self action:@selector(clickBackBtn:)]; + [[RCDUIBarButtonItem alloc] initWithLeftBarButton:RCDLocalizedString(@"me") + target:self action:@selector(clickBackBtn:)]; self.navigationItem.leftBarButtonItem = leftBtn; self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; } +- (void)viewDidLayoutSubviews { + self.tableView.frame = self.view.frame; +} + - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. @@ -81,19 +86,23 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N switch (indexPath.row) { case 0: { - cell.leftLabel.text = @"密码修改"; + cell.leftLabel.text = RCDLocalizedString(@"change_password") +; } break; case 1: { - cell.leftLabel.text = @"隐私"; + cell.leftLabel.text = RCDLocalizedString(@"privacy") +; } break; case 2: { - cell.leftLabel.text = @"新消息通知"; + cell.leftLabel.text = RCDLocalizedString(@"new_message_notification") +; } break; case 3: { - cell.leftLabel.text = @"推送设置"; + cell.leftLabel.text = RCDLocalizedString(@"push_setting") +; } break; default: @@ -102,7 +111,8 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N } break; case 1: { - cell.leftLabel.text = @"清除缓存"; + cell.leftLabel.text = RCDLocalizedString(@"clear_cache") +; } break; case 2: { @@ -151,10 +161,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath case 0: { //清除缓存 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"是否清理缓存?" + message:RCDLocalizedString(@"clear_cache_alert") + delegate:self - cancelButtonTitle:@"取消" - otherButtonTitles:@"确定", nil]; + cancelButtonTitle:RCDLocalizedString(@"cancel") + + otherButtonTitles:RCDLocalizedString(@"confirm") +, nil]; alertView.tag = 1011; [alertView show]; @@ -170,10 +183,13 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath case 0: { //退出登录 UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"是否退出登录?" + message:RCDLocalizedString(@"logout_alert") + delegate:self - cancelButtonTitle:@"取消" - otherButtonTitles:@"确定", nil]; + cancelButtonTitle:RCDLocalizedString(@"cancel") + + otherButtonTitles:RCDLocalizedString(@"confirm") +, nil]; alertView.tag = 1010; [alertView show]; } break; @@ -225,9 +241,11 @@ - (void)clearCache { - (void)clearCacheSuccess { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"缓存清理成功!" + message:RCDLocalizedString(@"clear_cache_succrss") + delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; } @@ -265,7 +283,8 @@ - (UITableViewCell *)createQuitCell { UILabel *label = [[UILabel alloc] init]; label.font = [UIFont systemFontOfSize:16]; label.textColor = [UIColor colorWithHexString:@"000000" alpha:1.0]; - label.text = @"退出登录"; + label.text = RCDLocalizedString(@"logout") +; label.translatesAutoresizingMaskIntoConstraints = NO; quitCell.contentView.layer.borderWidth = 0.5; quitCell.contentView.layer.borderColor = [[UIColor colorWithHexString:@"dfdfdf" alpha:1.0] CGColor]; diff --git a/ios-rongimdemo/RCloudMessage/RCDUpdateNameViewController.m b/ios-rongimdemo/RCloudMessage/RCDUpdateNameViewController.m index 0101bd9b..8eaf44b4 100644 --- a/ios-rongimdemo/RCloudMessage/RCDUpdateNameViewController.m +++ b/ios-rongimdemo/RCloudMessage/RCDUpdateNameViewController.m @@ -29,6 +29,7 @@ - (instancetype)init { self.tableView.backgroundColor = [UIColor colorWithRed:239 / 255.0 green:239 / 255.0 blue:244 / 255.0 alpha:1]; [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:RCDUpdateNameTableViewCellIdentifier]; + self.tableView.cellLayoutMarginsFollowReadableWidth = NO; } return self; } @@ -40,13 +41,15 @@ - (void)viewDidLoad { [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]]; self.navigationItem.leftBarButtonItem = - [[UIBarButtonItem alloc] initWithTitle:@"取消" + [[UIBarButtonItem alloc] initWithTitle:RCDLocalizedString(@"cancel") + style:UIBarButtonItemStylePlain target:self action:@selector(backBarButtonItemClicked:)]; self.navigationItem.rightBarButtonItem = - [[UIBarButtonItem alloc] initWithTitle:@"保存" + [[UIBarButtonItem alloc] initWithTitle:RCDLocalizedString(@"save") + style:UIBarButtonItemStylePlain target:self action:@selector(rightBarButtonItemClicked:)]; @@ -67,9 +70,10 @@ - (void)rightBarButtonItemClicked:(id)sender { //保存讨论组名称 if (self.nameTextField.text.length == 0) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"请输入讨论组名称!" + message:RCDLocalizedString(@"please_type_discuss_group_name") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; return; @@ -78,9 +82,10 @@ - (void)rightBarButtonItemClicked:(id)sender { NSRange range = [self.nameTextField.text rangeOfString:@" "]; if (range.location != NSNotFound) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil - message:@"讨论组名称不能包含空格!" + message:RCDLocalizedString(@"discuss_group_can_not_space") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; return; diff --git a/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/NSBundle+RCUtils.h b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/NSBundle+RCUtils.h new file mode 100644 index 00000000..636a3d28 --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/NSBundle+RCUtils.h @@ -0,0 +1,17 @@ +// +// NSBundle+RCUtils.h +// LanguageSettingDemo +// +// Created by 孙浩 on 2019/2/17. +// Copyright © 2019 rongcloud. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface NSBundle (RCUtils) + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/NSBundle+RCUtils.m b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/NSBundle+RCUtils.m new file mode 100644 index 00000000..b281299a --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/NSBundle+RCUtils.m @@ -0,0 +1,57 @@ +// +// NSBundle+RCUtils.m +// LanguageSettingDemo +// +// Created by 孙浩 on 2019/2/17. +// Copyright © 2019 rongcloud. All rights reserved. +// + +#import "NSBundle+RCUtils.h" +#import "RCDLanguageManager.h" +#import + +@interface RCDBundle : NSBundle + +@end + +@implementation NSBundle (RCUtils) + ++ (NSString *)currentLanguage { + + return [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage ? : [NSLocale preferredLanguages].firstObject; +} + ++ (void)load { + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + object_setClass([NSBundle mainBundle], [RCDBundle class]); + }); +} + +@end + + +@implementation RCDBundle + +- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName { + + if ([RCDBundle rcd_mainBundle]) { + return [[RCDBundle rcd_mainBundle] localizedStringForKey:key value:value table:tableName]; + } else { + return [super localizedStringForKey:key value:value table:tableName]; + } +} + ++ (NSBundle *)rcd_mainBundle { + + if ([NSBundle currentLanguage].length) { + NSString *path = [[NSBundle mainBundle] pathForResource:[NSBundle currentLanguage] ofType:@"lproj"]; + if (path.length) { + return [NSBundle bundleWithPath:path]; + } + } + return nil; +} + +@end diff --git a/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/RCDLanguageManager.h b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/RCDLanguageManager.h new file mode 100644 index 00000000..f0ad13a0 --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/RCDLanguageManager.h @@ -0,0 +1,35 @@ +// +// RCDLanguageManager.h +// LanguageSettingDemo +// +// Created by 孙浩 on 2019/2/17. +// Copyright © 2019 rongcloud. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RCDLanguageManager : NSObject + +// 当前的国际化语言 +@property(nonatomic, copy, readonly) NSString *localzableLanguage; + +/** + 单例方法 + + @return 单例对象 + */ ++ (instancetype)sharedRCDLanguageManager; + +/** + 设置当前的国际化语言 + + @param Language 当前的国际化语言,请参考上面的RCLocalizableLanguageDefault + */ +- (void)setLocalizableLanguage:(NSString *)Language; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/RCDLanguageManager.m b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/RCDLanguageManager.m new file mode 100644 index 00000000..6f770386 --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/LanguageUtility/RCDLanguageManager.m @@ -0,0 +1,64 @@ +// +// RCDLanguageManager.m +// LanguageSettingDemo +// +// Created by 孙浩 on 2019/2/17. +// Copyright © 2019 rongcloud. All rights reserved. +// + +#import "RCDLanguageManager.h" + +static NSString *const RCDUserLanguageKey = @"RCDUserLanguageKey"; +#define RC_USERDEFAULTS [NSUserDefaults standardUserDefaults] + +@interface RCDLanguageManager () + +@property(nonatomic, copy) NSString *localzableLanguage; + +@end + +@implementation RCDLanguageManager + ++ (instancetype)sharedRCDLanguageManager { + + static RCDLanguageManager *manager = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + manager = [[self alloc] init]; + }); + return manager; +} + +- (void)setLocalizableLanguage:(NSString *)Language { + if (Language.length == 0) { + [self resetLanguage]; + return; + } + + if (![_localzableLanguage isEqualToString:Language]) { + [RC_USERDEFAULTS setValue:Language forKey:RCDUserLanguageKey]; + [RC_USERDEFAULTS setValue:@[Language] forKey:@"AppleLanguages"]; + } +} + +- (NSString *)localzableLanguage { + NSString *userLanguage = [RC_USERDEFAULTS valueForKey:RCDUserLanguageKey]; + if(!userLanguage){ + NSArray *languages = [NSLocale preferredLanguages]; + userLanguage = [languages objectAtIndex:0]; + if ([userLanguage containsString:@"en"]) { + userLanguage = @"en"; + }else if ([userLanguage containsString:@"zh-Hans"]){ + userLanguage = @"zh-Hans"; + } + } + return userLanguage ? userLanguage : @"default"; +} + +- (void)resetLanguage { + + [RC_USERDEFAULTS removeObjectForKey:RCDUserLanguageKey]; + [RC_USERDEFAULTS setValue:nil forKey:@"AppleLanguages"]; +} + +@end diff --git a/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Bugly b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Bugly new file mode 100644 index 00000000..05dd8e61 Binary files /dev/null and b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Bugly differ diff --git a/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/Bugly.h b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/Bugly.h new file mode 100644 index 00000000..ba33306a --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/Bugly.h @@ -0,0 +1,144 @@ +// +// Bugly.h +// +// Version: 2.5(0) +// +// Copyright (c) 2017年 Tencent. All rights reserved. +// + +#import + +#import "BuglyConfig.h" +#import "BuglyLog.h" + +BLY_START_NONNULL + +@interface Bugly : NSObject + +/** + * 初始化Bugly,使用默认BuglyConfig + * + * @param appId 注册Bugly分配的应用唯一标识 + */ ++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId; + +/** + * 使用指定配置初始化Bugly + * + * @param appId 注册Bugly分配的应用唯一标识 + * @param config 传入配置的 BuglyConfig + */ ++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId + config:(BuglyConfig * BLY_NULLABLE)config; + +/** + * 使用指定配置初始化Bugly + * + * @param appId 注册Bugly分配的应用唯一标识 + * @param development 是否开发设备 + * @param config 传入配置的 BuglyConfig + */ ++ (void)startWithAppId:(NSString * BLY_NULLABLE)appId + developmentDevice:(BOOL)development + config:(BuglyConfig * BLY_NULLABLE)config; + +/** + * 设置用户标识 + * + * @param userId 用户标识 + */ ++ (void)setUserIdentifier:(NSString *)userId; + +/** + * 更新版本信息 + * + * @param version 应用版本信息 + */ ++ (void)updateAppVersion:(NSString *)version; + +/** + * 设置关键数据,随崩溃信息上报 + * + * @param value KEY + * @param key VALUE + */ ++ (void)setUserValue:(NSString *)value + forKey:(NSString *)key; + +/** + * 获取关键数据 + * + * @return 关键数据 + */ ++ (NSDictionary * BLY_NULLABLE)allUserValues; + +/** + * 设置标签 + * + * @param tag 标签ID,可在网站生成 + */ ++ (void)setTag:(NSUInteger)tag; + +/** + * 获取当前设置标签 + * + * @return 当前标签ID + */ ++ (NSUInteger)currentTag; + +/** + * 获取设备ID + * + * @return 设备ID + */ ++ (NSString *)buglyDeviceId; + +/** + * 上报自定义Objective-C异常 + * + * @param exception 异常信息 + */ ++ (void)reportException:(NSException *)exception; + +/** + * 上报错误 + * + * @param error 错误信息 + */ ++ (void)reportError:(NSError *)error; + +/** + * @brief 上报自定义错误 + * + * @param category 类型(Cocoa=3,CSharp=4,JS=5,Lua=6) + * @param aName 名称 + * @param aReason 错误原因 + * @param aStackArray 堆栈 + * @param info 附加数据 + * @param terminate 上报后是否退出应用进程 + */ ++ (void)reportExceptionWithCategory:(NSUInteger)category + name:(NSString *)aName + reason:(NSString *)aReason + callStack:(NSArray *)aStackArray + extraInfo:(NSDictionary *)info + terminateApp:(BOOL)terminate; + +/** + * SDK 版本信息 + * + * @return SDK版本号 + */ ++ (NSString *)sdkVersion; + +/** + * App 是否发生了连续闪退 + * 如果 启动SDK 且 5秒内 闪退,且次数达到 3次 则判定为连续闪退 + * + * @return 是否连续闪退 + */ ++ (BOOL)isAppCrashedOnStartUpExceedTheLimit; + +BLY_END_NONNULL + +@end diff --git a/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/BuglyConfig.h b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/BuglyConfig.h new file mode 100644 index 00000000..0e0fea17 --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/BuglyConfig.h @@ -0,0 +1,126 @@ +// +// BuglyConfig.h +// Bugly +// +// Copyright (c) 2016年 Tencent. All rights reserved. +// + +#pragma once + +#define BLY_UNAVAILABLE(x) __attribute__((unavailable(x))) + +#if __has_feature(nullability) +#define BLY_NONNULL __nonnull +#define BLY_NULLABLE __nullable +#define BLY_START_NONNULL _Pragma("clang assume_nonnull begin") +#define BLY_END_NONNULL _Pragma("clang assume_nonnull end") +#else +#define BLY_NONNULL +#define BLY_NULLABLE +#define BLY_START_NONNULL +#define BLY_END_NONNULL +#endif + +#import + +#import "BuglyLog.h" + +BLY_START_NONNULL + +@protocol BuglyDelegate + +@optional +/** + * 发生异常时回调 + * + * @param exception 异常信息 + * + * @return 返回需上报记录,随异常上报一起上报 + */ +- (NSString * BLY_NULLABLE)attachmentForException:(NSException * BLY_NULLABLE)exception; + +@end + +@interface BuglyConfig : NSObject + +/** + * SDK Debug信息开关, 默认关闭 + */ +@property (nonatomic, assign) BOOL debugMode; + +/** + * 设置自定义渠道标识 + */ +@property (nonatomic, copy) NSString *channel; + +/** + * 设置自定义版本号 + */ +@property (nonatomic, copy) NSString *version; + +/** + * 设置自定义设备唯一标识 + */ +@property (nonatomic, copy) NSString *deviceIdentifier; + +/** + * 卡顿监控开关,默认关闭 + */ +@property (nonatomic) BOOL blockMonitorEnable; + +/** + * 卡顿监控判断间隔,单位为秒 + */ +@property (nonatomic) NSTimeInterval blockMonitorTimeout; + +/** + * 设置 App Groups Id (如有使用 Bugly iOS Extension SDK,请设置该值) + */ +@property (nonatomic, copy) NSString *applicationGroupIdentifier; + +/** + * 进程内还原开关,默认开启 + */ +@property (nonatomic) BOOL symbolicateInProcessEnable; + +/** + * 非正常退出事件记录开关,默认关闭 + */ +@property (nonatomic) BOOL unexpectedTerminatingDetectionEnable; + +/** + * 页面信息记录开关,默认开启 + */ +@property (nonatomic) BOOL viewControllerTrackingEnable; + +/** + * Bugly Delegate + */ +@property (nonatomic, assign) id delegate; + +/** + * 控制自定义日志上报,默认值为BuglyLogLevelSilent,即关闭日志记录功能。 + * 如果设置为BuglyLogLevelWarn,则在崩溃时会上报Warn、Error接口打印的日志 + */ +@property (nonatomic, assign) BuglyLogLevel reportLogLevel; + +/** + * 崩溃数据过滤器,如果崩溃堆栈的模块名包含过滤器中设置的关键字,则崩溃数据不会进行上报 + * 例如,过滤崩溃堆栈中包含搜狗输入法的数据,可以添加过滤器关键字SogouInputIPhone.dylib等 + */ +@property (nonatomic, copy) NSArray *excludeModuleFilter; + +/** + * 控制台日志上报开关,默认开启 + */ +@property (nonatomic, assign) BOOL consolelogEnable; + +/** + * 崩溃退出超时,如果监听到崩溃后,App一直没有退出,则到达超时时间后会自动abort进程退出 + * 默认值 5s, 单位 秒 + * 当赋值为0时,则不会自动abort进程退出 + */ +@property (nonatomic, assign) NSUInteger crashAbortTimeout; + +@end +BLY_END_NONNULL diff --git a/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/BuglyLog.h b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/BuglyLog.h new file mode 100644 index 00000000..2768e14c --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Headers/BuglyLog.h @@ -0,0 +1,78 @@ +// +// BuglyLog.h +// Bugly +// +// Copyright (c) 2017年 Tencent. All rights reserved. +// + +#import + +// Log level for Bugly Log +typedef NS_ENUM(NSUInteger, BuglyLogLevel) { + BuglyLogLevelSilent = 0, + BuglyLogLevelError = 1, + BuglyLogLevelWarn = 2, + BuglyLogLevelInfo = 3, + BuglyLogLevelDebug = 4, + BuglyLogLevelVerbose = 5, +}; +#pragma mark - + +OBJC_EXTERN void BLYLog(BuglyLogLevel level, NSString *format, ...) NS_FORMAT_FUNCTION(2, 3); + +OBJC_EXTERN void BLYLogv(BuglyLogLevel level, NSString *format, va_list args) NS_FORMAT_FUNCTION(2, 0); + +#pragma mark - +#define BUGLY_LOG_MACRO(_level, fmt, ...) [BuglyLog level:_level tag:nil log:fmt, ##__VA_ARGS__] + +#define BLYLogError(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelError, fmt, ##__VA_ARGS__) +#define BLYLogWarn(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelWarn, fmt, ##__VA_ARGS__) +#define BLYLogInfo(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelInfo, fmt, ##__VA_ARGS__) +#define BLYLogDebug(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelDebug, fmt, ##__VA_ARGS__) +#define BLYLogVerbose(fmt, ...) BUGLY_LOG_MACRO(BuglyLogLevelVerbose, fmt, ##__VA_ARGS__) + +#pragma mark - Interface +@interface BuglyLog : NSObject + +/** + * @brief 初始化日志模块 + * + * @param level 设置默认日志级别,默认BLYLogLevelSilent + * + * @param printConsole 是否打印到控制台,默认NO + */ ++ (void)initLogger:(BuglyLogLevel) level consolePrint:(BOOL)printConsole; + +/** + * @brief 打印BLYLogLevelInfo日志 + * + * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 + */ ++ (void)log:(NSString *)format, ... NS_FORMAT_FUNCTION(1, 2); + +/** + * @brief 打印日志 + * + * @param level 日志级别 + * @param message 日志内容 总日志大小限制为:字符串长度30k,条数200 + */ ++ (void)level:(BuglyLogLevel) level logs:(NSString *)message; + +/** + * @brief 打印日志 + * + * @param level 日志级别 + * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 + */ ++ (void)level:(BuglyLogLevel) level log:(NSString *)format, ... NS_FORMAT_FUNCTION(2, 3); + +/** + * @brief 打印日志 + * + * @param level 日志级别 + * @param tag 日志模块分类 + * @param format 日志内容 总日志大小限制为:字符串长度30k,条数200 + */ ++ (void)level:(BuglyLogLevel) level tag:(NSString *) tag log:(NSString *)format, ... NS_FORMAT_FUNCTION(3, 4); + +@end diff --git a/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Modules/module.modulemap b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Modules/module.modulemap new file mode 100644 index 00000000..c5367052 --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/Bugly.framework/Modules/module.modulemap @@ -0,0 +1,12 @@ +framework module Bugly { + umbrella header "Bugly.h" + + export * + module * { export * } + + link framework "Foundation" + link framework "Security" + link framework "SystemConfiguration" + link "c++" + link "z" +} diff --git a/ios-rongimdemo/RCloudMessage/Utilities/Monitor/RCDBuglyManager.h b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/RCDBuglyManager.h new file mode 100644 index 00000000..8c64da06 --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/RCDBuglyManager.h @@ -0,0 +1,31 @@ +// +// RCDBuglyManager.h +// SealTalk +// +// Created by 孙浩 on 2019/3/8. +// Copyright © 2019 RongCloud. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RCDBuglyManager : NSObject + +/** + 初始化Bugly,使用默认BuglyConfig + + @param appId 注册Bugly分配的应用唯一标识 + */ ++ (void)startWithAppId:(NSString *)appId; + +/** + 设置用户标识 + + @param userId 用户标识 + */ ++ (void)setUserIdentifier:(NSString *)userId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RCloudMessage/Utilities/Monitor/RCDBuglyManager.m b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/RCDBuglyManager.m new file mode 100644 index 00000000..7fde14e3 --- /dev/null +++ b/ios-rongimdemo/RCloudMessage/Utilities/Monitor/RCDBuglyManager.m @@ -0,0 +1,27 @@ +// +// RCDBuglyManager.m +// SealTalk +// +// Created by 孙浩 on 2019/3/8. +// Copyright © 2019 RongCloud. All rights reserved. +// + +#import "RCDBuglyManager.h" +#import + +@implementation RCDBuglyManager + ++ (void)startWithAppId:(NSString *)appId { + BuglyConfig * config = [[BuglyConfig alloc] init]; + config.reportLogLevel = BuglyLogLevelWarn; + config.blockMonitorEnable = YES; + config.blockMonitorTimeout = 2; + config.unexpectedTerminatingDetectionEnable = YES; + [Bugly startWithAppId:appId config:config]; +} + ++ (void)setUserIdentifier:(NSString *)userId { + [Bugly setUserIdentifier:userId]; +} + +@end diff --git a/ios-rongimdemo/RCloudMessage/Utilities/RCDCommonDefine.h b/ios-rongimdemo/RCloudMessage/Utilities/RCDCommonDefine.h index b354223c..503b5ab9 100644 --- a/ios-rongimdemo/RCloudMessage/Utilities/RCDCommonDefine.h +++ b/ios-rongimdemo/RCloudMessage/Utilities/RCDCommonDefine.h @@ -28,5 +28,6 @@ #define RCD_IS_IPHONEX (RCDscreenWidth>=375.0f && RCDscreenHeight>=812.0f) #define RCDExtraBottomHeight (RCD_IS_IPHONEX ? 34 : 0) #define RCDExtraTopHeight (RCD_IS_IPHONEX ? 24 : 0) +#define RCDIsIPad [[UIDevice currentDevice].model containsString:@"iPad"] #endif diff --git a/ios-rongimdemo/RCloudMessage/Utilities/RCDForwardAlertView.m b/ios-rongimdemo/RCloudMessage/Utilities/RCDForwardAlertView.m index 48b6c9cb..a5b76290 100644 --- a/ios-rongimdemo/RCloudMessage/Utilities/RCDForwardAlertView.m +++ b/ios-rongimdemo/RCloudMessage/Utilities/RCDForwardAlertView.m @@ -75,7 +75,8 @@ - (void)setModel:(RCConversation *)model { } - (void)updateUI { - self.titleLabel.text = @"确定发送给:"; + self.titleLabel.text = RCDLocalizedString(@"confirm_send") +; } - (void)loadSubviews { @@ -128,7 +129,8 @@ - (UIButton *)cancelButton { CGFloat cancelButtonHeight = 44; UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(cancelButtonX, cancelButtonY, cancelButtonWidth, cancelButtonHeight)]; - [button setTitle:@"取消" forState:UIControlStateNormal]; + [button setTitle:RCDLocalizedString(@"cancel") + forState:UIControlStateNormal]; [button setTitleColor:HEXCOLOR(0x262626) forState:UIControlStateNormal]; button.titleLabel.font = [UIFont systemFontOfSize:18]; [button addTarget:self action:@selector(cancelButtonEvent) forControlEvents:UIControlEventTouchUpInside]; @@ -145,7 +147,8 @@ - (UIButton *)confirmButton { CGFloat cancelButtonHeight = 44; UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(cancelButtonX, cancelButtonY, cancelButtonWidth, cancelButtonHeight)]; - [button setTitle:@"发送" forState:UIControlStateNormal]; + [button setTitle:RCDLocalizedString(@"send") + forState:UIControlStateNormal]; [button setTitleColor:HEXCOLOR(0x4093f0) forState:UIControlStateNormal]; button.titleLabel.font = [UIFont systemFontOfSize:18]; [button addTarget:self action:@selector(confirmButtonEvent) forControlEvents:UIControlEventTouchUpInside]; diff --git a/ios-rongimdemo/RCloudMessage/Utilities/RCDTextFieldValidate.m b/ios-rongimdemo/RCloudMessage/Utilities/RCDTextFieldValidate.m index 661f7c1c..cd0c1c4f 100644 --- a/ios-rongimdemo/RCloudMessage/Utilities/RCDTextFieldValidate.m +++ b/ios-rongimdemo/RCloudMessage/Utilities/RCDTextFieldValidate.m @@ -13,11 +13,13 @@ @implementation RCDTextFieldValidate //验证手机号码 + (BOOL)validateMobile:(NSString *)mobile { if (mobile.length == 0) { - NSString *message = @"手机号码不能为空!"; + NSString *message = RCDLocalizedString(@"mobile_number_unempty") +; UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; return NO; @@ -26,11 +28,12 @@ + (BOOL)validateMobile:(NSString *)mobile { NSString *phoneRegex = @"^((13[0-9])|(15[^4,\\D])|(18[0,0-9]))\\d{8}$"; NSPredicate *phoneTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", phoneRegex]; if (![phoneTest evaluateWithObject:mobile]) { - NSString *message = @"手机号码格式不正确!"; + NSString *message = RCDLocalizedString(@"mobile_number_unempty"); UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; return NO; @@ -45,7 +48,8 @@ + (BOOL)validateEmail:(NSString *)email { // UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil // message:message // delegate:nil - // cancelButtonTitle:@"确定" + // cancelButtonTitle:RCDLocalizedString(@"confirm") + // otherButtonTitles:nil, // nil]; // [alertView show]; @@ -62,7 +66,8 @@ + (BOOL)validateEmail:(NSString *)email { // UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil // message:@"邮箱格式错误!" // delegate:nil - // cancelButtonTitle:@"确定" + // cancelButtonTitle:RCDLocalizedString(@"confirm") + // otherButtonTitles:nil, // nil]; // [alertView show]; @@ -74,22 +79,24 @@ + (BOOL)validateEmail:(NSString *)email { //验证密码 + (BOOL)validatePassword:(NSString *)password { if (password.length == 0) { - NSString *message = @"密码不能为空!"; + NSString *message = RCDLocalizedString(@"password_can_not_be_blank"); UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; return NO; } NSRange _range = [password rangeOfString:@" "]; if (_range.location != NSNotFound) { - NSString *message = @"密码中不能有空格!"; + NSString *message = RCDLocalizedString(@"There_can_be_no_spaces_in_the_password"); UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil message:message delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil, nil]; [alertView show]; return NO; @@ -98,7 +105,8 @@ + (BOOL)validatePassword:(NSString *)password { // UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:nil // message:@"密码不足六位!" // delegate:nil - // cancelButtonTitle:@"确定" + // cancelButtonTitle:RCDLocalizedString(@"confirm") + // otherButtonTitles:nil, // nil]; // [alertView show]; diff --git a/ios-rongimdemo/RealTimeLocation/HeadCollectionView.m b/ios-rongimdemo/RealTimeLocation/HeadCollectionView.m index b0e8ba09..8600ce57 100644 --- a/ios-rongimdemo/RealTimeLocation/HeadCollectionView.m +++ b/ios-rongimdemo/RealTimeLocation/HeadCollectionView.m @@ -63,6 +63,7 @@ - (instancetype)initWithFrame:(CGRect)frame [backButton setImage:[UIImage imageNamed:@"back_to_conversation"] forState:UIControlStateNormal]; [backButton addTarget:self action:@selector(onBackButtonPressed:) forControlEvents:UIControlEventTouchDown]; [self addSubview:backButton]; + self.backButton = backButton; self.tipLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.headViewRect.origin.x, 20 + self.headViewSize + 12, @@ -80,6 +81,19 @@ - (instancetype)initWithFrame:(CGRect)frame return self; } +- (void)layoutSubviews { + self.backButton.frame = CGRectMake(self.bounds.size.width - 8 - 26, 41.5, 26, 26); + self.tipLabel.frame = CGRectMake(0, 20 + self.headViewSize + 12, self.headViewRect.size.width, 13); + CGPoint tipLabelCenter = self.tipLabel.center; + tipLabelCenter.x = self.center.x; + self.tipLabel.center = tipLabelCenter; + + CGPoint scrollViewCenter = self.scrollView.center; + scrollViewCenter.x = self.center.x; + self.scrollView.center = scrollViewCenter; + +} + #pragma mark user source processing - (BOOL)participantJoin:(NSString *)userId { return [self addUser:userId showChange:YES]; @@ -105,10 +119,10 @@ - (BOOL)addUser:(NSString *)userId showChange:(BOOL)show { [self.rcUserInfos addObject:userInfo]; [self addHeadViewUser:userInfo]; if (show) { - [self showUserChangeInfo:[NSString stringWithFormat:@"%@加入...", userInfo.name]]; + [self showUserChangeInfo:[NSString stringWithFormat:RCDLocalizedString(@"join_share_location"), userInfo.name]]; } else { self.tipLabel.text = [NSString - stringWithFormat:@"%lu人在共享位置", (unsigned long)self.rcUserInfos.count]; + stringWithFormat:RCDLocalizedString(@"share_location_people_count"), (unsigned long)self.rcUserInfos.count]; } }]; } else { @@ -116,10 +130,10 @@ - (BOOL)addUser:(NSString *)userId showChange:(BOOL)show { [self.rcUserInfos addObject:userInfo]; [self addHeadViewUser:userInfo]; if (show) { - [self showUserChangeInfo:[NSString stringWithFormat:@"%@加入...", userInfo.name]]; + [self showUserChangeInfo:[NSString stringWithFormat:RCDLocalizedString(@"join_share_location"), userInfo.name]]; } else { self.tipLabel.text = - [NSString stringWithFormat:@"%lu人在共享位置", (unsigned long)self.rcUserInfos.count]; + [NSString stringWithFormat:RCDLocalizedString(@"share_location_people_count"), (unsigned long)self.rcUserInfos.count]; } } return YES; @@ -139,7 +153,7 @@ - (BOOL)removeUser:(NSString *)userId showChange:(BOOL)show { [self showUserChangeInfo:[NSString stringWithFormat:@"%@退出...", userInfo.name]]; } else { self.tipLabel.text = - [NSString stringWithFormat:@"%lu人在共享位置", (unsigned long)self.rcUserInfos.count]; + [NSString stringWithFormat:RCDLocalizedString(@"share_location_people_count"), (unsigned long)self.rcUserInfos.count]; } return YES; } else { @@ -162,7 +176,7 @@ - (void)showUserChangeInfo:(NSString *)changInfo { - (void)showUserShareInfo { self.tipLabel.textColor = [UIColor whiteColor]; - self.tipLabel.text = [NSString stringWithFormat:@"%lu人在共享位置", (unsigned long)self.rcUserInfos.count]; + self.tipLabel.text = [NSString stringWithFormat:RCDLocalizedString(@"share_location_people_count"), (unsigned long)self.rcUserInfos.count]; } - (NSArray *)getParticipantsUserInfo { diff --git a/ios-rongimdemo/RealTimeLocation/RealTimeLocationEndCell.m b/ios-rongimdemo/RealTimeLocation/RealTimeLocationEndCell.m index eac23859..89218ef8 100644 --- a/ios-rongimdemo/RealTimeLocation/RealTimeLocationEndCell.m +++ b/ios-rongimdemo/RealTimeLocation/RealTimeLocationEndCell.m @@ -34,7 +34,7 @@ - (void)setDataModel:(RCMessageModel *)model { // RCMessageContent *content = model.content; CGFloat maxMessageLabelWidth = self.baseContentView.bounds.size.width - 30 * 2; - [self.tipMessageLabel setText:@"位置共享已结束" dataDetectorEnabled:NO]; + [self.tipMessageLabel setText:RCDLocalizedString(@"share_location_finished") dataDetectorEnabled:NO]; NSString *__text = self.tipMessageLabel.text; CGSize __textSize = [RCKitUtility getTextDrawingSize:__text diff --git a/ios-rongimdemo/RealTimeLocation/RealTimeLocationStartCell.m b/ios-rongimdemo/RealTimeLocation/RealTimeLocationStartCell.m index 6d2b7d58..cb7eb831 100644 --- a/ios-rongimdemo/RealTimeLocation/RealTimeLocationStartCell.m +++ b/ios-rongimdemo/RealTimeLocation/RealTimeLocationStartCell.m @@ -34,7 +34,7 @@ - (void)setDataModel:(RCMessageModel *)model { // [subView removeFromSuperview]; // } - NSString *content = @"我发起了位置共享"; + NSString *content = RCDLocalizedString(@"i_start_location_share"); [self.textLabel setText:content dataDetectorEnabled:NO]; self.bubbleBackgroundView.userInteractionEnabled = YES; UILongPressGestureRecognizer *longPress = diff --git a/ios-rongimdemo/RealTimeLocation/RealTimeLocationStatusView.m b/ios-rongimdemo/RealTimeLocation/RealTimeLocationStatusView.m index fbcf950f..533e66c8 100644 --- a/ios-rongimdemo/RealTimeLocation/RealTimeLocationStatusView.m +++ b/ios-rongimdemo/RealTimeLocation/RealTimeLocationStatusView.m @@ -121,6 +121,35 @@ - (void)showStatus { [self addSubview:self.moreIcon]; } +- (void)layoutSubviews { + if (!self.isHidden) { + CGRect statusFrame = self.statusLabel.frame; + statusFrame = CGRectMake(30, 0, self.frame.size.width - 60, 40); + self.statusLabel.frame = statusFrame; + + CGRect locationFrame = self.locationIcon.frame; + locationFrame = CGRectMake(10, 13, 10, 14); + self.locationIcon.frame = locationFrame; + + CGRect moreIconFrame = self.moreIcon.frame; + moreIconFrame = CGRectMake(self.frame.size.width - 20, 13, 10, 14); + self.moreIcon.frame = moreIconFrame; + + CGRect expendLabelFrame = self.expendLabel.frame; + expendLabelFrame = CGRectMake(30, 0, self.frame.size.width - 48, 60); + self.expendLabel.frame = expendLabelFrame; + + CGRect cancelFrame = self.cancelButton.frame; + cancelFrame = CGRectMake(79, 52, 50, 25); + self.cancelButton.frame = cancelFrame; + + CGRect joinFrame = self.joinButton.frame; + joinFrame = CGRectMake(self.frame.size.width - 50 - 79, 52, 50, 25); + self.joinButton.frame = joinFrame; + } + [self setIsExpended:self.isExpended]; +} + - (void)showExtendedView { for (UIView *subView in self.subviews) { [subView removeFromSuperview]; @@ -157,9 +186,7 @@ - (UILabel *)expendLabel { _expendLabel = [[UILabel alloc] initWithFrame:CGRectMake(30, 0, self.frame.size.width - 48, 60)]; _expendLabel.textAlignment = NSTextAlignmentCenter; _expendLabel.textColor = [UIColor whiteColor]; - [_expendLabel setText:@"加" - @"入位置共享,聊天中其他人也能看到你的位置,确定加入" - @"?"]; + [_expendLabel setText:RCDLocalizedString(@"join_share_location_alert")]; _expendLabel.numberOfLines = 0; } return _expendLabel; @@ -167,7 +194,8 @@ - (UILabel *)expendLabel { - (UIButton *)cancelButton { if (!_cancelButton) { _cancelButton = [[UIButton alloc] initWithFrame:CGRectMake(79, 52, 50, 25)]; - [_cancelButton setTitle:@"取消" forState:UIControlStateNormal]; + [_cancelButton setTitle:RCDLocalizedString(@"cancel") + forState:UIControlStateNormal]; [_cancelButton setBackgroundImage:[UIImage imageNamed:@"location_share_button"] forState:UIControlStateNormal]; [_cancelButton setBackgroundImage:[UIImage imageNamed:@"location_share_button_hover"] forState:UIControlStateHighlighted]; diff --git a/ios-rongimdemo/RealTimeLocation/RealTimeLocationViewController.m b/ios-rongimdemo/RealTimeLocation/RealTimeLocationViewController.m index 37fd2ae0..e685a834 100644 --- a/ios-rongimdemo/RealTimeLocation/RealTimeLocationViewController.m +++ b/ios-rongimdemo/RealTimeLocation/RealTimeLocationViewController.m @@ -74,7 +74,7 @@ - (void)viewDidLoad { hud = [MBProgressHUD showHUDAddedTo:self.mapView animated:YES]; hud.color = [UIColor colorWithHexString:@"343637" alpha:0.5]; - hud.labelText = @"定位中..."; + hud.labelText = RCDLocalizedString(@"locating"); [hud show:YES]; } @@ -84,17 +84,21 @@ - (void)viewWillAppear:(BOOL)animated { CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; if (status == kCLAuthorizationStatusDenied) { [hud hide:YES]; - UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"无法访问" - message:@"没" - @"有权限访问位置信息,请从设置-" - @"隐私-定位服务 " - @"中打开位置访问权限" + UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:RCDLocalizedString(@"Inaccessible") + message:RCDLocalizedString(@"Location_access_without_permission") delegate:nil - cancelButtonTitle:@"确定" + cancelButtonTitle:RCDLocalizedString(@"confirm") + otherButtonTitles:nil]; [alertView show]; } } + +- (void)viewDidLayoutSubviews { + self.mapView.frame = CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height); + self.headCollectionView.frame = CGRectMake(0, 0, self.view.bounds.size.width, 95); +} + - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [self.realTimeLocationProxy removeRealTimeLocationObserver:self]; @@ -108,10 +112,11 @@ - (void)onUserSelected:(RCUserInfo *)user atIndex:(NSUInteger)index { } - (BOOL)quitButtonPressed { - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"是否结束位置共享?" + UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:RCDLocalizedString(@"end_share_location_alert") delegate:self - cancelButtonTitle:@"取消" - destructiveButtonTitle:@"结束" + cancelButtonTitle:RCDLocalizedString(@"cancel") + + destructiveButtonTitle:RCDLocalizedString(@"end") otherButtonTitles:nil]; [actionSheet showInView:self.view]; return YES; @@ -378,7 +383,7 @@ - (void)willPresentActionSheet:(UIActionSheet *)actionSheet { for (UIView *subView in actionSheet.subviews) { if ([subView isKindOfClass:[UIButton class]]) { UIButton *btn = (UIButton *)subView; - if ([btn.titleLabel.text isEqualToString:@"结束"]) { + if ([btn.titleLabel.text isEqualToString:RCDLocalizedString(@"end")]) { [btn setTitleColor:[UIColor redColor] forState:UIControlStateNormal]; } else { [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; diff --git a/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingTableViewCell.h b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingTableViewCell.h new file mode 100644 index 00000000..c7fba783 --- /dev/null +++ b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingTableViewCell.h @@ -0,0 +1,21 @@ +// +// RCDLanguageSettingTableViewCell.h +// SealTalk +// +// Created by 孙浩 on 2019/2/21. +// Copyright © 2019 RongCloud. All rights reserved. +// + +#import "RCDBaseSettingTableViewCell.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RCDLanguageSettingTableViewCell : UITableViewCell + +@property (nonatomic, strong) UILabel *leftLabel; + +@property (nonatomic, strong) UIImageView *rightImageView; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingTableViewCell.m b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingTableViewCell.m new file mode 100644 index 00000000..3bb0310a --- /dev/null +++ b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingTableViewCell.m @@ -0,0 +1,80 @@ +// +// RCDLanguageSettingTableViewCell.m +// SealTalk +// +// Created by 孙浩 on 2019/2/21. +// Copyright © 2019 RongCloud. All rights reserved. +// + +#import "RCDLanguageSettingTableViewCell.h" +#import "UIColor+RCColor.h" + +@interface RCDLanguageSettingTableViewCell () + +@property(nonatomic, strong) NSDictionary *cellSubViews; + +@end + +@implementation RCDLanguageSettingTableViewCell + +- (instancetype)initWithFrame:(CGRect)frame { + self = [super initWithFrame:frame]; + if (self) { + [self initialize]; + } + return self; +} + +- (void)initialize { + self.leftLabel = [[UILabel alloc] init]; + self.leftLabel.font = [UIFont systemFontOfSize:17.f]; + self.leftLabel.textColor = [UIColor colorWithHexString:@"0x262626" alpha:1.0f]; + self.leftLabel.translatesAutoresizingMaskIntoConstraints = NO; + + self.rightImageView = [[UIImageView alloc] init]; + self.rightImageView.layer.cornerRadius = 5.0f; + self.rightImageView.layer.masksToBounds = YES; + self.rightImageView.translatesAutoresizingMaskIntoConstraints = NO; + self.rightImageView.contentMode = UIViewContentModeScaleAspectFill; + + [self.contentView addSubview:self.leftLabel]; + [self.contentView addSubview:self.rightImageView]; + + self.cellSubViews = NSDictionaryOfVariableBindings(_leftLabel, _rightImageView); + [self setLayout]; +} + +- (void)setLayout { + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_leftLabel(21)]" + options:0 + metrics:nil + views:self.cellSubViews]]; + [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_leftLabel + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self.contentView + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0]]; + + [self.contentView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[_rightImageView(20)]" + options:0 + metrics:nil + views:self.cellSubViews]]; + + [self.contentView addConstraint:[NSLayoutConstraint constraintWithItem:_rightImageView + attribute:NSLayoutAttributeCenterY + relatedBy:NSLayoutRelationEqual + toItem:self.contentView + attribute:NSLayoutAttributeCenterY + multiplier:1 + constant:0]]; + + [self.contentView + addConstraints: + [NSLayoutConstraint + constraintsWithVisualFormat:@"H:|-10-[_leftLabel]-(>=10)-[_rightImageView(20)]-20-|" + options:0 + metrics:nil + views:self.cellSubViews]]; +}@end diff --git a/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingViewController.h b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingViewController.h new file mode 100644 index 00000000..dc437c38 --- /dev/null +++ b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingViewController.h @@ -0,0 +1,17 @@ +// +// RCDLanguageSettingViewController.h +// SealTalk +// +// Created by 孙浩 on 2019/2/21. +// Copyright © 2019 RongCloud. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RCDLanguageSettingViewController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingViewController.m b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingViewController.m new file mode 100644 index 00000000..047e2ca5 --- /dev/null +++ b/ios-rongimdemo/RongCloud/LanguageSettings/RCDLanguageSettingViewController.m @@ -0,0 +1,127 @@ +// +// RCDLanguageSettingViewController.m +// SealTalk +// +// Created by 孙浩 on 2019/2/21. +// Copyright © 2019 RongCloud. All rights reserved. +// + +#import "RCDLanguageSettingViewController.h" +#import "AppDelegate.h" +#import "RCDLanguageManager.h" +#import "RCDMainTabBarViewController.h" +#import "RCDNavigationViewController.h" +#import "UIColor+RCColor.h" +#import "RCDLanguageSettingTableViewCell.h" + +@interface RCDLanguageSettingViewController () + +@property (nonatomic, strong) UITableView *tableView; +@property (nonatomic, strong) NSString *language; +@property (nonatomic, strong) NSString *currentLanguage; +@property (nonatomic, strong) NSDictionary *languageDic; + +@end + +@implementation RCDLanguageSettingViewController + +#pragma mark - Life cycle +- (void)viewDidLoad { + [super viewDidLoad]; + + self.title = RCDLocalizedString(@"language"); + self.languageDic = @{@"en":@"English", @"zh-Hans":@"简体中文"}; + [self.view addSubview:self.tableView]; + + self.language = [RCDLanguageManager sharedRCDLanguageManager].localzableLanguage; + self.currentLanguage = self.language; + self.tableView.tableFooterView = [UIView new]; + + self.tableView.backgroundColor = [UIColor colorWithHexString:@"f0f0f6" alpha:1.f]; + if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { + self.tableView.separatorInset = UIEdgeInsetsMake(0, 10, 0, 0); + } + if ([self.tableView respondsToSelector:@selector(setLayoutMargins:)]) { + self.tableView.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 0); + } + + UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:RCDLocalizedString(@"save") style:UIBarButtonItemStylePlain target:self action:@selector(save)]; + [rightBarButtonItem setTintColor:[UIColor colorWithHexString:@"3A91F3" alpha:0.4]]; + self.navigationItem.rightBarButtonItem = rightBarButtonItem; + self.navigationItem.rightBarButtonItem.enabled = NO; +} + +-(void)viewDidLayoutSubviews{ + self.tableView.frame = self.view.bounds; + [self.tableView reloadData]; +} + +#pragma mark - UITableView Delegate +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSLog(@"current language %@", self.languageDic.allValues[indexPath.row]); + + self.language = self.languageDic.allKeys[indexPath.row]; + + if ([self.language containsString:self.currentLanguage]) { + [self.navigationItem.rightBarButtonItem setTintColor:[UIColor colorWithHexString:@"3A91F3" alpha:0.4]]; + self.navigationItem.rightBarButtonItem.enabled = NO; + } else { + [self.navigationItem.rightBarButtonItem setTintColor:[RCIM sharedRCIM].globalNavigationBarTintColor]; + self.navigationItem.rightBarButtonItem.enabled = YES; + } + [self.tableView reloadData]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return 15.f; +} + +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + + UITableViewHeaderFooterView *header = [[UITableViewHeaderFooterView alloc]init]; + header.contentView.backgroundColor = [UIColor colorWithHexString:@"f0f0f6" alpha:1.f];; + + return header; +} + +#pragma mark - UITableView DataSource +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.languageDic.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *reusableCellWithIdentifier = @"RCELanguageSettingViewControllerCell"; + RCDLanguageSettingTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:reusableCellWithIdentifier]; + if (cell == nil) { + cell = [[RCDLanguageSettingTableViewCell alloc] init]; + } + NSString * key = self.languageDic.allKeys[indexPath.row]; + cell.leftLabel.text = [self.languageDic valueForKey:key]; + cell.rightImageView.image = [key containsString:self.language] ? [UIImage imageNamed:@"select"] : nil; + return cell; +} + +#pragma mark - Target action +- (void)save { + //设置当前语言 + [[RCDLanguageManager sharedRCDLanguageManager] setLocalizableLanguage:self.language]; + + //重置vc堆栈 + AppDelegate *app = (AppDelegate *)[UIApplication sharedApplication].delegate; + RCDMainTabBarViewController *mainTabBarVC = [[RCDMainTabBarViewController alloc] init]; + RCDNavigationViewController *nav = [[RCDNavigationViewController alloc] initWithRootViewController:mainTabBarVC]; + mainTabBarVC.selectedIndex = 3; + app.window.rootViewController = nav; +} + +#pragma mark - Getters and setters +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + } + return _tableView; +} + +@end diff --git a/ios-rongimdemo/RongCloud/RCDSearchFriendController.h b/ios-rongimdemo/RongCloud/RCDSearchFriendController.h new file mode 100644 index 00000000..a8b182df --- /dev/null +++ b/ios-rongimdemo/RongCloud/RCDSearchFriendController.h @@ -0,0 +1,17 @@ +// +// RCDSearchFriendController.h +// SealTalk +// +// Created by 张改红 on 2019/2/28. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface RCDSearchFriendController : UIViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/ios-rongimdemo/RongCloud/RCDSearchFriendController.m b/ios-rongimdemo/RongCloud/RCDSearchFriendController.m new file mode 100644 index 00000000..6ff97844 --- /dev/null +++ b/ios-rongimdemo/RongCloud/RCDSearchFriendController.m @@ -0,0 +1,300 @@ +// +// RCDSearchFriendController.m +// SealTalk +// +// Created by 张改红 on 2019/2/28. +// Copyright © 2019年 RongCloud. All rights reserved. +// + +#import "RCDSearchFriendController.h" +#import "RCDIndicateTextField.h" +#import "DefaultPortraitView.h" +#import "RCDAddFriendViewController.h" +#import "RCDHttpTool.h" +#import "RCDPersonDetailViewController.h" +#import "RCDRCIMDataSource.h" +#import "RCDSearchResultTableViewCell.h" +#import "RCDUserInfoManager.h" +#import "RCDataBaseManager.h" +#import "UIImageView+WebCache.h" +#import "RCDCountryListController.h" +#import "RCDCountry.h" +@interface RCDSearchFriendController () +@property (nonatomic, strong) UITableView *resultTableView; +@property (nonatomic, strong) UIView *searchInfoView; +@property (nonatomic, strong) RCDIndicateTextField *countryTextField; +@property (nonatomic, strong) RCDIndicateTextField *phoneTextField; +@property (nonatomic, strong) NSMutableArray *searchResult; +@property (nonatomic, strong) RCDCountry *currentRegion; +@end + +@implementation RCDSearchFriendController +#pragma mark - Life cycle +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; + self.currentRegion = [[RCDCountry alloc] initWithDict:[[NSUserDefaults standardUserDefaults] objectForKey:@"currentCountry"]]; + [self addSubviews]; + self.navigationItem.title = RCDLocalizedString(@"add_contacts"); + UIBarButtonItem *right = [[UIBarButtonItem alloc] initWithTitle:RCDLocalizedString(@"cancel") + style:(UIBarButtonItemStylePlain) target:self action:@selector(onCancelAction)]; + self.navigationItem.rightBarButtonItem = right; + self.navigationItem.rightBarButtonItem.enabled = NO;; + +} + +- (void)viewWillAppear:(BOOL)animated{ + [super viewWillAppear:animated]; + [self.navigationController setNavigationBarHidden:NO animated:NO]; +} + +- (void)viewDidLayoutSubviews { + self.resultTableView.frame = self.view.bounds; + self.searchInfoView.frame = CGRectMake(0, 0, self.view.frame.size.width, 200); +} + +#pragma mark - UITableViewDataSource & UITableViewDelegate +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.searchResult.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 80.f; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *reusableCellWithIdentifier = @"RCDSearchResultTableViewCell"; + RCDSearchResultTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reusableCellWithIdentifier]; + if (cell == nil) { + cell = [[RCDSearchResultTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reusableCellWithIdentifier]; + } + cell = [[RCDSearchResultTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault + reuseIdentifier:reusableCellWithIdentifier]; + RCDUserInfo *user = self.searchResult[indexPath.row]; + if (user) { + cell.lblName.text = user.name; + if ([user.portraitUri isEqualToString:@""]) { + DefaultPortraitView *defaultPortrait = + [[DefaultPortraitView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; + [defaultPortrait setColorAndLabel:user.userId Nickname:user.name]; + UIImage *portrait = [defaultPortrait imageFromView]; + cell.ivAva.image = portrait; + } else { + [cell.ivAva sd_setImageWithURL:[NSURL URLWithString:user.portraitUri] + placeholderImage:[UIImage imageNamed:@"icon_person"]]; + } + } + cell.ivAva.contentMode = UIViewContentModeScaleAspectFill; + cell.selectionStyle = UITableViewCellSelectionStyleNone; + return cell; +} + +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + RCDUserInfo *user = _searchResult[indexPath.row]; + RCUserInfo *userInfo = [RCUserInfo new]; + userInfo.userId = user.userId; + userInfo.name = user.name; + userInfo.portraitUri = user.portraitUri; + + if ([userInfo.userId isEqualToString:[RCIM sharedRCIM].currentUserInfo.userId]) { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil + message:RCDLocalizedString(@"can_not_add_self_to_address_book") + delegate:nil + cancelButtonTitle:RCDLocalizedString(@"confirm") + + otherButtonTitles:nil]; + [alert show]; + } else{ + NSMutableArray *cacheList = + [[NSMutableArray alloc] initWithArray:[[RCDataBaseManager shareInstance] getAllFriends]]; + BOOL isFriend = NO; + for (RCDUserInfo *tempInfo in cacheList) { + if ([tempInfo.userId isEqualToString:user.userId] && [tempInfo.status isEqualToString:@"20"]) { + isFriend = YES; + break; + } + } + if (isFriend == YES) { + RCDPersonDetailViewController *detailViewController = [[RCDPersonDetailViewController alloc] init]; + detailViewController.userId = user.userId; + [self.navigationController pushViewController:detailViewController animated:YES]; + } else { + RCDAddFriendViewController *addViewController = [[RCDAddFriendViewController alloc] init]; + addViewController.targetUserInfo = userInfo; + [self.navigationController pushViewController:addViewController animated:YES]; + } + } +} + +#pragma mark - RCDCountryListControllerDelegate +- (void)fetchCountryPhoneCode:(RCDCountry *)country{ + self.currentRegion = country; + self.countryTextField.textField.text = country.countryName; + self.phoneTextField.indicateInfoLabel.text = [NSString stringWithFormat:@"+%@",self.currentRegion.phoneCode]; +} + +#pragma mark - Target action +- (void)didTapCountryTextField{ + RCDCountryListController *countryListVC = [[RCDCountryListController alloc] init]; + countryListVC.showNavigationBarWhenBack = YES; + countryListVC.delegate = self; + [self.navigationController pushViewController:countryListVC animated:YES]; +} + +- (void)didSearchFriend{ + [self.searchResult removeAllObjects]; + NSString *searchText = self.phoneTextField.textField.text; + if ([searchText length] > 0) { + __weak typeof(self) weakSelf = self; + [RCDHTTPTOOL + searchUserByPhone:searchText region:self.currentRegion.phoneCode + complete:^(NSMutableArray *result) { + if (result && result.count > 0) { + for (RCDUserInfo *user in result) { + if ([user.userId isEqualToString:[RCIM sharedRCIM].currentUserInfo.userId]) { + [[RCDUserInfoManager shareInstance] + getUserInfo:user.userId + completion:^(RCUserInfo *user) { + [weakSelf.searchResult addObject:user]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf showAndReloadResultTableView]; + }); + }]; + } else { + [[RCDUserInfoManager shareInstance] + getFriendInfo:user.userId + completion:^(RCUserInfo *user) { + [weakSelf.searchResult addObject:user]; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf showAndReloadResultTableView]; + }); + }]; + } + } + }else{ + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil + message:RCDLocalizedString(@"no_search_Friend") + delegate:nil + cancelButtonTitle:RCDLocalizedString(@"confirm") + + otherButtonTitles:nil]; + [alert show]; + } + }]; + } +} + +- (void)onCancelAction{ + [self hidenAndReloadResultTableView]; +} + +- (void)showAndReloadResultTableView{ + [self.phoneTextField.textField resignFirstResponder]; + self.navigationItem.rightBarButtonItem.enabled = YES;; + [UIView animateWithDuration:0.2 animations:^{ + self.resultTableView.hidden = NO; + self.searchInfoView.hidden = YES; + [self.searchInfoView sendSubviewToBack:self.resultTableView]; + [self.resultTableView reloadData]; + }]; +} + +- (void)hidenAndReloadResultTableView{ + self.navigationItem.rightBarButtonItem.enabled = NO;; + [UIView animateWithDuration:0.2 animations:^{ + self.resultTableView.hidden = YES; + self.searchInfoView.hidden = NO; + [self.searchInfoView bringSubviewToFront:self.resultTableView]; + [self.resultTableView reloadData]; + }]; +} + +#pragma mark - Subviews +- (void)addSubviews{ + [self.view addSubview:self.resultTableView]; + [self.view addSubview:self.searchInfoView]; + + [self.searchInfoView addSubview:self.countryTextField]; + [self.searchInfoView addSubview:self.phoneTextField]; + UIButton *searchButton = [[UIButton alloc] init]; + [searchButton setTitleColor:HEXCOLOR(0x252525) forState:(UIControlStateNormal)]; + [searchButton setTitle:RCDLocalizedString(@"search") forState:(UIControlStateNormal)]; + searchButton.titleLabel.font = [UIFont systemFontOfSize:15]; + searchButton.layer.masksToBounds = YES; + searchButton.layer.cornerRadius = 4; + searchButton.layer.borderColor = [UIColor grayColor].CGColor; + searchButton.layer.borderWidth = 1; + [searchButton addTarget:self action:@selector(didSearchFriend) forControlEvents:(UIControlEventTouchUpInside)]; + [self.searchInfoView addSubview:searchButton]; + + self.countryTextField.translatesAutoresizingMaskIntoConstraints = NO; + self.phoneTextField.translatesAutoresizingMaskIntoConstraints = NO; + searchButton.translatesAutoresizingMaskIntoConstraints = NO; + + NSDictionary *view = NSDictionaryOfVariableBindings(_countryTextField,_phoneTextField,searchButton); + [self.searchInfoView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-20-[_countryTextField(60)]-10-[_phoneTextField(60)]-20-[searchButton(30)]" options:0 metrics:nil views:view]]; + [self.searchInfoView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-20-[_countryTextField]-20-|" options:0 metrics:nil views:view]]; + [self.searchInfoView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-20-[_phoneTextField]-20-|" options:0 metrics:nil views:view]]; + [self.searchInfoView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:[searchButton(80)]-20-|" options:0 metrics:nil views:view]]; +} + +#pragma mark - Getters and setters +- (UITableView *)resultTableView{ + if (!_resultTableView) { + _resultTableView = [[UITableView alloc] initWithFrame:self.view.bounds style:(UITableViewStylePlain)]; + _resultTableView.backgroundColor= [UIColor whiteColor]; + _resultTableView.tableFooterView = [UIView new]; + _resultTableView.delegate = self; + _resultTableView.dataSource = self; + _resultTableView.hidden = YES; + } + return _resultTableView; +} + +- (UIView *)searchInfoView{ + if (!_searchInfoView) { + _searchInfoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 200)]; + } + return _searchInfoView; +} + +-(RCDIndicateTextField *)countryTextField{ + if (!_countryTextField) { + _countryTextField = [[RCDIndicateTextField alloc] initWithLineColor:[UIColor grayColor]]; + _countryTextField.indicateIcon.image = [UIImage imageNamed:@"right_arrow"]; + _countryTextField.indicateInfoLabel.text = RCDLocalizedString(@"country"); + _countryTextField.indicateInfoLabel.textColor = HEXCOLOR(0x252525); + _countryTextField.textField.text = self.currentRegion.countryName; + _countryTextField.textField.textColor = HEXCOLOR(0x252525); + _countryTextField.textField.userInteractionEnabled = NO; + [_countryTextField indicateIconShow:YES]; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapCountryTextField)]; + [_countryTextField addGestureRecognizer:tap]; + _countryTextField.userInteractionEnabled = YES; + } + return _countryTextField; +} + +- (RCDIndicateTextField *)phoneTextField{ + if (!_phoneTextField) { + _phoneTextField = [[RCDIndicateTextField alloc] initWithLineColor:[UIColor grayColor]]; + _phoneTextField.backgroundColor = [UIColor clearColor]; + _phoneTextField.indicateInfoLabel.text = [NSString stringWithFormat:@"+%@",self.currentRegion.phoneCode]; + _phoneTextField.indicateInfoLabel.textColor = HEXCOLOR(0x252525); + _phoneTextField.textField.textColor = HEXCOLOR(0x252525); + _phoneTextField.userInteractionEnabled = YES; + _phoneTextField.translatesAutoresizingMaskIntoConstraints = NO; + _phoneTextField.textField.adjustsFontSizeToFitWidth = YES; + _phoneTextField.textField.clearButtonMode = UITextFieldViewModeWhileEditing; + _phoneTextField.textField.keyboardType = UIKeyboardTypeNumberPad; + } + return _phoneTextField; +} + +-(NSMutableArray *)searchResult{ + if (!_searchResult) { + _searchResult = [NSMutableArray array]; + } + return _searchResult; +} +@end diff --git a/ios-rongimdemo/SealTalkShareExtension/RCDShareChatListController.m b/ios-rongimdemo/SealTalkShareExtension/RCDShareChatListController.m index e5cfe7c0..d2f1021a 100644 --- a/ios-rongimdemo/SealTalkShareExtension/RCDShareChatListController.m +++ b/ios-rongimdemo/SealTalkShareExtension/RCDShareChatListController.m @@ -16,6 +16,7 @@ @interface RCDShareChatListController () @end #define ReuseIdentifier @"cellReuseIdentifier" +#define RCDLocalizedString(key) NSLocalizedStringFromTable(key, @"SealTalk", nil) #define DemoServer @"http://api.sealtalk.im/" //线上正式环境 //#define DemoServer @"http://api.hitalk.im/" //测试环境 @@ -24,9 +25,10 @@ @implementation RCDShareChatListController - (void)viewDidLoad { [super viewDidLoad]; - self.title = @"选择"; + self.title = RCDLocalizedString(@"choose") +; - self.rightBarButton = [[UIBarButtonItem alloc] initWithTitle:@"发送" + self.rightBarButton = [[UIBarButtonItem alloc] initWithTitle:RCDLocalizedString(@"send") style:UIBarButtonItemStylePlain target:self action:@selector(sendMessageTofriend:)]; @@ -106,7 +108,8 @@ - (void)sendMessageTofriend:(id)sender { [request setHTTPBody:[NSJSONSerialization dataWithJSONObject:sendMessageDict options:0 error:nil]]; [request setTimeoutInterval:10.0]; - self.rightBarButton.title = @"发送中"; + self.rightBarButton.title = RCDLocalizedString(@"sending") +; self.rightBarButton.enabled = NO; // 4.建立连接 @@ -122,9 +125,11 @@ - (void)sendMessageTofriend:(id)sender { [array addObject:insertMessageDict]; [shareUserDefaults setValue:array forKey:@"sharedMessages"]; [shareUserDefaults synchronize]; - notify = @"发送成功"; + notify = RCDLocalizedString(@"send_success") +; } else { - notify = @"发送失败"; + notify = RCDLocalizedString(@"send_fail") +; } dispatch_async(dispatch_get_main_queue(), ^{ UIAlertController *alertController = diff --git a/ios-rongimdemo/SealTalkShareExtension/RCDShareViewController.m b/ios-rongimdemo/SealTalkShareExtension/RCDShareViewController.m index 07995fd5..0e9640da 100644 --- a/ios-rongimdemo/SealTalkShareExtension/RCDShareViewController.m +++ b/ios-rongimdemo/SealTalkShareExtension/RCDShareViewController.m @@ -9,6 +9,8 @@ #import "RCDShareViewController.h" #import "RCDShareChatListController.h" #import "TFHpple.h" +#define RCDLocalizedString(key) NSLocalizedStringFromTable(key, @"SealTalk", nil) + @interface RCDShareViewController () @property(nonatomic, copy) NSString *titleString; @@ -81,9 +83,11 @@ - (NSArray *)configurationItems { if (self.isLogin) { //不支持此类型的分享 if (!self.canShare) { - item.title = @"我知道了"; + item.title = RCDLocalizedString(@"i_know_it") +; __weak typeof(self) weakSelf = self; - self.textView.text = @"抱歉,暂不支持此类型内容的分享"; + self.textView.text = RCDLocalizedString(@"support_share") +; self.textView.textAlignment = NSTextAlignmentCenter; item.tapHandler = ^{ [weakSelf.extensionContext completeRequestReturningItems:@[] completionHandler:nil]; @@ -91,7 +95,8 @@ - (NSArray *)configurationItems { return @[ item ]; } - item.title = @"分享给朋友"; + item.title = RCDLocalizedString(@"share_to_friend") +; __weak typeof(self) weakSelf = self; item.tapHandler = ^{ RCDShareChatListController *tableView = [[RCDShareChatListController alloc] init]; @@ -161,10 +166,12 @@ - (NSArray *)configurationItems { }; }else{ - item.title = @"我知道了"; + item.title = RCDLocalizedString(@"i_know_it") +; __weak typeof(self) weakSelf = self; - self.textView.text = @"抱歉,请先打开 SealTalk,并登录,才可以使用分享功能"; + self.textView.text = RCDLocalizedString(@"use_share_must_open_sealtalk") +; self.textView.textAlignment = NSTextAlignmentCenter; item.tapHandler = ^{ [weakSelf.extensionContext completeRequestReturningItems:@[] completionHandler:nil]; diff --git a/ios-rongimdemo/ServiceExtension/NotificationService.m b/ios-rongimdemo/ServiceExtension/NotificationService.m index c2d9d482..a57dd59d 100644 --- a/ios-rongimdemo/ServiceExtension/NotificationService.m +++ b/ios-rongimdemo/ServiceExtension/NotificationService.m @@ -7,7 +7,6 @@ // #import "NotificationService.h" -#import @interface NotificationService () diff --git a/ios-rongimdemo/UITabBar+badge.m b/ios-rongimdemo/UITabBar+badge.m index 5c713ed3..f52cea43 100644 --- a/ios-rongimdemo/UITabBar+badge.m +++ b/ios-rongimdemo/UITabBar+badge.m @@ -10,6 +10,7 @@ #define TabbarItemNums 4.0 #import "RCDTabBarBtn.h" #import "UIColor+RCColor.h" +#import "RCDCommonDefine.h" @implementation UITabBar (badge) @@ -103,7 +104,15 @@ - (void)showBadgeOnItemIndex:(int)index badgeValue:(int)badgeValue { //新建小红点 CGRect tabFrame = self.frame; //确定小红点的位置 - float percentX = (index + 0.5) / TabbarItemNums; + float scale = 0.5; + if (RCDIsIPad) { + if (([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortrait) || ([UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationPortraitUpsideDown)) { + scale = 0.55; + } else { + scale = 0.6; + } + } + float percentX = (index + scale) / TabbarItemNums; CGFloat x = ceilf(percentX * tabFrame.size.width); CGFloat y = ceilf(0.1 * tabFrame.size.height); if (badgeValue < 10) { diff --git a/ios-rongimdemo/autobuild.sh b/ios-rongimdemo/autobuild.sh index 4d321f4a..8348a384 100644 --- a/ios-rongimdemo/autobuild.sh +++ b/ios-rongimdemo/autobuild.sh @@ -248,6 +248,25 @@ mkdir -p "$BIN_DIR" mkdir -p "$BUILD_DIR" xcodebuild clean -alltargets +echo "Copy 3rd framework start." +if [ -d "../ios-3rd-vendor/jrmf/AlipaySDK" ]; then +rm -rf ./framework/AlipaySDK +cp -rf ../ios-3rd-vendor/jrmf/AlipaySDK ./framework/ +fi +if [ -d "../ios-3rd-vendor/jrmf/JrmfIMLib" ]; then +rm -rf ./framework/JrmfIMLib +cp -rf ../ios-3rd-vendor/jrmf/JrmfIMLib ./framework/ +fi +if [ -d "../ios-3rd-vendor/ifly" ]; then +rm -rf ./framework/ifly +cp -rf ../ios-3rd-vendor/ifly ./framework/ +fi +if [ -d "../ios-3rd-vendor/bqmm" ]; then +rm -rf ./framework/bqmm +cp -rf ../ios-3rd-vendor/bqmm ./framework/ +fi +echo "Copy 3rd framework end." + echo "***开始build iphoneos文件***" xcodebuild -scheme "${targetName}" archive -archivePath "./${BUILD_DIR}/${targetName}.xcarchive" -configuration "${configuration}" APP_PROFILE="${BUILD_APP_PROFILE}" SHARE_PROFILE="${BUILD_SHARE_PROFILE}" xcodebuild -exportArchive -archivePath "./${BUILD_DIR}/${targetName}.xcarchive" -exportOptionsPlist "archive.plist" -exportPath "./${BIN_DIR}" diff --git a/ios-rongimdemo/en.lproj/SealTalk.strings b/ios-rongimdemo/en.lproj/SealTalk.strings new file mode 100644 index 00000000..69813afa --- /dev/null +++ b/ios-rongimdemo/en.lproj/SealTalk.strings @@ -0,0 +1,480 @@ +"conversation"="Chats"; +"search"="Search"; +"contacts"="Contacts"; +"discover"="Discover"; +"me"="Me"; +"start_chatting"="Start Chatting"; +"create_groups"="Create Groups"; +"add_contacts"="Add Contacts"; +"add_friend_placeholder"="Enter mobile (i.e.):(86)137XXXXX"; +"create_discussion_group"="Create Discussion Group"; +"cancel"="Cancel"; +"back"="Back"; +"mention_all"="@All"; +"group_information_x"="Group Information(%@)"; +"group_information"="Group Information"; +"group_members_x"="Group Members(%lu)"; +"all_group_member_z"="All Group Members(%@)"; +"group_portrait"="Group Portrait"; +"group_name"="Group Name"; +"group_announcement"="Group Announcemnet"; +"search_chat_history"="Search Chat History"; +"mute_notifications"="Mute Notifications"; +"stick_on_top"="Stick on Top"; +"clear_chat_history"="Clear Chat History"; +"delete_and_exit"="Delete and Quit"; +"delete_and_exit_discuss_group"="Delete and quit discussion group"; +"confirm"="Confirm"; +"done"="Done"; +"Please_edit_the_group_announcement"="Please edit group announcement"; +"detailed_information"="Detailed Information"; +"set_remarks"="Set Remarks"; +"mobile_number"="Mobile Number"; +"start_chat"="Start Chatting"; +"voice_call"="Voice Call"; +"video_call"="Video Call"; +"blacklist"="Blacklist"; +"add_to_blacklist"="Add to blacklist"; +"cancel_block"="Remove from blacklist"; +"adding_to_blacklist"="Adding to blacklist"; +"fail_to_add_to_blacklist"="Failed to add to blacklist"; +"removing_from_blacklist"="Removing from blacklist"; +"fail_to_remove_from_blacklist"="Failed to remove from blacklist"; +"new_friend"="New Friend"; +"group"="Group"; +"public_account"="Public Account"; +"add_friend"="Add Contacts"; +"chatroom"="Chatroom"; +"account_setting"="Account Settings"; +"my_wallet"="My Wallet"; +"feedback"="Feedback"; +"about_sealtalk"="About SealTalk"; +"customer_service_xn"="Xiaoneng"; +"customer_service_jx"="Jiaxin"; +"nickname"="Nickname"; +"take_picture"="Take Picture"; +"my_album"="My Album"; +"change_nickname"="Change Nickname"; +"save"="Save"; +"privacy"="Privacy"; +"new_message_notification"="New Message Notification"; +"push_setting"="Push Settings"; +"Display_remotely_pushed_content"="Notification Shows Details"; +"clear_cache"="Clear Cache"; +"clear_cache_alert"="Do you want to clear cache?"; +"clear_cache_succrss"="Cache is cleared successfully"; +"logout"="Logout"; +"logout_alert"="Are you sure to logout this account?"; +"change_password"="Change Password"; +"old_password"="Old Password"; +"old_and_new_friend_different"="The confirmed password is inconsistent with the new password."; +"old_password_error"="The old password is incorrect"; +"password_hint"="Input 6-16 characters, case sensitive"; +"password_alert"="Password must be 6-16 characters, case sensitive"; +"new_password"="New Password"; +"confirm_new_password"="Confirm Password"; +"confirm_send"="Confirm to send to: "; +"send"="Send"; +"mobile_number_unempty"="Mobile number input cannot be empty"; +"mobile_number_format_is_incorrect"="The mobile number format is incorrect"; +"password_can_not_be_blank"="Password input cannot be empty"; +"There_can_be_no_spaces_in_the_password"="Password cannot contain spaces"; +"The_phone_number_format_is_incorrect"="The mobile number format is incorrect"; +"see_more"="See more %@"; +"include"="Include:"; +"file"="[File]"; +"link"="[Link]"; +"no_search_Friend"="No Results"; +"no_search_result"="Not related content of \"%@\" were found"; +"join_share_location"="%@ join..."; +"someone_join_share_location"="%@ join to location sharing"; +"user_join_share_location"="User<%@> joined to location sharing"; +"share_location_people_count"="%lu of people in sharing location"; +"share_location_finished"="Location sharing is ended"; +"i_start_location_share"="I initiate a location sharing"; +"join_share_location_alert"="Join location sharing, other people in the chat can also see your location, confirm to join?"; +"locating"="Positioning..."; +"Inaccessible"="Unable to access"; +"Location_access_without_permission"="Can not access to location information, please turn on location access from Settings - Privacy - Location Services"; +"end_share_location_alert"="Are you sure to end location sharing?"; +"end"="End"; +"leave_location_share_when_leave_chat"="End chatting, the location share will also be ended, confirm to end the conversion ?"; +"send_location"="Send Location"; +"location_share"="Real-time Location Sharing"; +"you_join_location_share"="You have joined a location share"; +"you_location_sharing"="You are sharing a location"; +"someone_location_sharing"="%@ is sharing a location"; +"user_location_sharing"="User<%@> is sharing a location"; +"you_quit_location_share"="You have quit a location sharing"; +"someone_quit_location_share"="%@ has quit a location sharing"; +"user_quit_location_share"="User<%@> has quit a location sharing"; +"Forwarding_is_not_supported"="Voice message, emoticons, failed messages, and other special type of message are not be able to forward"; +"de_actionbar_sub_system"="System Message"; +"select_contact"="Select Contacts"; +"friend_request"="Friend Request"; +"from_someone_friend_request"="Friend request from %@"; +"someone_accept_you_friend_request"="%@ has accepted your friend request"; +"choose_contact"="Select Contacts"; +"all_contacts"="Contacts"; +"discussion_group_name"="Discussion Group Name"; +"open_member_invite"="Enable Member Invitation"; +"please_type_discuss_group_name"="Please input discussion group name"; +"discuss_group_can_not_space"="Discussion group name cannot contain spaces"; +"Login"="Login"; +"new_user"="Sign up"; +"verification_code"="Verification Code"; +"send_verification_code"="Get Code"; +"after_60_seconds_obtain"="Get after 60 seconds"; +"char_section_case_sensitive_from6_t16"="Input 6-16 characters, case sensitive"; +"change_success"="Changed"; +"username_can_not_nil"="User name cannot be empty"; +"password_can_not_more_than_20"="The password cannot be greater than 20 characters!"; +"password_can_not_nil"="Password input cannot be empty"; +"verification_code_can_not_nil"="Verification code cannot be empty"; +"after_x_seconds_send"="Send after %d seconds"; +"forgot_password"="Find Password"; +"password"="Password"; +"private_cloud_setting"="Private Cloud Settings"; +"Login_fail"="Login failed"; +"can_not_connect_server"="Unable to connect to the server"; +"network_can_not_use_please_check"="The current network is not available, please check!"; +"logining"="Logging in..."; +"mobile_number_or_password_error"="Mobile number or password is incorrect"; +"Login_fail_please_check_network"="Login failed, please check the network"; +"please_check_mobile_number_and_password"="Please check your mobile number and password"; +"accout_kicked"="Your account is logged-in on another device and you are forced to logout!"; +"please_type_demo_server"="Please enter the demo server address "; +"please_type_navigation_server"="Please enter the navigation server address"; +"please_type_file_server_address"="Please enter the file server address"; +"please_type_appKey"="Please enter app key"; +"note_server_can_not_type_http"="Note: Please do not enter \"http://\" in server address "; +"appKey_can_not_nil"="Appkey input cannot be empty"; +"demo_server_can_not_nil"="Demo server address cannot be empty"; +"navi_server_can_not_nil"="Navigation server address cannot be empty"; +"file_server_can_not_nil"="File server address cannot be empty"; +"dev_value_must_1_or_2"="The dev value must be 1 or 2 "; +"code"="SMS Verification Code"; +"phone_number_has_been_registered"="The mobile number has been registered "; +"phone_number_type_error"="The mobile number was entered incorrectly"; +"register_success"="Registration is successful"; +"register_fail"="Registration is failed"; +"register"="Register"; +"verification_code_error"="Incorrect verification code"; +"captcha_overdue"="The verification code is expired, please re-request"; +"verification_code_invail"="Invalid verification code"; +"phone_number_can_not_nil"="Mobile number input cannot be empty"; +"nickname_can_not_nil"="The nickname input cannot be empty"; +"nickname_can_not_over_32"="The nickname format cannot be greater than 32 characters"; +"nickname_can_not_contain_space"="The nickname cannot contain spaces"; +"after_60_seconds_send"="Send after 60 seconds"; +"chat_detail"="Chat Details"; +"someone_nickname"="Nickname: %@"; +"total_related_message"="%d message(s) related"; +"chat_history"="Chat History"; +"clear_chat_history_alert"="Confirm to clear the chat history?"; +"clear_chat_history_success"="Chat history is cleared"; +"clear_chat_history_fail"="Clear chat history failed"; +"friend_news"="Friend Message"; +"can_not_add_self_to_address_book"="Not be able to add myself as friend"; +"friend_invite_had_send"="Friend request has sent"; +"request_had_send"="Request has sent"; +"request_fail_retry"="Request failed, please try again"; +"accept"="Accept"; +"had_accept"="Accepted"; +"had_invite"="Invited"; +"no_invite"="No Data"; +"adding_friend"="Adding Friends…"; +"add_fail"="Add failed"; +"add_member_fail"="Failed to add members"; +"delete_member_fail"="Failed to delete members"; +"discuss_group"="Disscussion Group"; +"no_friend"="No Friends"; +"setting"="Setting…"; +"set_fail"="Setting failed"; +"Remark_name"="Remark Name"; +"x_people_had_read"="%lu have read"; +"zero_people_unread"="0 unread"; +"x_people_unread"="%lu unread"; +"Receipt_details"="Receipt Details"; +"DisbandAndDelete"="Dismiss and Delete"; +"delete_group_alert"="Confirm to quit the group?"; +"Disband_group_alert"="Confirm to dismiss the group?"; +"Uploading_avatar"="Uploading portrait…"; +"Upload_avatar_fail"="Uploading failed"; +"quit_fail"="Quit failed"; +"Disband_group_fail"="Failed to dismiss the group"; +"Only_the_owner_can_edit_the_group_name"="Only group admin is able to edit the group name"; +"Only_the_owner_can_change_the_group_portrait"="Only group admin is able to edit the group portrait"; +"Only_the_group_owner_can_post_a_group_announcement"="Only group admin is able to send group announcement"; +"remove_member"="Remove Members"; +"Exit_this_edit"="Quit this edit ?"; +"Continue_editing"="Continue"; +"quit"="Quit"; +"The_announcement_will_notify_all_members_of_the_group"="The announcement will notify all group members, confirm to submit?"; +"Group_announcement_failed_to_be_sent"="Failed to send group announcemnet "; +"group_name_can_not_nil"="Group name input cannot be empty"; +"Group_name_is_too_short"="Group name is too short"; +"Group_name_cannot_exceed_10_words"="Group name cannot exceed 10 words"; +"Group_name_modification_failed"="Group name modification failed"; +"type_croup_name_hint"="Fill in the group name (2-10 characters)"; +"creating_group"="Creating…"; +"create_group_fail"="Failed to create a group, please check your network settings."; +"customer"="Customer Service"; +"remark_rebot_service"="Please rate our robotic customer service "; +"satisfaction"="If you are satisfied with our service, press Yes. If is not, press No."; +"yes"="Yes"; +"no"="No"; +"choose_tag"="Please select the tag"; +"type_idea"="Please fill in your suggestion"; +"remark"="Rate"; +"submit_remark"="Submit Rate"; +"remark_customer"="Please rate our customer service "; +"cs_evaluate_resolved_title"="Our customer service has solved your problem?"; +"cs_evaluate_resolved"="Solved"; +"cs_evaluate_unresolved"="Unsolved"; +"cs_evaluate_problem_title"="What are the problems ?"; +"cs_evaluate_problem_must_title"="What are the problems ? (must select)"; +"Personal_information"="Personal Info"; +"modify_nickname"="Change Nickname"; +"Username_cannot_be_greater_than_32_digits"="User name cannot be greater than 32 characters"; +"modify_nickname_fail"="Modification failed, please check the entered name"; +"english"="En"; +"chinese"="Cn"; +"settings"="Settings"; +"setting_success"="Setting completed"; +"Do_not_disturb_setting"="Mute Notifications Setup"; +"alert"="Prompt"; +"Turn_on_message_do_not_disturb"="Turn on mute notification"; +"Start_time"="Start Time"; +"Start_time1"="Start Time:"; +"continue_times"="Spent Time (mins):"; +"end_time"="End Time:"; +"shut_down_failed"="Shut down failed"; +"Receive_new_message_notifications"="New Message Notification"; +"show_ID"="Shows ID"; +"show_online_status"="Display Online Status"; +"show_setting"="Display Settings"; +"force_crash"="Forced Crash"; +"send_log"="Send Log"; +"Joining_the_chat_room_failed_to_stay_in_the_session_interface"="Joining the chat room failed to retain in the session interface"; +"custom_setting"="Custom Settings"; +"Set_offline_message_compensation_time"="Set up offline message compensation time"; +"Set_global_DND_time"="Set up overall do not disturb time"; +"time_setting"="Time settings"; +"xday"="%d days"; +"Set_offline_message_compensation_hint"="Offline message compensation time, between 1-7days"; +"update_log"="Log Updates"; +"function_introduce"="Feature Introductions"; +"offical_website"="Official Website"; +"SealTalk_version"="SealTalk Version"; +"SDK_version"="SDK Version"; +"Login_is_invalid_please_login_again"="Login failed, please try again"; +"i_know"="Got it"; +"Your_account_has_been_banned"="Your account has been suspended"; +"picture"="[Picture]"; +"voice"="[Voice]"; +"location"="[Location]"; +"no_support"="[Do not support message]"; +"good_friend"="Friend"; +"x_unread_message"="%d unread messages"; +"stop_record"="Stop recording"; +"start_record"="Start recording"; +"i_know_it"="I know"; +"support_share"="Sorry, current version does not support sharing this type of contents"; +"share_to_friend"="Share to friend"; +"use_share_must_open_sealtalk"="Sorry, please login SealTalk for sharing contents."; +"choose"="Select "; +"sending"="Sending"; +"send_success"="Sent"; +"send_fail"="Failed"; +"portrait"="Portrait"; +"country"="Country/Region"; +"select_country"="Select the Country & Region"; +"language"="Language"; +"China"="China"; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios-rongimdemo/framework/Blink.framework/Blink b/ios-rongimdemo/framework/Blink.framework/Blink index b277d7d8..3b5ba991 100644 --- a/ios-rongimdemo/framework/Blink.framework/Blink +++ b/ios-rongimdemo/framework/Blink.framework/Blink @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:20009afe5b01465cabce9494e6ec09ce9349bb8534761ac5f7c0dba9f117d904 -size 127895456 +oid sha256:e2783a66c993cf4ea2fa9471cd4d225a3d51eb5f328f835c49f84fad8f0b7c61 +size 127901888 diff --git a/ios-rongimdemo/framework/Blink.framework/Headers/BlinkEngine.h b/ios-rongimdemo/framework/Blink.framework/Headers/BlinkEngine.h index 809091aa..70d34dbc 100644 --- a/ios-rongimdemo/framework/Blink.framework/Headers/BlinkEngine.h +++ b/ios-rongimdemo/framework/Blink.framework/Headers/BlinkEngine.h @@ -1,7 +1,7 @@ /*! @header BlinkEngine.h @author BailingCloud - @version 2.0.3_20190123180221_dev_meeting_dev_seal_9bcdf80 + @version 2.0.3_20190305204820_dev_meeting_dev_seal_3f41477 @Copyright © 2018年 BailingCloud. All rights reserved. */ @@ -9,7 +9,7 @@ #import #import -#define SDKCompileInfo @"2.0.3_20190123180143_dev_meeting_dev_seal_9bcdf80" +#define SDKCompileInfo @"2.0.3_20190305204806_dev_meeting_dev_seal_3f41477" //宏定义说明, 设置视频聊天参数时的Key值, 详见SetVideoParameters:方法 #define kAudioOnly @"AudioOnly" diff --git a/ios-rongimdemo/framework/JrmfIMLib/en.lproj/JrmfInfo.strings b/ios-rongimdemo/framework/JrmfIMLib/en.lproj/JrmfInfo.strings index bd70758a..60cd807d 100644 --- a/ios-rongimdemo/framework/JrmfIMLib/en.lproj/JrmfInfo.strings +++ b/ios-rongimdemo/framework/JrmfIMLib/en.lproj/JrmfInfo.strings @@ -6,6 +6,7 @@ Copyright © 2016年 JYang. All rights reserved. */ "Packet" = "Red Packet"; +"转账" = "Transfer"; "红包" = "Red Packet"; "实名认证" = "Real-name authentication"; "真实姓名" = "Real Name"; @@ -165,6 +166,7 @@ "安全设置" = "Security setting"; "银行卡设置" = "Cards"; "我的零钱" = "Balance"; +//"%@张" = "Amounts: %@ "; "%@张" = " %@ "; "充值" = "Top Up"; "提现" = "Withdraw"; @@ -257,3 +259,44 @@ "网络异常,请检查网络" = "Network anomaly, please check the network"; "https公钥未找到" = "Https public key not found"; "服务器异常,请重试" = "Server is abnormal, please try again"; + + +// 转账 +"[转账]待确认收款" = "[Transfer] Wait for your receipt"; +"[转账]请确认收款" = "[Transfer] Confirm"; +"[转账]已确认收款" = "[Transfer] Receipt confirm"; +"[转账]确认收款" = "[Transfer] You've confirmed receipt"; +"[转账]款已被退还" = "[Transfer] Your friend has rejected the transfer"; +"[转账]已将款退还" = "[Transfer] You've rejected this money"; +"已收款" = "Accepted"; +"待%@确认收款" = "Wait for %@ receipt"; +"确认收款" = "Confirm Receipt"; +"收款时间:%@" = "Collection Time:%@"; +"%@已收款" = "%@ Receipt confirm"; + +"云转账" = "Cloud Transfer"; +"添加转账说明" = "Add Note"; +"你有%@笔相同的转账对方未确认收款,你是否要继续转账" = "You have %@ transfer(s) with the same amount awaiting confirmation by the receiver. You can open transaction history to resend these transfer messages or continue to make a new transfer"; +"继续转账" = "Continue"; +"修改" = "Change"; +"向%转账" = "Transfer money to %@"; +"完成" = "Done"; +"转账时间:%@" = "Transfer Time:%@"; +"转账详情" = "Transfer Details"; +"1天内朋友未确认,将退还给对方。立即退还" = "If the friend does not confirm within one day, it will be returned to the other party. Immediately returned"; +"1天内朋友未确认,将退还给对方。" = "More than one day will be refunded"; +"1天内朋友未确认,将退还给你。" = "Money will be refunded to other user if receipt not confirmed within in 1 day "; +"立即退还" = "Refond now"; +"是否退还%@的转账" = "To reject %@’s transfer"; +"已退还" = "Rejected"; +"%@ 已退还" = "%@ Rejected"; +"退还时间:%@" = "Rejected time:%@"; +"已退款到钱包" = "This money has been returned to Balance"; +"转账金额" = "Transfer amount"; +"转账给%@" = "Pay to %@"; +"向%@转账" = "Pay to %@"; +"您尚未进行实名认证,账户可能存在安全风险,请实名认证后尝试" = "You have not been the real-name authentication, the account may have security risks, please try after the real-name authentication"; +"实名认证" = "Real-name Authentication"; +"转账给你" = "Transfer to you"; +"已退还(过期)" = "Rejected(Expired)"; +"转账说明" = "Transfer instructions"; diff --git a/ios-rongimdemo/framework/JrmfIMLib/zh-Hans.lproj/JrmfInfo.strings b/ios-rongimdemo/framework/JrmfIMLib/zh-Hans.lproj/JrmfInfo.strings index 33dc4639..a04b1c4f 100644 --- a/ios-rongimdemo/framework/JrmfIMLib/zh-Hans.lproj/JrmfInfo.strings +++ b/ios-rongimdemo/framework/JrmfIMLib/zh-Hans.lproj/JrmfInfo.strings @@ -6,3 +6,4 @@ Copyright © 2016年 JYang. All rights reserved. */ "Packet" = "红包"; +"%@人民币" = "%@元"; diff --git a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongCloud.bundle/no_message_img@2x.png b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongCloud.bundle/no_message_img@2x.png index db018060..582dab95 100644 Binary files a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongCloud.bundle/no_message_img@2x.png and b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongCloud.bundle/no_message_img@2x.png differ diff --git a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongPTTKit b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongPTTKit index b64c12ca..01b15348 100644 Binary files a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongPTTKit and b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/RongPTTKit differ diff --git a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/en.lproj/RongCloudKit.strings b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/en.lproj/RongCloudKit.strings index b66bae3c..1b55772c 100644 Binary files a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/en.lproj/RongCloudKit.strings and b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/en.lproj/RongCloudKit.strings differ diff --git a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/zh-Hans.lproj/RongCloudKit.strings b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/zh-Hans.lproj/RongCloudKit.strings index b7eae384..901cebf4 100644 Binary files a/ios-rongimdemo/framework/PTT/RongPTTKit.framework/zh-Hans.lproj/RongCloudKit.strings and b/ios-rongimdemo/framework/PTT/RongPTTKit.framework/zh-Hans.lproj/RongCloudKit.strings differ diff --git a/ios-rongimdemo/framework/RCSticker/RongSticker.framework/RongSticker b/ios-rongimdemo/framework/RCSticker/RongSticker.framework/RongSticker index 6d9f0537..e6e86d6a 100644 Binary files a/ios-rongimdemo/framework/RCSticker/RongSticker.framework/RongSticker and b/ios-rongimdemo/framework/RCSticker/RongSticker.framework/RongSticker differ diff --git a/ios-rongimdemo/framework/RongCallKit.framework/Info.plist b/ios-rongimdemo/framework/RongCallKit.framework/Info.plist index d905e420..4967d5db 100644 Binary files a/ios-rongimdemo/framework/RongCallKit.framework/Info.plist and b/ios-rongimdemo/framework/RongCallKit.framework/Info.plist differ diff --git a/ios-rongimdemo/framework/RongCallKit.framework/RongCallKit b/ios-rongimdemo/framework/RongCallKit.framework/RongCallKit index 51ad6fe7..14eb46a1 100644 Binary files a/ios-rongimdemo/framework/RongCallKit.framework/RongCallKit and b/ios-rongimdemo/framework/RongCallKit.framework/RongCallKit differ diff --git a/ios-rongimdemo/framework/RongCallLib.framework/Info.plist b/ios-rongimdemo/framework/RongCallLib.framework/Info.plist index 2e05768f..49f7495a 100644 Binary files a/ios-rongimdemo/framework/RongCallLib.framework/Info.plist and b/ios-rongimdemo/framework/RongCallLib.framework/Info.plist differ diff --git a/ios-rongimdemo/framework/RongCallLib.framework/RongCallLib b/ios-rongimdemo/framework/RongCallLib.framework/RongCallLib index a2bbb630..af1be0b7 100644 Binary files a/ios-rongimdemo/framework/RongCallLib.framework/RongCallLib and b/ios-rongimdemo/framework/RongCallLib.framework/RongCallLib differ diff --git a/ios-rongimdemo/framework/RongCloud.bundle/no_message_img@2x.png b/ios-rongimdemo/framework/RongCloud.bundle/no_message_img@2x.png index db018060..582dab95 100644 Binary files a/ios-rongimdemo/framework/RongCloud.bundle/no_message_img@2x.png and b/ios-rongimdemo/framework/RongCloud.bundle/no_message_img@2x.png differ diff --git a/ios-rongimdemo/framework/RongContactCard.framework/RongContactCard b/ios-rongimdemo/framework/RongContactCard.framework/RongContactCard index 948a8625..e8554173 100644 Binary files a/ios-rongimdemo/framework/RongContactCard.framework/RongContactCard and b/ios-rongimdemo/framework/RongContactCard.framework/RongContactCard differ diff --git a/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCConversationViewController.h b/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCConversationViewController.h index aaa74cc6..6d5da068 100644 --- a/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCConversationViewController.h +++ b/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCConversationViewController.h @@ -188,6 +188,16 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; +/*! + 输入工具栏尺寸(高度)发生变化的回调 + + @param chatInputBar 输入工具栏 + @param frame 输入工具栏最终需要显示的Frame + + @discussion 如重写此方法,请先调用父类方法。 + */ +- (void)chatInputBar:(RCChatSessionInputBarControl *)chatInputBar shouldChangeFrame:(CGRect)frame; + /*! 扩展功能板的点击回调 @@ -582,9 +592,12 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { @discussion 自定义消息如果需要显示,则必须先通过RCIM的registerMessageType:注册该自定义消息类型, 并在会话页面中通过registerClass:forCellWithReuseIdentifier:注册该自定义消息的Cell,否则将此回调将不会被调用。 + + @warning **已废弃,请勿使用。** + 升级说明:即将显示消息的回调统一使用 willDisplayMessageCell:atIndexPath: 方法。 */ - (RCMessageBaseCell *)rcConversationCollectionView:(UICollectionView *)collectionView - cellForItemAtIndexPath:(NSIndexPath *)indexPath; + cellForItemAtIndexPath:(NSIndexPath *)indexPath __deprecated_msg("已废弃,请勿使用。"); /*! 自定义消息Cell显示的回调 @@ -596,10 +609,13 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { @discussion 自定义消息如果需要显示,则必须先通过RCIM的registerMessageType:注册该自定义消息类型, 并在会话页面中通过registerClass:forCellWithReuseIdentifier:注册该自定义消息的Cell,否则将此回调将不会被调用。 + + @warning **已废弃,请勿使用。** + 升级说明:请实现自定义消息 Cell 的 sizeForMessageModel:withCollectionViewWidth:referenceExtraHeight: 方法来设置 size。 */ - (CGSize)rcConversationCollectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout - sizeForItemAtIndexPath:(NSIndexPath *)indexPath; + sizeForItemAtIndexPath:(NSIndexPath *)indexPath __deprecated_msg("已废弃,请勿使用。"); /*! 未注册消息Cell显示的回调 diff --git a/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCKitUtility.h b/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCKitUtility.h index f8a0cca1..0152c0b5 100644 --- a/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCKitUtility.h +++ b/ios-rongimdemo/framework/RongIMKit.framework/Headers/RCKitUtility.h @@ -251,4 +251,11 @@ 验证邮箱 */ + (BOOL)validateEmail:(NSString *)email; + +/** + 获取 AppDelegate window 的 safeAreaInsets + + @return AppDelegate window 的 safeAreaInsets + */ ++ (UIEdgeInsets)getWindowSafeAreaInsets; @end diff --git a/ios-rongimdemo/framework/RongIMKit.framework/Info.plist b/ios-rongimdemo/framework/RongIMKit.framework/Info.plist index 454fdec0..b957219b 100644 Binary files a/ios-rongimdemo/framework/RongIMKit.framework/Info.plist and b/ios-rongimdemo/framework/RongIMKit.framework/Info.plist differ diff --git a/ios-rongimdemo/framework/RongIMKit.framework/RongIMKit b/ios-rongimdemo/framework/RongIMKit.framework/RongIMKit index 82afe805..e42bfb51 100644 Binary files a/ios-rongimdemo/framework/RongIMKit.framework/RongIMKit and b/ios-rongimdemo/framework/RongIMKit.framework/RongIMKit differ diff --git a/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h b/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h index ccefa616..0db4ad9a 100644 --- a/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h +++ b/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h @@ -35,7 +35,7 @@ /*! 将AMR格式的音频数据转化为WAV格式的音频数据 - @param data AMR格式的音频数据,必须是AMR-NB的格式 + @param data AMR格式的音频数据,可以是AMR-NB或者AMR-WB格式 @return WAV格式的音频数据 */ - (NSData *)decodeAMRToWAVE:(NSData *)data; @@ -63,7 +63,17 @@ 如果您想和SDK自带的语音消息保持一致和互通,考虑到跨平台和传输的原因,SDK对于WAV音频有所限制. 具体可以参考RCVoiceMessage中的音频参数说明(nChannels为1,nBitsPerSample为16)。 */ -- (NSData *)encodeWAVEToAMR:(NSData *)data channel:(int)nChannels nBitsPerSample:(int)nBitsPerSample; +- (NSData *)encodeWAVEToAMR:(NSData *)data channel:(int)nChannels nBitsPerSample:(int)nBitsPerSample __deprecated_msg("已废弃,请勿使用。"); + +/*! + 将WAV格式的音频数据转化为AMR格式的音频数据(8KHz/16KHz采样) + + @param data WAV格式的音频数据 + @return AMR-NB/AMR-WB格式的音频数据 + @discussion 如果采样率为8KHz则返回 AMR-NB 格式数据,如果采样率为16KHz则返回 AMR-WB 格式数据。 + */ +- (NSData *)encodeWAVEToAMR:(NSData *)data; + @end #endif diff --git a/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCIMClient.h b/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCIMClient.h index d318c98d..e7a0c1e2 100644 --- a/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCIMClient.h +++ b/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCIMClient.h @@ -1290,6 +1290,28 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; +/*! + 清除历史消息 + + @param conversationType 会话类型 + @param targetId 目标会话ID + @param recordTime 清除消息时间戳,【0 <= recordTime <= 当前会话最后一条消息的 sentTime,0 清除所有消息,其他值清除小于等于 recordTime 的消息】 + @param clearRemote 是否同时删除服务端消息 + @param successBlock 获取成功的回调 + @param errorBlock 获取失败的回调 [status:清除失败的错误码] + + @discussion + 此方法可以清除服务器端历史消息和本地消息,如果清除服务器端消息必须先开通历史消息云存储功能。 + 例如,您不想从服务器上获取更多的历史消息,通过指定 recordTime 并设置 clearRemote 为 YES 清除消息,成功后只能获取该时间戳之后的历史消息。如果 clearRemote 传 NO, + 只会清除本地消息。 + */ +- (void)clearHistoryMessages:(RCConversationType)conversationType + targetId:(NSString *)targetId + recordTime:(long long)recordTime + clearRemote:(BOOL)clearRemote + success:(void (^)(void))successBlock + error:(void (^)(RCErrorCode status))errorBlock; + /*! 从服务器端获取之前的历史消息 @@ -2273,6 +2295,15 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; */ - (NSData *)encodeWAVEToAMR:(NSData *)data channel:(int)nChannels nBitsPerSample:(int)nBitsPerSample; +#pragma mark - 语音消息设置 +/** + 语音消息采样率,默认8KHz + + @discussion + 2.9.12 之前的版本只支持 8KHz。如果设置为 16KHz,老版本将无法播放 16KHz 的语音消息。 + */ +@property (nonatomic, assign) RCSampleRate sampleRate; + #pragma mark - 客服方法 /*! 发起客服聊天 @@ -2461,7 +2492,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param targetId 会话ID @param keyword 关键字 @param count 最大的查询数量 - @param startTime 查询记录的起始时间(传 0 表示不限时间) + @param startTime 查询 startTime 之前的消息(传 0 表示不限时间) @return 匹配的消息列表 */ @@ -2471,6 +2502,23 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; count:(int)count startTime:(long long)startTime; +/*! + 按用户 ID 搜索指定会话中的消息 + + @param conversationType 会话类型 + @param targetId 会话ID + @param userId 搜索用户ID + @param count 最大的查询数量 + @param startTime 查询 startTime 之前的消息(传 0 表示不限时间) + + @return 匹配的消息列表 + */ +- (NSArray *)searchMessages:(RCConversationType)conversationType + targetId:(NSString *)targetId + userId:(NSString *)userId + count:(int)count + startTime:(long long)startTime; + /*! 根据关键字搜索会话 diff --git a/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCStatusDefine.h b/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCStatusDefine.h index 5d532357..6bac8c58 100644 --- a/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCStatusDefine.h +++ b/ios-rongimdemo/framework/RongIMLib.framework/Headers/RCStatusDefine.h @@ -613,6 +613,11 @@ typedef NS_ENUM(NSUInteger, RCConversationType) { */ ConversationType_Encrypted = 11, + /** + * RTC 会话 + */ + ConversationType_RTC = 12, + /*! 无效类型 */ @@ -841,6 +846,18 @@ typedef NS_ENUM(NSUInteger, RCMentionedType) { RC_Mentioned_Users = 2, }; +/** + 语音消息采样率 + + - RCSample_Rate_8000: 8KHz + - RCSample_Rate_16000: 16KHz + */ +typedef NS_ENUM(NSInteger,RCSampleRate) +{ + RCSample_Rate_8000 = 1, //8KHz + RCSample_Rate_16000 = 2, //16KHz +}; + #pragma mark - 公众服务相关 #pragma mark RCPublicServiceType - 公众服务账号类型 diff --git a/ios-rongimdemo/framework/RongIMLib.framework/Info.plist b/ios-rongimdemo/framework/RongIMLib.framework/Info.plist index d0acf3b7..bb8553ee 100644 Binary files a/ios-rongimdemo/framework/RongIMLib.framework/Info.plist and b/ios-rongimdemo/framework/RongIMLib.framework/Info.plist differ diff --git a/ios-rongimdemo/framework/RongIMLib.framework/RongIMLib b/ios-rongimdemo/framework/RongIMLib.framework/RongIMLib index 71e38eb4..df8aa3da 100644 Binary files a/ios-rongimdemo/framework/RongIMLib.framework/RongIMLib and b/ios-rongimdemo/framework/RongIMLib.framework/RongIMLib differ diff --git a/ios-rongimdemo/framework/RongPTTLib.framework/RongPTTLib b/ios-rongimdemo/framework/RongPTTLib.framework/RongPTTLib index 89670a91..b76d5d35 100644 Binary files a/ios-rongimdemo/framework/RongPTTLib.framework/RongPTTLib and b/ios-rongimdemo/framework/RongPTTLib.framework/RongPTTLib differ diff --git a/ios-rongimdemo/framework/RongRTCEngine.framework/RongRTCEngine b/ios-rongimdemo/framework/RongRTCEngine.framework/RongRTCEngine index 5ddefa5c..d7543c31 100644 Binary files a/ios-rongimdemo/framework/RongRTCEngine.framework/RongRTCEngine and b/ios-rongimdemo/framework/RongRTCEngine.framework/RongRTCEngine differ diff --git a/ios-rongimdemo/framework/RongSight.framework/RongSight b/ios-rongimdemo/framework/RongSight.framework/RongSight index f14db552..a70f28ea 100644 Binary files a/ios-rongimdemo/framework/RongSight.framework/RongSight and b/ios-rongimdemo/framework/RongSight.framework/RongSight differ diff --git a/ios-rongimdemo/framework/RongiFlyKit.framework/Info.plist b/ios-rongimdemo/framework/RongiFlyKit.framework/Info.plist index c131b4b5..25ff58c5 100644 Binary files a/ios-rongimdemo/framework/RongiFlyKit.framework/Info.plist and b/ios-rongimdemo/framework/RongiFlyKit.framework/Info.plist differ diff --git a/ios-rongimdemo/framework/RongiFlyKit.framework/RongiFlyKit b/ios-rongimdemo/framework/RongiFlyKit.framework/RongiFlyKit index c27a610f..1ecccdc6 100644 Binary files a/ios-rongimdemo/framework/RongiFlyKit.framework/RongiFlyKit and b/ios-rongimdemo/framework/RongiFlyKit.framework/RongiFlyKit differ diff --git a/ios-rongimdemo/framework/en.lproj/RongCloudKit.strings b/ios-rongimdemo/framework/en.lproj/RongCloudKit.strings index f2225b42..44a4143e 100644 --- a/ios-rongimdemo/framework/en.lproj/RongCloudKit.strings +++ b/ios-rongimdemo/framework/en.lproj/RongCloudKit.strings @@ -1,158 +1,159 @@ "RC:ImgMsg"="[Image]"; "RC:LBSMsg"="[Location]"; "RC:VcMsg"="[Voice]"; -"RC:ImgTextMsg"="[RichContent]"; -"RC:PSMultiImgTxtMsg"="[RichContent]"; -"RC:PSImgTxtMsg"="[RichContent]"; +"RC:ImgTextMsg"="[Message]"; +"RC:PSMultiImgTxtMsg"="[Message]"; +"RC:PSImgTxtMsg"="[Message]"; "RC:SightMsg"="[Video]"; "Draft"="[Draft]"; "Message"="Message"; -"conversation_private_collection_title"="Private Groups"; -"conversation_customer_collection_title"="Customer Groups"; -"conversation_group_collection_title"="My Groups"; -"conversation_discussion_collection_title"="Discussion Groups"; -"conversation_systemMessage_collection_title"="System Messages"; +"conversation_private_collection_title"="Chat assistant"; +"conversation_customer_collection_title"="Customer assistant"; +"conversation_group_collection_title"="Group assistant"; +"conversation_discussion_collection_title"="Discussion groups assistant"; +"conversation_systemMessage_collection_title"="System messages assistant"; "OK"="Ok"; + "Cancel"="Cancel"; -"speakerAccessRight"="You don't have the access right of speaker, please set it in Settings"; -"cameraAccessRight"="You don't have the access right of camera, please set it in Settings"; -"photoAccessRight"="You don't have the access right of photo, please set it in Settings"; +"speakerAccessRight"="You don't have microphone access, please go to \"Settings - Privacy - Microphone\" to allow access to your microphone!"; +"cameraAccessRight"="You don't have camera access, please go to \"Settings - Privacy - Camera\" to allow access to your camera!"; +"photoAccessRight"="You don't have photo aceess, please go to \"Settings - Privacy - Photos\" to allow access to your photos!"; "VoIP_Mute"="Mute"; "VoIP_Speaker"="Speaker"; "VoIP_End"="End"; "VoIP_Answer"="Answer"; "VoIP_Reject"="Reject"; "VoIP_Drop"="Drop"; -"Request_Friends_extra"="You have received a message for requesting add friends"; -"Setting"="Setting"; +"Request_Friends_extra"="Friend adding request"; +"Setting"="Settings"; "Back"="Back"; -"IsDeleteHistoryMsg"="Do you want to delete history message?"; +"IsDeleteHistoryMsg"="Do you want to clear the chat history?"; "ConnectionIsNotReachable"="Network unavailable, check network"; -"PreviewFile"="Preview File"; -"StartDownloadingFile"="Start downloading"; +"PreviewFile"="File preview"; +"StartDownloadingFile"="Start download"; "FileIsDownloading"="Downloding..."; "FileDownloadFailed"="Download failed"; "FileDownloadCanceled"="Download has been canceled"; "OpenFileInOtherApp"="Open the file in other app"; "Audio"="Audio"; "unknown_message_cell_tip"="The current version is not available for viewing this message"; -"unknown_message_notification_tip"="Receive an unkown message"; +"unknown_message_notification_tip"="Received an unkown message"; "Copy"="Copy"; "Delete"="Delete"; "Recall"="Recall"; "Forward"="Forward"; -"MessageRecalling"="Message is recalling"; +"MessageRecalling"="Recalling..."; "AdminWithMessageRecalled"="Admin"; "OtherHasRecalled"="%@ has recalled a message"; "SelfHaveRecalled"="You have recalled a message"; -"MessageRecallFailed"="Failed to recall the message.Check network."; +"MessageRecallFailed"="Failed to recall the message, please check your network."; "Save"="Save"; "SavePhotoFailed"="Failed to save this photo"; "SavePhotoSuccess"="Saved"; "Done"="Done"; "LocationInformation"="Location information"; "LocalNotificationShow"="Show"; -"MaxNumSelectPhoto"="Max number is 9 for selection"; -"AllPhoto"="All Photo"; +"MaxNumSelectPhoto"="Select up to 9 photos"; +"AllPhoto"="All Photos"; "NoPhotoTitle"="No Photos or Videos"; -"NoPhotoDesc"="You can sync photos and videos onto your iPhone using iTunes."; -"SetToTop"="Sticky to Top"; +"NoPhotoDesc"="You can use your camera to take photos and videos, or use iTunes to sync photos and videos to your iPhone."; +"SetToTop"="Stick to Top"; "NewMsgNotification"="New Message Notification"; "ClearRecord"="Clear Chat History"; -"CanNotRemoveSelf"="Can't remove yourself"; +"CanNotRemoveSelf"="Cannot remove yourself"; "MemberNumber"="members"; "You"="You"; "Invite"="invited"; "JoinDiscussion"="to the discussion"; "QuitDiscussion"="quit the discussion"; -"By"="removed"; -"RemoveDiscussion"="from the discussion"; +"By"="By"; +"RemoveDiscussion"="Removed from the discussion"; "ModifyDiscussion"="renamed the discussion as"; "InviteStatus"="invitation"; -"Open"="Open"; +"Open"="Enable"; "Close"="Close"; "VoIP_Calling"="Calling..."; -"VoIP_Talking"="Calling number is talking"; -"VoIP_Offline"="Calling number is offline"; -"VoIP_Net_busy"="Network is busy"; -"VoIP_Not_Accept"="Call has no answer"; -"VoIP_Rejected_By_Blacklist"="Your call has sent out, but been rejected by the receiver"; -"WaitingForAcceptInvitation"="Waiting for accept calling invitation..."; -"VoIP_CallingFailed"="Calling is failed, please try again"; -"VoIP_invite"="Invite you for talking"; -"VoIP_Incoming_Notification"="Invite you to join the call"; +"VoIP_Talking"="The number you have called is busy"; +"VoIP_Offline"="The number you have called is offline"; +"VoIP_Net_busy"="Network is busy, please try later"; +"VoIP_Not_Accept"="Call has not answered"; +"VoIP_Rejected_By_Blacklist"="Your call has been rejected by receiver"; +"WaitingForAcceptInvitation"="Waiting for others to accept the invitation..."; +"VoIP_CallingFailed"="Calling failed, please try again"; +"VoIP_invite"="Invite you for chatting"; +"VoIP_Incoming_Notification"="Invite you for a voice call"; "VoIP_Accepted_Notification"="Call accepted"; "VoIP_SessionIDWrong"="Session ID is wrong"; "Yesterday"="Yesterday"; -"SearchPublicService"="Search Public Service"; -"PublicService"="Public Service"; +"SearchPublicService"="Search Service Account"; +"PublicService"="Service Account"; "NOT_IN_DISCUSSION"="You are not in current discussion"; "NOT_IN_GROUP"="You are not in current group"; -"FORBIDDEN_IN_GROUP"="You were forbidden to send message in current group."; +"FORBIDDEN_IN_GROUP"="You are banned to send message in current group."; "NOT_IN_CHATROOM"="You are not in current chatroom"; -"Message rejected"="Your message have sent out, but rejected by the receiver"; -"AccessRightTitle"="no access right"; -"ForbiddenInChatRoom"="You were forbidden to send message in current chatroom."; -"KickedFromChatRoom"="You were kicked from current chatroom."; -"JoinChatRoomRejected"="You were forbidden to join current chatroom, please contact customer service."; -"JoinChatRoomFailed"="Failed to join chatroom"; +"Message rejected"="Your message has been sent, but rejected by receiver"; +"AccessRightTitle"="Cannot access"; +"ForbiddenInChatRoom"="You are banned to send message in current chatroom"; +"KickedFromChatRoom"="You were kicked out from chatroom"; +"JoinChatRoomRejected"="You are banned to join the chatroom, please contact customer service"; +"JoinChatRoomFailed"="Failed to join the chatroom"; "Connecting..."="Connecting..."; -"FromFriendInvitation"="From %@ friend invitation"; -"AcceptFriendRequest"="Accept your friend request"; -"AddFriendRequest"="Add Friend Invitation"; +"FromFriendInvitation"="friend invitation from %@"; +"AcceptFriendRequest"="Accepted your friend request"; +"AddFriendRequest"="Friend adding request"; "ReadAll"="Read all"; -"OfficialAccounts"="Official Accounts"; -"Share"="Share Name Card"; +"OfficialAccounts"="Public account"; +"Share"="Share to friend"; "Report"="Report"; "OpenURLInBrowser"="Open in Safari"; "CopyURL"="Copy URL"; "ClearHistory"="Clear History"; "Unfollow"="Unfollow"; -"Introduced"="Intro"; +"Introduced"="Feature introduction"; "AccountType"="Account Type"; -"ServicePhone"="Customer service hotline"; +"ServicePhone"="Service hotline"; "BusinessScope"="Business Scope"; "NewMessageNotification"="New message notification"; -"ViewHistory"="View History"; +"ViewHistory"="View chat history"; "EnterOfficialAccount"="Enter Official Account"; "Attention"="Follow"; -"PublicNum"="Public service : %@"; +"PublicNum"="Public account : %@"; "Wait"="Please wait a moment..."; "Searching"="Searching..."; "Search"="Search:"; "Right_unReadMessage"="%@ new message"; "HistoryMessageTip"="Above is the historical messages"; -"DISCUSSION"="discussion"; +"DISCUSSION"="Discussion"; "DateFormat"="MM-dd"; "MessageHasRead"="Read"; "MessageHasSend"="Sent"; "typing"="typing..."; "Speaking"="Speaking..."; "Submit"="Submit"; -"EvaluateCustomerService"="Evaluate customer service"; -"Robot_Comment_Title"="Whether the robot solves your problem?"; -"Admin_Comment_Title"="Please comment on our services"; +"EvaluateCustomerService"="Rate the customer service"; +"Robot_Comment_Title"="Whether the robotic customer service has solved your problem?"; +"Admin_Comment_Title"="Please rate our services"; "NOT_CUSTOM_SERVICE"="No custom service"; "VoIPAudioCall"="Voice Call"; "VoIPVideoCall"="Video Call"; -"VoIPAudioCallExistedWarning"="Voice call is on. Try again later."; -"VoIPVideoCallExistedWarning"="Video call is on. Try again later."; -"AudioHoldingWarning"="Audio is holding by other function. Try again later."; +"VoIPAudioCallExistedWarning"="Voice call is in progress, please try again later"; +"VoIPVideoCallExistedWarning"="Video call is in progress, please try again later"; +"AudioHoldingWarning"="The audio channel is being used, please try later"; "VoIPCallSelectMember"="Select Members"; -"VoIPAudioCallMaxNumSelectMember"="Up to %d members"; -"VoIPVideoCallMaxNumSelectMember"="Up to %d members"; -"VoIPCallEnd"="Call cancelled"; +"VoIPAudioCallMaxNumSelectMember"="Select up to %d members for a voice call"; +"VoIPVideoCallMaxNumSelectMember"="Select up to @ members for a video call"; +"VoIPCallEnd"="Call ended"; "VoIPAudioCallCamera"="Camera"; -"VoIPVideoCallCloseCamera"="Camera"; -"VoIPVideoCallOpenCamera"="Camera"; +"VoIPVideoCallCloseCamera"="Turn-off the camera"; +"VoIPVideoCallOpenCamera"="Turn-on the camera"; "VoIPVideoCallTurnToAudioCall"="Voice Call"; "VoIPCallHangup"="Hang Up"; "VoIPCallAccept"="Accept"; "VoIPCallMute"="Mute"; "VoIPCallSpeaker"="Speaker"; -"VoIPCallWaitingForRemoteAccept"="Awaiting response..."; -"VoIPAudioCallIncoming"=" invites you to voice call"; -"VoIPVideoCallIncoming"=" invites you to video call"; +"VoIPCallWaitingForRemoteAccept"="Waiting for response..."; +"VoIPAudioCallIncoming"=" invites you to join a voice call"; +"VoIPVideoCallIncoming"=" invites you to join a video call"; "VoIPAudioCallIncomingWithoutUserName"="You have a voice call"; "VoIPVideoCallIncomingWithoutUserName"="You have a video call"; "VoIPMultiCallUserCollectionTitle"="Members"; @@ -160,29 +161,29 @@ "VoIPCallHasEnd"="Cancelled"; "VoIPCallHasCancel"="Cancelled"; "VoIPCallHasReject"="Declined"; -"VoIPCallHasHangup"="Cancelled"; +"VoIPCallHasHangup"="Hung-up"; "VoIPCallNoResponse"="No answer"; -"VoIPCallRemoteCancel"="Cancelled"; -"VoIPCallRemoteReject"="Declined"; -"VoIPCallRemoteHangup"="Cancelled"; -"VoIPCallRemoteNoResponse"="No answer"; -"VoIPCallAcceptByOtherClient"="Accept by other client"; -"VoIPCallRemoteBusyLine"="Busy line"; -"VoIPCallRemoteBusyLineAndShowAdvice"="Remote user my be busy. Try again later."; -"VoIPCallRemoteDidInvite"="%@ to join the call"; -"VoIPCallLocalNetworkError"="Network Error"; -"VoIPCallRemoteNetworkError"="Network Error"; -"GroupCreated"="%@ created the group"; -"GroupInvited"="%@ invited %@ to join the group"; -"GroupRemoved"="%@ removed %@ from the group chat"; -"GroupByRemoved"="%@ were removed from the group chat by %@"; -"GroupDismiss"="%@ dismissed the group"; -"GroupQuit"="%@ quitted the group"; +"VoIPCallRemoteCancel"="has Cancelled"; +"VoIPCallRemoteReject"="has declined"; +"VoIPCallRemoteHangup"="has hung-up"; +"VoIPCallRemoteNoResponse"="not answered the call"; +"VoIPCallAcceptByOtherClient"="Accepted by other client"; +"VoIPCallRemoteBusyLine"="is busy"; +"VoIPCallRemoteBusyLineAndShowAdvice"="The number you have called is busy, please try later"; +"VoIPCallRemoteDidInvite"="%@ has joined the group chat"; +"VoIPCallLocalNetworkError"="local network error"; +"VoIPCallRemoteNetworkError"="receiver network error"; +"GroupCreated"="%@ has created the group"; +"GroupInvited"="%@ has invited %@ to join the group"; +"GroupRemoved"="%@ has removed %@ from the group "; +"GroupByRemoved"="%@ has removed by %@ from the group"; +"GroupDismiss"="%@ has dismissed the group"; +"GroupQuit"="%@ has quit the group"; "GroupChanged"="%@ changed the group name to \"%@\""; "GroupJoin"="%@ joined the group"; -"GroupEtc"=" etc."; -"GroupAnnouncementUpdated"="%@更新了群公告"; -"ImageLoadFailed"="Unable to download image"; +"GroupEtc"="and etc."; +"GroupAnnouncementUpdated"="%@ has updated the group announcement"; +"ImageLoadFailed"="Picture loading failed"; "ImageHasBeenDeleted"="The image has been deleted"; "HaveMentioned"="[You were mentioned]"; "HaveMentionedForNotification"="You were mentioned "; @@ -202,17 +203,19 @@ "ContactCard"="Contact Card"; "Send"="Send"; "SendTo"="Send to:"; -"LeaveAMessage"="Leave a message"; +"LeaveAMessage"="Leave a message to friend"; "SharedContactCard"="You shared %@'s contact card."; "RecommendedToYou"="recommended %@ to you."; -"Person"=""; -"SelectContact"="Select Contact"; +"Person"="Member"; +"SelectContact"="Select Contacts"; "MessageTapMore"="More..."; "bottom_result_view_choosed_person_prefix"="Selected"; "bottom_result_view_choosed_person_subfix"="member(s)"; -"message_destructed"="The message has auto-destructed,can't continue to view"; +"message_destructed"="The message cannot be viewed due to automatically destroyed"; "receive_new_message"="You got a new message"; +"push_to_talk"="Push to Talk"; +"no_message"="No chats info"; "hold_to_talk_title"="Hold to talk"; "release_to_send_title"="Release to send"; "message_too_short"="Message too short"; diff --git a/ios-rongimdemo/framework/libopencore-amrwb.a b/ios-rongimdemo/framework/libopencore-amrwb.a new file mode 100755 index 00000000..cdd7d8da Binary files /dev/null and b/ios-rongimdemo/framework/libopencore-amrwb.a differ diff --git a/ios-rongimdemo/framework/libvo-amrwbenc.a b/ios-rongimdemo/framework/libvo-amrwbenc.a new file mode 100755 index 00000000..355ece58 Binary files /dev/null and b/ios-rongimdemo/framework/libvo-amrwbenc.a differ diff --git a/ios-rongimdemo/framework/zh-Hans.lproj/RongCloudKit.strings b/ios-rongimdemo/framework/zh-Hans.lproj/RongCloudKit.strings index 9b9b8710..3d8e1b91 100644 --- a/ios-rongimdemo/framework/zh-Hans.lproj/RongCloudKit.strings +++ b/ios-rongimdemo/framework/zh-Hans.lproj/RongCloudKit.strings @@ -213,6 +213,8 @@ "bottom_result_view_choosed_person_subfix"="人"; "message_destructed"="该消息已自动销毁,无法继续查看"; "receive_new_message"="你收到一条新消息"; +"push_to_talk"="对讲机"; +"no_message"="暂无消息"; "hold_to_talk_title"="按住 说话"; "release_to_send_title"="松开 发送"; "slide_up_to_cancel_title"="手指上滑,取消发送"; diff --git a/ios-rongimdemo/xcodebuild.sh b/ios-rongimdemo/xcodebuild.sh index 3330a2a9..fcd1a03b 100644 --- a/ios-rongimdemo/xcodebuild.sh +++ b/ios-rongimdemo/xcodebuild.sh @@ -1,20 +1,21 @@ #!/bin/sh -# echo "Copy 3rd framework start." -# if [ -d "../ios-3rd-vendor/jrmf/AlipaySDK" ]; then -# rm -rf ./framework/AlipaySDK -# cp -rf ../ios-3rd-vendor/jrmf/AlipaySDK ./framework/ -# fi -# if [ -d "../ios-3rd-vendor/jrmf/JrmfIMLib" ]; then -# # rm -rf ./framework/JrmfIMLib -# cp -rf ../ios-3rd-vendor/jrmf/JrmfIMLib ./framework/ -# fi -# if [ -d "../ios-3rd-vendor/ifly" ]; then -# rm -rf ./framework/ifly -# cp -rf ../ios-3rd-vendor/ifly ./framework/ -# fi -# if [ -d "../ios-3rd-vendor/bqmm" ]; then -# rm -rf ./framework/bqmm -# cp -rf ../ios-3rd-vendor/bqmm ./framework/ -# fi -# echo "Copy 3rd framework end." +echo "Copy 3rd framework start." +if [ -d "../ios-3rd-vendor/jrmf/AlipaySDK" ]; then +rm -rf ./framework/AlipaySDK +cp -rf ../ios-3rd-vendor/jrmf/AlipaySDK ./framework/ +fi +if [ -d "../ios-3rd-vendor/jrmf/JrmfIMLib" ]; then +rm -rf ./framework/JrmfIMLib +cp -rf ../ios-3rd-vendor/jrmf/JrmfIMLib ./framework/ +fi +if [ -d "../ios-3rd-vendor/ifly" ]; then +rm -rf ./framework/ifly +cp -rf ../ios-3rd-vendor/ifly ./framework/ +fi +if [ -d "../ios-3rd-vendor/bqmm" ]; then +rm -rf ./framework/bqmm +cp -rf ../ios-3rd-vendor/bqmm ./framework/ +fi +echo "Copy 3rd framework end." + diff --git a/ios-rongimdemo/zh-Hans.lproj/SealTalk.strings b/ios-rongimdemo/zh-Hans.lproj/SealTalk.strings new file mode 100644 index 00000000..5e5ac71f --- /dev/null +++ b/ios-rongimdemo/zh-Hans.lproj/SealTalk.strings @@ -0,0 +1,482 @@ +"conversation"="会话"; +"search"="搜索"; +"contacts"="通讯录"; +"discover"="发现"; +"me"="我"; +"start_chatting"="发起聊天"; +"create_groups"="创建群组"; +"add_contacts"="添加好友"; +"add_friend_placeholder"="搜索好友,如(86)137XXXXX"; +"create_discussion_group"="创建讨论组"; +"cancel"="取消"; +"back"="返回"; +"mention_all"="@所有人"; +"group_information_x"="群组信息(%@)"; +"group_information"="群组信息"; +"group_members_x"="群组成员(%lu)"; +"all_group_member_z"="全部群成员(%@)"; +"portrait"="头像"; +"group_portrait"="群组头像"; +"group_name"="群组名称"; +"group_announcement"="群公告"; +"total_related_message"="共%d条相关的聊天记录"; +"chat_history"="聊天记录"; +"search_chat_history"="查找聊天记录"; +"mute_notifications"="消息免打扰"; +"stick_on_top"="会话置顶"; +"clear_chat_history"="清除聊天记录"; +"delete_and_exit"="删除并退出"; +"delete_and_exit_discuss_group"="删除并且退出讨论组"; +"confirm"="确定"; +"done"="完成"; +"Please_edit_the_group_announcement"="请编辑群公告"; +"detailed_information"="详细资料"; +"set_remarks"="设置备注"; +"mobile_number"="手机号"; +"start_chat"="发起会话"; +"voice_call"="语音通话"; +"video_call"="视频通话"; +"blacklist"="黑名单"; +"add_to_blacklist"="加入黑名单"; +"cancel_block"="取消黑名单"; +"adding_to_blacklist"="正在加入黑名单"; +"fail_to_add_to_blacklist"="加入黑名单失败"; +"removing_from_blacklist"="正在从黑名单移除"; +"fail_to_remove_from_blacklist"="从黑名单移除失败"; +"new_friend"="新朋友"; +"group"="群组"; +"public_account"="公众号"; +"add_friend"="添加好友"; +"chatroom"="聊天室"; +"account_setting"="账号设置"; +"my_wallet"="我的钱包"; +"feedback"="意见反馈"; +"about_sealtalk"="关于 SealTalk"; +"customer_service_xn"="小能客服"; +"customer_service_jx"="佳信"; +"group"="群组"; +"nickname"="昵 称"; +"take_picture"="拍照"; +"my_album"="我的相册"; +"change_nickname"="修改昵称"; +"save"="保存"; +"privacy"="隐私"; +"new_message_notification"="新消息通知"; +"push_setting"="推送设置"; +"Display_remotely_pushed_content"="显示远程推送的内容"; +"clear_cache"="清除缓存"; +"clear_cache_alert"="是否清理缓存?"; +"clear_cache_succrss"="缓存清理成功!"; +"logout"="退出登录"; +"logout_alert"="是否退出登录?"; +"change_password"="密码修改"; +"old_password"="原密码"; +"old_and_new_friend_different"="填写的确认密码与新密码不一致"; +"old_password_error"="原密码填写错误"; +"password_hint"="6-16位字符,区分大小写"; +"password_alert"="密码必须为6-16位字符,区分大小写"; +"new_password"="新密码"; +"confirm_new_password"="确认密码"; +"confirm_send"="确定发送给:"; +"send"="发送"; +"mobile_number_unempty"="手机号码不能为空!"; +"mobile_number_format_is_incorrect"="手机号码格式不正确!"; +"password_can_not_be_blank"="密码不能为空!"; +"There_can_be_no_spaces_in_the_password"="密码中不能有空格!"; +"The_phone_number_format_is_incorrect"="手机号码格式不正确!"; +"see_more"="查看更多%@"; +"include"="包含:"; +"nickname"="昵称:"; +"file"="[文件]"; +"link"="[链接]"; +"no_search_Friend"="没有结果"; +"no_search_result"="没有搜索到“%@”相关的内容"; +"join_share_location"="%@加入..."; +"someone_join_share_location"="%@加入地理位置共享"; +"user_join_share_location"="user<%@>加入地理位置共享"; +"share_location_people_count"="%lu人在共享位置"; +"share_location_finished"="位置共享已结束"; +"i_start_location_share"="我发起了位置共享"; +"join_share_location_alert"="加入位置共享,聊天中其他人也能看到你的位置,确定加入?"; +"locating"="定位中..."; +"Inaccessible"="无法访问"; +"Location_access_without_permission"="没有权限访问位置信息,请从设置-隐私-定位服务中打开位置访问权限"; +"end_share_location_alert"="是否结束位置共享?"; +"end"="结束"; +"leave_location_share_when_leave_chat"="离开聊天,位置共享也会结束,确认离开"; +"send_location"="发送位置"; +"location_share"="位置实时共享"; +"you_join_location_share"="你加入了地理位置共享"; +"you_location_sharing"="你正在共享位置"; +"someone_location_sharing"="%@正在共享位置"; +"user_location_sharing"="user<%@>正在共享位置"; +"you_quit_location_share"="你退出地理位置共享"; +"someone_quit_location_share"="%@退出地理位置共享"; +"user_quit_location_share"="user<%@>退出地理位置共享"; +"Forwarding_is_not_supported"="语音、表情、红包、发送失败的消息和其它特殊消息类型不支持转发。"; +"de_actionbar_sub_system"="系统消息"; +"select_contact"="选择联系人"; +"friend_request"="好友请求"; +"from_someone_friend_request"="来自%@的好友请求"; +"someone_accept_you_friend_request"="%@通过了你的好友请求"; +"choose_contact"="选择联系人"; +"all_contacts"="联系人"; +"discussion_group_name"="讨论组名称"; +"open_member_invite"="开放成员邀请"; +"please_type_discuss_group_name"="请输入讨论组名称!"; +"discuss_group_can_not_space"="讨论组名称不能包含空格!"; +"Login"="登录"; +"new_user"="新用户"; +"verification_code"="验证码"; +"send_verification_code"="发送验证码"; +"after_60_seconds_obtain"="60秒后获取"; +"char_section_case_sensitive_from6_t16"="6-16位字符区分大小写"; +"change_success"="修改成功"; +"username_can_not_nil"="用户名不能为空!"; +"password_can_not_more_than_20"="密码不能大于20位!"; +"password_can_not_nil"="密码不能为空!"; +"verification_code_can_not_nil"="验证码不能为空!"; +"after_x_seconds_send"="%d秒后发送"; +"forgot_password"="找回密码"; +"password"="密码"; +"private_cloud_setting"="私有云设置"; +"Login_fail"="登录失败"; +"can_not_connect_server"="无法连接到服务器!"; +"network_can_not_use_please_check"="当前网络不可用,请检查!"; +"logining"="登录中..."; +"mobile_number_or_password_error"="手机号或密码错误!"; +"Login_fail_please_check_network"="登录失败,请检查网络。"; +"please_check_mobile_number_and_password"="请检查手机号和密码"; +"accout_kicked"="您的帐号在别的设备上登录,您被迫下线!"; +"please_type_demo_server"="请输入demo服务器地址"; +"please_type_navigation_server"="请输入导航服务器地址"; +"please_type_file_server_address"="请输入文件服务器地址"; +"please_type_appKey"="请输入App Key"; +"note_server_can_not_type_http"="注:服务器地址请不要输入'http://'"; +"appKey_can_not_nil"="appKey不能为空"; +"demo_server_can_not_nil"="demo server不能为空!"; +"navi_server_can_not_nil"="导航server不能为空"; +"file_server_can_not_nil"="文件server不能为空!"; +"dev_value_must_1_or_2"="dev值必须是1或者2"; +"code"="短信验证码"; +"phone_number_has_been_registered"="手机号已被注册"; +"phone_number_type_error"="手机号输入有误"; +"register_success"="注册成功"; +"register_fail"="注册失败"; +"register"="注册"; +"verification_code_error"="验证码错误"; +"captcha_overdue"="验证码过期,请重新请求"; +"verification_code_invail"="验证码无效"; +"phone_number_can_not_nil"="手机号不能为空!"; +"nickname_can_not_nil"="昵称不能为空!"; +"nickname_can_not_over_32"="昵称不能大于32位!"; +"nickname_can_not_contain_space"="昵称中不能有空格!"; +"after_60_seconds_send"="60秒后发送"; +"chat_detail"="聊天详情"; +"someone_nickname"="昵称: %@"; +"clear_chat_history_alert"="确定清除聊天记录?"; +"clear_chat_history_success"="清除聊天记录成功!"; +"clear_chat_history_fail"="清除聊天记录失败!"; +"friend_news"="好友消息"; +"can_not_add_self_to_address_book"="你不能添加自己到通讯录"; +"friend_invite_had_send"="已发送好友邀请"; +"request_had_send"="请求已发送"; +"request_fail_retry"="请求失败,请重试"; +"accept"="接受"; +"had_accept"="已接受"; +"had_invite"="已邀请"; +"no_invite"="暂无数据"; +"adding_friend"="添加好友中..."; +"add_fail"="添加失败"; +"add_member_fail"="添加成员失败"; +"delete_member_fail"="删除成员失败"; +"discuss_group"="讨论组"; +"no_friend"="暂无好友"; +"setting"="设置中..."; +"set_fail"="设置失败"; +"Remark_name"="备注名"; +"x_people_had_read"="%lu人已读"; +"zero_people_unread"="0人未读"; +"x_people_unread"="%lu人未读"; +"Receipt_details"="回执详情"; +"DisbandAndDelete"="解散并删除"; +"delete_group_alert"="确定退出群组?"; +"Disband_group_alert"="确定解散群组?"; +"Uploading_avatar"="上传头像中..."; +"Upload_avatar_fail"="上传头像失败"; +"quit_fail"="退出失败!"; +"Disband_group_fail"="解散群组失败!"; +"Only_the_owner_can_edit_the_group_name"="只有群主可以修改群组名称"; +"Only_the_owner_can_change_the_group_portrait"="只有群主可以修改群组头像"; +"Only_the_group_owner_can_post_a_group_announcement"="只有群主可以发布群公告"; +"remove_member"="移除成员"; +"Exit_this_edit"="退出本次编辑"; +"Continue_editing"="继续编辑"; +"quit"="退出"; +"The_announcement_will_notify_all_members_of_the_group"="该公告会通知全部群成员,是否发布?"; +"Group_announcement_failed_to_be_sent"="群公告发送失败"; +"group_name_can_not_nil"="群组名称不能为空"; +"Group_name_is_too_short"="群组名称过短"; +"Group_name_cannot_exceed_10_words"="群组名称不能超过10个字"; +"Group_name_modification_failed"="群组名称修改失败"; +"type_croup_name_hint"="填写群名称(2-10个字符)"; +"creating_group"="创建中..."; +"create_group_fail"="创建群组失败,请检查你的网络设置。"; +"customer"="客服"; +"remark_rebot_service"="请评价我们的机器人服务"; +"satisfaction"="如果您满意就按是,不满意就按否"; +"yes"="是"; +"no"="否"; +"choose_tag"="请选择标签"; +"type_idea"="请填写你的想法"; +"remark"="评价"; +"submit_remark"="提交评价"; +"remark_customer"="请您对客服进行评价"; +"cs_evaluate_resolved_title"="请问客服是否解决了您的问题"; +"cs_evaluate_resolved"="已解决"; +"cs_evaluate_unresolved"="未解决"; +"cs_evaluate_problem_title"="存在哪些问题"; +"cs_evaluate_problem_must_title"="存在哪些问题(必选)"; +"Personal_information"="个人信息"; +"modify_nickname"="昵称修改"; +"Username_cannot_be_greater_than_32_digits"="用户名不能大于32位!"; +"modify_nickname_fail"="修改失败,请检查输入的名称"; +"english"="英语"; +"chinese"="汉语"; +"settings"="设置"; +"setting_success"="设置成功"; +"Do_not_disturb_setting"="免打扰设置"; +"alert"="提示"; +"Turn_on_message_do_not_disturb"="开启消息免打扰"; +"Start_time"="开始时间"; +"Start_time1"="开始时间:"; +"continue_times"="持续时间(分):"; +"end_time"="结束时间"; +"shut_down_failed"="关闭失败"; +"Receive_new_message_notifications"="接收新消息通知"; +"show_ID"="显示ID"; +"show_online_status"="显示在线状态"; +"show_setting"="显示设置"; +"force_crash"="强制Crash"; +"send_log"="发送Log"; +"Joining_the_chat_room_failed_to_stay_in_the_session_interface"="加入聊天室失败仍停留在会话界面"; +"custom_setting"="自定义设置"; +"Set_offline_message_compensation_time"="设置离线消息补偿时间"; +"Set_global_DND_time"="设置全局免打扰时间"; +"time_setting"="时间设置"; +"xday"="%d 天"; +"Set_offline_message_compensation_hint"="离线消息补偿时间,范围【1~7天】"; +"update_log"="更新日志"; +"function_introduce"="功能介绍"; +"offical_website"="官方网站"; +"SealTalk_version"="SealTalk 版本"; +"SDK_version"="SDK 版本"; +"Login_is_invalid_please_login_again"="登录失效,请重新登录。"; +"i_know"="知道了"; +"Your_account_has_been_banned"="您的帐号被封禁"; +"picture"="[图片]"; +"voice"="[语音]"; +"location"="[位置]"; +"no_support"="[不支持消息]"; +"good_friend"="好友"; +"x_unread_message"="%d条未读消息"; +"stop_record"="停止录音"; +"start_record"="开始录音"; +"i_know_it"="我知道了"; +"support_share"="抱歉,暂不支持此类型内容的分享"; +"share_to_friend"="分享给朋友"; +"use_share_must_open_sealtalk"="抱歉,请先打开 SealTalk,并登录,才可以使用分享功能"; +"choose"="选择"; +"sending"="发送中"; +"send_success"="发送成功"; +"send_fail"="发送失败"; +"country"="国家/地区"; +"select_country"="选择国家和地区"; +"language"="多语言"; +"China"="中国"; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit App/Info.plist" "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit App/Info.plist" index b16d3cf3..f28e32d8 100644 --- "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit App/Info.plist" +++ "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit App/Info.plist" @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 2.9.10 Dev + 2.9.12 Dev CFBundleSignature ???? CFBundleVersion - 201901251505 + 201903201910 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/Info.plist" "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/Info.plist" index 5a4ff497..2a6e2dc5 100644 --- "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/Info.plist" +++ "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/Info.plist" @@ -17,11 +17,11 @@ CFBundlePackageType XPC! CFBundleShortVersionString - 2.9.10 Dev + 2.9.12 Dev CFBundleSignature ???? CFBundleVersion - 201901251505 + 201903201910 NSExtension NSExtensionAttributes diff --git "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/ConversationListController.m" "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/ConversationListController.m" index d2223dc2..32c1cc8f 100644 --- "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/ConversationListController.m" +++ "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/ConversationListController.m" @@ -77,7 +77,7 @@ - (void)awakeWithContext:(id)context { [super awakeWithContext:context]; // Configure interface objects here. - [self setTitle:@"会话"]; + [self setTitle:RCDLocalizedString(@"conversation")]; } - (void)willActivate { @@ -201,16 +201,19 @@ - (void)updateTable RCTextMessage *textMsg = (RCTextMessage *)conversation.lastestMessage; [row.lastMsg setText:textMsg.content]; } else if ([conversation.lastestMessage isKindOfClass:[RCImageMessage class]]) { - [row.lastMsg setText:@"[图片]"]; + [row.lastMsg setText:RCDLocalizedString(@"picture") +]; } else if ([conversation.lastestMessage isKindOfClass:[RCVoiceMessage class]]) { - [row.lastMsg setText:@"[语音]"]; + [row.lastMsg setText:RCDLocalizedString(@"voice") +]; } else if ([conversation.lastestMessage isKindOfClass:[RCLocationMessage class]]) { - [row.lastMsg setText:@"[位置]"]; + [row.lastMsg setText:RCDLocalizedString(@"location") +]; } else if ([conversation.lastestMessage isKindOfClass:[RCDiscussionNotificationMessage class]]) { NSString *notifyString = [RCWKUtility formatDiscussionNotificationMessageContent:(RCDiscussionNotificationMessage *)conversation.lastestMessage]; [row.lastMsg setText:notifyString]; } else { - [row.lastMsg setText:@"[不支持消息]"]; + [row.lastMsg setText:RCDLocalizedString(@"no_support")]; } }]; } diff --git "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/FriendListController.m" "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/FriendListController.m" index 73f25e60..0969c780 100644 --- "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/FriendListController.m" +++ "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/FriendListController.m" @@ -53,7 +53,8 @@ - (void)awakeWithContext:(id)context { [super awakeWithContext:context]; // Configure interface objects here. - [self setTitle:@"好友"]; + [self setTitle:RCDLocalizedString(@"good_friend") +]; } - (void)willActivate { diff --git "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/MainInterfaceController.m" "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/MainInterfaceController.m" index 1aa00612..cf94eff0 100644 --- "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/MainInterfaceController.m" +++ "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/MainInterfaceController.m" @@ -59,7 +59,8 @@ - (void)loadDataFromApp // [RCAppQueryHelper queryParentAppConnectionStatus:^(BOOL isConnected) { // if (isConnected) { [RCAppQueryHelper queryParentAppUnreadMessageCount:^(int count) { - [self.newmsgcount setText:[NSString stringWithFormat:@"%d条未读消息", count]]; + [self.newmsgcount setText:[NSString stringWithFormat:RCDLocalizedString(@"x_unread_message") +, count]]; }]; // } else { // [self.newmsgcount setText:@"客户端未登录"]; diff --git "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/VoiceInputController.m" "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/VoiceInputController.m" index 75d95328..dbea9aaa 100644 --- "a/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/VoiceInputController.m" +++ "b/ios-rongimdemo/\350\236\215\344\272\221 Demo WatchKit Extension/RCWKExtension/Controller/VoiceInputController.m" @@ -140,12 +140,14 @@ - (void)didDeactivate { - (void)updateUI { if (self.isRecording) { - [self.recordButton setTitle:@"停止录音"]; + [self.recordButton setTitle:RCDLocalizedString(@"stop_record") +]; [self.recordImage setImageNamed:@"to_voice_play"]; [self.recordImage startAnimating]; [self.sendButton setEnabled:false]; } else { - [self.recordButton setTitle:@"开始录音"]; + [self.recordButton setTitle:RCDLocalizedString(@"start_record") +]; if (self.recordedData && self.duration > 1) { [self.sendButton setEnabled:true]; [self.recordImage setImageNamed:@"to_voice"];