SHARE
TWEET

Untitled

a guest Mar 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @interface UserController()
  2. {
  3.     dispatch_semaphore_t _sema_use_log;
  4. }
  5. @end
  6.  
  7. static UserController *_sguco = nil;
  8. @implementation UserController
  9.  
  10. +(UserController*)sigleton {
  11.     if(_sguco!=nil) { return _sguco; }
  12.    
  13.     static dispatch_once_t onceToken_sguco;
  14.     dispatch_once(&onceToken_sguco, ^{
  15.         _sguco = [[UserController alloc]init];
  16.     });
  17.    
  18.     while (_sguco == nil) {}
  19.     return _sguco;
  20. }
  21.  
  22. - (id) init {
  23.     self = [super init];
  24.     if(self) {
  25.         logMessage(@"[dev]", @"%s", __FUNCTION__);
  26.         __block NSString* ikeyUid = [NotNilString(self.userProfile[@"ikeyToken"]) copy];
  27.        
  28.         if([ikeyUid length]>10) {
  29.             logMessage(@"[dev]", @"%s Logined", __FUNCTION__);
  30.             [sysObj triggerUploadFCMToken];
  31.             [self startUserCtrlTimer];
  32.         }
  33.        
  34.         _sema_use_log = dispatch_semaphore_create(1);
  35.     }
  36.     return self;
  37. }
  38.  
  39.  
  40.  
  41. #define kLoginInfoInputUserId       @"11912e7e353469f9eebd953f2"
  42. #define kLoginInfoInputPasswd       @"11912e7e353469f9eebd953f2aac468f"
  43. #define kLoginInfoInputSocialType       @"061k0ea85vb7i0fc3n3312ed45f9ee347e429k"
  44.  
  45. - (void) userLoginWithAccountId:(NSString*)accId
  46.                          passwd:(NSString*)passwd
  47.                      socialType:(NSString*)socialType //N:None; FB:facebook; G:GSI
  48.                      completion:(GeneralCallbackBlock)completion
  49. {
  50.     GenenalCallbackGen(completion);
  51.    
  52.     [VIGP2API objectForAllLogInWithTag:0
  53.                            ikeyAccount:accId
  54.                              phoneType:@"I" phoneBrand:@"iPhone"
  55.                               deviceID:[[sysObj DeviceId]lowercaseString]
  56.                       deviceCreateTime:[[sysObj DeviceCreateTime]copy]
  57.                         phoneOSVersion:[[sysObj systemVersion] copy]
  58.                               password:passwd
  59.                             completion:^(id selfObj, NSInteger tag, id data, NSError *error)
  60.      {
  61.          NSInteger tokenLen = (error==nil)?[[data valueForKey:@"ikeyToken"] length]:0;
  62.          if(error==nil &&
  63.             data != nil &&
  64.             [data isKindOfClass:[NSDictionary class]] &&
  65.             [data count]>2 &&
  66.             APIerrCde00Check(data) &&
  67.             tokenLen == 36)
  68.          {
  69.              [UDObj setLoginInfoResult:[data copy]];
  70.              [sysObj triggerUploadFCMToken];
  71.  
  72.              [self startUserCtrlTimer];
  73.          }
  74.          GenenalCallbackCall(data, error);
  75.      }];
  76. }
  77.  
  78. ...
  79.  
  80. @end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top