summaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2019-12-04 13:55:04 +0100
committerArne Schwabe <arne@rfc2549.org>2019-12-04 13:55:04 +0100
commite8e10c931384d665d0f1b60a3a5ae7781b7d423f (patch)
treebebf5d422a37e5ed04b5434e389aaa7afab58819 /main/src
parentf998355bde3212f43a6b45db81d60f36119c4d10 (diff)
Fix importing profiles
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt14
1 files changed, 11 insertions, 3 deletions
diff --git a/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt b/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt
index b91628a2..972ff479 100644
--- a/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt
+++ b/main/src/ui/java/de/blinkt/openvpn/activities/ConfigConverter.kt
@@ -612,6 +612,13 @@ class ConfigConverter : BaseActivity(), FileSelectCallback, View.OnClickListener
startImportTask(Uri.fromParts("inline", "inlinetext", null),
"imported profiles from AS", data);
}
+ } else if (intent.action.equals(IMPORT_PROFILE)) {
+ val data = intent.data
+ if (data != null) {
+ mSourceUri = data
+ doImportUri(data)
+
+ }
}
}
@@ -658,7 +665,7 @@ class ConfigConverter : BaseActivity(), FileSelectCallback, View.OnClickListener
}
- private fun startImportTask(data: Uri, possibleName: String?, inlineData:String) {
+ private fun startImportTask(data: Uri, possibleName: String?, inlineData: String) {
mImportTask = object : AsyncTask<Void, Void, Int>() {
private var mProgress: ProgressBar? = null
@@ -669,7 +676,7 @@ class ConfigConverter : BaseActivity(), FileSelectCallback, View.OnClickListener
override fun doInBackground(vararg params: Void): Int? {
try {
- var inputStream:InputStream?
+ var inputStream: InputStream?
if (data.scheme.equals("inline")) {
inputStream = inlineData.byteInputStream()
} else {
@@ -763,10 +770,11 @@ class ConfigConverter : BaseActivity(), FileSelectCallback, View.OnClickListener
} catch (e: ConfigParseError) {
log(R.string.error_reading_config_file)
log(e.localizedMessage)
+ } finally {
+ inputStream.close()
}
mResult = null
- inputStream.close()
}