Skip to content

Instantly share code, notes, and snippets.

@Calvin-Huang Calvin-Huang/API.m
Created Mar 14, 2019

Embed
What would you like to do?
@interface VIGP2API()
{
AnGooGeneralCallbackBlock _callBack;
}
@property AnGooGeneralCallbackBlock PushMsgCallbackBlock;
@end
static TIAESCipher *_sgAesEngineObj = nil;
@implementation VIGP2API
@synthesize PushMsgCallbackBlock = _callBack;
+ (VIGP2API*)objectForV2AuthLoginWithTag:(NSInteger)tag
account:(NSString*)account
passwd:(NSString*)passwd
deviceID:(NSString*)deviceID
deviceCreateTime:(NSNumber*)deviceCreateTime
deviceType:(NSString*)deviceType
deviceBrand:(NSString*)deviceBrand
deviceOsVersion:(NSString*)deviceOsVersion
completion:(AnGooGeneralCallbackBlock)block
{
NSDictionary *args = @{@"account":NotNilString(account),
@"password":EncryString(NotNilString(passwd)),
@"deviceId":NotNilString(deviceID),
@"deviceCreateTime":deviceCreateTime,
@"deviceType":NotNilString(deviceType),
@"deviceBrand":NotNilString(deviceBrand),
@"deviceOsVersion":NotNilString(deviceOsVersion)};
VIGP2API *retObj = [[VIGP2API alloc]initWithArgs:args
tag:tag
trustHosts:TruckHosts
completion:^(id selfObj, NSInteger tag, id data, NSError *error)
{
logExceptionWithFunc(error);
logf(data);
VIGP2API *WsApiObj = (VIGP2API*)selfObj;
AnGooGeneralCallbackBlock aBlock = WsApiObj.PushMsgCallbackBlock;
if(aBlock != nil) {
aBlock(selfObj, tag, data, error);
}
}];
[retObj setPushMsgCallbackBlock:block];
NSURLRequest *urlR = [retObj genURLRequestWithUrlString:[NSString stringWithFormat:@"%@/auth/login", GetLuxgenVIGP2Url] args:args];
[retObj excuteURLRequest:urlR timeoutInSeconds:TimeoutSec];
return retObj;
}
...
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.