private void checkAutoLogin() { // 2013-02-20 자동로그인은 인트로에서 처리하도록 변경 // 더이상 자동으로 호출되지 않음 if (prefModel.isAutoLogin()) { // 씨네폭스 자동로그인은 여기로 안 넘어옴 if (EXTRA_AUTO_LOGIN_FACEBOOK.equals(prefModel.getAutoLoginAction())) { startActivityForResult( new Intent(this, FacebookLoginActivity.class), REQUEST_FACEBOOK_LOGIN); } else if (EXTRA_AUTO_LOGIN_ME2DAY.equals(prefModel.getAutoLoginAction())) { me2Model = new Me2DayModel(this); me2Model.setAuthCallback(this); me2Model.setUserInfoCallback(this); me2Model.loadMe2UserInfo(prefModel.getMe2LoginId()); } else if (EXTRA_AUTO_LOGIN_TWITTER.equals(prefModel.getAutoLoginAction())) { twModel = new TwitterModel(this); twModel.setAuthCallback(this); twModel.setUserInfoCallback(this); twModel.loadTwitUserInfo(prefModel.getTwitterAccessToken()); } else if (EXTRA_AUTO_LOGIN_YOZM.equals(prefModel.getAutoLoginAction())) { yozmModel = new YozmModel(this); yozmModel.setAuthCallback(this); yozmModel.setUserInfoCallback(this); yozmModel.loadYozmUserInfo(prefModel.getYozmAccessToken()); } } }
@Override public void onClickYozmLogin(SelectLoginMethodView view) { // TODO Auto-generated method stub yozmModel = new YozmModel(this); yozmModel.setAuthCallback(this); yozmModel.setUserInfoCallback(this); AccessToken token = prefModel.getYozmAccessToken(); if (token != null) yozmModel.loadYozmUserInfo(token); else yozmModel.loadYozmBaseInfo(); }
@Override public void onYozmAuthLoaded(YozmModel model, OAuthConsumer consumer) { // TODO Auto-generated method stub view.dismissLoading(); AccessToken token = new AccessToken(consumer.getToken(), consumer.getTokenSecret()); prefModel.setYozmAccessToken(token); yozmModel.loadYozmUserInfo(consumer); }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); if (resultCode == Activity.RESULT_OK) { switch (requestCode) { case REQUEST_FACEBOOK_LOGIN: view.showLoading(); fbModel = new FacebookModel(this); fbModel.loadFBUserInfo(Session.getActiveSession(), this); break; case REQUEST_TWITTER_LOGIN: twModel.loadTwitAccessToken(data.getStringExtra(EXTRA_URL)); break; case REQUEST_ME2DAY_LOGIN: me2Model.loadMe2AuthInfo(); break; case REQUEST_YOZM_LOGIN: yozmModel.loadYozmAuthInfo(data.getStringExtra(EXTRA_URL)); break; case REQUEST_JOIN_ACTION: checkAutoLogin(); break; } } else if (resultCode == Activity.RESULT_CANCELED) { switch (requestCode) { case REQUEST_FACEBOOK_LOGIN: view.showError(data.getStringExtra(EXTRA_MSG)); break; case REQUEST_TWITTER_LOGIN: break; case REQUEST_ME2DAY_LOGIN: break; case REQUEST_YOZM_LOGIN: break; case REQUEST_JOIN_ACTION: break; } } }