diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index de0c11d55b..182e115713 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -278,11 +278,6 @@
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"
android:launchMode="singleTask"
android:theme="@style/NoAnimation.Theme.AppCompat.Light.DarkActionBar" />
-
pages;
- private @StringRes int notificationTitle;
- private @StringRes int notificationText;
- private @StringRes int notificationBigText;
- private @Nullable Class nextIntent;
- private boolean handlesNavigation;
-
- ExperienceUpgrade(int version,
- @NonNull List pages,
- @StringRes int notificationTitle,
- @StringRes int notificationText,
- @StringRes int notificationBigText,
- @Nullable Class nextIntent,
- boolean handlesNavigation)
- {
- this.version = version;
- this.pages = pages;
- this.notificationTitle = notificationTitle;
- this.notificationText = notificationText;
- this.notificationBigText = notificationBigText;
- this.nextIntent = nextIntent;
- this.handlesNavigation = handlesNavigation;
- }
-
- ExperienceUpgrade(int version,
- @NonNull IntroPage page,
- @StringRes int notificationTitle,
- @StringRes int notificationText,
- @StringRes int notificationBigText,
- @Nullable Class nextIntent,
- boolean handlesNavigation)
- {
- this(version, Collections.singletonList(page), notificationTitle, notificationText, notificationBigText, nextIntent, handlesNavigation);
- }
-
- public int getVersion() {
- return version;
- }
-
- public List getPages() {
- return pages;
- }
-
- public IntroPage getPage(int i) {
- return pages.get(i);
- }
-
- public int getNotificationTitle() {
- return notificationTitle;
- }
-
- public int getNotificationText() {
- return notificationText;
- }
-
- public int getNotificationBigText() {
- return notificationBigText;
- }
-
- public boolean handlesNavigation() {
- return handlesNavigation;
- }
- }
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- final Optional upgrade = getExperienceUpgrade(this);
- if (!upgrade.isPresent()) {
- onContinue(upgrade);
- return;
- }
-
- setContentView(R.layout.experience_upgrade_activity);
- final ViewPager pager = ViewUtil.findById(this, R.id.pager);
- final FloatingActionButton fab = ViewUtil.findById(this, R.id.fab);
-
- pager.setAdapter(new IntroPagerAdapter(getSupportFragmentManager(), upgrade.get().getPages()));
-
- if (upgrade.get().handlesNavigation()) {
- fab.setVisibility(View.GONE);
- } else {
- fab.setVisibility(View.VISIBLE);
- fab.setOnClickListener(v -> onContinue(upgrade));
- }
-
- getWindow().setBackgroundDrawable(new ColorDrawable(upgrade.get().getPage(0).backgroundColor));
- ServiceUtil.getNotificationManager(this).cancel(NOTIFICATION_ID);
- }
-
- private void onContinue(Optional seenUpgrade) {
- ServiceUtil.getNotificationManager(this).cancel(NOTIFICATION_ID);
- int latestVersion = seenUpgrade.isPresent() ? seenUpgrade.get().getVersion()
- : Util.getCanonicalVersionCode();
- TextSecurePreferences.setLastExperienceVersionCode(this, latestVersion);
- if (seenUpgrade.isPresent() && seenUpgrade.get().nextIntent != null) {
- Intent intent = new Intent(this, seenUpgrade.get().nextIntent);
- Intent nextIntent = new Intent(this, HomeActivity.class);
- intent.putExtra("next_intent", nextIntent);
- startActivity(intent);
- } else {
- startActivity(getIntent().getParcelableExtra("next_intent"));
- }
-
- finish();
- }
-
- public static boolean isUpdate(Context context) {
- return getExperienceUpgrade(context).isPresent();
- }
-
- public static Optional getExperienceUpgrade(Context context) {
- final int currentVersionCode = Util.getCanonicalVersionCode();
- final int lastSeenVersion = TextSecurePreferences.getLastExperienceVersionCode(context);
- Log.i(TAG, "getExperienceUpgrade(" + lastSeenVersion + ")");
-
- if (lastSeenVersion >= currentVersionCode) {
- TextSecurePreferences.setLastExperienceVersionCode(context, currentVersionCode);
- return Optional.absent();
- }
-
- Optional eligibleUpgrade = Optional.absent();
- for (ExperienceUpgrade upgrade : ExperienceUpgrade.values()) {
- if (lastSeenVersion < upgrade.getVersion()) eligibleUpgrade = Optional.of(upgrade);
- }
-
- return eligibleUpgrade;
- }
-
- @Override
- public void onTypingIndicatorsFinished() {
- onContinue(Optional.of(ExperienceUpgrade.TYPING_INDICATORS));
- }
-
- @Override
- public void onLinkPreviewsFinished() {
- onContinue(Optional.of(ExperienceUpgrade.LINK_PREVIEWS));
- }
-
- private final class OnPageChangeListener implements ViewPager.OnPageChangeListener {
- private final ArgbEvaluator evaluator = new ArgbEvaluator();
- private final ExperienceUpgrade upgrade;
-
- public OnPageChangeListener(ExperienceUpgrade upgrade) {
- this.upgrade = upgrade;
- }
-
- @Override
- public void onPageSelected(int position) {}
-
- @Override
- public void onPageScrollStateChanged(int state) {}
-
- @Override
- public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- final int nextPosition = (position + 1) % upgrade.getPages().size();
-
- final int color = (Integer)evaluator.evaluate(positionOffset,
- upgrade.getPage(position).backgroundColor,
- upgrade.getPage(nextPosition).backgroundColor);
- getWindow().setBackgroundDrawable(new ColorDrawable(color));
- }
- }
-
- public static class AppUpgradeReceiver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (Intent.ACTION_MY_PACKAGE_REPLACED.equals(intent.getAction()) &&
- intent.getData().getSchemeSpecificPart().equals(context.getPackageName()))
- {
- if (TextSecurePreferences.getLastExperienceVersionCode(context) < 339 &&
- !TextSecurePreferences.isPasswordDisabled(context))
- {
- Notification notification = new NotificationCompat.Builder(context, NotificationChannels.OTHER)
- .setSmallIcon(R.drawable.ic_notification)
- .setColor(context.getResources().getColor(R.color.signal_primary))
- .setContentTitle(context.getString(R.string.ExperienceUpgradeActivity_unlock_to_complete_update))
- .setContentText(context.getString(R.string.ExperienceUpgradeActivity_please_unlock_signal_to_complete_update))
- .setStyle(new NotificationCompat.BigTextStyle().bigText(context.getString(R.string.ExperienceUpgradeActivity_please_unlock_signal_to_complete_update)))
- .setAutoCancel(true)
- .setContentIntent(PendingIntent.getActivity(context, 0,
- context.getPackageManager().getLaunchIntentForPackage(context.getPackageName()),
- PendingIntent.FLAG_UPDATE_CURRENT))
- .build();
-
- ServiceUtil.getNotificationManager(context).notify(NOTIFICATION_ID, notification);
- }
-
- Optional experienceUpgrade = getExperienceUpgrade(context);
-
- if (!experienceUpgrade.isPresent()) {
- return;
- }
-
- if (experienceUpgrade.get().getVersion() == TextSecurePreferences.getExperienceDismissedVersionCode(context)) {
- return;
- }
-
- Intent targetIntent = context.getPackageManager().getLaunchIntentForPackage(context.getPackageName());
- Intent dismissIntent = new Intent(context, AppUpgradeReceiver.class);
- dismissIntent.setAction(DISMISS_ACTION);
-
- Notification notification = new NotificationCompat.Builder(context, NotificationChannels.OTHER)
- .setSmallIcon(R.drawable.ic_notification)
- .setColor(context.getResources().getColor(R.color.signal_primary))
- .setContentTitle(context.getString(experienceUpgrade.get().getNotificationTitle()))
- .setContentText(context.getString(experienceUpgrade.get().getNotificationText()))
- .setStyle(new NotificationCompat.BigTextStyle().bigText(context.getString(experienceUpgrade.get().getNotificationBigText())))
- .setAutoCancel(true)
- .setContentIntent(PendingIntent.getActivity(context, 0,
- targetIntent,
- PendingIntent.FLAG_UPDATE_CURRENT))
-
- .setDeleteIntent(PendingIntent.getBroadcast(context, 0,
- dismissIntent,
- PendingIntent.FLAG_UPDATE_CURRENT))
- .build();
- ServiceUtil.getNotificationManager(context).notify(NOTIFICATION_ID, notification);
- } else if (DISMISS_ACTION.equals(intent.getAction())) {
- TextSecurePreferences.setExperienceDismissedVersionCode(context, Util.getCanonicalVersionCode());
- }
- }
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/IntroPagerAdapter.java b/app/src/main/java/org/thoughtcrime/securesms/IntroPagerAdapter.java
deleted file mode 100644
index a176c28bbc..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/IntroPagerAdapter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.thoughtcrime.securesms;
-
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-import androidx.fragment.app.FragmentStatePagerAdapter;
-
-import java.util.List;
-
-public class IntroPagerAdapter extends FragmentStatePagerAdapter {
-
- public static class IntroPage {
- final int backgroundColor;
- final Fragment fragment;
-
- public IntroPage(int backgroundColor, Fragment fragment) {
- this.backgroundColor = backgroundColor;
- this.fragment = fragment;
- }
- }
-
- private List pages;
-
- public IntroPagerAdapter(FragmentManager fm, List pages) {
- super(fm);
- this.pages = pages;
- }
-
- @Override
- public Fragment getItem(int i) {
- IntroPage page = pages.get(i);
- return page.fragment;
- }
-
- @Override
- public int getCount() {
- return pages.size();
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java b/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java
index 3ed8ae2011..47f625a487 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/PassphraseRequiredActionBarActivity.java
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
+
import androidx.annotation.IdRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -13,23 +14,21 @@ import androidx.fragment.app.Fragment;
import org.thoughtcrime.securesms.logging.Log;
import org.thoughtcrime.securesms.loki.activities.HomeActivity;
import org.thoughtcrime.securesms.loki.activities.LandingActivity;
-import org.thoughtcrime.securesms.loki.activities.SeedActivity;
import org.thoughtcrime.securesms.service.KeyCachingService;
import org.thoughtcrime.securesms.util.TextSecurePreferences;
import java.util.Locale;
+//TODO AC: Rename to ScreenLockActionBarActivity.
public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarActivity {
private static final String TAG = PassphraseRequiredActionBarActivity.class.getSimpleName();
public static final String LOCALE_EXTRA = "locale_extra";
private static final int STATE_NORMAL = 0;
- private static final int STATE_PROMPT_PASSPHRASE = 2;
- private static final int STATE_UPGRADE_DATABASE = 3;
- private static final int STATE_PROMPT_PUSH_REGISTRATION = 4;
- private static final int STATE_EXPERIENCE_UPGRADE = 5;
- private static final int STATE_WELCOME_SCREEN = 6;
+ private static final int STATE_PROMPT_PASSPHRASE = 1; //TODO AC: Rename to STATE_SCREEN_LOCKED
+ private static final int STATE_UPGRADE_DATABASE = 2; //TODO AC: Rename to STATE_MIGRATE_DATA
+ private static final int STATE_WELCOME_SCREEN = 3;
private BroadcastReceiver clearKeyReceiver;
@@ -120,8 +119,6 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
case STATE_PROMPT_PASSPHRASE: return getPromptPassphraseIntent();
case STATE_UPGRADE_DATABASE: return getUpgradeDatabaseIntent();
case STATE_WELCOME_SCREEN: return getWelcomeIntent();
- case STATE_PROMPT_PUSH_REGISTRATION: return getPushRegistrationIntent();
- case STATE_EXPERIENCE_UPGRADE: return getExperienceUpgradeIntent();
default: return null;
}
}
@@ -133,13 +130,7 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
return STATE_UPGRADE_DATABASE;
} else if (!TextSecurePreferences.hasSeenWelcomeScreen(this)) {
return STATE_WELCOME_SCREEN;
- } else if (!TextSecurePreferences.hasPromptedPushRegistration(this)) {
- return STATE_PROMPT_PUSH_REGISTRATION;
- }
-// else if (ExperienceUpgradeActivity.isUpdate(this)) {
-// return STATE_EXPERIENCE_UPGRADE;
-// }
- else {
+ } else {
return STATE_NORMAL;
}
}
@@ -149,22 +140,15 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
}
private Intent getUpgradeDatabaseIntent() {
- return getRoutedIntent(DatabaseUpgradeActivity.class,
- TextSecurePreferences.hasPromptedPushRegistration(this)
- ? getConversationListIntent()
- : getPushRegistrationIntent());
- }
-
- private Intent getExperienceUpgradeIntent() {
- return getRoutedIntent(ExperienceUpgradeActivity.class, getIntent());
+ return getRoutedIntent(DatabaseUpgradeActivity.class, getConversationListIntent());
}
private Intent getWelcomeIntent() {
- return getRoutedIntent(LandingActivity.class, getPushRegistrationIntent());
+ return getRoutedIntent(LandingActivity.class, getConversationListIntent());
}
- private Intent getPushRegistrationIntent() {
- return getRoutedIntent(SeedActivity.class, getConversationListIntent());
+ private Intent getConversationListIntent() {
+ return new Intent(this, HomeActivity.class);
}
private Intent getRoutedIntent(Class> destination, @Nullable Intent nextIntent) {
@@ -173,10 +157,6 @@ public abstract class PassphraseRequiredActionBarActivity extends BaseActionBarA
return intent;
}
- private Intent getConversationListIntent() {
- return new Intent(this, HomeActivity.class);
- }
-
private void initializeClearKeyReceiver() {
Log.i(TAG, "initializeClearKeyReceiver()");
this.clearKeyReceiver = new BroadcastReceiver() {
diff --git a/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java b/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java
index 2c5ba26e4b..b569701661 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/crypto/IdentityKeyUtil.java
@@ -22,6 +22,7 @@ import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import androidx.annotation.NonNull;
+import org.session.libsignal.libsignal.ecc.ECPublicKey;
import org.thoughtcrime.securesms.backup.BackupProtos;
import org.thoughtcrime.securesms.util.Base64;
import org.session.libsignal.libsignal.IdentityKey;
@@ -40,7 +41,6 @@ import java.util.List;
*
* @author Moxie Marlinspike
*/
-//TODO AC: Delete
public class IdentityKeyUtil {
private static final String MASTER_SECRET_UTIL_PREFERENCES_NAME = "SecureSMS-Preferences";
@@ -86,6 +86,14 @@ public class IdentityKeyUtil {
}
}
+ public static void generateIdentityKeyPair(@NonNull Context context) {
+ ECKeyPair keyPair = Curve.generateKeyPair();
+ ECPublicKey publicKey = keyPair.getPublicKey();
+ ECPrivateKey privateKey = keyPair.getPrivateKey();
+ save(context, IDENTITY_PUBLIC_KEY_PREF, Base64.encodeBytes(publicKey.serialize()));
+ save(context, IDENTITY_PRIVATE_KEY_PREF, Base64.encodeBytes(privateKey.serialize()));
+ }
+
public static List getBackupRecords(@NonNull Context context) {
final String prefName = MASTER_SECRET_UTIL_PREFERENCES_NAME;
SharedPreferences preferences = context.getSharedPreferences(prefName, 0);
diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/BackupRestoreActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/BackupRestoreActivity.kt
index 5544941436..ab98403a39 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/BackupRestoreActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/BackupRestoreActivity.kt
@@ -189,7 +189,6 @@ class BackupRestoreViewModel(application: Application): AndroidViewModel(applica
TextSecurePreferences.setRestorationTime(context, System.currentTimeMillis())
TextSecurePreferences.setHasViewedSeed(context, true)
TextSecurePreferences.setHasSeenWelcomeScreen(context, true)
- TextSecurePreferences.setPromptedPushRegistration(context, true)
TextSecurePreferences.setHasSeenMultiDeviceRemovalSheet(context)
TextSecurePreferences.setHasSeenLightThemeIntroSheet(context)
val application = ApplicationContext.getInstance(context)
diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt
index 6808220aa5..b3ff21c881 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/LandingActivity.kt
@@ -2,15 +2,17 @@ package org.thoughtcrime.securesms.loki.activities
import android.content.Intent
import android.os.Bundle
+import android.view.View
import android.widget.Toast
-import kotlinx.android.synthetic.main.activity_landing.*
import network.loki.messenger.R
import org.thoughtcrime.securesms.ApplicationContext
import org.thoughtcrime.securesms.BaseActionBarActivity
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil
import org.thoughtcrime.securesms.loki.utilities.push
import org.thoughtcrime.securesms.loki.utilities.setUpActionBarSessionLogo
+import org.thoughtcrime.securesms.loki.views.FakeChatView
import org.thoughtcrime.securesms.util.TextSecurePreferences
+import org.thoughtcrime.securesms.util.Util
class LandingActivity : BaseActionBarActivity() {
@@ -18,13 +20,23 @@ class LandingActivity : BaseActionBarActivity() {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_landing)
setUpActionBarSessionLogo(true)
- fakeChatView.startAnimating()
- registerButton.setOnClickListener { register() }
- restoreButton.setOnClickListener { restoreFromRecoveryPhrase() }
- restoreBackupButton.setOnClickListener { restoreFromBackup() }
+ findViewById(R.id.fakeChatView).startAnimating()
+
+ findViewById(R.id.registerButton).setOnClickListener { register() }
+ findViewById(R.id.restoreButton).setOnClickListener { restoreFromRecoveryPhrase() }
+ findViewById(R.id.restoreBackupButton).setOnClickListener { restoreFromBackup() }
+
if (TextSecurePreferences.getWasUnlinked(this)) {
Toast.makeText(this, R.string.activity_landing_device_unlinked_dialog_title, Toast.LENGTH_LONG).show()
}
+
+ // Setup essentials for a new user.
+ IdentityKeyUtil.generateIdentityKeyPair(this)
+
+ TextSecurePreferences.setLastExperienceVersionCode(this, Util.getCanonicalVersionCode())
+ TextSecurePreferences.setPasswordDisabled(this, true)
+ TextSecurePreferences.setReadReceiptsEnabled(this, true)
+ TextSecurePreferences.setTypingIndicatorsEnabled(this, true)
}
private fun register() {
@@ -46,7 +58,6 @@ class LandingActivity : BaseActionBarActivity() {
IdentityKeyUtil.delete(this, IdentityKeyUtil.LOKI_SEED)
TextSecurePreferences.removeLocalNumber(this)
TextSecurePreferences.setHasSeenWelcomeScreen(this, false)
- TextSecurePreferences.setPromptedPushRegistration(this, false)
val application = ApplicationContext.getInstance(this)
application.stopPolling()
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/PNModeActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/PNModeActivity.kt
index 03e0dec356..7c86dec593 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/PNModeActivity.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/PNModeActivity.kt
@@ -151,7 +151,6 @@ class PNModeActivity : BaseActionBarActivity() {
return
}
TextSecurePreferences.setHasSeenWelcomeScreen(this, true)
- TextSecurePreferences.setPromptedPushRegistration(this, true)
TextSecurePreferences.setIsUsingFCM(this, (selectedOptionView == fcmOptionView))
TextSecurePreferences.setHasSeenMultiDeviceRemovalSheet(this)
TextSecurePreferences.setHasSeenLightThemeIntroSheet(this)
diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/utilities/KeyPairUtilities.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/utilities/KeyPairUtilities.kt
index 255e99964b..00aea67d4d 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/loki/utilities/KeyPairUtilities.kt
+++ b/app/src/main/java/org/thoughtcrime/securesms/loki/utilities/KeyPairUtilities.kt
@@ -15,12 +15,6 @@ object KeyPairUtilities {
private val sodium = LazySodiumAndroid(SodiumAndroid())
- data class KeyPairGenerationResult(
- val seed: ByteArray,
- val ed25519KeyPair: KeyPair,
- val x25519KeyPair: ECKeyPair
- )
-
fun generate(): KeyPairGenerationResult {
val seed = sodium.randomBytesBuf(16)
try {
@@ -45,4 +39,10 @@ object KeyPairUtilities {
IdentityKeyUtil.save(context, IdentityKeyUtil.ED25519_PUBLIC_KEY, Base64.encodeBytes(ed25519KeyPair.publicKey.asBytes))
IdentityKeyUtil.save(context, IdentityKeyUtil.ED25519_SECRET_KEY, Base64.encodeBytes(ed25519KeyPair.secretKey.asBytes))
}
+
+ data class KeyPairGenerationResult(
+ val seed: ByteArray,
+ val ed25519KeyPair: KeyPair,
+ val x25519KeyPair: ECKeyPair
+ )
}
\ No newline at end of file
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
index 202d901b15..2c6e639471 100644
--- a/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/TextSecurePreferences.java
@@ -81,7 +81,6 @@ public class TextSecurePreferences {
public static final String REGISTERED_GCM_PREF = "pref_gcm_registered";
private static final String GCM_PASSWORD_PREF = "pref_gcm_password";
private static final String SEEN_WELCOME_SCREEN_PREF = "pref_seen_welcome_screen";
- private static final String PROMPTED_PUSH_REGISTRATION_PREF = "pref_prompted_push_registration";
private static final String PROMPTED_DEFAULT_SMS_PREF = "pref_prompted_default_sms";
private static final String PROMPTED_OPTIMIZE_DOZE_PREF = "pref_prompted_optimize_doze";
private static final String PROMPTED_SHARE_PREF = "pref_prompted_share";
@@ -879,21 +878,13 @@ public class TextSecurePreferences {
}
public static boolean hasSeenWelcomeScreen(Context context) {
- return getBooleanPreference(context, SEEN_WELCOME_SCREEN_PREF, true);
+ return getBooleanPreference(context, SEEN_WELCOME_SCREEN_PREF, false);
}
public static void setHasSeenWelcomeScreen(Context context, boolean value) {
setBooleanPreference(context, SEEN_WELCOME_SCREEN_PREF, value);
}
- public static boolean hasPromptedPushRegistration(Context context) {
- return getBooleanPreference(context, PROMPTED_PUSH_REGISTRATION_PREF, false);
- }
-
- public static void setPromptedPushRegistration(Context context, boolean value) {
- setBooleanPreference(context, PROMPTED_PUSH_REGISTRATION_PREF, value);
- }
-
public static boolean hasPromptedDefaultSmsProvider(Context context) {
return getBooleanPreference(context, PROMPTED_DEFAULT_SMS_PREF, false);
}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/VersionTracker.java b/app/src/main/java/org/thoughtcrime/securesms/util/VersionTracker.java
deleted file mode 100644
index 4c9a6ba97a..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/util/VersionTracker.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.thoughtcrime.securesms.util;
-
-import android.content.Context;
-import androidx.annotation.NonNull;
-
-import java.io.IOException;
-
-public class VersionTracker {
-
- public static int getLastSeenVersion(@NonNull Context context) {
- return TextSecurePreferences.getLastVersionCode(context);
- }
-
- public static void updateLastSeenVersion(@NonNull Context context) {
- try {
- int currentVersionCode = Util.getCanonicalVersionCode();
- TextSecurePreferences.setLastVersionCode(context, currentVersionCode);
- } catch (IOException ioe) {
- throw new AssertionError(ioe);
- }
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/VersionTracker.kt b/app/src/main/java/org/thoughtcrime/securesms/util/VersionTracker.kt
new file mode 100644
index 0000000000..4c07027650
--- /dev/null
+++ b/app/src/main/java/org/thoughtcrime/securesms/util/VersionTracker.kt
@@ -0,0 +1,29 @@
+package org.thoughtcrime.securesms.util
+
+import android.content.Context
+import java.io.IOException
+import java.lang.RuntimeException
+
+object VersionTracker {
+
+ @JvmStatic
+ fun getLastSeenVersion(context: Context): Int {
+ var version = TextSecurePreferences.getLastVersionCode(context)
+ // Zero means the app is freshly installed = user is actually on the current version.
+ if (version == 0) {
+ version = updateLastSeenVersion(context)
+ }
+ return version
+ }
+
+ @JvmStatic
+ fun updateLastSeenVersion(context: Context): Int {
+ return try {
+ val currentVersionCode = Util.getCanonicalVersionCode()
+ TextSecurePreferences.setLastVersionCode(context, currentVersionCode)
+ currentVersionCode
+ } catch (e: IOException) {
+ throw RuntimeException("Failed to update the last seen app version.", e)
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/res/layout/experience_upgrade_activity.xml b/app/src/main/res/layout/experience_upgrade_activity.xml
deleted file mode 100644
index 73c64014dc..0000000000
--- a/app/src/main/res/layout/experience_upgrade_activity.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file