Commit 9a7ad333 by Kazuyuki Hida

Merge branch 'features/1.4.500_54062_logout' into 'features/1.4.500'

同意せずにログイン画面に戻った際、事業者入力欄が表示されない

See merge request !319
parents a314d3e0 f9389470
......@@ -57,6 +57,13 @@ public class AcmsDao extends AbstractDao {
insert("insert into m_acms (url_path, acms_address,download_server_address, websocket_server_http_url, websocket_server_ws_url, schedulelist_last_fetch_date, contentversion_last_fetch_date) values (?,?,?,?,?,?,?)", acmsDto.getInsertValues());
}
/**
* ログイン情報の削除
*/
public void deleteAcms() {
delete("m_acms", "", null);
}
public boolean isTodayLastAnnounceChangePasswordDate() {
int ret = rawQueryGetInt("select COUNT(url_path) AS last_count from m_acms where last_announce_change_password_date=DATE('NOW','LOCALTIME')", null);
return ret > 0;
......
......@@ -351,7 +351,15 @@ public class ContractLogic extends AbstractLogic {
cache.setUrlPath(urlPath);
}
}
/**
* ログイン情報のアカウントパスを削除する
*/
public void deleteUrlPath() {
acmsDao.deleteAcms();
cache.setUrlPath(null);
}
public static boolean getBooleanValue(String value) {
return True.equals(value);
}
......
......@@ -83,7 +83,7 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
AlertDialog dialog = AgreementToTermsHelper.getCurrentDialog();
if (dialog != null && dialog.isShowing()) {
dialog.dismiss();
LogoutHelper.logout(this, false);
LogoutHelper.logout(this, false, false);
}
}
......@@ -118,8 +118,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
// 同意したら初期化
doShowMainActivity();
} else {
// 規約に同意しなかったので、ログアウト
LogoutHelper.logout(ABVNoAuthenticatedActivity.this);
// 規約に同意しなかったので、ログアウト(ログイン直後なので、ログイン情報をクリア)
LogoutHelper.logout(ABVNoAuthenticatedActivity.this, true, true);
}
}
......@@ -466,8 +466,8 @@ public abstract class ABVNoAuthenticatedActivity extends ABVActivity {
// 同意したら初期化
doMoveToHome();
} else {
// 規約に同意しなかったので、ログアウト
LogoutHelper.logout(ABVNoAuthenticatedActivity.this);
// 規約に同意しなかったので、ログアウト(ログイン済みなので、ログイン情報を維持)
LogoutHelper.logout(ABVNoAuthenticatedActivity.this, false, true);
}
}
......
......@@ -6,8 +6,11 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.widget.Toast;
import jp.agentec.abook.abv.bl.acms.type.LoginMode;
import jp.agentec.abook.abv.bl.common.ABVEnvironment;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.UserAuthenticateLogic;
import jp.agentec.abook.abv.launcher.android.R;
import jp.agentec.abook.abv.ui.common.appinfo.AppDefType;
......@@ -27,16 +30,17 @@ public class LogoutHelper {
* @param activity 呼び出し元アクティビティ
*/
public static void logout(Activity activity) {
logout(activity, true);
logout(activity, false, true);
}
/**
* ログアウトして、ログイン画面に遷移する
*
* @param activity 呼び出し元アクティビティ
* @param removeLoginInfo ログイン情報をクリアする場合はtrue
* @param launchLogin trueならLoginActivityをstart
*/
public static void logout(Activity activity, boolean launchLogin) {
public static void logout(Activity activity, boolean removeLoginInfo, boolean launchLogin) {
try {
// modify by Jang 2013.06.20
UserAuthenticateLogic user = AbstractLogic.getLogic(UserAuthenticateLogic.class);
......@@ -60,6 +64,17 @@ public class LogoutHelper {
SharedPreferences sharedPreferences = activity.getSharedPreferences(AppDefType.PrefName.USER_PREFERENCE, Context.MODE_PRIVATE);
sharedPreferences.edit().remove(AppDefType.UserPrefKey.GUEST_LOGIN).apply();
boolean isLoginModePath = activity.getResources().getInteger(R.integer.login_mode) == LoginMode.PATH_ID_PASS;
boolean isLoginModeSite = activity.getResources().getInteger(R.integer.login_mode) == LoginMode.SITE_PATH_ID_PASS;
if (removeLoginInfo && (isLoginModePath || isLoginModeSite)) {
ContractLogic logic = AbstractLogic.getLogic(ContractLogic.class);
logic.deleteUrlPath();
}
if (removeLoginInfo && isLoginModeSite) {
ABVEnvironment.getInstance().acmsAddress = null;
}
if (launchLogin) {
Intent intent = new Intent(activity, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment