theme and lang save. Notification fix
This commit is contained in:
@@ -224,10 +224,22 @@ class VpnPlugin(private val activity: Activity) : Plugin(activity) {
|
||||
}
|
||||
}
|
||||
|
||||
private fun requestNotificationPermission() {
|
||||
if (android.os.Build.VERSION.SDK_INT >= 33) {
|
||||
val permission = "android.permission.POST_NOTIFICATIONS"
|
||||
if (androidx.core.content.ContextCompat.checkSelfPermission(activity, permission) !=
|
||||
android.content.pm.PackageManager.PERMISSION_GRANTED) {
|
||||
|
||||
androidx.core.app.ActivityCompat.requestPermissions(activity, arrayOf(permission), 101)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun load(webView: WebView) {
|
||||
super.load(webView)
|
||||
try { System.loadLibrary("netrunner_client") } catch (e: Exception) { Log.e(TAG, "Lib fail") }
|
||||
|
||||
requestNotificationPermission()
|
||||
val filter = IntentFilter("com.netrunner.vpn.STATUS_UPDATE")
|
||||
if (Build.VERSION.SDK_INT >= 33) {
|
||||
activity.registerReceiver(statusReceiver, filter, Context.RECEIVER_NOT_EXPORTED)
|
||||
|
||||
Reference in New Issue
Block a user