mirror of
https://github.com/vector-im/riotX-android
synced 2025-10-06 00:02:48 +02:00
Merge branch 'develop' into feature/bca/rust_flavor
This commit is contained in:
@@ -403,7 +403,7 @@ dependencies {
|
||||
debugImplementation(libs.flipper.flipperNetworkPlugin) {
|
||||
exclude group: 'com.facebook.fbjni', module: 'fbjni'
|
||||
}
|
||||
debugImplementation 'com.facebook.soloader:soloader:0.10.4'
|
||||
debugImplementation 'com.facebook.soloader:soloader:0.10.5'
|
||||
debugImplementation "com.kgurgul.flipper:flipper-realm-android:2.2.0"
|
||||
|
||||
gplayImplementation "com.google.android.gms:play-services-location:21.0.1"
|
||||
@@ -418,7 +418,7 @@ dependencies {
|
||||
// API-only library
|
||||
gplayImplementation libs.google.appdistributionApi
|
||||
// Full SDK implementation
|
||||
gplayImplementation libs.google.appdistribution
|
||||
nightlyImplementation libs.google.appdistribution
|
||||
|
||||
// OSS License, gplay flavor only
|
||||
gplayImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
|
||||
@@ -448,5 +448,5 @@ dependencies {
|
||||
androidTestImplementation libs.androidx.fragmentTesting
|
||||
androidTestImplementation "org.jetbrains.kotlin:kotlin-reflect:1.7.22"
|
||||
debugImplementation libs.androidx.fragmentTesting
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.9.1'
|
||||
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.10'
|
||||
}
|
||||
|
@@ -46,9 +46,9 @@ abstract class FlavorModule {
|
||||
|
||||
@Provides
|
||||
fun provideNightlyProxy() = object : NightlyProxy {
|
||||
override fun onHomeResumed() {
|
||||
// no op
|
||||
}
|
||||
override fun canDisplayPopup() = false
|
||||
override fun isNightlyBuild() = false
|
||||
override fun updateApplication() = Unit
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
package im.vector.app.push.fcm
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.pushers.FcmHelper
|
||||
@@ -44,7 +43,7 @@ class FdroidFcmHelper @Inject constructor(
|
||||
// No op
|
||||
}
|
||||
|
||||
override fun ensureFcmTokenIsRetrieved(activity: Activity, pushersManager: PushersManager, registerPusher: Boolean) {
|
||||
override fun ensureFcmTokenIsRetrieved(pushersManager: PushersManager, registerPusher: Boolean) {
|
||||
// No op
|
||||
}
|
||||
|
||||
|
@@ -34,8 +34,11 @@ class FirebaseNightlyProxy @Inject constructor(
|
||||
private val buildMeta: BuildMeta,
|
||||
) : NightlyProxy {
|
||||
|
||||
override fun onHomeResumed() {
|
||||
if (!canDisplayPopup()) return
|
||||
override fun isNightlyBuild(): Boolean {
|
||||
return buildMeta.applicationId in nightlyPackages
|
||||
}
|
||||
|
||||
override fun updateApplication() {
|
||||
val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
|
||||
firebaseAppDistribution.updateIfNewReleaseAvailable()
|
||||
.addOnProgressListener { up ->
|
||||
@@ -46,6 +49,7 @@ class FirebaseNightlyProxy @Inject constructor(
|
||||
when (e.errorCode) {
|
||||
FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> {
|
||||
// SDK did nothing. This is expected when building for Play.
|
||||
Timber.d("FirebaseAppDistribution NOT_IMPLEMENTED error")
|
||||
}
|
||||
else -> {
|
||||
// Handle other errors.
|
||||
@@ -56,10 +60,14 @@ class FirebaseNightlyProxy @Inject constructor(
|
||||
Timber.e(e, "FirebaseAppDistribution - other error")
|
||||
}
|
||||
}
|
||||
.addOnSuccessListener {
|
||||
Timber.d("FirebaseAppDistribution Success!")
|
||||
}
|
||||
}
|
||||
|
||||
private fun canDisplayPopup(): Boolean {
|
||||
if (buildMeta.applicationId != "im.vector.app.nightly") return false
|
||||
override fun canDisplayPopup(): Boolean {
|
||||
if (!POPUP_IS_ENABLED) return false
|
||||
if (!isNightlyBuild()) return false
|
||||
val today = clock.epochMillis() / A_DAY_IN_MILLIS
|
||||
val lastDisplayPopupDay = sharedPreferences.getLong(SHARED_PREF_KEY, 0)
|
||||
return (today > lastDisplayPopupDay)
|
||||
@@ -73,7 +81,12 @@ class FirebaseNightlyProxy @Inject constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val POPUP_IS_ENABLED = false
|
||||
private const val A_DAY_IN_MILLIS = 8_600_000L
|
||||
private const val SHARED_PREF_KEY = "LAST_NIGHTLY_POPUP_DAY"
|
||||
|
||||
private val nightlyPackages = listOf(
|
||||
"im.vector.app.nightly"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package im.vector.app.push.fcm
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.widget.Toast
|
||||
@@ -23,6 +22,7 @@ import androidx.core.content.edit
|
||||
import com.google.android.gms.common.ConnectionResult
|
||||
import com.google.android.gms.common.GoogleApiAvailability
|
||||
import com.google.firebase.messaging.FirebaseMessaging
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import im.vector.app.R
|
||||
import im.vector.app.core.di.ActiveSessionHolder
|
||||
import im.vector.app.core.di.DefaultPreferences
|
||||
@@ -36,8 +36,8 @@ import javax.inject.Inject
|
||||
* It has an alter ego in the fdroid variant.
|
||||
*/
|
||||
class GoogleFcmHelper @Inject constructor(
|
||||
@DefaultPreferences
|
||||
private val sharedPrefs: SharedPreferences,
|
||||
@ApplicationContext private val context: Context,
|
||||
@DefaultPreferences private val sharedPrefs: SharedPreferences,
|
||||
) : FcmHelper {
|
||||
companion object {
|
||||
private const val PREFS_KEY_FCM_TOKEN = "FCM_TOKEN"
|
||||
@@ -56,10 +56,9 @@ class GoogleFcmHelper @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun ensureFcmTokenIsRetrieved(activity: Activity, pushersManager: PushersManager, registerPusher: Boolean) {
|
||||
// if (TextUtils.isEmpty(getFcmToken(activity))) {
|
||||
override fun ensureFcmTokenIsRetrieved(pushersManager: PushersManager, registerPusher: Boolean) {
|
||||
// 'app should always check the device for a compatible Google Play services APK before accessing Google Play services features'
|
||||
if (checkPlayServices(activity)) {
|
||||
if (checkPlayServices(context)) {
|
||||
try {
|
||||
FirebaseMessaging.getInstance().token
|
||||
.addOnSuccessListener { token ->
|
||||
@@ -75,7 +74,7 @@ class GoogleFcmHelper @Inject constructor(
|
||||
Timber.e(e, "## ensureFcmTokenIsRetrieved() : failed")
|
||||
}
|
||||
} else {
|
||||
Toast.makeText(activity, R.string.no_valid_google_play_services_apk, Toast.LENGTH_SHORT).show()
|
||||
Toast.makeText(context, R.string.no_valid_google_play_services_apk, Toast.LENGTH_SHORT).show()
|
||||
Timber.e("No valid Google Play Services found. Cannot use FCM.")
|
||||
}
|
||||
}
|
||||
|
@@ -46,6 +46,7 @@ import im.vector.app.core.utils.AndroidSystemSettingsProvider
|
||||
import im.vector.app.core.utils.SystemSettingsProvider
|
||||
import im.vector.app.features.analytics.AnalyticsTracker
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import im.vector.app.features.analytics.errors.ErrorTracker
|
||||
import im.vector.app.features.analytics.impl.DefaultVectorAnalytics
|
||||
import im.vector.app.features.analytics.metrics.VectorPlugins
|
||||
import im.vector.app.features.invite.AutoAcceptInvites
|
||||
@@ -84,6 +85,9 @@ import javax.inject.Singleton
|
||||
@Binds
|
||||
abstract fun bindVectorAnalytics(analytics: DefaultVectorAnalytics): VectorAnalytics
|
||||
|
||||
@Binds
|
||||
abstract fun bindErrorTracker(analytics: DefaultVectorAnalytics): ErrorTracker
|
||||
|
||||
@Binds
|
||||
abstract fun bindAnalyticsTracker(analytics: DefaultVectorAnalytics): AnalyticsTracker
|
||||
|
||||
|
Reference in New Issue
Block a user