diff --git a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt
index 643435e8..50027a6b 100644
--- a/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt
+++ b/app/src/main/java/com/stevesoltys/seedvault/ui/storage/StorageRootFetcher.kt
@@ -156,11 +156,19 @@ internal class StorageRootFetcher(private val context: Context, private val isRe
data = Uri.parse("nc://login/server:")
putExtra("onlyAdd", true)
}
+ val marketIntent =
+ Intent(ACTION_VIEW, Uri.parse("market://details?id=$NEXTCLOUD_PACKAGE")).apply {
+ addFlags(FLAG_ACTIVITY_NEW_TASK)
+ }
val isInstalled = packageManager.resolveActivity(intent, 0) != null
+ val canInstall = packageManager.resolveActivity(marketIntent, 0) != null
val summaryRes = if (isInstalled) {
if (isRestore) R.string.storage_fake_nextcloud_summary_installed
else R.string.storage_fake_nextcloud_summary_unavailable
- } else R.string.storage_fake_nextcloud_summary
+ } else {
+ if (canInstall) R.string.storage_fake_nextcloud_summary
+ else R.string.storage_fake_nextcloud_summary_unavailable_market
+ }
val root = StorageRoot(
authority = AUTHORITY_NEXTCLOUD,
rootId = "fake",
@@ -171,15 +179,10 @@ internal class StorageRootFetcher(private val context: Context, private val isRe
availableBytes = null,
isUsb = false,
requiresNetwork = true,
- enabled = !isInstalled || isRestore,
+ enabled = isInstalled || canInstall,
overrideClickListener = {
if (isInstalled) context.startActivity(intent)
- else {
- val uri = Uri.parse("market://details?id=$NEXTCLOUD_PACKAGE")
- val i = Intent(ACTION_VIEW, uri)
- i.addFlags(FLAG_ACTIVITY_NEW_TASK)
- context.startActivity(i)
- }
+ else if (canInstall) context.startActivity(marketIntent)
}
)
roots.add(root)
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e502e9c7..7682402e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -54,6 +54,7 @@
Tap to install
Tap to set up account
Account not available. Set one up (or disable passcode).
+ Not installed
Initializing backup location…
This may take some time…
Looking for backups…