Fix issue #52 - Clicking on push notifications open notification timeline with the correct account

This commit is contained in:
Thomas 2022-05-15 18:35:09 +02:00
parent 73b7662f45
commit 967046607a
2 changed files with 10 additions and 1 deletions

View file

@ -198,12 +198,20 @@ public abstract class BaseMainActivity extends BaseActivity implements NetworkSt
editor.putString(PREF_USER_TOKEN, account.token);
editor.commit();
Intent mainActivity = new Intent(this, MainActivity.class);
mainActivity.putExtra(Helper.INTENT_ACTION, Helper.OPEN_NOTIFICATION);
startActivity(mainActivity);
intent.removeExtra(Helper.INTENT_ACTION);
finish();
} catch (DBException e) {
e.printStackTrace();
}
} else if (extras.getInt(Helper.INTENT_ACTION) == Helper.OPEN_NOTIFICATION) {
final Handler handler = new Handler();
handler.postDelayed(() -> {
binding.bottomNavView.getMenu().getItem(3).setChecked(true);
binding.viewPager.setCurrentItem(3);
}, 1000);
intent.removeExtra(Helper.INTENT_ACTION);
}
}

View file

@ -242,6 +242,7 @@ public class Helper {
public static final int NOTIFICATION_INTENT = 1;
public static final int OPEN_NOTIFICATION = 2;
public static final String INTENT_TARGETED_ACCOUNT = "INTENT_TARGETED_ACCOUNT";
public static final String TEMP_MEDIA_DIRECTORY = "TEMP_MEDIA_DIRECTORY";