-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check notification permission on new pair alert (#118)
* Check notification permission on new pair alert * fix frequent sorting * Ask notification permission immediately if pair alerts already exist
- Loading branch information
Showing
5 changed files
with
87 additions
and
11 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
app/src/main/java/dev/arkbuilders/rate/data/permission/NotificationPermissionHelper.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package dev.arkbuilders.rate.data.permission | ||
|
||
import android.Manifest | ||
import android.content.Context | ||
import android.content.pm.PackageManager | ||
import android.os.Build | ||
import androidx.core.content.ContextCompat | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class NotificationPermissionHelper @Inject constructor( | ||
private val ctx: Context, | ||
) { | ||
fun isGranted(): Boolean { | ||
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { | ||
ContextCompat.checkSelfPermission(ctx, Manifest.permission.POST_NOTIFICATIONS) == | ||
PackageManager.PERMISSION_GRANTED | ||
} else { | ||
true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters