Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6d70f0a0 authored by Mark Harman's avatar Mark Harman
Browse files

Avoid showing what's new dialog again when restoring from saved settings.

parent 1d6766d7
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
package net.sourceforge.opencamera;

import android.content.SharedPreferences;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.preference.PreferenceManager;
import android.util.Log;
@@ -128,6 +130,20 @@ public class SettingsManager {
				skip(parser);
			}

			// even though we're restoring from settings, we don't want the first time or what's new dialog showing up again!
			// important to do this after reading from xml, so that the keys aren't overwritten
			editor.putBoolean(PreferenceKeys.FirstTimePreferenceKey, true);
			try {
				PackageInfo pInfo = main_activity.getPackageManager().getPackageInfo(main_activity.getPackageName(), 0);
				int version_code = pInfo.versionCode;
				editor.putInt(PreferenceKeys.LatestVersionPreferenceKey, version_code);
			}
			catch(PackageManager.NameNotFoundException e) {
				if (MyDebug.LOG)
					Log.d(TAG, "NameNotFoundException exception trying to get version number");
				e.printStackTrace();
			}

			editor.apply();
			if( !main_activity.is_test ) {
				// restarting seems to cause problems for test code (e.g., see testSettingsSaveLoad - even if that test is fine, it risks affecting subsequent tests)