aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/org/pacien/tincapp/activities/start/StartActivity.kt10
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
31import org.pacien.tincapp.activities.common.RecentCrashHandler 31import org.pacien.tincapp.activities.common.RecentCrashHandler
32import org.pacien.tincapp.activities.configure.ConfigureActivity 32import org.pacien.tincapp.activities.configure.ConfigureActivity
33import org.pacien.tincapp.activities.status.StatusActivity 33import org.pacien.tincapp.activities.status.StatusActivity
34import org.pacien.tincapp.context.App
34import org.pacien.tincapp.intent.Actions 35import org.pacien.tincapp.intent.Actions
35import org.pacien.tincapp.intent.BroadcastMapper 36import org.pacien.tincapp.intent.BroadcastMapper
36import org.pacien.tincapp.service.TincVpnService 37import 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()