Release 1.19.0
This commit is contained in:
parent
87fc426cef
commit
79111776d0
|
@ -7,7 +7,7 @@ android {
|
|||
applicationId "fr.gouv.etalab.mastodon"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
versionCode 173
|
||||
versionCode 174
|
||||
versionName "1.19.0"
|
||||
}
|
||||
flavorDimensions "default"
|
||||
|
|
|
@ -1702,6 +1702,9 @@ public class TootActivity extends BaseActivity implements OnRetrieveSearcAccount
|
|||
}
|
||||
}
|
||||
}else {
|
||||
Intent intent = new Intent(getApplicationContext(), MainActivity.class);
|
||||
intent.putExtra(INTENT_ACTION, HOME_TIMELINE_INTENT);
|
||||
startActivity(intent);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
|
|
@ -1213,25 +1213,35 @@ public class Helper {
|
|||
public static void changeUser(Activity activity, String userID, boolean checkItem) {
|
||||
|
||||
|
||||
final NavigationView navigationView = activity.findViewById(R.id.nav_view);
|
||||
navigationView.getMenu().clear();
|
||||
MainActivity.lastNotificationId = null;
|
||||
MainActivity.lastHomeId = null;
|
||||
navigationView.inflateMenu(R.menu.activity_main_drawer);
|
||||
SQLiteDatabase db = Sqlite.getInstance(activity, Sqlite.DB_NAME, null, Sqlite.DB_VERSION).open();
|
||||
Account account = new AccountDAO(activity,db).getAccountByID(userID);
|
||||
//Can happen when an account has been deleted and there is a click on an old notification
|
||||
if( account == null)
|
||||
return;
|
||||
//Locked account can see follow request
|
||||
if (account.isLocked()) {
|
||||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(true);
|
||||
} else {
|
||||
navigationView.getMenu().findItem(R.id.nav_follow_request).setVisible(false);
|
||||
}
|
||||
SharedPreferences sharedpreferences = activity.getSharedPreferences(Helper.APP_PREFS, Context.MODE_PRIVATE);
|
||||
String token = sharedpreferences.getString(Helper.PREF_KEY_OAUTH_TOKEN, null);
|
||||
if( account.getToken().equals(token))
|
||||
return;
|
||||
MainActivity.lastNotificationId = null;
|
||||
MainActivity.lastHomeId = null;
|
||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||
editor.putString(Helper.PREF_KEY_OAUTH_TOKEN, account.getToken());
|
||||
editor.putString(Helper.PREF_KEY_ID, account.getId());
|
||||
editor.putString(Helper.PREF_INSTANCE, account.getInstance().trim());
|
||||
editor.apply();
|
||||
Intent intent = activity.getIntent();
|
||||
activity.finish();
|
||||
activity.startActivity(intent);
|
||||
activity.recreate();
|
||||
if( checkItem ) {
|
||||
Intent intent = new Intent(activity, MainActivity.class);
|
||||
intent.putExtra(INTENT_ACTION, CHANGE_USER_INTENT);
|
||||
activity.startActivity(intent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue