Skip to content

Commit

Permalink
feat(InAppUpdateManager): Add kdoc for the inAppUpdate manager
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianDevel committed Nov 15, 2024
1 parent c7e849e commit 89e83f0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import com.infomaniak.lib.core.utils.goToPlayStore
import com.infomaniak.lib.core.utils.showToast
import com.infomaniak.lib.stores.databinding.ActivityUpdateRequiredBinding
import com.infomaniak.lib.stores.updatemanagers.InAppUpdateManager
import io.sentry.Sentry
import kotlin.system.exitProcess
import com.infomaniak.lib.core.R as RCore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ import com.infomaniak.lib.stores.StoreUtils
import com.infomaniak.lib.stores.StoresSettingsRepository
import io.sentry.Sentry

/**
* Manager encapsulating all the needed logic for Google Play's in-app update api
* Implements [BaseInAppUpdateManager] to add compatibility with fDroid
*
* @param activity: Activity on which the lifecycleObserver will be bound
* @param appId: Parameter needed for the fDroid manager, won't compile without it
* @param versionCode: Parameter needed for the fDroid manager, won't compile without it
*/
class InAppUpdateManager(
private val activity: FragmentActivity,
appId: String,
Expand Down Expand Up @@ -149,7 +157,7 @@ class InAppUpdateManager(
.addOnSuccessListener { onInstallSuccess?.invoke() }
.addOnFailureListener {
viewModel.resetUpdateSettings()
onInstallFailure?.invoke(it)
onInstallFailure?.invoke(AppUpdateException(it.message))
}
}

Expand Down Expand Up @@ -196,4 +204,6 @@ class InAppUpdateManager(
AppUpdateOptions.newBuilder(updateType).build(),
)
}

private class AppUpdateException(override val message: String?) : Exception()
}

0 comments on commit 89e83f0

Please sign in to comment.