mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-16 07:57:38 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2a708a24a | ||
|
|
f19e060b1c | ||
|
|
94265ac5ed | ||
|
|
e4894c55cf |
@@ -21,8 +21,8 @@ plugins {
|
||||
apply(from = "static-ips.gradle.kts")
|
||||
|
||||
val canonicalVersionCode = 1522
|
||||
val canonicalVersionName = "7.37.3"
|
||||
val currentHotfixVersion = 0
|
||||
val canonicalVersionName = "7.37.5"
|
||||
val currentHotfixVersion = 2
|
||||
val maxHotfixVersions = 100
|
||||
|
||||
val keystores: Map<String, Properties?> = mapOf("debug" to loadKeystoreProperties("keystore.debug.properties"))
|
||||
|
||||
@@ -32,7 +32,7 @@ public final class AppInitialization {
|
||||
|
||||
TextSecurePreferences.setAppMigrationVersion(context, ApplicationMigrations.CURRENT_VERSION);
|
||||
TextSecurePreferences.setJobManagerVersion(context, JobManager.CURRENT_VERSION);
|
||||
TextSecurePreferences.setLastVersionCode(context, Util.getCanonicalVersionCode());
|
||||
TextSecurePreferences.setLastVersionCode(context, BuildConfig.VERSION_CODE);
|
||||
TextSecurePreferences.setHasSeenStickerIntroTooltip(context, true);
|
||||
SignalStore.settings().setPassphraseDisabled(true);
|
||||
TextSecurePreferences.setReadReceiptsEnabled(context, true);
|
||||
@@ -72,7 +72,7 @@ public final class AppInitialization {
|
||||
|
||||
TextSecurePreferences.setAppMigrationVersion(context, ApplicationMigrations.CURRENT_VERSION);
|
||||
TextSecurePreferences.setJobManagerVersion(context, JobManager.CURRENT_VERSION);
|
||||
TextSecurePreferences.setLastVersionCode(context, Util.getCanonicalVersionCode());
|
||||
TextSecurePreferences.setLastVersionCode(context, BuildConfig.VERSION_CODE);
|
||||
TextSecurePreferences.setHasSeenStickerIntroTooltip(context, true);
|
||||
SignalStore.settings().setPassphraseDisabled(true);
|
||||
AppDependencies.getMegaphoneRepository().onFirstEverAppLaunch();
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package org.thoughtcrime.securesms.net;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.Response;
|
||||
|
||||
/**
|
||||
* Marks the client as remotely-deprecated when it receives a 499 response.
|
||||
*/
|
||||
public final class RemoteDeprecationDetectorInterceptor implements Interceptor {
|
||||
|
||||
private static final String TAG = Log.tag(RemoteDeprecationDetectorInterceptor.class);
|
||||
|
||||
@Override
|
||||
public @NonNull Response intercept(@NonNull Chain chain) throws IOException {
|
||||
Response response = chain.proceed(chain.request());
|
||||
|
||||
if (response.code() == 499 && !SignalStore.misc().isClientDeprecated()) {
|
||||
Log.w(TAG, "Received 499. Client version is deprecated.", true);
|
||||
SignalStore.misc().setClientDeprecated(true);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package org.thoughtcrime.securesms.net
|
||||
|
||||
import okhttp3.Interceptor
|
||||
import okhttp3.Response
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.signal.core.util.logging.Log.tag
|
||||
import org.signal.core.util.orNull
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore.Companion.misc
|
||||
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Marks the client as remotely-deprecated when it receives a 499 response.
|
||||
*/
|
||||
class RemoteDeprecationDetectorInterceptor(private val getConfiguration: () -> SignalServiceConfiguration) : Interceptor {
|
||||
|
||||
companion object {
|
||||
private val TAG = tag(RemoteDeprecationDetectorInterceptor::class.java)
|
||||
}
|
||||
|
||||
@Throws(IOException::class)
|
||||
override fun intercept(chain: Interceptor.Chain): Response {
|
||||
val request = chain.request()
|
||||
val response = chain.proceed(request)
|
||||
|
||||
if (response.code == 499 && !misc.isClientDeprecated && getConfiguration().signalServiceUrls.any { request.url.toString().startsWith(it.url) && it.hostHeader.orNull() == request.header("host") }) {
|
||||
Log.w(TAG, "Received 499. Client version is deprecated.", true)
|
||||
misc.isClientDeprecated = true
|
||||
}
|
||||
|
||||
return response
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ class SignalServiceNetworkAccess(context: Context) {
|
||||
|
||||
private val interceptors: List<Interceptor> = listOf(
|
||||
StandardUserAgentInterceptor(),
|
||||
RemoteDeprecationDetectorInterceptor(),
|
||||
RemoteDeprecationDetectorInterceptor(this::getConfiguration),
|
||||
DeprecatedClientPreventionInterceptor(),
|
||||
DeviceTransferBlockingInterceptor.getInstance()
|
||||
)
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.greenrobot.eventbus.EventBus;
|
||||
import org.signal.core.util.PendingIntentFlags;
|
||||
import org.signal.core.util.logging.Log;
|
||||
import org.signal.libsignal.zkgroup.profiles.ProfileKey;
|
||||
import org.thoughtcrime.securesms.BuildConfig;
|
||||
import org.thoughtcrime.securesms.R;
|
||||
import org.thoughtcrime.securesms.backup.proto.SharedPreference;
|
||||
import org.thoughtcrime.securesms.crypto.ProfileKeyUtil;
|
||||
@@ -573,7 +574,7 @@ public class TextSecurePreferences {
|
||||
}
|
||||
|
||||
public static int getLastVersionCode(Context context) {
|
||||
return getIntegerPreference(context, LAST_VERSION_CODE_PREF, Util.getCanonicalVersionCode());
|
||||
return getIntegerPreference(context, LAST_VERSION_CODE_PREF, BuildConfig.VERSION_CODE);
|
||||
}
|
||||
|
||||
public static void setLastVersionCode(Context context, int versionCode) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.util
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import org.signal.core.util.logging.Log
|
||||
import org.thoughtcrime.securesms.BuildConfig
|
||||
import org.thoughtcrime.securesms.dependencies.AppDependencies
|
||||
import org.thoughtcrime.securesms.jobs.RefreshAttributesJob
|
||||
import org.thoughtcrime.securesms.jobs.RemoteConfigRefreshJob
|
||||
@@ -20,7 +21,7 @@ object VersionTracker {
|
||||
|
||||
@JvmStatic
|
||||
fun updateLastSeenVersion(context: Context) {
|
||||
val currentVersionCode = Util.getCanonicalVersionCode()
|
||||
val currentVersionCode = BuildConfig.VERSION_CODE
|
||||
val lastVersionCode = TextSecurePreferences.getLastVersionCode(context)
|
||||
|
||||
if (currentVersionCode != lastVersionCode) {
|
||||
|
||||
Reference in New Issue
Block a user