-
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.
* Update plugin to proxy 10.0.0 * Wire up lu/la * Changelog * Update changelog
- Loading branch information
Showing
49 changed files
with
1,279 additions
and
100 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -3,5 +3,5 @@ | |
package com.airship.capacitor | ||
|
||
object AirshipCapacitorVersion { | ||
var version = "2.2.0" | ||
var version = "2.3.0" | ||
} |
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
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
69 changes: 69 additions & 0 deletions
69
example/android/app/src/main/java/com/example/plugin/AirshipExtender.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,69 @@ | ||
package com.example.plugin | ||
|
||
import android.app.NotificationChannel | ||
import android.app.NotificationManager | ||
import android.app.PendingIntent | ||
import android.content.Context | ||
import android.content.Intent | ||
import android.os.Build | ||
import androidx.annotation.Keep | ||
import androidx.core.app.NotificationCompat | ||
import androidx.core.app.NotificationManagerCompat | ||
import com.urbanairship.UAirship | ||
import com.urbanairship.android.framework.proxy.AirshipPluginExtender | ||
import com.urbanairship.json.requireField | ||
import com.urbanairship.liveupdate.LiveUpdate | ||
import com.urbanairship.liveupdate.LiveUpdateEvent | ||
import com.urbanairship.liveupdate.LiveUpdateManager | ||
import com.urbanairship.liveupdate.LiveUpdateResult | ||
import com.urbanairship.liveupdate.SuspendLiveUpdateNotificationHandler | ||
|
||
|
||
@Keep | ||
public final class AirshipExtender: AirshipPluginExtender { | ||
override fun onAirshipReady(context: Context, airship: UAirship) { | ||
LiveUpdateManager.shared().register("Example", ExampleLiveUpdateHandler()) | ||
} | ||
} | ||
|
||
public final class ExampleLiveUpdateHandler: SuspendLiveUpdateNotificationHandler() { | ||
override suspend fun onUpdate( | ||
context: Context, | ||
event: LiveUpdateEvent, | ||
update: LiveUpdate | ||
): LiveUpdateResult<NotificationCompat.Builder> { | ||
|
||
if (event == LiveUpdateEvent.END) { | ||
// Dismiss the live update on END. The default behavior will leave the Live Update | ||
// in the notification tray until the dismissal time is reached or the user dismisses it. | ||
return LiveUpdateResult.cancel() | ||
} | ||
|
||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
val importance = NotificationManager.IMPORTANCE_DEFAULT | ||
val channel = NotificationChannel("emoji-example", "Emoji example", importance) | ||
channel.description = "Emoji example" | ||
NotificationManagerCompat.from(context).createNotificationChannel(channel) | ||
} | ||
|
||
val launchIntent = context.packageManager | ||
.getLaunchIntentForPackage(context.packageName) | ||
?.addCategory(update.name) | ||
?.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP) | ||
?.setPackage(null) | ||
|
||
val contentIntent = PendingIntent.getActivity( | ||
context, 0, launchIntent, PendingIntent.FLAG_IMMUTABLE | ||
) | ||
|
||
val notification = NotificationCompat.Builder(context, "emoji-example") | ||
.setSmallIcon(R.drawable.ic_notification) | ||
.setPriority(NotificationCompat.PRIORITY_MAX) | ||
.setCategory(NotificationCompat.CATEGORY_EVENT) | ||
.setContentTitle("Example Live Update") | ||
.setContentText(update.content.requireField<String>("emoji")) | ||
.setContentIntent(contentIntent) | ||
|
||
return LiveUpdateResult.ok(notification) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
example/android/app/src/main/res/drawable-anydpi-v24/ic_notification.xml
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,15 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="24dp" | ||
android:height="24dp" | ||
android:viewportWidth="24" | ||
android:viewportHeight="24" | ||
android:tint="#FFFFFF"> | ||
<group android:scaleX="0.92" | ||
android:scaleY="0.92" | ||
android:translateX="0.96" | ||
android:translateY="0.96"> | ||
<path | ||
android:pathData="M17.6,11.48 L19.44,8.3a0.63,0.63 0,0 0,-1.09 -0.63l-1.88,3.24a11.43,11.43 0,0 0,-8.94 0L5.65,7.67a0.63,0.63 0,0 0,-1.09 0.63L6.4,11.48A10.81,10.81 0,0 0,1 20L23,20A10.81,10.81 0,0 0,17.6 11.48ZM7,17.25A1.25,1.25 0,1 1,8.25 16,1.25 1.25,0 0,1 7,17.25ZM17,17.25A1.25,1.25 0,1 1,18.25 16,1.25 1.25,0 0,1 17,17.25Z" | ||
android:fillColor="#FF000000"/> | ||
</group> | ||
</vector> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+508 Bytes
example/android/app/src/main/res/drawable-xhdpi/ic_notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+769 Bytes
example/android/app/src/main/res/drawable-xxhdpi/ic_notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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.2.1-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip | ||
networkTimeout=10000 | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.