Skip to content

Commit

Permalink
Use new QuickPermissions parameter to remove duplicate check
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Oct 3, 2023
1 parent 55606a5 commit 167eeaf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dependencies {
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.preference:preference-ktx:1.2.0'

implementation 'com.github.cyb3rko:QuickPermissions-Kotlin:1.0.2'
implementation 'com.github.cyb3rko:QuickPermissions-Kotlin:1.1.1'
implementation 'com.hypertrack:hyperlog:0.0.10'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'io.noties.markwon:core:4.6.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.app.AlarmManager
import android.app.NotificationManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Build
import android.os.Bundle
Expand Down Expand Up @@ -195,15 +194,10 @@ internal class InitializationActivity : AppCompatActivity() {
private fun runWithPostNotificationsPermission(action: () -> Unit) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
// Android 13 and above
if (checkSelfPermission(Manifest.permission.POST_NOTIFICATIONS)
!= PackageManager.PERMISSION_GRANTED
) {
splashScreenActive = false
setContentView(R.layout.splash)
}
val quickPermissionsOption = QuickPermissionsOptions(
handleRationale = true,
handlePermanentlyDenied = true,
preRationaleAction = { stopSlashScreen() },
rationaleMethod = { req -> processPermissionRationale(req) },
permissionsDeniedMethod = { req -> processPermissionRationale(req) },
permanentDeniedMethod = { req -> processPermissionsPermanentDenied(req) }
Expand All @@ -219,6 +213,11 @@ internal class InitializationActivity : AppCompatActivity() {
}
}

private fun stopSlashScreen() {
splashScreenActive = false
setContentView(R.layout.splash)
}

private fun processPermissionRationale(req: QuickPermissionsRequest) {
MaterialAlertDialogBuilder(this)
.setMessage(getString(R.string.permissions_notification_denied_temp))
Expand Down

3 comments on commit 167eeaf

@jmattheis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this is about, doesn't seem related to the gotify project.

@cyb3rko
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does your GitHub plan merge two phones into one, what is a "schok" device, what is the screenshot for and what does all of that have to do with Gotify?
I'm confused xD

@cyb3rko
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And why are we commenting on my permission related commit?

Please sign in to comment.