Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remember user signed out also from Accounts page

  • Loading branch information...
commit fd65bd552f19a0f92836b1e407db2b00eb1ca520 1 parent 8fa195d
@devrandom authored
View
11 src/info/guardianproject/otr/app/im/app/AccountActivity.java
@@ -303,11 +303,6 @@ public void onClick(View v) {
if (isSignedIn)
{
- //if you are signing out, then we will deactive "auto" sign in
- ContentValues values = new ContentValues();
- values.put(Imps.Account.KEEP_SIGNED_IN, false ? 1 : 0);
- getContentResolver().update(mAccountUri, values, null, null);
-
signOut();
isSignedIn = false;
}
@@ -614,7 +609,11 @@ void signOutUsingActivity () {
void signOut ()
{
-
+ //if you are signing out, then we will deactive "auto" sign in
+ ContentValues values = new ContentValues();
+ values.put(Imps.Account.KEEP_SIGNED_IN, false ? 1 : 0);
+ getContentResolver().update(mAccountUri, values, null, null);
+
mApp = ImApp.getApplication(AccountActivity.this);
mApp.callWhenServiceConnected(mHandler, new Runnable() {
View
29 src/info/guardianproject/otr/app/im/app/LandingPage.java
@@ -26,6 +26,7 @@
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.ContentUris;
+import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -230,20 +231,32 @@ public void onClick(DialogInterface dialog, int whichButton) {
.show();
}
- private void signOut(long accountId) {
+ private void signOut(final long accountId) {
if (accountId == 0) {
Log.w(TAG, "signOut: account id is 0, bail");
return;
}
- try {
- IImConnection conn = mApp.getConnectionByAccount(accountId);
- if (conn != null) {
- conn.logout();
+ // Remember that the user signed out and do not auto sign in until they
+ // explicitly do so
+ Uri mAccountUri = ContentUris.withAppendedId(Imps.Account.CONTENT_URI, accountId);
+ ContentValues values = new ContentValues();
+ values.put(Imps.Account.KEEP_SIGNED_IN, false);
+ getContentResolver().update(mAccountUri, values, null, null);
+
+ // Sign out
+ mApp.callWhenServiceConnected(mHandler, new Runnable() {
+ public void run() {
+ try {
+ IImConnection conn = mApp.getConnectionByAccount(accountId);
+ if (conn != null) {
+ conn.logout();
+ }
+ } catch (RemoteException ex) {
+ Log.e(TAG, "signOut failed", ex);
+ }
}
- } catch (RemoteException ex) {
- Log.e(TAG, "signOut failed", ex);
- }
+ });
}
@Override
Please sign in to comment.
Something went wrong with that request. Please try again.