Skip to content

Commit

Permalink
Merge pull request #98 from mirzemehdi/rel_1.4.0
Browse files Browse the repository at this point in the history
Release 1.4.0
  • Loading branch information
mirzemehdi authored Dec 11, 2024
2 parents 5ca7b37 + 82e6de8 commit ba2ada3
Show file tree
Hide file tree
Showing 29 changed files with 496 additions and 128 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,21 @@ If you are using mac make sure you also allow notifications for browser from sys
You can send either local or push notification.

### Local Notification
Local notifications are supported on Android, iOS, JS and wasm targets.
Local notifications are supported on Android, iOS, JS and wasm targets. Image is supported on Android and iOS
#### Send notification

```kotlin
val notifier = NotifierManager.getLocalNotifier()
val notificationId = notifier.notify("Title", "Body")
// or you can use below to specify ID yourself
notifier.notify(1, "Title", "Body")


notifier.notify {
id= Random.nextInt(0, Int.MAX_VALUE)
title = "Title from KMPNotifier"
body = "Body message from KMPNotifier"
payloadData = mapOf(
Notifier.KEY_URL to "https://github.com/mirzemehdi/KMPNotifier/",
"extraKey" to "randomValue"
)
image = NotificationImage.Url("https://github.com/user-attachments/assets/a0f38159-b31d-4a47-97a7-cc230e15d30b")
}
```

