Skip to content
This repository has been archived by the owner on Oct 9, 2021. It is now read-only.

Commit

Permalink
Release SealTalk Demo version 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
JosephJue committed Jun 29, 2016
1 parent 346e09b commit 3b17ef3
Show file tree
Hide file tree
Showing 143 changed files with 3,813 additions and 2,393 deletions.
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

1 change: 1 addition & 0 deletions RCDAboutRongCloudTableViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
#import <UIKit/UIKit.h>

@interface RCDAboutRongCloudTableViewController : UITableViewController
@property (weak, nonatomic) IBOutlet UILabel *VersionLabel;

@end
92 changes: 86 additions & 6 deletions RCDAboutRongCloudTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,78 @@

@interface RCDAboutRongCloudTableViewController()
@property (nonatomic, strong)NSArray *urls;
@property (nonatomic)BOOL hasNewVersion;
@property (nonatomic)NSString *versionUrl;
@property (nonatomic, strong)NSString *versionString;
@property (nonatomic, strong)NSURLConnection *connection;
@end

@implementation RCDAboutRongCloudTableViewController

-(id)initWithCoder:(NSCoder *)aDecoder
{
self = [super initWithCoder:aDecoder];
if (self) {
self.versionUrl= [[NSUserDefaults standardUserDefaults] stringForKey:@"newVersionUrl"];
self.versionUrl= [[NSUserDefaults standardUserDefaults] stringForKey:@"newVersionString"];
// self.hasNewVersion = [[NSUserDefaults standardUserDefaults] boolForKey:@"hasNewVersion"];
[self checkNewVersion];
}
return self;
}
#if DEBUG
#define DEMO_VERSION_BOARD @"http://bj.rongcloud.net/list.php"
#else
#define DEMO_VERSION_BOARD @"http://rongcloud.cn/demo"
#endif


-(void)viewDidLoad
{
[super viewDidLoad];
self.tableView.tableFooterView=[UIView new];
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSURL *url = [self getUrlAt:indexPath];
if (url) {
[[UIApplication sharedApplication]openURL:[self getUrlAt:indexPath]];
if (indexPath.section == 0 && indexPath.row == 5) {
if (self.hasNewVersion) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:self.versionUrl]];
self.hasNewVersion = NO;
self.versionUrl = nil;
} else {
[self checkNewVersion];
}
return;
}
if (indexPath.section == 0 && indexPath.row < 4) {
NSURL *url = [self getUrlAt:indexPath];
if (url) {
[[UIApplication sharedApplication]openURL:[self getUrlAt:indexPath]];
}
}
}

- (void)setHasNewVersion:(BOOL)hasNewVersion
{
_hasNewVersion = hasNewVersion;
[[NSUserDefaults standardUserDefaults] setBool:self.hasNewVersion forKey:@"hasNewVersion"];
[[NSUserDefaults standardUserDefaults] synchronize];
[self updateNewVersionBadge];
}

-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self updateNewVersionBadge];
}


- (NSArray *)urls
{
if (!_urls) {
NSArray *section0 = [NSArray arrayWithObjects:@"http://rongcloud.cn/", @"http://rongcloud.cn/downloads/history/ios", @"http://rongcloud.cn/features", @"http://docs.rongcloud.cn/api/ios/imkit/index.html", nil];
NSArray *section1 = [NSArray arrayWithObjects:@"http://rongcloud.cn/", nil];
_urls = [NSArray arrayWithObjects:section0, section1, nil];
NSArray *section0 = [NSArray arrayWithObjects:@"http://rongcloud.cn/", @"http://rongcloud.cn/downloads/history/ios", @"http://rongcloud.cn/features", @"http://rongcloud.cn/", nil];
// NSArray *section1 = [NSArray arrayWithObjects:@"http://rongcloud.cn/", nil];
_urls = [NSArray arrayWithObjects:section0, nil];
}
return _urls;
}
Expand All @@ -45,4 +95,34 @@ - (NSURL *)getUrlAt:(NSIndexPath *)indexPath
}
return [NSURL URLWithString:urlString];
}

- (void)checkNewVersion {
long lastCheckTime = [[NSUserDefaults standardUserDefaults] integerForKey:@"lastupdatetimestamp"];

NSDate *now = [[NSDate alloc] init];
if (now.timeIntervalSince1970 - lastCheckTime > 0) {
if (DEMO_VERSION_BOARD.length == 0) {
return;
}
NSURL *url = [NSURL URLWithString:DEMO_VERSION_BOARD];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:10];
self.connection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
}
}

