1
This commit is contained in:
@@ -14,7 +14,27 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
typedef void(^KBLoginCompletion)(BOOL success, NSError * _Nullable error);
|
||||
typedef void(^KBRegisterCompletion)(BOOL success, NSError * _Nullable error);
|
||||
typedef void(^KBVerifyMailCompletion)(BOOL success, NSError * _Nullable error);
|
||||
typedef void(^KBAppUpdateCompletion)(NSDictionary * _Nullable data, NSError * _Nullable error);
|
||||
|
||||
@class KBAppUpdateInfo;
|
||||
@class KBAppUpdateResponse;
|
||||
typedef void(^KBAppUpdateCompletion)(KBAppUpdateInfo * _Nullable info, NSError * _Nullable error);
|
||||
|
||||
@interface KBAppUpdateInfo : NSObject
|
||||
@property (nonatomic, assign) NSInteger minSupportedCode;
|
||||
@property (nonatomic, copy, nullable) NSString *latestVersionName;
|
||||
@property (nonatomic, copy, nullable) NSString *downloadUrl;
|
||||
@property (nonatomic, assign) BOOL needUpdate;
|
||||
@property (nonatomic, assign) NSInteger latestVersionCode;
|
||||
@property (nonatomic, assign) BOOL forceUpdate;
|
||||
@property (nonatomic, copy, nullable) NSString *releaseNotes;
|
||||
@property (nonatomic, copy, nullable) NSString *storeUrl;
|
||||
@end
|
||||
|
||||
@interface KBAppUpdateResponse : NSObject
|
||||
@property (nonatomic, assign) NSInteger code;
|
||||
@property (nonatomic, copy, nullable) NSString *message;
|
||||
@property (nonatomic, strong, nullable) KBAppUpdateInfo *data;
|
||||
@end
|
||||
|
||||
@interface KBLoginVM : NSObject
|
||||
|
||||
|
||||
@@ -15,6 +15,12 @@
|
||||
@property (nonatomic, strong) KBMyVM *myVM;
|
||||
@end
|
||||
|
||||
@implementation KBAppUpdateInfo
|
||||
@end
|
||||
|
||||
@implementation KBAppUpdateResponse
|
||||
@end
|
||||
|
||||
@implementation KBLoginVM
|
||||
|
||||
+ (instancetype)shared {
|
||||
@@ -169,7 +175,10 @@
|
||||
NSDictionary *params = [self kb_appUpdateParams];
|
||||
[[KBNetworkManager shared] POST:API_APP_CHECK_UPDATE jsonBody:params headers:nil autoShowBusinessError:NO completion:^(NSDictionary * _Nullable jsonOrData, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
||||
if (error) { if (completion) completion(nil, error); return; }
|
||||
if (completion) completion(jsonOrData, nil);
|
||||
if (![jsonOrData isKindOfClass:NSDictionary.class]) { if (completion) completion(nil, nil); return; }
|
||||
KBAppUpdateResponse *resp = [KBAppUpdateResponse mj_objectWithKeyValues:jsonOrData];
|
||||
if (resp.code != 0) { if (completion) completion(nil, nil); return; }
|
||||
if (completion) completion(resp.data, nil);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user