Merge pull request #6629 from vector-im/feature/bma/nightyl_in_app_alert
Add in-app alert to let user know if a new version is available.
This commit is contained in:
commit
a06dc55848
|
@ -15,6 +15,7 @@ def gradle = "7.1.3"
|
||||||
def kotlin = "1.6.21"
|
def kotlin = "1.6.21"
|
||||||
def kotlinCoroutines = "1.6.4"
|
def kotlinCoroutines = "1.6.4"
|
||||||
def dagger = "2.42"
|
def dagger = "2.42"
|
||||||
|
def appDistribution = "16.0.0-beta03"
|
||||||
def retrofit = "2.9.0"
|
def retrofit = "2.9.0"
|
||||||
def arrow = "0.8.2"
|
def arrow = "0.8.2"
|
||||||
def markwon = "4.6.2"
|
def markwon = "4.6.2"
|
||||||
|
@ -81,7 +82,9 @@ ext.libs = [
|
||||||
'transition' : "androidx.transition:transition:1.2.0",
|
'transition' : "androidx.transition:transition:1.2.0",
|
||||||
],
|
],
|
||||||
google : [
|
google : [
|
||||||
'material' : "com.google.android.material:material:1.6.1"
|
'material' : "com.google.android.material:material:1.6.1",
|
||||||
|
'appdistributionApi' : "com.google.firebase:firebase-appdistribution-api-ktx:$appDistribution",
|
||||||
|
'appdistribution' : "com.google.firebase:firebase-appdistribution:$appDistribution",
|
||||||
],
|
],
|
||||||
dagger : [
|
dagger : [
|
||||||
'dagger' : "com.google.dagger:dagger:$dagger",
|
'dagger' : "com.google.dagger:dagger:$dagger",
|
||||||
|
|
|
@ -449,6 +449,12 @@ dependencies {
|
||||||
implementation libs.airbnb.epoxyPaging
|
implementation libs.airbnb.epoxyPaging
|
||||||
implementation libs.airbnb.mavericks
|
implementation libs.airbnb.mavericks
|
||||||
|
|
||||||
|
// Nightly
|
||||||
|
// API-only library
|
||||||
|
gplayImplementation libs.google.appdistributionApi
|
||||||
|
// Full SDK implementation
|
||||||
|
gplayImplementation libs.google.appdistribution
|
||||||
|
|
||||||
// Work
|
// Work
|
||||||
implementation libs.androidx.work
|
implementation libs.androidx.work
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.app.nightly
|
||||||
|
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class NightlyProxy @Inject constructor() {
|
||||||
|
fun updateIfNewReleaseAvailable() = Unit
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 New Vector Ltd
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package im.vector.app.nightly
|
||||||
|
|
||||||
|
import com.google.firebase.appdistribution.FirebaseAppDistribution
|
||||||
|
import com.google.firebase.appdistribution.FirebaseAppDistributionException
|
||||||
|
import timber.log.Timber
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class NightlyProxy @Inject constructor() {
|
||||||
|
fun updateIfNewReleaseAvailable() {
|
||||||
|
val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
|
||||||
|
firebaseAppDistribution.updateIfNewReleaseAvailable()
|
||||||
|
.addOnProgressListener { up ->
|
||||||
|
Timber.d("FirebaseAppDistribution progress: ${up.updateStatus}. ${up.apkBytesDownloaded}/${up.apkFileTotalBytes}")
|
||||||
|
}
|
||||||
|
.addOnFailureListener { e ->
|
||||||
|
if (e is FirebaseAppDistributionException) {
|
||||||
|
when (e.errorCode) {
|
||||||
|
FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> {
|
||||||
|
// SDK did nothing. This is expected when building for Play.
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
// Handle other errors.
|
||||||
|
Timber.e(e, "FirebaseAppDistribution error, status: ${e.errorCode}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Timber.e(e, "FirebaseAppDistribution - other error")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -78,6 +78,7 @@ import im.vector.app.features.spaces.invite.SpaceInviteBottomSheet
|
||||||
import im.vector.app.features.spaces.share.ShareSpaceBottomSheet
|
import im.vector.app.features.spaces.share.ShareSpaceBottomSheet
|
||||||
import im.vector.app.features.themes.ThemeUtils
|
import im.vector.app.features.themes.ThemeUtils
|
||||||
import im.vector.app.features.workers.signout.ServerBackupStatusViewModel
|
import im.vector.app.features.workers.signout.ServerBackupStatusViewModel
|
||||||
|
import im.vector.app.nightly.NightlyProxy
|
||||||
import im.vector.app.push.fcm.FcmHelper
|
import im.vector.app.push.fcm.FcmHelper
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.onEach
|
import kotlinx.coroutines.flow.onEach
|
||||||
|
@ -132,6 +133,7 @@ class HomeActivity :
|
||||||
@Inject lateinit var appStateHandler: AppStateHandler
|
@Inject lateinit var appStateHandler: AppStateHandler
|
||||||
@Inject lateinit var unifiedPushHelper: UnifiedPushHelper
|
@Inject lateinit var unifiedPushHelper: UnifiedPushHelper
|
||||||
@Inject lateinit var fcmHelper: FcmHelper
|
@Inject lateinit var fcmHelper: FcmHelper
|
||||||
|
@Inject lateinit var nightlyProxy: NightlyProxy
|
||||||
|
|
||||||
private val createSpaceResultLauncher = registerStartForActivityResult { activityResult ->
|
private val createSpaceResultLauncher = registerStartForActivityResult { activityResult ->
|
||||||
if (activityResult.resultCode == Activity.RESULT_OK) {
|
if (activityResult.resultCode == Activity.RESULT_OK) {
|
||||||
|
@ -533,6 +535,9 @@ class HomeActivity :
|
||||||
|
|
||||||
// Force remote backup state update to update the banner if needed
|
// Force remote backup state update to update the banner if needed
|
||||||
serverBackupStatusViewModel.refreshRemoteStateIfNeeded()
|
serverBackupStatusViewModel.refreshRemoteStateIfNeeded()
|
||||||
|
|
||||||
|
// Check nightly
|
||||||
|
nightlyProxy.updateIfNewReleaseAvailable()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMenuRes() = R.menu.home
|
override fun getMenuRes() = R.menu.home
|
||||||
|
|
Loading…
Reference in New Issue