- (void)updateNewVersionBadge {
#if DEBUG
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];
if (self.hasNewVersion && ([self.versionString compare:version] == NSOrderedDescending)) {
#else
if (self.hasNewVersion) {
#endif
_VersionLabel.attributedText = [[NSAttributedString alloc] initWithString:@"有新版本啦。。。" attributes:@{NSForegroundColorAttributeName:[UIColor redColor]}];
} else {
self.tabBarItem.badgeValue = nil;
NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
_VersionLabel.text=[NSString stringWithFormat:@"SDK 版本 %@",version];
}
}

@end
6 changes: 4 additions & 2 deletions RCDAddFriendViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@ - (void)viewDidLoad {
{
[self.ivAva sd_setImageWithURL:[NSURL URLWithString:self.targetUserInfo.portraitUri] placeholderImage:[UIImage imageNamed:@"icon_person"]];
}

self.ivAva.layer.masksToBounds = YES;
self.ivAva.layer.cornerRadius = 6.f;
self.ivAva.contentMode = UIViewContentModeScaleAspectFill;
NSMutableArray *cacheList=[[NSMutableArray alloc]initWithArray:[[RCDataBaseManager shareInstance] getAllFriends]];
BOOL isFriend = NO;
for (RCDUserInfo *user in cacheList) {
if ([user.userId isEqualToString:self.targetUserInfo.userId]) {
if ([user.userId isEqualToString:self.targetUserInfo.userId] && [user.status isEqualToString:@"20"]) {
isFriend = YES;
break;
}
Expand Down
8 changes: 8 additions & 0 deletions RCDChangePasswordViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,12 @@

@interface RCDChangePasswordViewController : UIViewController

@property (weak, nonatomic) IBOutlet UIButton *DoneButton;

@property (weak, nonatomic) IBOutlet UIView *OldPasswordView;

@property (weak, nonatomic) IBOutlet UIView *NewPasswordView;

@property (weak, nonatomic) IBOutlet UIView *ConfirmPasswordView;

@end
27 changes: 21 additions & 6 deletions RCDChangePasswordViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,27 @@ @implementation RCDChangePasswordViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 34)];
[rightBtn setTitle:@"保存" forState:UIControlStateNormal];
[rightBtn addTarget:self action:@selector(saveNewPassword:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
[rightBtn setTintColor:[UIColor whiteColor]];
self.navigationItem.rightBarButtonItem = rightButton;
// UIButton *rightBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 50, 34)];
// [rightBtn setTitle:@"保存" forState:UIControlStateNormal];
// [rightBtn addTarget:self action:@selector(saveNewPassword:) forControlEvents:UIControlEventTouchUpInside];
// UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithCustomView:rightBtn];
// [rightBtn setTintColor:[UIColor whiteColor]];
// self.navigationItem.rightBarButtonItem = rightButton;
self.navigationItem.title = @"密码修改";

self.OldPasswordView.layer.borderWidth = 0.5;
self.OldPasswordView.layer.borderColor = [HEXCOLOR(0xdfdfdd) CGColor];

self.NewPasswordView.layer.borderWidth = 0.5;
self.NewPasswordView.layer.borderColor = [HEXCOLOR(0xdfdfdd) CGColor];

self.ConfirmPasswordView.layer.borderWidth = 0.5;
self.ConfirmPasswordView.layer.borderColor = [HEXCOLOR(0xdfdfdd) CGColor];

self.DoneButton.layer.borderWidth = 0.5;
self.DoneButton.layer.borderColor = [HEXCOLOR(0x0181dd) CGColor];
[self.DoneButton addTarget:self action:@selector(saveNewPassword:) forControlEvents:UIControlEventTouchUpInside];

}

- (void)didReceiveMemoryWarning {
Expand Down
4 changes: 2 additions & 2 deletions RCDContactSelectedTableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ - (void)awakeFromNib {
// Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
- (void)setSelected:(BOOL)selected{
[super setSelected:selected];
if (selected) {
_selectedImageView.image = [UIImage imageNamed:@"select"];
}else{
Expand Down
78 changes: 60 additions & 18 deletions RCDContactSelectedTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,20 @@
#import "RCDCreateGroupViewController.h"
#import "DefaultPortraitView.h"
#import "RCDChatViewController.h"
#import "MBProgressHUD.h"

@interface RCDContactSelectedTableViewController ()
@property (nonatomic,strong) NSMutableArray *friends;
@property (strong, nonatomic) NSMutableArray *friendsArr;
@property (nonatomic,strong) NSMutableArray *tempOtherArr;
@property (nonatomic,strong) UILabel *noFriend;
//@property (nonatomic,strong) UILabel *noFriend;

@property (nonatomic,strong) NSIndexPath *selectIndexPath;

@end

@implementation RCDContactSelectedTableViewController
MBProgressHUD* hud ;

- (void)viewDidLoad {
[super viewDidLoad];
Expand All @@ -53,6 +57,7 @@ - (void)viewDidLoad {

// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
self.navigationItem.rightBarButtonItem.enabled = NO;
}

- (void)didReceiveMemoryWarning {
Expand All @@ -73,15 +78,27 @@ -(void)viewWillAppear:(BOOL)animated

}

-(void)viewWillDisappear:(BOOL)animated
{
self.navigationItem.rightBarButtonItem.enabled = YES;
[hud hide:YES];
}

//clicked done
-(void) clickedDone:(id) sender
{
self.navigationItem.rightBarButtonItem.enabled = NO;
hud= [MBProgressHUD showHUDAddedTo:self.view animated:YES];
// hud.labelText = @"";
[hud show:YES];

NSArray *indexPaths = [self.tableView indexPathsForSelectedRows];
if (!indexPaths||indexPaths.count == 0){
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"请选择!" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
return;
}
// if (!indexPaths||indexPaths.count == 0){
// [hud hide:YES];
// UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"请选择!" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
// [alert show];
// return;
// }

//get seleted users
NSMutableArray *seletedUsers = [NSMutableArray new];
Expand All @@ -107,6 +124,13 @@ -(void) clickedDone:(id) sender
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"addGroupMemberList" object:seletedUsers]];
[self.navigationController popViewControllerAnimated:YES];
}
else
{
[hud hide:YES];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"添加成员失败" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
self.navigationItem.rightBarButtonItem.enabled = YES;
}
}];
return;
}
Expand All @@ -118,6 +142,13 @@ -(void) clickedDone:(id) sender
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:@"deleteGroupMemberList" object:seletedUsers]];
[self.navigationController popViewControllerAnimated:YES];
}
else
{
[hud hide:YES];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"删除成员失败" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
self.navigationItem.rightBarButtonItem.enabled = YES;
}
}];
return;
}
Expand Down Expand Up @@ -299,14 +330,25 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
//override delegate
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
self.navigationItem.rightBarButtonItem.enabled = YES;
RCDContactSelectedTableViewCell *cell = (RCDContactSelectedTableViewCell*)[tableView cellForRowAtIndexPath:indexPath];
[cell setSelected:YES];
if (self.selectIndexPath && self.selectIndexPath.row == indexPath.row) {
[cell setSelected:NO];
self.selectIndexPath = nil;
}else{
self.selectIndexPath = indexPath;
}
}

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
RCDContactSelectedTableViewCell *cell = (RCDContactSelectedTableViewCell*)[tableView cellForRowAtIndexPath:indexPath];
[cell setSelected:NO];
if ([tableView.indexPathsForSelectedRows count] == 0) {
self.navigationItem.rightBarButtonItem.enabled = NO;
}
self.selectIndexPath = nil;
}


