diff options
author | pacien | 2019-09-15 05:44:25 +0200 |
---|---|---|
committer | pacien | 2019-09-15 05:44:25 +0200 |
commit | 3bc69093654f61c723a70bca9d57ffd57062cb2f (patch) | |
tree | 64bc42d19317ff21cb4f0cb824a59ea9733eb1d0 /app | |
parent | 5de0313f16382ab97c14661222d8be51c5fc6e72 (diff) | |
download | tincapp-3bc69093654f61c723a70bca9d57ffd57062cb2f.tar.gz |
notify user of missing vpn permission
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt index 0e50060..877492d 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon | 2 | * Tinc App, an Android binding and user interface for the tinc mesh VPN daemon |
3 | * Copyright (C) 2017-2018 Pacien TRAN-GIRARD | 3 | * Copyright (C) 2017-2019 Pacien TRAN-GIRARD |
4 | * | 4 | * |
5 | * This program is free software: you can redistribute it and/or modify | 5 | * This program is free software: you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by | 6 | * it under the terms of the GNU General Public License as published by |
@@ -31,6 +31,7 @@ import org.pacien.tincapp.activities.common.ProgressModal | |||
31 | import org.pacien.tincapp.activities.common.RecentCrashHandler | 31 | import org.pacien.tincapp.activities.common.RecentCrashHandler |
32 | import org.pacien.tincapp.activities.configure.ConfigureActivity | 32 | import org.pacien.tincapp.activities.configure.ConfigureActivity |
33 | import org.pacien.tincapp.activities.status.StatusActivity | 33 | import org.pacien.tincapp.activities.status.StatusActivity |
34 | import org.pacien.tincapp.context.App | ||
34 | import org.pacien.tincapp.intent.Actions | 35 | import org.pacien.tincapp.intent.Actions |
35 | import org.pacien.tincapp.intent.BroadcastMapper | 36 | import org.pacien.tincapp.intent.BroadcastMapper |
36 | import org.pacien.tincapp.service.TincVpnService | 37 | import org.pacien.tincapp.service.TincVpnService |
@@ -86,10 +87,15 @@ class StartActivity : BaseActivity() { | |||
86 | } | 87 | } |
87 | 88 | ||
88 | override fun onActivityResult(request: Int, result: Int, data: Intent?): Unit = when (request) { | 89 | override fun onActivityResult(request: Int, result: Int, data: Intent?): Unit = when (request) { |
89 | permissionRequestCode -> if (result == Activity.RESULT_OK) connectionStarter.tryStart() else Unit | 90 | permissionRequestCode -> continueConnectionStart(result) |
90 | else -> throw IllegalArgumentException("Result for unknown request received.") | 91 | else -> throw IllegalArgumentException("Result for unknown request received.") |
91 | } | 92 | } |
92 | 93 | ||
94 | private fun continueConnectionStart(result: Int): Unit = when (result) { | ||
95 | Activity.RESULT_OK -> connectionStarter.tryStart() | ||
96 | else -> App.alert(R.string.notification_error_title_unable_to_start_tinc, getString(R.string.notification_error_message_could_not_bind_iface)) | ||
97 | } | ||
98 | |||
93 | private fun onVpnStart() { | 99 | private fun onVpnStart() { |
94 | connectDialog?.dismiss() | 100 | connectDialog?.dismiss() |
95 | if (connectionStarter.displayStatus()) openStatusActivity() | 101 | if (connectionStarter.displayStatus()) openStatusActivity() |