|
|
@@ -120,6 +120,7 @@
|
|
|
}
|
|
|
|
|
|
if (_chkIdSave.checked) {
|
|
|
+ NSLog(@"Save ID : %@", [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID]);
|
|
|
_txtEmail.text = [[JDFacade facade] objectForKeyFromKeychain:USDEF_SESSION_LOGIN_ID];
|
|
|
}
|
|
|
|
|
|
@@ -135,7 +136,7 @@
|
|
|
@"message_type": @"auth"};
|
|
|
|
|
|
[self sendDataToSocket:param];
|
|
|
-
|
|
|
+ [[JDFacade facade] loadIndicator:YES allowUserInteraction:NO];
|
|
|
// [[RequestHandler handler] sendAsyncPostRequestAPIPath:API_POST_SIGN_IN parameters:param modelClass:[LoginModel class] completion:^(id responseObject) {
|
|
|
// if (!responseObject) {//응답결과가 잘못되었거나 없을 경우,
|
|
|
// return;
|
|
|
@@ -245,10 +246,13 @@
|
|
|
}
|
|
|
|
|
|
[RequestHandler handler].authorization = loginInfo.authorization;
|
|
|
-// TODO : 자동로그인 / 아이디 저장 관련 작업하기
|
|
|
+
|
|
|
+
|
|
|
+ [[JDFacade facade] storeObjectToUserDefaults:@(_chkAutoLogin.checked) forKey:USDEF_APP_AUTO_LOGIN];
|
|
|
+ [[JDFacade facade] storeObjectToUserDefaults:@(_chkIdSave.checked) forKey:USDEF_APP_SAVE_ID];
|
|
|
if (_chkAutoLogin.checked) {//자동로그인 설정 시, 인증 토큰 저장
|
|
|
- [[JDFacade facade] storeObjectToKeychain:@(_chkAutoLogin.checked) forKey:USDEF_APP_AUTO_LOGIN];
|
|
|
- [[JDFacade facade] storeObjectToKeychain:[JDFacade facade].tmpEmailId forKey:USDEF_SESSION_LOGIN_PWD];
|
|
|
+ [[JDFacade facade] storeObjectToKeychain:[_txtEmail.text trim] forKey:USDEF_SESSION_LOGIN_ID];
|
|
|
+ [[JDFacade facade] storeObjectToKeychain:[_txtPasswd.text trim] forKey:USDEF_SESSION_LOGIN_PWD];
|
|
|
} else {
|
|
|
[[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_AUTOTOKEN];
|
|
|
[[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_PWD];
|
|
|
@@ -258,8 +262,8 @@
|
|
|
}
|
|
|
|
|
|
if (_chkIdSave.checked) {
|
|
|
- [[JDFacade facade] storeObjectToKeychain:@(_chkIdSave.checked) forKey:USDEF_APP_SAVE_ID];
|
|
|
-// [[JDFacade facade] storeObjectToUserDefaultsuser:[_txtEmail.text trim] forKey:USDEF_SESSION_LOGIN_ID];
|
|
|
+
|
|
|
+ [[JDFacade facade] storeObjectToKeychain:[_txtEmail.text trim] forKey:USDEF_SESSION_LOGIN_ID];
|
|
|
} else {
|
|
|
if (!_chkAutoLogin.checked) {
|
|
|
[[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
|
|
|
@@ -336,22 +340,26 @@
|
|
|
|
|
|
- (void)requestLogout {
|
|
|
//parameters
|
|
|
- NSString *path = [NSString stringWithFormat:API_POST_SIGN_OUT];
|
|
|
-
|
|
|
- [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:nil modelClass:[JDJSONModel class] completion:^(id responseObject) {
|
|
|
- [self actionAfterLogout];
|
|
|
-
|
|
|
- } failure:^(id errorObject) {
|
|
|
- JDErrorModel *error = (JDErrorModel *)errorObject;
|
|
|
- [[JDFacade facade] alert:error.errorMessage];
|
|
|
- }];
|
|
|
+ [self actionAfterLogout];
|
|
|
+// NSString *path = [NSString stringWithFormat:API_POST_SIGN_OUT];
|
|
|
+//
|
|
|
+// [[RequestHandler handler] sendAsyncGetRequestAPIPath:path parameters:nil modelClass:[JDJSONModel class] completion:^(id responseObject) {
|
|
|
+// [self actionAfterLogout];
|
|
|
+//
|
|
|
+// } failure:^(id errorObject) {
|
|
|
+// JDErrorModel *error = (JDErrorModel *)errorObject;
|
|
|
+// [[JDFacade facade] alert:error.errorMessage];
|
|
|
+// }];
|
|
|
}
|
|
|
|
|
|
- (void)actionAfterLogout {
|
|
|
|
|
|
//자동 로그인 설정 - 취소
|
|
|
[[JDFacade facade] storeObjectToUserDefaults:@(NO) forKey:USDEF_APP_AUTO_LOGIN];
|
|
|
- [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_AUTOTOKEN];
|
|
|
+ [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_PWD];
|
|
|
+ if (![[[JDFacade facade] objectForKeyFromUserDefaults:USDEF_APP_SAVE_ID] boolValue]) {
|
|
|
+ [[JDFacade facade] removeObjectAtKeychain:USDEF_SESSION_LOGIN_ID];
|
|
|
+ }
|
|
|
|
|
|
[JDFacade facade].loginUser = nil;
|
|
|
|
|
|
@@ -439,6 +447,7 @@
|
|
|
{
|
|
|
CASE (@"auth")
|
|
|
{
|
|
|
+ [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
|
|
|
if (result.isSuccess) {
|
|
|
LoginModel *loginInfo = [[LoginModel alloc] initWithDictionary:info error:nil];;
|
|
|
if (loginInfo) {//API 성공 ,함
|
|
|
@@ -460,6 +469,12 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+- (void) socketDidFailWithError:(NSError *)error {
|
|
|
+ [[JDFacade facade] loadIndicator:NO allowUserInteraction:YES];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
#pragma mark - MemoryWarning
|
|
|
- (void)didReceiveMemoryWarning
|
|
|
{
|