Skip to content

Instantly share code, notes, and snippets.

@Calvin-Huang
Created March 14, 2019 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Calvin-Huang/5090bb729bc6663b06bdc3984624188e to your computer and use it in GitHub Desktop.
Save Calvin-Huang/5090bb729bc6663b06bdc3984624188e to your computer and use it in GitHub Desktop.
@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