// // JXUserDetialVc.m // shiku_im // // Created by 123 on 2020/5/7. // Copyright © 2020 Reese. All rights reserved. // #define HEIGHT 56 #define LINE_INSET 8 #define TopHeight 7 #define CellHeight 45 #import "JXUserDetialVc.h" @interface JXUserDetialVc () /**去掉了*/ @property (weak, nonatomic) IBOutlet UILabel *nickNameL; @property (weak, nonatomic) IBOutlet UIImageView *headIMG; @property (weak, nonatomic) IBOutlet UIImageView *setIMG; @property (weak, nonatomic) IBOutlet UILabel *nameL; @property (weak, nonatomic) IBOutlet UILabel *levelL; @property (weak, nonatomic) IBOutlet UILabel *jixinNoL; @property (weak, nonatomic) IBOutlet UILabel *bridthyL; @end @implementation JXUserDetialVc - (void)onCirclePermissions { JXCirclePermissionsVC *vc = [[JXCirclePermissionsVC alloc] init]; vc.user = self.user; [g_navigation pushViewController:vc animated:YES]; } /** * 备注标签 与朋友圈 */ - (IBAction)tagBtn:(UIButton *)sender { if (sender.tag==0) {//备注标签 JXSetNoteAndLabelVC *vc = [[JXSetNoteAndLabelVC alloc] init]; vc.title =@"设置备注和标签";// Localized(@"JX_SetNotesAndLabels"); vc.delegate = self; vc.didSelect = @selector(refreshLabel:); vc.user = self.user; [g_navigation pushViewController:vc animated:YES]; }else{//朋友权限 [self onCirclePermissions]; } } - (id)init { self = [super init]; if (self) { _titleArr = [[NSMutableArray alloc]init]; _friendStatus = [_user.status intValue]; _latitude = [_user.latitude doubleValue]; _longitude = [_user.longitude doubleValue]; if([self.userId isKindOfClass:[NSNumber class]]) self.userId = [(NSNumber*)self.userId stringValue]; [g_server getUser:self.userId toView:self]; [g_notify addObserver:self selector:@selector(newReceipt:) name:kXMPPReceiptNotifaction object:nil]; [g_notify addObserver:self selector:@selector(onSendTimeout:) name:kXMPPSendTimeOutNotifaction object:nil]; [g_notify addObserver:self selector:@selector(friendPassNotif:) name:kFriendPassNotif object:nil]; [g_notify addObserver:self selector:@selector(newRequest:) name:kXMPPNewRequestNotifaction object:nil]; } return self; } - (void)viewDidLoad { [super viewDidLoad]; self.title = Localized(@"JX_BaseInfo"); UIButton *btn = [UIFactory createButtonWithImage:THESIMPLESTYLE ? @"title_more_black" : @"title_more" highlight:nil target:self selector:@selector(onMore)]; btn.frame = CGRectMake(JX_SCREEN_WIDTH-24-8, JX_SCREEN_TOP - 34, 24, 24); [self.view addSubview:btn]; [self setupServers]; } - (void)setupServers { //如果是自己,则不现实按钮 // 自己/公众号/厂家不删除 // 更新头像缓存 // [g_server delHeadImage:self.userId]; self.headIMG.image = [UIImage imageNamed:@"face_cry "]; [self.headIMG addGestureRecognizer:[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(onHeadImage)]]; [g_server getHeadImageSmall:self.userId userName:self.user.userNickname imageView:_headIMG]; // 更新头像缓存 [g_server delHeadImage:self.userId]; #pragma mark ---------- 呢称 // 昵称 _levelL.text = [NSString stringWithFormat:@"%@",@"帝王"]; _nameL.text = [NSString stringWithFormat:@"%@ : %@",Localized(@"JX_NickName"),@"--"]; _nickNameL.text = [NSString stringWithFormat:@"%@ : %@",Localized(@"JX_NickName"),@"--"]; //即信号 _jixinNoL.text = [NSString stringWithFormat:@"%@ : %@",Localized(@"JX_Communication"),@"--"]; /* if ([self.userId intValue]>10100 || [self.userId intValue]<10000) { iv = [self createButton:Localized(@"JX_MemoName") drawTop:NO drawBottom:YES must:NO click:nil superView:self.tableBody]; iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT); //如果是朋友且设置备注,这修改为备注,暂时不知道有没有此接口 _remarkName = [self createLabel:iv default:user.remarkName]; h+=iv.frame.size.height; iv = [self createButton:Localized(@"JX_UserInfoDescribe") drawTop:NO drawBottom:YES must:NO click:nil superView:self.tableBody]; iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT); //如果是朋友且设置备注,这修改为备注,暂时不知道有没有此接口 _describe = [self createLabel:iv default:user.describe]; h+=iv.frame.size.height; } */ JXUserObject *friend = [[JXUserObject sharedInstance] getUserById:self.userId]; if ((friend && [friend.status intValue] != friend_status_none) || [self.userId isEqualToString:g_myself.userId]) {} if ([g_config.isOpenPositionService intValue] == 0) { if (!self.isJustShow) { // iv = [self createButton:Localized(@"JXUserInfoVC_Loation") drawTop:NO drawBottom:YES must:NO click:@selector(actionMap) superView:_baseView]; // iv.frame = CGRectMake(0, h, JX_SCREEN_WIDTH, HEIGHT); // h+=iv.frame.size.height; } } } - (void)newRequest:(NSNotification *)notif { [g_server getUser:self.userId toView:self]; } - (void) setUserInfo:(JXUserObject *)user { if (self.user.content) { user.content = self.user.content; } self.user = user; // 更新用户信息 [user updateUserNickname]; _friendStatus = [user.status intValue]; _latitude = [user.latitude doubleValue]; _longitude = [user.longitude doubleValue]; // 设置用户名字、备注、通讯号、地区等. if ([user.showLastLoginTime intValue] > 0 && [user.userType intValue] != 2) { //_lastTime.text = [self dateTimeDifferenceWithStartTime:user.showLastLoginTime]; // _lastTImgV.hidden = NO; }else { // _lastTImgV.hidden = YES; } if (user.telephone.length > 0 && [user.userType intValue] != 2) { // _showNum.text = user.phone; // _showNImgV.hidden = NO; }else { // _showNImgV.hidden = YES; } if (user.userDescription.length > 0) { // _desLab.text = user.userDescription; // _desImgV.hidden = NO; }else { // _desImgV.hidden = YES; } //NSString* city = [g_constant getAddressForNumber:user.provinceId cityId:user.cityId areaId:user.areaId]; if ([user.sex intValue] == 0) {// 女 // _sex.image = [UIImage imageNamed:@"basic_famale"]; }else {// 男 // _sex.image = [UIImage imageNamed:@"basic_male"]; } // 标签 NSMutableArray *array = [[JXLabelObject sharedInstance] fetchLabelsWithUserId:self.user.userId]; NSMutableString *labelsName = [NSMutableString string]; for (NSInteger i = 0; i < array.count; i ++) { JXLabelObject *labelObj = array[i]; if (i == 0) { [labelsName appendString:labelObj.groupName]; }else { [labelsName appendFormat:@",%@",labelObj.groupName]; } } if (labelsName.length > 0 && self.user.describe.length <= 0) { // _labelLab.text = Localized(@"JX_Label"); } else if (labelsName.length > 0 && self.user.describe.length > 0) { // _labelLab.text = Localized(@"JX_Label"); } else { //_labelLab.text = Localized(@"JX_SetNotesAndLabels"); // _label.text = @""; //_describeImgV.hidden = YES; } } - (void)friendPassNotif:(NSNotification *)notif { JXFriendObject *user = notif.object; if ([user.userId isEqualToString:self.userId]) { _friendStatus = friend_status_friend; [self showAddFriend]; } } -(void)switchAction:(UISwitch *) sender{ if (_friendStatus == friend_status_friend && ![_user.isBeenBlack boolValue]) { int offlineNoPushMsg = sender.isOn; [g_server friendsUpdateOfflineNoPushMsgUserId:g_myself.userId toUserId:_user.userId offlineNoPushMsg:offlineNoPushMsg type:0 toView:self]; }else { [sender setOn:!sender.isOn]; [g_server showMsg:Localized(@"JX_PleaseAddAsFriendFirst")]; } } /** *头像的缩放 */ -(void)onHeadImage{ [g_server delHeadImage:self.user.userId]; JXImageScrollVC * imageVC = [[JXImageScrollVC alloc]init]; imageVC.imageSize = CGSizeMake(JX_SCREEN_WIDTH, JX_SCREEN_WIDTH); imageVC.iv = [[JXImageView alloc] initWithFrame:CGRectMake(0, 0, JX_SCREEN_WIDTH, JX_SCREEN_WIDTH)]; imageVC.iv.center = imageVC.view.center; [g_server getHeadImageLarge:self.user.userId userName:self.user.userNickname imageView:imageVC.iv]; [self addTransition:imageVC]; [self presentViewController:imageVC animated:YES completion:^{ }]; } //添加VC转场动画 - (void) addTransition:(JXImageScrollVC *) siv { _scaleTransition = [[DMScaleTransition alloc]init]; [siv setTransitioningDelegate:_scaleTransition]; } -(void)dealloc{ NSLog(@"JXUserInfoVC.dealloc"); [g_notify removeObserver:self name:kXMPPSendTimeOutNotifaction object:nil]; [g_notify removeObserver:self name:kXMPPReceiptNotifaction object:nil]; [g_notify removeObserver:self]; self.user = nil; // [super dealloc]; } -(void) didServerResultSucces:(JXConnection*)aDownload dict:(NSDictionary*)dict array:(NSArray*)array1{ if([aDownload.action isEqualToString:act_AttentionAdd]){//加好友 int n = [[dict objectForKey:@"type"] intValue]; if( n==2 || n==4) _friendStatus = friend_status_friend;//成为好友,一般是无需验证 // else // _friendStatus = friend_status_see;//单向关注 if ([self.user.userType intValue] == 2) { _user.status = [NSNumber numberWithInt:2]; if([_user haveTheUser]) [_user insert]; else [_user update]; //[self actionQuit]; [g_notify postNotificationName:kActionRelayQuitVC object:nil]; [self.user doSendMsg:XMPP_TYPE_FRIEND content:nil]; [self showAddFriend]; JXChatViewController *chatVC=[JXChatViewController alloc]; chatVC.title = _user.userNickname; chatVC.chatPerson = self.user; chatVC = [chatVC init]; [g_navigation pushViewController:chatVC animated:YES]; }else { if(_friendStatus == friend_status_friend){ // [_wait stop]; [self doMakeFriend]; } else [self doSayHello]; } } if ([aDownload.action isEqualToString:act_FriendDel]) {//删除好友 [self.user doSendMsg:XMPP_TYPE_DELALL content:nil]; } if([aDownload.action isEqualToString:act_BlacklistAdd]){//拉黑 [self.user doSendMsg:XMPP_TYPE_BLACK content:nil]; } if([aDownload.action isEqualToString:act_FriendRemark]){ //[_wait stop]; JXUserObject* user1 = [[JXUserObject sharedInstance] getUserById:_user.userId]; // user1.userNickname = user.remarkName; //user1.remarkName = user.remarkName; //user1.describe = user.describe; // 修改备注后实时刷新 [g_notify postNotificationName:kFriendRemark object:user1]; [g_server showMsg:Localized(@"JXAlert_SetOK")]; } if([aDownload.action isEqualToString:act_BlacklistDel]){ [self.user doSendMsg:XMPP_TYPE_NOBLACK content:nil]; } if([aDownload.action isEqualToString:act_AttentionDel]){ [_user doSendMsg:XMPP_TYPE_DELSEE content:nil]; } if([aDownload.action isEqualToString:act_Report]){ [g_server showMsg:Localized(@"JXUserInfoVC_ReportSuccess")]; } if([aDownload.action isEqualToString:act_friendsUpdateOfflineNoPushMsg]){ [g_server showMsg:Localized(@"JXAlert_SetOK")]; } if([aDownload.action isEqualToString:act_filterUserCircle]){ } if( [aDownload.action isEqualToString:act_UserGet] ){ JXUserObject* user = [[JXUserObject alloc]init]; [user getDataFromDict:dict]; [user insertFriend]; [user updateUserNickname]; [user updateRemarkName]; [user updateTelephone]; // 更新等级气泡 [g_server getbubbleFontByUserId:user.userId ToView:self]; if ([user.userType intValue] != 2) { // [self createViews]; } if (self.user && ![self.user.userNickname isEqualToString:user.userNickname]) { [g_notify postNotificationName:kFriendListRefresh object:nil]; } [self setUserInfo:user]; if ([user.userType intValue] == 2) { [self setupServers]; // [self setServerDetail]; } if (self.chatVC) { [self.chatVC.tableView reloadData]; } } if([aDownload.action isEqualToString:act_getbubbleFontByUserId]){ // 保存到数据库 JLBubbleManager *manager = [JLBubbleManager sharedManager]; FMDatabase* db = [manager openResouceDb]; BOOL result = [manager checkBubbleFontTableCreatedInDb:db]; if (result) { // self.id, self.iosLeftUrl, self.iosRightUrl, self.name, self.code, self.color for (NSDictionary *tempDict in array1) { JLBubbleModel *model = [JLBubbleModel mj_objectWithKeyValues:tempDict]; manager.id = model.id; manager.iosLeftUrl = model.bubble.iosLeftUrl; manager.iosRightUrl = model.bubble.iosRightUrl; manager.name = model.bubble.name; manager.code = [NSString stringWithFormat:@"%d", model.font.code]; manager.color = model.font.color; [manager insertBubbleFontTable]; } } } } -(int) didServerResultFailed:(JXConnection*)aDownload dict:(NSDictionary*)dict{ return show_error; } -(int) didServerConnectError:(JXConnection*)aDownload error:(NSError *)error{//error为空时,代表超时 return show_error; } -(void) didServerConnectStart:(JXConnection*)aDownload{ if( [aDownload.action isEqualToString:act_UserGet] ){ return; } } - (BOOL)textFieldShouldReturn:(UITextField *)textField { [self.view endEditing:YES]; return YES; } -(void)actionAddFriend:(UIView*)sender{ // 验证XMPP是否在线 if(g_xmpp.isLogined != 1){ [g_xmpp showXmppOfflineAlert]; return; } if([_user.isBeenBlack boolValue]){ [g_server showMsg:Localized(@"TO_BLACKLIST")]; return; } switch (_friendStatus) { case friend_status_black:{ // [g_server addAttention:user.userId toView:self]; [self onDelBlack]; // [self viewDisMissAction]; } break; case friend_status_none: case friend_status_see: [g_server addAttention:_user.userId fromAddType:self.fromAddType toView:self]; break; // case friend_status_see: // [self doSayHello]; // break; case friend_status_friend:{//发消息 if([_user haveTheUser]) [_user insert]; else [_user update]; // [self actionQuit]; [g_notify postNotificationName:kActionRelayQuitVC object:nil]; JXChatViewController *chatVC=[JXChatViewController alloc]; chatVC.title = _user.userNickname; chatVC.chatPerson = self.user; chatVC = [chatVC init]; // [g_App.window addSubview:chatVC.view]; [g_navigation pushViewController:chatVC animated:YES]; } break; } } -(void)doSayHello{//打招呼 //_xmppMsgId = [self.user doSendMsg:XMPP_TYPE_SAYHELLO content:Localized(@"JXUserInfoVC_Hello")]; } -(void)onSendTimeout:(NSNotification *)notifacation//超时未收到回执 { // NSLog(@"onSendTimeout"); // [g_App showAlert:Localized(@"JXAlert_SendFilad")]; [JXMyTools showTipView:Localized(@"JXAlert_SendFilad")]; } -(void)newReceipt:(NSNotification *)notifacation{//新回执 // NSLog(@"newReceipt"); JXMessageObject *msg = (JXMessageObject *)notifacation.object; if(msg == nil) return; if(![msg isAddFriendMsg]) return; if(![msg.toUserId isEqualToString:self.user.userId]) return; if([msg.type intValue] == XMPP_TYPE_SAYHELLO){//打招呼 [g_server showMsg:Localized(@"JXAlert_SayHiOK")]; } if([msg.type intValue] == XMPP_TYPE_BLACK){//拉黑 _user.status = [NSNumber numberWithInt:friend_status_black]; _friendStatus = [_user.status intValue]; [[JXXMPP sharedInstance].blackList addObject:_user.userId]; [_user update]; [self showAddFriend]; [g_server showMsg:Localized(@"JXAlert_AddBlackList")]; [g_notify postNotificationName:kXMPPNewFriendNotifaction object:nil]; // [JXMessageObject msgWithFriendStatus:user.userId status:_friendStatus]; // [user notifyDelFriend]; } if([msg.type intValue] == XMPP_TYPE_DELSEE){//删除关注,弃用 _friendStatus = friend_status_none; [self showAddFriend]; [JXMessageObject msgWithFriendStatus:_user.userId status:_friendStatus]; [g_server showMsg:Localized(@"JXAlert_CencalFollow")]; } if([msg.type intValue] == XMPP_TYPE_DELALL){//删除好友 _friendStatus = friend_status_none; [self showAddFriend]; [g_notify postNotificationName:kXMPPNewFriendNotifaction object:nil]; if ([self.user.userType intValue] == 2) { [g_server showMsg:@"已取消关注"]; _user.status = [NSNumber numberWithInt:1]; [_user update]; }else { [g_server showMsg:Localized(@"JXAlert_DeleteFirend")]; } } if([msg.type intValue] == XMPP_TYPE_NOBLACK){//取消拉黑 _user.status = [NSNumber numberWithInt:friend_status_friend]; [_user updateStatus]; _friendStatus = friend_status_friend; [self showAddFriend]; if ([[JXXMPP sharedInstance].blackList containsObject:_user.userId]) { [[JXXMPP sharedInstance].blackList removeObject:_user.userId]; [JXMessageObject msgWithFriendStatus:_user.userId status:friend_status_friend]; } [g_server showMsg:Localized(@"JXAlert_MoveBlackList")]; [g_notify postNotificationName:kXMPPNewFriendNotifaction object:nil]; } if([msg.type intValue] == XMPP_TYPE_FRIEND){//无验证加好友 if ([g_myself.telephone rangeOfString:@"18938880001"].location == NSNotFound) { [g_server showMsg:Localized(@"JX_AddSuccess")]; } _user.status = [NSNumber numberWithInt:2]; [g_notify postNotificationName:kXMPPNewFriendNotifaction object:nil]; } } -(void)showAddFriend{ } -(void)specialCareClick{ CYSpecialCareViewController *vc = [[CYSpecialCareViewController alloc] init]; vc.user = self.user; vc.userId = self.userId; [g_navigation pushViewController:vc animated:YES]; } -(void)onMyBlog{ userWeiboVC* vc = [userWeiboVC alloc]; vc.user = _user; vc.isGotoBack = YES; vc = [vc init]; // [g_window addSubview:vc.view]; [g_navigation pushViewController:vc animated:YES]; } /** * 地图 */ -(void)actionMap{ if (_longitude <=0 && _latitude <= 0) { [g_server showMsg:Localized(@"JX_NotShareLocation")]; return; } JXMapData * mapData = [[JXMapData alloc] init]; mapData.latitude = [NSString stringWithFormat:@"%f",_latitude]; mapData.longitude = [NSString stringWithFormat:@"%f",_longitude]; NSArray * locations = @[mapData]; if (g_config.isChina) { JXLocationVC * vc = [JXLocationVC alloc]; vc.locations = [NSMutableArray arrayWithArray:locations]; vc.locationType = JXLocationTypeShowStaticLocation; vc = [vc init]; [g_navigation pushViewController:vc animated:YES]; }else { _gooMap = [JXGoogleMapVC alloc]; _gooMap.locations = [NSMutableArray arrayWithArray:locations]; _gooMap.locationType = JXGooLocationTypeShowStaticLocation; _gooMap = [_gooMap init]; [g_navigation pushViewController:_gooMap animated:YES]; } // JXLocationVC* vc = [JXLocationVC alloc]; // vc.isSend = NO; // vc.locationType = JXLocationTypeShowStaticLocation; // NSMutableArray * locationsArray = [[NSMutableArray alloc]init]; // // JXMapData* p = [[JXMapData alloc]init]; // p.latitude = [NSString stringWithFormat:@"%f",_latitude]; // p.longitude = [NSString stringWithFormat:@"%f",_longitude]; // p.title = _name.text; // p.subtitle = _city.text; // [locationsArray addObject:p]; // vc.locations = locationsArray; // // vc = [vc init]; //// [g_window addSubview:vc.view]; // [g_navigation pushViewController:vc animated:YES]; } -(void)reportUserView{ JXReportUserVC * reportVC = [[JXReportUserVC alloc] init]; reportVC.user = _user; reportVC.delegate = self; // [g_window addSubview:reportVC.view]; [g_navigation pushViewController:reportVC animated:YES]; } - (void)report:(JXUserObject *)reportUser reasonId:(NSNumber *)reasonId { [g_server reportUser:reportUser.userId roomId:nil webUrl:nil reasonId:reasonId toView:self]; } - (void)onMore{ int n = _friendStatus; //标题数组 [_titleArr removeAllObjects]; [_titleArr addObject:Localized(@"JXUserInfoVC_Report")]; if ([self.user.userType intValue] != 2) { //[_titleArr addObject:Localized(@"JX_SetNotesAndDescriptions")]; [_titleArr addObject:@"设置备注和名称"];//Localized(@"JX_SetNotesAndDescriptions")]; if(n == friend_status_friend){ if(n == friend_status_black) [_titleArr addObject:Localized(@"JXUserInfoVC_CancelBlackList")]; else if(![_user.isBeenBlack boolValue]) { [_titleArr addObject:Localized(@"JXUserInfoVC_AddBlackList")]; } if(![_user.isBeenBlack boolValue]){ if(n == friend_status_friend) [_titleArr addObject:Localized(@"JXUserInfoVC_DeleteFirend")]; else [_titleArr addObject:Localized(@"JX_AddFriend")]; } } } //自定义View _selectView = [[JX_SelectMenuView alloc] initWithTitle:_titleArr image:@[] cellHeight:CellHeight]; _selectView.alpha = 0.0; _selectView.delegate = self; [self.view addSubview:_selectView]; // [_selectView release]; //动画 [UIView animateWithDuration:0.3 animations:^{ _selectView.alpha = 1; }]; } - (void)didMenuView:(JX_SelectMenuView *)MenuView WithIndex:(NSInteger)index { long n = _friendStatus;//好友状态 // if(n>[_titleArr count]-1) // return; switch (index) { case 0: [self reportUserView]; [self viewDisMissAction]; break; case 1: [self onRemark]; [self viewDisMissAction]; break; case 2: if(n == friend_status_black){ [self onDelBlack]; [self viewDisMissAction]; }else{ [self onAddBlack]; [self viewDisMissAction]; } break; case 3: if(n == friend_status_see || n == friend_status_friend){ // [self onCancelSee]; // [self viewDisMissAction]; [self onDeleteFriend]; [self viewDisMissAction]; }else{ [self actionAddFriend:nil]; [self viewDisMissAction]; } break; default: [self viewDisMissAction]; break; } } - (void)viewDisMissAction{ [UIView animateWithDuration:0.4 animations:^{ _bgBlackAlpha.alpha = 0.0; } completion:^(BOOL finished) { [_selectView removeFromSuperview]; _selectView = nil; [_bgBlackAlpha removeFromSuperview]; }]; } #pragma mark ---------------创建设置好友备注页面---------------- -(void)onRemark{ // JXInputValueVC* vc = [JXInputValueVC alloc]; // vc.value = user.remarkName; // vc.title = Localized(@"JXUserInfoVC_SetName"); // vc.delegate = self; // vc.isLimit = YES; // vc.didSelect = @selector(onSaveNickName:); // vc = [vc init]; //// [g_window addSubview:vc.view]; // [g_navigation pushViewController:vc animated:YES]; JXSetNoteAndLabelVC *vc = [[JXSetNoteAndLabelVC alloc] init]; vc.title = @"设置备注和名称";// Localized(@"JX_SetNotesAndLabels"); vc.delegate = self; vc.didSelect = @selector(refreshLabel:); vc.user = self.user; [g_navigation pushViewController:vc animated:YES]; } - (void)refreshLabel:(JXUserObject *)user { self.user.remarkName = user.remarkName; self.user.describe = user.describe; // CGSize sizeN = [user.remarkName sizeWithAttributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:16]}]; // _remarkName.frame = CGRectMake(_remarkName.frame.origin.x, _remarkName.frame.origin.y, sizeN.width, _remarkName.frame.size.height); // _sex.frame = CGRectMake(CGRectGetMaxX(_remarkName.frame)+3, _sex.frame.origin.y, _sex.frame.size.width, _sex.frame.size.height); // // _remarkName.text = user.remarkName.length > 0 ? user.remarkName : user.userNickname; [g_server setFriendName:self.user.userId noteName:user.remarkName describe:user.describe toView:self]; } -(void)onSaveNickName:(JXInputValueVC*)vc{ _user.remarkName = vc.value; [g_server setFriendName:_user.userId noteName:vc.value describe:nil toView:self]; } -(void)onAddBlack{ [g_server addBlacklist:_user.userId toView:self]; } -(void)onDelBlack{ [g_server delBlacklist:_user.userId toView:self]; } -(void)onCancelSee{ [g_server delAttention:_user.userId toView:self]; } -(void)onDeleteFriend{ // [g_server delAttention:user.userId toView:self]; [g_server delFriend:_user.userId toView:self]; } -(void)doMakeFriend{ _friendStatus = friend_status_friend; // user.status = [NSNumber numberWithInt:_friendStatus]; // if([user haveTheUser]) // [user update]; // else // [user insert]; [self.user doSendMsg:XMPP_TYPE_FRIEND content:nil]; [JXMessageObject msgWithFriendStatus:_user.userId status:_friendStatus]; [self showAddFriend]; } -(void)showUserQRCode{ JXQRCodeViewController * qrVC = [[JXQRCodeViewController alloc] init]; qrVC.type = QRUserType; qrVC.userId = _user.userId; qrVC.account = _user.account; qrVC.nickName=_user.userNickname; qrVC.sex = _user.sex; // [g_window addSubview:qrVC.view]; [g_navigation pushViewController:qrVC animated:YES]; } - (NSString *)dateTimeDifferenceWithStartTime:(NSNumber *)compareDate { NSInteger timeInterval = [[NSDate date] timeIntervalSince1970] - [compareDate integerValue]; long temp = 0; NSString *result; if (timeInterval < 60) { result = [NSString stringWithFormat:@"%d%@",(int)timeInterval,Localized(@"SECONDS_AGO")]; } else if((temp = timeInterval/60) <60){ result = [NSString stringWithFormat:@"%ld%@",temp,Localized(@"MINUTES_AGO")]; } else if((temp = temp/60) <24){ result = [NSString stringWithFormat:@"%ld%@",temp,Localized(@"JX_HoursAgo")]; } else if((temp = temp/24) <30){ result = [NSString stringWithFormat:@"%ld%@",temp,Localized(@"JX_DaysAgo")]; } else if((temp = temp/30) <12){ result = [NSString stringWithFormat:@"%ld%@",temp,Localized(@"JX_MonthAgo")]; } else{ temp = temp/12; result = [NSString stringWithFormat:@"%ld%@",temp,Localized(@"JX_YearsAgo")]; } return result; } @end