mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-17 15:33:30 +01:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb06ec51f3 | ||
|
|
dda28f8c24 | ||
|
|
236e3f7e81 | ||
|
|
f772f98947 | ||
|
|
597756122b | ||
|
|
edc7d4d696 |
@@ -58,14 +58,14 @@ ktlint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def canonicalVersionCode = 1076
|
def canonicalVersionCode = 1076
|
||||||
def canonicalVersionName = "5.41.11"
|
def canonicalVersionName = "5.41.14"
|
||||||
|
|
||||||
def postFixSize = 100
|
def postFixSize = 100
|
||||||
def abiPostFix = ['universal' : 0,
|
def abiPostFix = ['universal' : 15,
|
||||||
'armeabi-v7a' : 1,
|
'armeabi-v7a' : 16,
|
||||||
'arm64-v8a' : 2,
|
'arm64-v8a' : 17,
|
||||||
'x86' : 3,
|
'x86' : 18,
|
||||||
'x86_64' : 4]
|
'x86_64' : 19]
|
||||||
|
|
||||||
def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties') ]
|
def keystores = [ 'debug' : loadKeystoreProperties('keystore.debug.properties') ]
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,11 @@ object FcmFetchManager {
|
|||||||
@Volatile
|
@Volatile
|
||||||
private var startedForeground = false
|
private var startedForeground = false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return True if a service was successfully started, otherwise false.
|
||||||
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun enqueue(context: Context, foreground: Boolean) {
|
fun enqueue(context: Context, foreground: Boolean): Boolean {
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
try {
|
try {
|
||||||
if (foreground) {
|
if (foreground) {
|
||||||
@@ -63,8 +66,11 @@ object FcmFetchManager {
|
|||||||
}
|
}
|
||||||
} catch (e: IllegalStateException) {
|
} catch (e: IllegalStateException) {
|
||||||
Log.w(TAG, "Failed to start service!", e)
|
Log.w(TAG, "Failed to start service!", e)
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun fetch(context: Context) {
|
private fun fetch(context: Context) {
|
||||||
|
|||||||
@@ -78,18 +78,25 @@ public class FcmReceiveService extends FirebaseMessagingService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void handleReceivedNotification(Context context, @Nullable RemoteMessage remoteMessage) {
|
private static void handleReceivedNotification(Context context, @Nullable RemoteMessage remoteMessage) {
|
||||||
|
boolean enqueueSuccessful;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
long timeSinceLastRefresh = System.currentTimeMillis() - SignalStore.misc().getLastFcmForegroundServiceTime();
|
long timeSinceLastRefresh = System.currentTimeMillis() - SignalStore.misc().getLastFcmForegroundServiceTime();
|
||||||
Log.d(TAG, String.format(Locale.US, "[handleReceivedNotification] API: %s, FeatureFlag: %s, RemoteMessagePriority: %s, TimeSinceLastRefresh: %s ms", Build.VERSION.SDK_INT, FeatureFlags.useFcmForegroundService(), remoteMessage != null ? remoteMessage.getPriority() : "n/a", timeSinceLastRefresh));
|
Log.d(TAG, String.format(Locale.US, "[handleReceivedNotification] API: %s, FeatureFlag: %s, RemoteMessagePriority: %s, TimeSinceLastRefresh: %s ms", Build.VERSION.SDK_INT, FeatureFlags.useFcmForegroundService(), remoteMessage != null ? remoteMessage.getPriority() : "n/a", timeSinceLastRefresh));
|
||||||
|
|
||||||
if (FeatureFlags.useFcmForegroundService() && Build.VERSION.SDK_INT >= 31 && remoteMessage != null && remoteMessage.getPriority() == RemoteMessage.PRIORITY_HIGH && timeSinceLastRefresh > FCM_FOREGROUND_INTERVAL) {
|
if (FeatureFlags.useFcmForegroundService() && Build.VERSION.SDK_INT >= 31 && remoteMessage != null && remoteMessage.getPriority() == RemoteMessage.PRIORITY_HIGH && timeSinceLastRefresh > FCM_FOREGROUND_INTERVAL) {
|
||||||
FcmFetchManager.enqueue(context, true);
|
enqueueSuccessful = FcmFetchManager.enqueue(context, true);
|
||||||
SignalStore.misc().setLastFcmForegroundServiceTime(System.currentTimeMillis());
|
SignalStore.misc().setLastFcmForegroundServiceTime(System.currentTimeMillis());
|
||||||
} else {
|
} else {
|
||||||
FcmFetchManager.enqueue(context, false);
|
enqueueSuccessful = FcmFetchManager.enqueue(context, false);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.w(TAG, "Failed to start service. Falling back to legacy approach.", e);
|
Log.w(TAG, "Failed to start service.", e);
|
||||||
|
enqueueSuccessful = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!enqueueSuccessful) {
|
||||||
|
Log.w(TAG, "Failed to start service. Falling back to legacy approach.");
|
||||||
FcmFetchManager.retrieveMessages(context);
|
FcmFetchManager.retrieveMessages(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ public class FcmRefreshJob extends BaseJob {
|
|||||||
this(new Job.Parameters.Builder()
|
this(new Job.Parameters.Builder()
|
||||||
.setQueue("FcmRefreshJob")
|
.setQueue("FcmRefreshJob")
|
||||||
.addConstraint(NetworkConstraint.KEY)
|
.addConstraint(NetworkConstraint.KEY)
|
||||||
.setMaxAttempts(1)
|
.setMaxAttempts(3)
|
||||||
.setLifespan(TimeUnit.MINUTES.toMillis(5))
|
.setLifespan(TimeUnit.HOURS.toMillis(6))
|
||||||
.setMaxInstancesForFactory(1)
|
.setMaxInstancesForFactory(1)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
@@ -109,7 +109,7 @@ public class FcmRefreshJob extends BaseJob {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure() {
|
public void onFailure() {
|
||||||
Log.w(TAG, "GCM reregistration failed after retry attempt exhaustion!");
|
Log.w(TAG, "FCM reregistration failed after retry attempt exhaustion!");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -91,12 +91,14 @@ public class EditProfileNameFragment extends Fragment {
|
|||||||
setEditTextEnabled(familyName, true);
|
setEditTextEnabled(familyName, true);
|
||||||
break;
|
break;
|
||||||
case IDLE:
|
case IDLE:
|
||||||
|
saveButton.setClickable(true);
|
||||||
saveButton.cancelSpinning();
|
saveButton.cancelSpinning();
|
||||||
saveButton.setAlpha(1);
|
saveButton.setAlpha(1);
|
||||||
setEditTextEnabled(givenName, true);
|
setEditTextEnabled(givenName, true);
|
||||||
setEditTextEnabled(familyName, true);
|
setEditTextEnabled(familyName, true);
|
||||||
break;
|
break;
|
||||||
case IN_PROGRESS:
|
case IN_PROGRESS:
|
||||||
|
saveButton.setClickable(false);
|
||||||
saveButton.setSpinning();
|
saveButton.setSpinning();
|
||||||
saveButton.setAlpha(1);
|
saveButton.setAlpha(1);
|
||||||
setEditTextEnabled(givenName, false);
|
setEditTextEnabled(givenName, false);
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ import androidx.annotation.StringRes
|
|||||||
import androidx.core.animation.doOnEnd
|
import androidx.core.animation.doOnEnd
|
||||||
import androidx.core.content.withStyledAttributes
|
import androidx.core.content.withStyledAttributes
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
|
import com.google.android.material.progressindicator.CircularProgressIndicator
|
||||||
import com.google.android.material.theme.overlay.MaterialThemeOverlay
|
import com.google.android.material.theme.overlay.MaterialThemeOverlay
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
|
import org.thoughtcrime.securesms.util.visible
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -33,6 +35,7 @@ class CircularProgressMaterialButton @JvmOverloads constructor(
|
|||||||
private var animator: Animator? = null
|
private var animator: Animator? = null
|
||||||
|
|
||||||
private val materialButton: MaterialButton = findViewById(R.id.button)
|
private val materialButton: MaterialButton = findViewById(R.id.button)
|
||||||
|
private val progressIndicator: CircularProgressIndicator = findViewById(R.id.progress_indicator)
|
||||||
|
|
||||||
var text: CharSequence?
|
var text: CharSequence?
|
||||||
get() = materialButton.text
|
get() = materialButton.text
|
||||||
@@ -52,6 +55,18 @@ class CircularProgressMaterialButton @JvmOverloads constructor(
|
|||||||
materialButton.setText(resId)
|
materialButton.setText(resId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun setEnabled(enabled: Boolean) {
|
||||||
|
super.setEnabled(enabled)
|
||||||
|
materialButton.isEnabled = enabled
|
||||||
|
progressIndicator.visible = enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun setClickable(clickable: Boolean) {
|
||||||
|
super.setClickable(clickable)
|
||||||
|
materialButton.isClickable = clickable
|
||||||
|
progressIndicator.visible = clickable
|
||||||
|
}
|
||||||
|
|
||||||
override fun onSaveInstanceState(): Parcelable {
|
override fun onSaveInstanceState(): Parcelable {
|
||||||
return Bundle().apply {
|
return Bundle().apply {
|
||||||
putParcelable(SUPER_STATE, super.onSaveInstanceState())
|
putParcelable(SUPER_STATE, super.onSaveInstanceState())
|
||||||
|
|||||||
Reference in New Issue
Block a user