Skip to content

Commit

Permalink
Merge pull request #2 from thesarangal/upgrade
Browse files Browse the repository at this point in the history
- [Added] New Extension
  • Loading branch information
thesarangal authored Jan 25, 2024
2 parents daa6dae + 511ed5e commit f6b037e
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 2 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# ChangeLog

### Version 1.3.1
#### Date: April 01, 2023

##### Added

- ActivityExtension:
`openAppNotificationSettings`

##### Deprecated
- SafetyExtensions:
`isNotEmptyTrim()`: Use `isNotBlank()`
`isNotNullAndEmptyTrim()`: Use `isNotNullAndBlank()`

### Version 1.3.0
#### Date: April 01, 2023

Expand Down
3 changes: 1 addition & 2 deletions kotlinsupplement/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ plugins {

android {
compileSdk 33
buildToolsVersion '32.0.0'

defaultConfig {
minSdkVersion 16
Expand Down Expand Up @@ -70,7 +69,7 @@ afterEvaluate {
from components.release
groupId = "in.sarangal.kotlinsupplement"
artifactId = "KotlinSupplement"
version = '1.1.2'
version = '1.3.1'
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,28 @@ fun Activity.openAppSettings(
intent.data = uri
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK

try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
toast(exceptionMsg)
}
}

/**
* Open Application's Notification Setting Screen with Package Name
*
* @param applicationId Pass Package Name (BuildConfig.APPLICATION_ID)
* @param exceptionMsg Custom Message for Exception
* */
@RequiresApi(Build.VERSION_CODES.O)
fun Activity.openAppNotificationSettings(
applicationId: String,
exceptionMsg: String
) {
val intent: Intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
.putExtra(Settings.EXTRA_APP_PACKAGE, applicationId)

try {
startActivity(intent)
} catch (e: ActivityNotFoundException) {
Expand Down

0 comments on commit f6b037e

Please sign in to comment.