Get back the ability to open configuration files
Doesn't work in all applications because some applications pass an abstract URI instead of the file path in the 'content' scheme
This commit is contained in:
parent
0c2d661e1c
commit
6d0167dcf3
2 changed files with 45 additions and 5 deletions
|
|
@ -98,6 +98,34 @@
|
|||
|
||||
<data android:scheme="vpn" android:host="*" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
|
||||
<data android:scheme="file" />
|
||||
<data android:scheme="content" />
|
||||
<data android:mimeType="*/*" />
|
||||
<data android:host="*" />
|
||||
|
||||
<data android:pathPattern=".*\\.vpn" />
|
||||
<data android:pathPattern=".*\\..*\\.vpn" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.vpn" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\.vpn" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.vpn" />
|
||||
|
||||
<data android:pathPattern=".*\\.cfg" />
|
||||
<data android:pathPattern=".*\\..*\\.cfg" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.cfg" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\.cfg" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.cfg" />
|
||||
|
||||
<data android:pathPattern=".*\\.conf" />
|
||||
<data android:pathPattern=".*\\..*\\.conf" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\.conf" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\.conf" />
|
||||
<data android:pathPattern=".*\\..*\\..*\\..*\\..*\\.conf" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
|
|
|
|||
|
|
@ -55,15 +55,27 @@ class ImportConfigActivity : ComponentActivity() {
|
|||
return
|
||||
}
|
||||
|
||||
"text/plain" -> {
|
||||
intent.getStringExtra(EXTRA_TEXT)?.let(::startMainActivity)
|
||||
}
|
||||
"text/plain" -> intent.getStringExtra(EXTRA_TEXT)?.let(::startMainActivity)
|
||||
}
|
||||
}
|
||||
|
||||
ACTION_VIEW -> {
|
||||
Log.v(TAG, "Process VIEW action")
|
||||
intent.data?.toString()?.let(::startMainActivity)
|
||||
Log.v(TAG, "Process VIEW action, scheme: ${intent.scheme}")
|
||||
when (intent.scheme) {
|
||||
"file", "content" -> {
|
||||
intent.data?.let { uri ->
|
||||
checkPermissions(
|
||||
uri,
|
||||
onSuccess = ::processUri,
|
||||
onFail = ::finish
|
||||
)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
"vpn" -> intent.data?.toString()?.let(::startMainActivity)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
finish()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue