Skip to content

Commit

Permalink
Target Android 13
Browse files Browse the repository at this point in the history
  • Loading branch information
robinlinden committed Sep 1, 2023
1 parent 35d9908 commit b3684d8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions atox/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
Expand Down
11 changes: 11 additions & 0 deletions atox/src/main/kotlin/ui/contactlist/ContactListFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

package ltd.evilcorp.atox.ui.contactlist

import android.Manifest
import android.os.Build
import android.os.Bundle
import android.text.method.PasswordTransformationMethod
Expand Down Expand Up @@ -36,6 +37,7 @@ import ltd.evilcorp.atox.databinding.ContactListViewItemBinding
import ltd.evilcorp.atox.databinding.FragmentContactListBinding
import ltd.evilcorp.atox.databinding.FriendRequestItemBinding
import ltd.evilcorp.atox.databinding.NavHeaderContactListBinding
import ltd.evilcorp.atox.hasPermission
import ltd.evilcorp.atox.truncated
import ltd.evilcorp.atox.ui.BaseFragment
import ltd.evilcorp.atox.ui.ReceiveShareDialogFragment
Expand Down Expand Up @@ -66,6 +68,10 @@ class ContactListFragment :
private var _navHeader: NavHeaderContactListBinding? = null
private val navHeader get() = _navHeader!!

private val requestPermissionLauncher = registerForActivityResult(
ActivityResultContracts.RequestPermission(),
) { _ -> }

private var backupFileNameHint = "something_is_broken.tox"

private var passwordDialog: AlertDialog? = null
Expand All @@ -84,6 +90,11 @@ class ContactListFragment :

override fun onViewCreated(view: View, savedInstanceState: Bundle?): Unit = binding.run {
if (!viewModel.isToxRunning()) return@run
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
if (!requireContext().hasPermission(Manifest.permission.POST_NOTIFICATIONS)) {
requestPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS)
}
}

ViewCompat.setOnApplyWindowInsetsListener(view) { _, compat ->
val insets = compat.getInsets(WindowInsetsCompat.Type.systemBars())
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]
sdk-min = "19"
sdk-target = "31"
sdk-target = "33"

kotlin = "1.9.10"
ksp = "1.9.10-1.0.13"
Expand Down

0 comments on commit b3684d8

Please sign in to comment.