Expand All @@ -320,18 +362,18 @@ -(void) getAllData
_allFriends = [NSMutableDictionary new];
_allKeys = [NSMutableArray new];
_friends = [NSMutableArray arrayWithArray:[[RCDataBaseManager shareInstance]getAllFriends ] ];
if ([_friends count] == 0) {
_noFriend = [[UILabel alloc] init];
_noFriend.frame = CGRectMake((self.view.frame.size.width / 2) - 50, (self.view.frame.size.height / 2) - 15 - self.navigationController.navigationBar.frame.size.height, 100, 30);
[_noFriend setText:@"暂无好友"];
[_noFriend setTextColor:[UIColor grayColor]];
_noFriend.textAlignment = UITextAlignmentCenter;
[self.view addSubview:_noFriend];
_noFriend.hidden = NO;
// return;
}
// if ([_friends count] == 0) {
// _noFriend = [[UILabel alloc] init];
// _noFriend.frame = CGRectMake((self.view.frame.size.width / 2) - 50, (self.view.frame.size.height / 2) - 15 - self.navigationController.navigationBar.frame.size.height, 100, 30);
// [_noFriend setText:@"暂无好友"];
// [_noFriend setTextColor:[UIColor grayColor]];
// _noFriend.textAlignment = UITextAlignmentCenter;
// [self.view addSubview:_noFriend];
// _noFriend.hidden = NO;
//// return;
// }
if (_friends==nil||_friends.count<1) {
_noFriend.hidden = YES;
// _noFriend.hidden = YES;
[RCDDataSource syncFriendList:[RCIM sharedRCIM].currentUserInfo.userId complete:^(NSMutableArray * result) {
_friends=result;
for (RCDUserInfo *user in _friends) {
Expand All @@ -357,7 +399,7 @@ -(void) getAllData
// if (_friends.count < 20) {
// self.hideSectionHeader = YES;
// }
_noFriend.hidden = YES;
// _noFriend.hidden = YES;
dispatch_async(dispatch_get_global_queue(0, 0), ^{
for (RCDUserInfo *user in _friends) {
if ([user.status isEqualToString:@"20"]) {
Expand Down
Loading

0 comments on commit 3b17ef3

Please sign in to comment.