mirror of
https://github.com/dovecoteescapee/ByeDPIAndroid.git
synced 2024-12-22 14:26:22 +00:00
Merge pull request #42 from kaajjo/master
fix: request `POST_NOTIFICATIONS` permission
This commit is contained in:
commit
b5cf8dede8
@ -1,10 +1,12 @@
|
|||||||
package io.github.dovecoteescapee.byedpi.activities
|
package io.github.dovecoteescapee.byedpi.activities
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.net.VpnService
|
import android.net.VpnService
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@ -14,6 +16,7 @@ import android.view.MenuItem
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
|
import androidx.core.content.ContextCompat
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import io.github.dovecoteescapee.byedpi.R
|
import io.github.dovecoteescapee.byedpi.R
|
||||||
import io.github.dovecoteescapee.byedpi.data.AppStatus
|
import io.github.dovecoteescapee.byedpi.data.AppStatus
|
||||||
@ -154,6 +157,15 @@ class MainActivity : AppCompatActivity() {
|
|||||||
val theme = getPreferences(this)
|
val theme = getPreferences(this)
|
||||||
.getString("app_theme", null)
|
.getString("app_theme", null)
|
||||||
SettingsFragment.setTheme(theme ?: "system")
|
SettingsFragment.setTheme(theme ?: "system")
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU &&
|
||||||
|
ContextCompat.checkSelfPermission(
|
||||||
|
this,
|
||||||
|
Manifest.permission.POST_NOTIFICATIONS
|
||||||
|
) != PackageManager.PERMISSION_GRANTED
|
||||||
|
) {
|
||||||
|
requestPermissions(arrayOf(Manifest.permission.POST_NOTIFICATIONS), 1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
Loading…
Reference in New Issue
Block a user