#### Remove notification by Id or all notifications
Expand Down
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ allprojects {
group = "io.github.mirzemehdi"
version = project.properties["kmpNotifierVersion"] as String

val gpgKeySecret = gradleLocalProperties(rootDir).getProperty("gpgKeySecret")
val gpgKeyPassword = gradleLocalProperties(rootDir).getProperty("gpgKeyPassword")
val gpgKeySecret = gradleLocalProperties(rootDir, providers).getProperty("gpgKeySecret")
val gpgKeyPassword = gradleLocalProperties(rootDir, providers).getProperty("gpgKeyPassword")

val excludedModules = listOf(":sample")
if (project.path in excludedModules) return@allprojects
Expand Down Expand Up @@ -90,8 +90,8 @@ nexusPublishing {
sonatype { //only for users registered in Sonatype after 24 Feb 2021
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
val sonatypeUsername = gradleLocalProperties(rootDir).getProperty("sonatypeUsername")
val sonatypePassword = gradleLocalProperties(rootDir).getProperty("sonatypePassword")
val sonatypeUsername = gradleLocalProperties(rootDir, providers).getProperty("sonatypeUsername")
val sonatypePassword = gradleLocalProperties(rootDir, providers).getProperty("sonatypePassword")
username = sonatypeUsername
password = sonatypePassword
}
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 -Dkotlin.daemon.jvm.options\=
org.jetbrains.compose.experimental.uikit.enabled=true
org.jetbrains.compose.experimental.wasm.enabled=true


#Android
android.useAndroidX=true
android.nonTransitiveRClass=true
Expand All @@ -20,4 +19,4 @@ kotlin.mpp.enableCInteropCommonization=true
#Development
development=true

kmpNotifierVersion=1.3.0
kmpNotifierVersion=1.4.0
26 changes: 14 additions & 12 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
[versions]
compose = "1.7.2"
compose-plugin = "1.6.11"
agp = "8.2.2"
compose = "1.7.6"
compose-plugin = "1.7.1"
agp = "8.7.0"
android-minSdk = "21"
android-compileSdk = "34"
android-targetSdk = "34"
androidx-activityCompose = "1.9.2"
androidx-core-ktx = "1.13.1"
android-compileSdk = "35"
android-targetSdk = "35"
androidx-activityCompose = "1.9.3"
androidx-core-ktx = "1.15.0"
androidx-appcompat = "1.7.0"
androidx-material = "1.12.0"
androidx-constraintlayout = "2.1.4"
androidx-constraintlayout = "2.2.0"
androidx-test-junit = "1.2.1"
androidx-espresso-core = "3.6.1"
androidx-startup-runtime = "1.2.0"
kotlin = "2.0.20"
kotlin = "2.1.0"
junit = "4.13.2"
koin = "4.0.0"
kotlinx-binary-validator = "0.13.2"
kotlinx-binary-validator = "0.16.3"
dokka = "1.9.10"
firebase-messaging = "24.0.1"
kotlinx-coroutine = "1.9.0-RC.2"
firebase-messaging = "24.1.0"
kotlinx-coroutine = "1.9.0"
nexusPublish = "2.0.0"
kotlinx-browser = "0.3"



[libraries]
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" }
kotlinx-coroutine = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutine" }
kotlinx-browser = { module = "org.jetbrains.kotlinx:kotlinx-browser", version.ref = "kotlinx-browser" }
junit = { group = "junit", name = "junit", version.ref = "junit" }
compose-ui = { module = "androidx.compose.ui:ui", version.ref = "compose" }
compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "compose" }
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
22 changes: 13 additions & 9 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -55,7 +57,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down Expand Up @@ -83,7 +85,9 @@ done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -144,15 +148,15 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -201,11 +205,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
22 changes: 12 additions & 10 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down Expand Up @@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand Down
2 changes: 2 additions & 0 deletions iosApp/iosApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
Expand Down
46 changes: 44 additions & 2 deletions kmpnotifier/api/android/kmpnotifier.api
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,73 @@ public final class com/mmk/kmpnotifier/extensions/NotifierManagerExtKt {
public static final fun onCreateOrOnNewIntent (Lcom/mmk/kmpnotifier/notification/NotifierManager;Landroid/content/Intent;)V
}

public abstract class com/mmk/kmpnotifier/notification/NotificationImage {
}

public final class com/mmk/kmpnotifier/notification/NotificationImage$File : com/mmk/kmpnotifier/notification/NotificationImage {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lcom/mmk/kmpnotifier/notification/NotificationImage$File;
public static synthetic fun copy$default (Lcom/mmk/kmpnotifier/notification/NotificationImage$File;Ljava/lang/String;ILjava/lang/Object;)Lcom/mmk/kmpnotifier/notification/NotificationImage$File;
public fun equals (Ljava/lang/Object;)Z
public final fun getPath ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/mmk/kmpnotifier/notification/NotificationImage$Url : com/mmk/kmpnotifier/notification/NotificationImage {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lcom/mmk/kmpnotifier/notification/NotificationImage$Url;
public static synthetic fun copy$default (Lcom/mmk/kmpnotifier/notification/NotificationImage$Url;Ljava/lang/String;ILjava/lang/Object;)Lcom/mmk/kmpnotifier/notification/NotificationImage$Url;
public fun equals (Ljava/lang/Object;)Z
public final fun getUrl ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public abstract interface class com/mmk/kmpnotifier/notification/Notifier {
public static final field Companion Lcom/mmk/kmpnotifier/notification/Notifier$Companion;
public static final field KEY_URL Ljava/lang/String;
public abstract fun notify (ILjava/lang/String;Ljava/lang/String;Ljava/util/Map;)V
public abstract fun notify (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;)I
public abstract fun notify (Lkotlin/jvm/functions/Function1;)V
public abstract fun remove (I)V
public abstract fun removeAll ()V
}

public final class com/mmk/kmpnotifier/notification/Notifier$Companion {
public static final field KEY_URL Ljava/lang/String;
public final fun getKEY_URL ()Ljava/lang/String;
public final fun setKEY_URL (Ljava/lang/String;)V
}

public final class com/mmk/kmpnotifier/notification/Notifier$DefaultImpls {
public static synthetic fun notify$default (Lcom/mmk/kmpnotifier/notification/Notifier;ILjava/lang/String;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)V
public static synthetic fun notify$default (Lcom/mmk/kmpnotifier/notification/Notifier;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)I
}

public final class com/mmk/kmpnotifier/notification/NotifierBuilder {
public fun <init> ()V
public final fun getBody ()Ljava/lang/String;
public final fun getId ()I
public final fun getImage ()Lcom/mmk/kmpnotifier/notification/NotificationImage;
public final fun getPayloadData ()Ljava/util/Map;
public final fun getTitle ()Ljava/lang/String;
public final fun payload (Lkotlin/jvm/functions/Function1;)V
public final fun setBody (Ljava/lang/String;)V
public final fun setId (I)V
public final fun setImage (Lcom/mmk/kmpnotifier/notification/NotificationImage;)V
public final fun setPayloadData (Ljava/util/Map;)V
public final fun setTitle (Ljava/lang/String;)V
}

public final class com/mmk/kmpnotifier/notification/NotifierManager {
public static final field INSTANCE Lcom/mmk/kmpnotifier/notification/NotifierManager;
public final fun addListener (Lcom/mmk/kmpnotifier/notification/NotifierManager$Listener;)V
public final fun getLocalNotifier ()Lcom/mmk/kmpnotifier/notification/Notifier;
public final fun getPermissionUtil ()Lcom/mmk/kmpnotifier/permission/PermissionUtil;
public final fun getPushNotifier ()Lcom/mmk/kmpnotifier/notification/PushNotifier;
public final fun initialize (Lcom/mmk/kmpnotifier/notification/configuration/NotificationPlatformConfiguration;)V
public final fun setListener (Lcom/mmk/kmpnotifier/notification/NotifierManager$Listener;)V
}

public abstract interface class com/mmk/kmpnotifier/notification/NotifierManager$Listener {
Expand Down
46 changes: 44 additions & 2 deletions kmpnotifier/api/jvm/kmpnotifier.api
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,73 @@ public final class com/mmk/kmpnotifier/extensions/DesktopPlatformExtKt {
public static final fun composeDesktopResourcesPath ()Ljava/lang/String;
}

public abstract class com/mmk/kmpnotifier/notification/NotificationImage {
}

public final class com/mmk/kmpnotifier/notification/NotificationImage$File : com/mmk/kmpnotifier/notification/NotificationImage {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lcom/mmk/kmpnotifier/notification/NotificationImage$File;
public static synthetic fun copy$default (Lcom/mmk/kmpnotifier/notification/NotificationImage$File;Ljava/lang/String;ILjava/lang/Object;)Lcom/mmk/kmpnotifier/notification/NotificationImage$File;
public fun equals (Ljava/lang/Object;)Z
public final fun getPath ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public final class com/mmk/kmpnotifier/notification/NotificationImage$Url : com/mmk/kmpnotifier/notification/NotificationImage {
public fun <init> (Ljava/lang/String;)V
public final fun component1 ()Ljava/lang/String;
public final fun copy (Ljava/lang/String;)Lcom/mmk/kmpnotifier/notification/NotificationImage$Url;
public static synthetic fun copy$default (Lcom/mmk/kmpnotifier/notification/NotificationImage$Url;Ljava/lang/String;ILjava/lang/Object;)Lcom/mmk/kmpnotifier/notification/NotificationImage$Url;
public fun equals (Ljava/lang/Object;)Z
public final fun getUrl ()Ljava/lang/String;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}

public abstract interface class com/mmk/kmpnotifier/notification/Notifier {
public static final field Companion Lcom/mmk/kmpnotifier/notification/Notifier$Companion;
public static final field KEY_URL Ljava/lang/String;
public abstract fun notify (ILjava/lang/String;Ljava/lang/String;Ljava/util/Map;)V
public abstract fun notify (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;)I
public abstract fun notify (Lkotlin/jvm/functions/Function1;)V
public abstract fun remove (I)V
public abstract fun removeAll ()V
}

public final class com/mmk/kmpnotifier/notification/Notifier$Companion {
public static final field KEY_URL Ljava/lang/String;
public final fun getKEY_URL ()Ljava/lang/String;
public final fun setKEY_URL (Ljava/lang/String;)V
}

public final class com/mmk/kmpnotifier/notification/Notifier$DefaultImpls {
public static synthetic fun notify$default (Lcom/mmk/kmpnotifier/notification/Notifier;ILjava/lang/String;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)V
public static synthetic fun notify$default (Lcom/mmk/kmpnotifier/notification/Notifier;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)I
}

public final class com/mmk/kmpnotifier/notification/NotifierBuilder {
public fun <init> ()V
public final fun getBody ()Ljava/lang/String;
public final fun getId ()I
public final fun getImage ()Lcom/mmk/kmpnotifier/notification/NotificationImage;
public final fun getPayloadData ()Ljava/util/Map;
public final fun getTitle ()Ljava/lang/String;
public final fun payload (Lkotlin/jvm/functions/Function1;)V
public final fun setBody (Ljava/lang/String;)V
public final fun setId (I)V
public final fun setImage (Lcom/mmk/kmpnotifier/notification/NotificationImage;)V
public final fun setPayloadData (Ljava/util/Map;)V
public final fun setTitle (Ljava/lang/String;)V
}

public final class com/mmk/kmpnotifier/notification/NotifierManager {
public static final field INSTANCE Lcom/mmk/kmpnotifier/notification/NotifierManager;
public final fun addListener (Lcom/mmk/kmpnotifier/notification/NotifierManager$Listener;)V
public final fun getLocalNotifier ()Lcom/mmk/kmpnotifier/notification/Notifier;
public final fun getPermissionUtil ()Lcom/mmk/kmpnotifier/permission/PermissionUtil;
public final fun getPushNotifier ()Lcom/mmk/kmpnotifier/notification/PushNotifier;
public final fun initialize (Lcom/mmk/kmpnotifier/notification/configuration/NotificationPlatformConfiguration;)V
public final fun setListener (Lcom/mmk/kmpnotifier/notification/NotifierManager$Listener;)V
}

public abstract interface class com/mmk/kmpnotifier/notification/NotifierManager$Listener {
Expand Down
Loading

0 comments on commit ba2ada3

Please sign in to comment.