Skip to content

Commit

Permalink
change(android): use higher-level context for Toasts
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Horton committed Jan 23, 2025
1 parent e97308a commit 7ffa001
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -558,14 +558,15 @@ void tryFinalizeUpdate() {
// TODO: make it smoother. Documented as #11097.
KMManager.clearKeyboardCache();

Context appContext = currentContext.getApplicationContext();
if (failedUpdateCount > 0) {
BaseActivity.makeToast(currentContext, R.string.update_failed, Toast.LENGTH_SHORT);
BaseActivity.makeToast(appContext, R.string.update_failed, Toast.LENGTH_SHORT);
lastUpdateCheck = Calendar.getInstance();
updateFailed = true;
checkingUpdates = false;
} else {
lastUpdateCheck = Calendar.getInstance();
SharedPreferences prefs = currentContext.getSharedPreferences(currentContext.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
SharedPreferences prefs = appContext.getSharedPreferences(currentContext.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putLong(PREF_KEY_LAST_UPDATE_CHECK, lastUpdateCheck.getTime().getTime());
editor.commit();
Expand Down

0 comments on commit 7ffa001

Please sign in to comment.