diff --git a/Ash_AWord.xcodeproj/project.pbxproj b/Ash_AWord.xcodeproj/project.pbxproj index 618006a..f6e2dff 100644 --- a/Ash_AWord.xcodeproj/project.pbxproj +++ b/Ash_AWord.xcodeproj/project.pbxproj @@ -138,7 +138,6 @@ A97C54D11AC8F10F0038818A /* RequireEngine.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54C51AC8F10F0038818A /* RequireEngine.m */; }; A97C54D21AC8F10F0038818A /* AFgzipResponseSerializer.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54C81AC8F10F0038818A /* AFgzipResponseSerializer.m */; }; A97C54D31AC8F10F0038818A /* XiaoYuAPIClient.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54CA1AC8F10F0038818A /* XiaoYuAPIClient.m */; }; - A97C54D41AC8F10F0038818A /* XMFishBaseCode.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54CC1AC8F10F0038818A /* XMFishBaseCode.m */; }; A97C54DD1AC901980038818A /* MBProgressHUD+Util.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54DC1AC901970038818A /* MBProgressHUD+Util.m */; }; A97C54E11AC91DA10038818A /* CommonUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = A97C54E01AC91DA10038818A /* CommonUtil.m */; }; A97C54FE1AC933AD0038818A /* UMSocialLocalizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = A97C54E41AC933AD0038818A /* UMSocialLocalizable.strings */; }; @@ -441,8 +440,6 @@ A97C54C81AC8F10F0038818A /* AFgzipResponseSerializer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFgzipResponseSerializer.m; sourceTree = ""; }; A97C54C91AC8F10F0038818A /* XiaoYuAPIClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XiaoYuAPIClient.h; sourceTree = ""; }; A97C54CA1AC8F10F0038818A /* XiaoYuAPIClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XiaoYuAPIClient.m; sourceTree = ""; }; - A97C54CB1AC8F10F0038818A /* XMFishBaseCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMFishBaseCode.h; sourceTree = ""; }; - A97C54CC1AC8F10F0038818A /* XMFishBaseCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XMFishBaseCode.m; sourceTree = ""; }; A97C54D61AC8FB6C0038818A /* Common.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Common.h; sourceTree = ""; }; A97C54D81AC8FCED0038818A /* PrefixHeader.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PrefixHeader.pch; sourceTree = ""; }; A97C54DB1AC901970038818A /* MBProgressHUD+Util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MBProgressHUD+Util.h"; sourceTree = ""; }; @@ -980,8 +977,6 @@ A97C54C61AC8F10F0038818A /* Serializer */, A97C54C91AC8F10F0038818A /* XiaoYuAPIClient.h */, A97C54CA1AC8F10F0038818A /* XiaoYuAPIClient.m */, - A97C54CB1AC8F10F0038818A /* XMFishBaseCode.h */, - A97C54CC1AC8F10F0038818A /* XMFishBaseCode.m */, ); path = Network; sourceTree = ""; @@ -1672,7 +1667,6 @@ A96862701ACCF13300DDAA6B /* PSTCollectionViewCell.m in Sources */, A98536771AEB7400000312BF /* RegistAccountViewController.m in Sources */, A97559B71ACBD99E004ADA42 /* UIPlaceHolderTextView.m in Sources */, - A97C54D41AC8F10F0038818A /* XMFishBaseCode.m in Sources */, A97C54E11AC91DA10038818A /* CommonUtil.m in Sources */, A96862491ACCF0B400DDAA6B /* MWTapDetectingView.m in Sources */, A99AA12D1ADCCB3C00574B12 /* MessageViewModel.m in Sources */, diff --git a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist index 76dc9cc..54897f4 100644 --- a/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ b/Ash_AWord.xcworkspace/xcuserdata/xmfish.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -898,22 +898,6 @@ landmarkType = "5"> - - - - - - - - - - - - @@ -1017,11 +969,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m" - timestampString = "450753135.973442" + timestampString = "455713467.245974" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "100" - endingLineNumber = "100" + startingLineNumber = "101" + endingLineNumber = "101" landmarkName = "-tick" landmarkType = "5"> @@ -1033,12 +985,12 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/ViewControllers/Main/MessageViewController.m" - timestampString = "451817100.154543" + timestampString = "455711777.493401" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "129" - endingLineNumber = "129" - landmarkName = "-headerRereshing" + startingLineNumber = "132" + endingLineNumber = "132" + landmarkName = "-footerRereshing" landmarkType = "5"> @@ -1058,22 +1010,6 @@ landmarkType = "5"> - - - - @@ -1129,11 +1065,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m" - timestampString = "450752843.371363" + timestampString = "455713467.245974" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "90" - endingLineNumber = "90" + startingLineNumber = "91" + endingLineNumber = "91" landmarkName = "-tick" landmarkType = "5"> @@ -1145,11 +1081,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m" - timestampString = "451817100.154543" + timestampString = "455713467.245974" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "246" - endingLineNumber = "246" + startingLineNumber = "247" + endingLineNumber = "247" landmarkName = "-audioPlayer:stateChanged:" landmarkType = "5"> @@ -1161,11 +1097,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m" - timestampString = "451817100.154543" + timestampString = "455713467.245974" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "251" - endingLineNumber = "251" + startingLineNumber = "252" + endingLineNumber = "252" landmarkName = "-audioPlayer:didEncounterError:" landmarkType = "5"> @@ -1177,11 +1113,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m" - timestampString = "451817100.154543" + timestampString = "455713467.245974" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "256" - endingLineNumber = "256" + startingLineNumber = "257" + endingLineNumber = "257" landmarkName = "-audioPlayer:didStartPlayingQueueItemId:" landmarkType = "5"> @@ -1193,23 +1129,7 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m" - timestampString = "451817100.154543" - startingColumnNumber = "9223372036854775807" - endingColumnNumber = "9223372036854775807" - startingLineNumber = "260" - endingLineNumber = "260" - landmarkName = "-audioPlayer:didFinishBufferingSourceWithQueueItemId:" - landmarkType = "5"> - - - - + + + + @@ -1241,11 +1177,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Views/Message/MessageTableViewCell.m" - timestampString = "450753266.175428" + timestampString = "455713467.245974" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "101" - endingLineNumber = "101" + startingLineNumber = "102" + endingLineNumber = "102" landmarkName = "-tick" landmarkType = "5"> @@ -1273,11 +1209,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Utility/Tool/CommonUtil.m" - timestampString = "451475837.570876" + timestampString = "455765642.372532" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "192" - endingLineNumber = "192" + startingLineNumber = "200" + endingLineNumber = "200" landmarkName = "+timeFromtimeSp:" landmarkType = "5"> @@ -1289,11 +1225,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Utility/Tool/CommonUtil.m" - timestampString = "451475842.946622" + timestampString = "455765642.372532" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "194" - endingLineNumber = "194" + startingLineNumber = "202" + endingLineNumber = "202" landmarkName = "+timeFromtimeSp:" landmarkType = "5"> @@ -1305,11 +1241,11 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Utility/Tool/CommonUtil.m" - timestampString = "451476200.990193" + timestampString = "455765642.372532" startingColumnNumber = "9223372036854775807" endingColumnNumber = "9223372036854775807" - startingLineNumber = "201" - endingLineNumber = "201" + startingLineNumber = "209" + endingLineNumber = "209" landmarkName = "+timeFromtimeSp:" landmarkType = "5"> @@ -1493,7 +1429,7 @@ @@ -1529,7 +1465,23 @@ ignoreCount = "0" continueAfterRunningActions = "No" filePath = "Ash_AWord/Utility/Network/RequireEngine.m" - timestampString = "451814117.694318" + timestampString = "455772130.614624" + startingColumnNumber = "9223372036854775807" + endingColumnNumber = "9223372036854775807" + startingLineNumber = "132" + endingLineNumber = "132" + landmarkName = "+requireWithProperty:completionBlock:failedBlock:" + landmarkType = "5"> + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Ash_AWord/Config/Common.h b/Ash_AWord/Config/Common.h index 13ea5d4..969e174 100644 --- a/Ash_AWord/Config/Common.h +++ b/Ash_AWord/Config/Common.h @@ -61,9 +61,10 @@ * 接口地址 */ -#define Ash_AWord_API_URL @"http://121.43.150.13/QuestionServer" +#define Ash_AWord_API_URL @"http://121.43.150.13/QuestionServer/rs/yjn/post" #define Ash_AWord_First_URL @"http://121.43.150.13" //#define Ash_AWord_API_URL @"http://192.168.1.3:8080/QuestionServer" +#define Sign_Key @"yjn@jjyy123" /** * 微信开放平台信息 diff --git a/Ash_AWord/Utility/Network/BaseViewModel.h b/Ash_AWord/Utility/Network/BaseViewModel.h index f6bd593..25b23f4 100644 --- a/Ash_AWord/Utility/Network/BaseViewModel.h +++ b/Ash_AWord/Utility/Network/BaseViewModel.h @@ -8,7 +8,11 @@ #import "MTLModel.h" #import "MTLJSONAdapter.h" - +#import "NSString+HXAddtions.h" +typedef enum { + Order_by_Time = 0, + Order_by_Good = 1, +}Order_by; @interface BaseViewModel : MTLModel @property (nonatomic, readonly) NSNumber* errCode; diff --git a/Ash_AWord/Utility/Network/PropertyEntity.m b/Ash_AWord/Utility/Network/PropertyEntity.m index 5cbcf44..37eabd9 100644 --- a/Ash_AWord/Utility/Network/PropertyEntity.m +++ b/Ash_AWord/Utility/Network/PropertyEntity.m @@ -7,8 +7,7 @@ // #import "PropertyEntity.h" -#import "XMFishBaseCode.h" - +#import "NSString+HXAddtions.h" @implementation proFile @end @@ -17,30 +16,29 @@ - (NSDictionary *)encodePro { -// XMFishBaseCode *bc = [[XMFishBaseCode alloc] init]; -// -// [bc setToken:nil]; -// [bc setCallback:_url]; -// if (_pro) -// { -// [bc setParams:[NSMutableDictionary dictionaryWithDictionary:_pro]]; -// } -// -// NSMutableString *key = [[NSMutableString alloc]initWithString:[bc getBaseCode]]; -// [key stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; -// NSDictionary *dic = @{@"mkey":key}; NSMutableDictionary* dic; - if (_pro) { - dic = [NSMutableDictionary dictionaryWithDictionary:_pro]; + if ([_pro objectForKey:@"root"]) { + dic = [NSMutableDictionary dictionaryWithDictionary:[_pro objectForKey:@"root"]]; }else{ dic = [NSMutableDictionary dictionary]; } if ([AWordUser sharedInstance].isLogin && [AWordUser sharedInstance].uid) { [dic setObject:[AWordUser sharedInstance].uid forKey:@"uid"]; - } - return dic; + NSString* command = [_pro objectForKey:@"command"]; + NSString* version = [CommonUtil getVersion]; + NSString* root = [NSString jsonStringWithDictionary:dic]; + + NSString* sign = [NSString stringWithFormat:@"%@%@%@%@", command, root, version, Sign_Key]; + sign = [sign md5]; + + NSDictionary* resultDic = @{@"root":root, + @"version":version, + @"command":command, + @"sign":sign}; + + return resultDic; } @end diff --git a/Ash_AWord/Utility/Network/RequireEngine.m b/Ash_AWord/Utility/Network/RequireEngine.m index ec3c200..2f0c3cb 100644 --- a/Ash_AWord/Utility/Network/RequireEngine.m +++ b/Ash_AWord/Utility/Network/RequireEngine.m @@ -38,7 +38,7 @@ } + (AFHTTPRequestOperation *)requireWithProperty:(PropertyEntity *)proper completionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock{ - + proper.reqURL = @""; NSString *apiKey = proper.url; if (proper.pro && proper.pro[@"page"]) { @@ -114,19 +114,22 @@ return [[XiaoYuAPIClient sharedClient] POST:[proper reqURL] parameters:[proper encodePro] constructingBodyWithBlock:^(id formData) { - if ([proper.pFile.name isEqualToString:@"img"]) { - for (int i = 0; i < proper.pFile.img.count; i++) { - UIImage *uploadImage = proper.pFile.img[i]; - NSString *proName = [proper.pFile.name stringByAppendingFormat:@"%d", i]; - NSData* data = UIImageJPEGRepresentation(uploadImage, 0.1); - DLog(@"%ld kB",data.length/(8*1024)); - [formData appendPartWithFileData:UIImageJPEGRepresentation(uploadImage, 0.1) name:proper.pFile.img.count == 1 ? proper.pFile.name : proName fileName:[proName stringByAppendingString:@".jpg" ] mimeType:@"image/jpg"]; + if (proper.pFile) { + if ([proper.pFile.name isEqualToString:@"img"]) { + for (int i = 0; i < proper.pFile.img.count; i++) { + UIImage *uploadImage = proper.pFile.img[i]; + NSString *proName = [proper.pFile.name stringByAppendingFormat:@"%d", i]; + NSData* data = UIImageJPEGRepresentation(uploadImage, 0.1); + DLog(@"%ld kB",data.length/(8*1024)); + [formData appendPartWithFileData:UIImageJPEGRepresentation(uploadImage, 0.1) name:proper.pFile.img.count == 1 ? proper.pFile.name : proName fileName:[proName stringByAppendingString:@".jpg" ] mimeType:@"image/jpg"]; + } + }else{ + NSData* uploadFile = proper.pFile.img[0]; + [formData appendPartWithFileData:uploadFile name:@"1" fileName:@"1.wav" mimeType:@"audio/x-wav"]; } - }else{ - NSData* uploadFile = proper.pFile.img[0]; - [formData appendPartWithFileData:uploadFile name:@"1" fileName:@"1.wav" mimeType:@"audio/x-wav"]; + } - } + } success:^(AFHTTPRequestOperation * __unused task, id JSON) { DLog(@"%@", JSON); diff --git a/Ash_AWord/Utility/Network/XMFishBaseCode.h b/Ash_AWord/Utility/Network/XMFishBaseCode.h deleted file mode 100644 index 9d1bb3b..0000000 --- a/Ash_AWord/Utility/Network/XMFishBaseCode.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// XMFishBaseCode.h -// FanLiKa -// -// Created by aDu on 14-10-23. -// Copyright (c) 2014年 xmfish. All rights reserved. -// - -#import - -@interface XMFishBaseCode : NSObject - -@property (nonatomic, strong, readwrite) NSString *token; -@property (nonatomic, strong, readwrite) NSString *callback; -@property (nonatomic, strong, readwrite) NSMutableDictionary *params; - -@property (nonatomic, strong, readwrite) NSString *uid; -@property (nonatomic, strong, readwrite) NSString *username; -@property (nonatomic, strong, readwrite) NSString *cityId; - -@property (nonatomic, strong, readwrite) NSString *mobile; - -- (NSString *)getBaseCode; - -+ (NSString *)getWkey; - -@end diff --git a/Ash_AWord/Utility/Network/XMFishBaseCode.m b/Ash_AWord/Utility/Network/XMFishBaseCode.m deleted file mode 100644 index 6ae479f..0000000 --- a/Ash_AWord/Utility/Network/XMFishBaseCode.m +++ /dev/null @@ -1,156 +0,0 @@ -// -// XMFishBaseCode.m -// FanLiKa -// -// Created by aDu on 14-10-23. -// Copyright (c) 2014年 xmfish. All rights reserved. -// - -#import "XMFishBaseCode.h" -#import "NSString+HXAddtions.h" -#import "SecureUDID.h" -#import -@implementation XMFishBaseCode - -static char encodingTable[] = ""; - -- (id)init -{ - self = [super init]; - - return self; -} - -- (void)setParams:(NSMutableDictionary *)Params -{ - if (_params != Params) - { - _params = nil; - _params = Params; - } -} - -- (NSString *)getBaseCode -{ - - - NSMutableDictionary *data = [[NSMutableDictionary alloc] init]; - - NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970]; - data[@"timestamp"] = [NSString stringWithFormat:@"%f", timeStamp]; - - - //app版本号 - NSString *appVersion = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; - if (appVersion) - { - [data setObject:appVersion forKey:@"appversion"]; - } - - //网络类型 - NSString *netWorkType = [NSString stringWithFormat:@"%d", [CommonUtil networkType]]; - [data setObject:netWorkType forKey:@"networktype"]; - - //设备类型 - NSString *deviceName = [CommonUtil getUtsName]; - if (deviceName) - { - [data setObject:deviceName forKey:@"devicename"]; - } - - //唯一的设备号,用于服务端识别游客 - NSString *domain = @"com.shengshi.ufun"; - NSString *key = @"xmfishufunkey"; - NSString *udid = [SecureUDID UDIDForDomain:domain usingKey:key]; - if (udid) - { - [data setObject:udid forKey:@"udid"]; - } - - DLog(@"Http param : %@", data); - return [NSString jsonStringWithDictionary:data]; -} - -- (NSData *)encode:(const uint8_t*) input length:(NSInteger) length -{ - NSInteger _dlen =((length + 2)/3 * 4)+1; - NSMutableData* tmpdata = [NSMutableData dataWithLength:_dlen]; - uint8_t* tmpchar = (uint8_t*)tmpdata.mutableBytes; - srand((unsigned)time(NULL)); - - for (NSInteger i = 0; i < length; i += 3) - { - NSInteger value = 0; - for (NSInteger j = i; j < (i + 3); j++) - { - value <<= 8; - if (j < length) - { - value |= (0xFF & input[j]); - } - } - NSInteger index = (i / 3) * 4; - tmpchar[index + 0] = encodingTable[(value >> 18) & 0x3F]; - tmpchar[index + 1] = encodingTable[(value >> 12) & 0x3F]; - if ((i + 1) < length) - { - tmpchar[index + 2] = encodingTable[(value >> 6) & 0x3F]; - } - else - { - tmpchar[index + 2] = 0; - _dlen--; - } - if ((i + 2) < length) - { - tmpchar[index + 3] = encodingTable[(value >> 0) & 0x3F]; - } - else - { - tmpchar[index + 3] = 0; - _dlen--; - } - } - int pos=1+ abs((rand()*1234))%60; //字符偏移量 - int add=encodingTable[pos]; - int step=((add%_dlen)%5)+4; - NSMutableData *_output = [NSMutableData dataWithLength:_dlen]; - uint8_t* output = (uint8_t*)_output.mutableBytes; - tmpchar[_dlen-1]=add; - for (int k = 0; k <= _dlen; k+=step) - { - int m=0; - if (k+step+1 > _dlen) - { - while (m < step && tmpchar[k+m] > 0) - { - output[k+m]=tmpchar[k+m]; - m++; - } - } - else - { - while (m < step && tmpchar[k+step-m-1] > 0) - { - output[k+m]=tmpchar[k+step-m-1]; - m++; - } - } - } - return _output; -} - -- (NSString *)encode:(NSString *)string -{ - NSData *rayBety=[string dataUsingEncoding:NSUTF8StringEncoding]; - NSData *newBety=[self encode:rayBety.bytes length:rayBety.length]; - NSString *newString=[[NSString alloc]initWithData:newBety encoding:NSUTF8StringEncoding]; - return newString; -} - -+ (NSString *)getWkey -{ - return [[[XMFishBaseCode alloc] init] getBaseCode]; -} - -@end diff --git a/Ash_AWord/Utility/Network/XiaoYuAPIClient.m b/Ash_AWord/Utility/Network/XiaoYuAPIClient.m index feeb084..22af5e4 100644 --- a/Ash_AWord/Utility/Network/XiaoYuAPIClient.m +++ b/Ash_AWord/Utility/Network/XiaoYuAPIClient.m @@ -24,6 +24,8 @@ _sharedClient = [[XiaoYuAPIClient alloc] initWithBaseURL:[NSURL URLWithString:[self getApiBaseString]]]; _sharedClient.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; +// _sharedClient.requestSerializer = [AFJSONRequestSerializer serializer]; +// _sharedClient.responseSerializer = [AFHTTPResponseSerializer serializer]; [_sharedClient.requestSerializer setValue:@"text/html" forHTTPHeaderField:@"Content-Type"]; _sharedClient.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; diff --git a/Ash_AWord/Utility/Tool/CommonUtil.h b/Ash_AWord/Utility/Tool/CommonUtil.h index 95f761f..e640730 100644 --- a/Ash_AWord/Utility/Tool/CommonUtil.h +++ b/Ash_AWord/Utility/Tool/CommonUtil.h @@ -21,6 +21,8 @@ NetworkType; @interface CommonUtil : NSObject +//获取版本号 ++(NSString*)getVersion; //获取系统网络类型 + (NetworkType)networkType; diff --git a/Ash_AWord/Utility/Tool/CommonUtil.m b/Ash_AWord/Utility/Tool/CommonUtil.m index b14e5f8..1d8de0a 100644 --- a/Ash_AWord/Utility/Tool/CommonUtil.m +++ b/Ash_AWord/Utility/Tool/CommonUtil.m @@ -20,6 +20,14 @@ @implementation CommonUtil ++(NSString*)getVersion +{ + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; + NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; + NSString *buildVersion = [infoDictionary objectForKey:@"CFBundleVersion"]; + NSString *version = [NSString stringWithFormat:@"%@.%@",app_Version, buildVersion]; + return version; +} + (NetworkType)networkType { NSArray *subviews = [[[[UIApplication sharedApplication] valueForKey:@"statusBar"] valueForKey:@"foregroundView"]subviews]; diff --git a/Ash_AWord/ViewControllers/My/MyMessageViewController.m b/Ash_AWord/ViewControllers/My/MyMessageViewController.m index 4cd0ea4..648dbbb 100644 --- a/Ash_AWord/ViewControllers/My/MyMessageViewController.m +++ b/Ash_AWord/ViewControllers/My/MyMessageViewController.m @@ -229,7 +229,6 @@ -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ Text_Voice* text_voice = [_text_voiceArr objectAtIndex:indexPath.section]; return [MessageTableViewCell heightWith:text_voice]; - // return 140; } -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { diff --git a/Ash_AWord/ViewControllers/My/PersonalInfoViewController.h b/Ash_AWord/ViewControllers/My/PersonalInfoViewController.h index b529fe0..ba2c03b 100644 --- a/Ash_AWord/ViewControllers/My/PersonalInfoViewController.h +++ b/Ash_AWord/ViewControllers/My/PersonalInfoViewController.h @@ -15,4 +15,5 @@ @property (weak, nonatomic) IBOutlet UIView *lineView; @property (weak, nonatomic) IBOutlet NSLayoutConstraint *lineHeight; +@property (nonatomic, strong)NSString* otherUserId; @end diff --git a/Ash_AWord/ViewControllers/My/PersonalInfoViewController.m b/Ash_AWord/ViewControllers/My/PersonalInfoViewController.m index 4b73a1d..0523539 100644 --- a/Ash_AWord/ViewControllers/My/PersonalInfoViewController.m +++ b/Ash_AWord/ViewControllers/My/PersonalInfoViewController.m @@ -9,13 +9,21 @@ #import "PersonalInfoViewController.h" #import "CExpandHeader.h" #import "PersonalTopView.h" - - - -@interface PersonalInfoViewController () +#import "NoteViewModel.h" +#import "NoteTableViewCell.h" +#import "MessageTableViewCell.h" +#import "MessageViewModel.h" +@interface PersonalInfoViewController () { CExpandHeader *_header; PersonalTopView* _personalTopView; + NSMutableArray* _imageArr; + NSMutableArray* _voiceArr; + BOOL _isSelectImage; + NSInteger _imagePage; + NSInteger _voicePage; + NSInteger _playIndex; + } @end @@ -24,11 +32,131 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. - - [self.tableView removeHeader]; - _personalTopView = [Ash_UIUtil instanceXibView:@"PersonalTopView"]; - [self.tableView setTableHeaderView:_personalTopView]; + [self customViewDidLoad]; + _isSelectImage = YES; + _imagePage = 1; + _voicePage = 1; + _playIndex = -1; + + _imageArr = [[NSMutableArray alloc] init]; + _voiceArr = [[NSMutableArray alloc] init]; + + [self loadData]; +} + +-(void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + _personalTopView = [Ash_UIUtil instanceXibView:@"PersonalTopView"]; + + __weak PersonalInfoViewController *weakself = self; + [_personalTopView setIsSelectImg:^(BOOL isSelectImg){ + _isSelectImage = isSelectImg; + if (isSelectImg) { + if (_imageArr.count <= 0) { + [weakself loadData]; + }else{ + [weakself.tableView reloadData]; + } + }else{ + if (_voiceArr.count <= 0) { + [weakself loadData]; + }else{ + [weakself.tableView reloadData]; + } + } + }]; + self.tableView.tableHeaderView = _personalTopView; +} +#pragma mark MJRefreshDelegate +-(void)headerRereshing +{ + if (_isSelectImage) { + _imagePage = 1; + }else{ + _voicePage = 1; + } + + [self loadData]; +} +-(void)footerRereshing +{ + [self loadData]; +} + +-(void)loadData +{ + if (_isSelectImage) { + PropertyEntity* pro; + if (!_otherUserId) { + pro = [NoteViewModel requireMyWithOrder_by:Order_by_Time withPage:_imagePage withPage_size:DefaultPageSize]; + }else{ + pro = [NoteViewModel requireOhterWithOrder_by:Order_by_Time withPage:_imagePage withPage_size:DefaultPageSize withOtherId:_otherUserId]; + } + [RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) { + + NoteViewModel* noteViewModel = (NoteViewModel*)viewModel; + + if (_imagePage <= 1) { + [_imageArr removeAllObjects]; + } + if (noteViewModel.text_imagesArr) { + [_imageArr addObjectsFromArray:noteViewModel.text_imagesArr]; + } + [self footerEndRefreshing]; + [self headerEndRefreshing]; + if (noteViewModel.text_imagesArr.count<20) { + [self.tableView removeFooter]; + }else{ + [self.tableView addGifFooterWithRefreshingTarget:self refreshingAction:@selector(footerRereshing)]; + } + _imagePage++; + [self.tableView reloadData]; + + } failedBlock:^(NSError *error) { + [MBProgressHUD errorHudWithView:self.view label:kNetworkErrorTips hidesAfter:1.0]; + [self footerEndRefreshing]; + [self headerEndRefreshing]; + }]; + + }else{ + PropertyEntity* pro ; + if (_otherUserId) { + pro = [MessageViewModel requireOhterWithOrder_by:Order_by_Time withPage:_voicePage withPage_size:DefaultPageSize withOtherId:_otherUserId]; + + }else{ + pro = [MessageViewModel requireMyWithOrder_by:Order_by_Time withPage:_voicePage withPage_size:DefaultPageSize]; + + } + [RequireEngine requireWithProperty:pro completionBlock:^(id viewModel) { + + MessageViewModel* noteViewModel = (MessageViewModel*)viewModel; + + if (_voicePage <= 1) { + [_voiceArr removeAllObjects]; + } + if (noteViewModel.text_voicesArr) { + [_voiceArr addObjectsFromArray:noteViewModel.text_voicesArr]; + } + [self footerEndRefreshing]; + [self headerEndRefreshing]; + if (noteViewModel.text_voicesArr.count @property (nonatomic, strong)NSString* content; diff --git a/Ash_AWord/ViewModels/Message/MessageViewModel.m b/Ash_AWord/ViewModels/Message/MessageViewModel.m index 251daf7..c14f523 100644 --- a/Ash_AWord/ViewModels/Message/MessageViewModel.m +++ b/Ash_AWord/ViewModels/Message/MessageViewModel.m @@ -60,12 +60,15 @@ +(PropertyEntity*)requireWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_voice/load_public"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"order_by": [NSString stringWithFormat:@"%u",order_by], - @"page": [NSString stringWithFormat:@"%ld",page], - @"page_size": [NSString stringWithFormat:@"%ld",page_size], + NSDictionary* dic = @{@"orderBy": [NSString stringWithFormat:@"%u",order_by], + @"page": [NSString stringWithFormat:@"%ld",(long)page], + @"pageSize": [NSString stringWithFormat:@"%ld",(long)page_size], + }; + + pro.pro = @{@"root": dic, + @"command": @"30004", }; return pro; @@ -74,13 +77,15 @@ +(PropertyEntity*)requireOhterWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size withOtherId:(NSString *)otherid { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_voice/load_others"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"order_by": [NSString stringWithFormat:@"%u",order_by], - @"page": [NSString stringWithFormat:@"%ld",page], - @"page_size": [NSString stringWithFormat:@"%ld",page_size], - @"target_uid": otherid + NSDictionary* dic = @{@"orderBy": [NSString stringWithFormat:@"%u",order_by], + @"page": [NSString stringWithFormat:@"%ld",page], + @"pageSize": [NSString stringWithFormat:@"%ld",page_size], + @"targetUid": otherid + }; + pro.pro = @{@"root": dic, + @"command": @"30003", }; return pro; @@ -88,12 +93,14 @@ +(PropertyEntity*)requireMyWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_voice/load_my"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"order_by": [NSString stringWithFormat:@"%u",order_by], - @"page": [NSString stringWithFormat:@"%ld",page], - @"page_size": [NSString stringWithFormat:@"%ld",page_size], + NSDictionary* dic = @{@"orderBy": [NSString stringWithFormat:@"%u",order_by], + @"page": [NSString stringWithFormat:@"%ld",page], + @"pageSize": [NSString stringWithFormat:@"%ld",page_size], + }; + pro.pro = @{@"root": dic, + @"command": @"30002", }; return pro; @@ -101,12 +108,14 @@ +(PropertyEntity*)requirePraiseWithRecordId:(NSInteger)recordId { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_voice/praise"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{ - @"record_id": [NSString stringWithFormat:@"%ld",recordId], - + NSDictionary* dic = @{ + @"recordId": [NSString stringWithFormat:@"%ld",recordId], + + }; + pro.pro = @{@"root": dic, + @"command": @"30005", }; return pro; @@ -114,12 +123,14 @@ +(PropertyEntity*)requireShareWithRecordId:(NSInteger)recordId { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_voice/share"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{ - @"record_id": [NSString stringWithFormat:@"%ld",recordId], - + NSDictionary* dic = @{ + @"recordId": [NSString stringWithFormat:@"%ld",recordId], + + }; + pro.pro = @{@"root": dic, + @"command": @"30007", }; return pro; @@ -127,12 +138,14 @@ +(PropertyEntity*)requireDelWithRecordId:(NSInteger)recordId { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_voice/del"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{ - @"record_id": [NSString stringWithFormat:@"%ld",recordId], - + NSDictionary* dic = @{ + @"recordId": [NSString stringWithFormat:@"%ld",recordId], + + }; + pro.pro = @{@"root": dic, + @"command": @"30006", }; return pro; diff --git a/Ash_AWord/ViewModels/My/UpdateViewModel.m b/Ash_AWord/ViewModels/My/UpdateViewModel.m index 0eca365..a9e560a 100644 --- a/Ash_AWord/ViewModels/My/UpdateViewModel.m +++ b/Ash_AWord/ViewModels/My/UpdateViewModel.m @@ -29,18 +29,16 @@ +(PropertyEntity*)requireUpdate { - NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; - NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"]; - NSString *buildVersion = [infoDictionary objectForKey:@"CFBundleVersion"]; - NSString *version = [NSString stringWithFormat:@"%@.%@",app_Version, buildVersion]; PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithPOST; - pro.reqURL = @"rs/common/get_version"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"version": version, + + NSDictionary* dic = @{@"version": [CommonUtil getVersion], + }; + pro.pro = @{@"root": dic, + @"command": @"10001", }; - return pro; } @end diff --git a/Ash_AWord/ViewModels/Note/NoteCommentViewModel.m b/Ash_AWord/ViewModels/Note/NoteCommentViewModel.m index 166c298..3426218 100644 --- a/Ash_AWord/ViewModels/Note/NoteCommentViewModel.m +++ b/Ash_AWord/ViewModels/Note/NoteCommentViewModel.m @@ -66,13 +66,15 @@ +(PropertyEntity*)requireAddwithRecordId:(NSString *)recordId withContent:(NSString *)content { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_image/add_comment"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"record_id": recordId, - @"content": content, - }; + NSDictionary* dic = @{@"recordId": recordId, + @"content": content, + }; + pro.pro = @{@"root": dic, + @"command": @"10201", + }; return pro; } @end diff --git a/Ash_AWord/ViewModels/Note/NotePublishViewModel.m b/Ash_AWord/ViewModels/Note/NotePublishViewModel.m index f1e511b..0705144 100644 --- a/Ash_AWord/ViewModels/Note/NotePublishViewModel.m +++ b/Ash_AWord/ViewModels/Note/NotePublishViewModel.m @@ -19,10 +19,11 @@ file.name = @"img"; file.img = [NSArray arrayWithObject:image]; pro.pFile = file; - pro.reqURL = @"rs/text_image/add"; pro.responesOBJ = self.class; -// content = [content stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - pro.pro = @{@"content": content, + NSDictionary* dic = @{@"content": content, + }; + pro.pro = @{@"root": dic, + @"command": @"20001", }; return pro; } diff --git a/Ash_AWord/ViewModels/Note/NoteViewModel.h b/Ash_AWord/ViewModels/Note/NoteViewModel.h index 887e108..4292dae 100644 --- a/Ash_AWord/ViewModels/Note/NoteViewModel.h +++ b/Ash_AWord/ViewModels/Note/NoteViewModel.h @@ -7,10 +7,7 @@ // #import "BaseViewModel.h" -typedef enum { - Order_by_Time = 0, - Order_by_Good = 1, -}Order_by; + @interface Text_Image : MTLModel @property (nonatomic, strong)NSString* content; diff --git a/Ash_AWord/ViewModels/Note/NoteViewModel.m b/Ash_AWord/ViewModels/Note/NoteViewModel.m index e5e7bbe..5fdb157 100644 --- a/Ash_AWord/ViewModels/Note/NoteViewModel.m +++ b/Ash_AWord/ViewModels/Note/NoteViewModel.m @@ -61,79 +61,91 @@ +(PropertyEntity*)requireWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_image/load_public"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"order_by": [NSString stringWithFormat:@"%u",order_by], - @"page": [NSString stringWithFormat:@"%ld",(long)page], - @"page_size": [NSString stringWithFormat:@"%ld",(long)page_size], + + NSDictionary* dic = @{@"orderBy": [NSString stringWithFormat:@"%u",order_by], + @"page": [NSString stringWithFormat:@"%ld",(long)page], + @"pageSize": [NSString stringWithFormat:@"%ld",(long)page_size], + }; + + pro.pro = @{@"root": dic, + @"command": @"20004", }; + return pro; } +(PropertyEntity*)requireOhterWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size withOtherId:(NSString *)otherid { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_image/load_others"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"order_by": [NSString stringWithFormat:@"%u",order_by], - @"page": [NSString stringWithFormat:@"%ld",page], - @"page_size": [NSString stringWithFormat:@"%ld",page_size], - @"target_uid": otherid + NSDictionary* dic = @{@"orderBy": [NSString stringWithFormat:@"%u",order_by], + @"page": [NSString stringWithFormat:@"%ld",page], + @"pageSize": [NSString stringWithFormat:@"%ld",page_size], + @"targetUid": otherid + }; + pro.pro = @{@"root": dic, + @"command": @"20003", }; - return pro; } +(PropertyEntity*)requireMyWithOrder_by:(Order_by)order_by withPage:(NSInteger)page withPage_size:(NSInteger)page_size { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_image/load_my"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{@"order_by": [NSString stringWithFormat:@"%u",order_by], - @"page": [NSString stringWithFormat:@"%ld",page], - @"page_size": [NSString stringWithFormat:@"%ld",page_size], + NSDictionary* dic = @{@"orderBy": [NSString stringWithFormat:@"%u",order_by], + @"page": [NSString stringWithFormat:@"%ld",page], + @"pageSize": [NSString stringWithFormat:@"%ld",page_size], + }; + pro.pro = @{@"root": dic, + @"command": @"20002", }; - return pro; } +(PropertyEntity*)requirePraiseWithRecordId:(NSInteger)recordId { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_image/praise"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{ - @"record_id": [NSString stringWithFormat:@"%ld",recordId], - + NSDictionary* dic = @{ + @"recordId": [NSString stringWithFormat:@"%ld",recordId], + + }; + pro.pro = @{@"root": dic, + @"command": @"20005", }; - return pro; } +(PropertyEntity*)requireShareWithRecordId:(NSInteger)recordId { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_image/share"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{ - @"record_id": [NSString stringWithFormat:@"%ld",recordId], - + + NSDictionary* dic = @{ + @"recordId": [NSString stringWithFormat:@"%ld",recordId], + + }; + pro.pro = @{@"root": dic, + @"command": @"20007", }; - return pro; } +(PropertyEntity*)requireDelWithRecordId:(NSInteger)recordId { PropertyEntity *pro = [[PropertyEntity alloc] init]; - pro.requireType = HTTPRequestTypeWithGET; - pro.reqURL = @"rs/text_image/del"; + pro.requireType = HTTPRequestTypeWithPOSTDATA; pro.responesOBJ = self.class; - pro.pro = @{ - @"record_id": [NSString stringWithFormat:@"%ld",recordId], - + NSDictionary* dic = @{ + @"recordId": [NSString stringWithFormat:@"%ld",recordId], + + }; + pro.pro = @{@"root": dic, + @"command": @"20006", }; return pro; diff --git a/Ash_AWord/Views/Message/MessageTableViewCell.m b/Ash_AWord/Views/Message/MessageTableViewCell.m index 0f6dee0..e2cc6fb 100644 --- a/Ash_AWord/Views/Message/MessageTableViewCell.m +++ b/Ash_AWord/Views/Message/MessageTableViewCell.m @@ -12,6 +12,7 @@ #import "AudioPlayer.h" #import "AppDelegate.h" #import "MyMessageViewController.h" +#import "PersonalInfoViewController.h" @interface MessageTableViewCell() @end @implementation MessageTableViewCell @@ -267,12 +268,10 @@ } - (IBAction)avatarBtnClick:(id)sender { - if (![_text_voice.ownerId isEqualToString:[AWordUser sharedInstance].uid] ) { - MyMessageViewController* myNoteViewController = [[MyMessageViewController alloc] init]; - myNoteViewController.otherUserId = _text_voice.ownerId; - myNoteViewController.otherName = _text_voice.ownerName; - myNoteViewController.hidesBottomBarWhenPushed = YES; - [[AppDelegate visibleViewController].navigationController pushViewController:myNoteViewController animated:YES]; + if (![_text_voice.ownerId isEqualToString:[AWordUser sharedInstance].uid] ) { PersonalInfoViewController* personalInfoViewController = [[PersonalInfoViewController alloc] init]; + personalInfoViewController.hidesBottomBarWhenPushed = YES; + personalInfoViewController.otherUserId = _text_voice.ownerId; + [[AppDelegate visibleViewController].navigationController pushViewController:personalInfoViewController animated:YES]; } } - (IBAction)closeBtnClick:(id)sender { diff --git a/Ash_AWord/Views/Note/NoteTableViewCell.m b/Ash_AWord/Views/Note/NoteTableViewCell.m index 3d73e6a..9051f39 100644 --- a/Ash_AWord/Views/Note/NoteTableViewCell.m +++ b/Ash_AWord/Views/Note/NoteTableViewCell.m @@ -201,16 +201,11 @@ } - (IBAction)avatarBtnClick:(id)sender { - PersonalInfoViewController* personalInfoViewController = [[PersonalInfoViewController alloc] init]; - personalInfoViewController.hidesBottomBarWhenPushed = YES; - [[AppDelegate visibleViewController].navigationController pushViewController:personalInfoViewController animated:YES]; - return; - if (![_text_image.ownerId isEqualToString:[AWordUser sharedInstance].uid] ) { - MyNoteViewController* myNoteViewController = [[MyNoteViewController alloc] init]; - myNoteViewController.otherUserId = _text_image.ownerId; - myNoteViewController.otherName = _text_image.ownerName; - myNoteViewController.hidesBottomBarWhenPushed = YES; - [[AppDelegate visibleViewController].navigationController pushViewController:myNoteViewController animated:YES]; + + if (![_text_image.ownerId isEqualToString:[AWordUser sharedInstance].uid] ) { PersonalInfoViewController* personalInfoViewController = [[PersonalInfoViewController alloc] init]; + personalInfoViewController.hidesBottomBarWhenPushed = YES; + personalInfoViewController.otherUserId = _text_image.ownerId; + [[AppDelegate visibleViewController].navigationController pushViewController:personalInfoViewController animated:YES]; } } diff --git a/Ash_AWord/Views/User/PersonalTopView.h b/Ash_AWord/Views/User/PersonalTopView.h index 43b717e..f2bbcf5 100644 --- a/Ash_AWord/Views/User/PersonalTopView.h +++ b/Ash_AWord/Views/User/PersonalTopView.h @@ -7,8 +7,10 @@ // #import +typedef void (^IsSelectImage)(BOOL); @interface PersonalTopView : UIView +@property (strong, nonatomic)IsSelectImage isSelectImg; @property (weak, nonatomic) IBOutlet UILabel *nameLabel; @property (weak, nonatomic) IBOutlet UIButton *avatarBtn; - (IBAction)avatarBtnClick:(id)sender; diff --git a/Ash_AWord/Views/User/PersonalTopView.m b/Ash_AWord/Views/User/PersonalTopView.m index e3539f0..934e2a1 100644 --- a/Ash_AWord/Views/User/PersonalTopView.m +++ b/Ash_AWord/Views/User/PersonalTopView.m @@ -56,6 +56,9 @@ [UIView animateWithDuration:0.3 animations:^{ _selectView.frame = frame; }]; + if (_isSelectImg) { + _isSelectImg(NO); + } } - (IBAction)imageBtnClick:(id)sender { if (_isSelectImage == YES) { @@ -70,6 +73,9 @@ [UIView animateWithDuration:0.3 animations:^{ _selectView.frame = frame; }]; + if (_isSelectImg) { + _isSelectImg(YES); + } } - (IBAction)attentionBtnClick:(id)sender { } diff --git a/Ash_AWord/Views/User/PersonalTopView.xib b/Ash_AWord/Views/User/PersonalTopView.xib index ab0ed7c..d5c0aa1 100644 --- a/Ash_AWord/Views/User/PersonalTopView.xib +++ b/Ash_AWord/Views/User/PersonalTopView.xib @@ -7,12 +7,12 @@ - - + + - + @@ -188,6 +188,8 @@ + + @@ -195,7 +197,14 @@ + + + + + + + @@ -213,7 +222,7 @@ - +