aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/phonesync/DocChannels.kt
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/phonesync/DocChannels.kt')
-rw-r--r--packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/phonesync/DocChannels.kt14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/phonesync/DocChannels.kt b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/phonesync/DocChannels.kt
index 2efe558..f4da64f 100644
--- a/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/phonesync/DocChannels.kt
+++ b/packages/meshbay-android/app/src/main/kotlin/org/meshbay/client/phonesync/DocChannels.kt
@@ -64,6 +64,7 @@ class DocChannels(
"sent" -> { sent(args.optString(0, ""), args.optString(1, ""), args.optString(2, "")); true }
"completed" -> { completed(); status() }
"failed" -> failed(args.optString(0, ""), args.optString(1, ""))
+ "open-settings" -> { openSettings(); true }
else -> throw Refused("Refused: no such channel")
}
@@ -167,6 +168,19 @@ class DocChannels(
permission = null
}
+ /**
+ * The application's page in the system's settings. Android keeps some
+ * permissions (text messages) behind "restricted settings" for an
+ * application installed outside a store; that page is where the person
+ * lifts it (⋮ > Allow restricted settings), and nowhere in here can.
+ */
+ private fun openSettings() {
+ val intent = android.content.Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS,
+ android.net.Uri.fromParts("package", activity.packageName, null))
+ .addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK)
+ activity.runOnUiThread { activity.startActivity(intent) }
+ }
+
/** From Activity.onRequestPermissionsResult; true when the request was ours. */
fun deliverPermission(requestCode: Int): Boolean {
if (requestCode != permissionRequest) return false