-
Notifications
You must be signed in to change notification settings - Fork 0
Add support for tracking push notification opens [sc-184466] #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -85,37 +85,43 @@ class RNMovableInkModule(reactContext: ReactApplicationContext) : | |||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @ReactMethod | ||||||||||||
| fun showInAppMessage(url: String, callback: Callback) { | ||||||||||||
| val activity = currentActivity | ||||||||||||
| if (activity is androidx.lifecycle.LifecycleOwner) { | ||||||||||||
| activity.lifecycleScope.launch { | ||||||||||||
| try { | ||||||||||||
| MIClient.showInAppBrowser( | ||||||||||||
| activity, | ||||||||||||
| url, | ||||||||||||
| listener = object : MovableInAppClient.OnUrlLoadingListener { | ||||||||||||
| override fun onButtonClicked(value: String) { | ||||||||||||
| activity.runOnUiThread { | ||||||||||||
| callback.invoke(value) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| ) | ||||||||||||
| } catch (e: Exception) { | ||||||||||||
| activity.runOnUiThread { | ||||||||||||
| callback.invoke("Error: ${e.message}") | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| @ReactMethod | ||||||||||||
| fun showInAppMessage(url: String, callback: Callback) { | ||||||||||||
| val activity = currentActivity | ||||||||||||
| if (activity is androidx.lifecycle.LifecycleOwner) { | ||||||||||||
| activity.lifecycleScope.launch { | ||||||||||||
| try { | ||||||||||||
| MIClient.showInAppBrowser( | ||||||||||||
| activity, | ||||||||||||
| url, | ||||||||||||
| listener = object : MovableInAppClient.OnUrlLoadingListener { | ||||||||||||
| override fun onButtonClicked(value: String) { | ||||||||||||
| activity.runOnUiThread { | ||||||||||||
| callback.invoke(value) | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| ) | ||||||||||||
| } catch (e: Exception) { | ||||||||||||
| activity.runOnUiThread { | ||||||||||||
| callback.invoke("Error: ${e.message}") | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @ReactMethod | ||||||||||||
| fun setValidPasteboardValues(values: ReadableArray) { | ||||||||||||
| MIClient.validPasteboardValues(values.toStringList()) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| @ReactMethod | ||||||||||||
| fun handlePushNotificationOpenedWithContent(properties: ReadableMap) { | ||||||||||||
| val map: Map<String, String> = properties.toHashMap().mapValues { it.value.toString() } | ||||||||||||
| MIClient.handlePushNotificationOpened(map) | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
Comment on lines
+121
to
+124
|
||||||||||||
| val map: Map<String, String> = properties.toHashMap().mapValues { it.value.toString() } | |
| MIClient.handlePushNotificationOpened(map) | |
| } | |
| MIClient.handlePushNotificationOpened(properties.toHashMap()) | |
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||
| apply plugin: "com.android.application" | ||||||
| apply plugin: "org.jetbrains.kotlin.android" | ||||||
| apply plugin: "com.facebook.react" | ||||||
| apply plugin: "com.google.gms.google-services" | ||||||
|
|
||||||
| // import com.android.build.OutputFile | ||||||
|
|
||||||
|
|
@@ -53,6 +54,14 @@ react { | |||||
| // hermesFlags = ["-O", "-output-source-map"] | ||||||
| } | ||||||
|
|
||||||
| repositories { | ||||||
| google() | ||||||
| mavenCentral() | ||||||
| maven { | ||||||
| url 'https://central.sonatype.com/repository/maven-snapshots/' | ||||||
chayelheinsen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| } | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Set this to true to create four separate APKs instead of one, | ||||||
| * one for each native architecture. This is useful if you don't | ||||||
|
|
@@ -94,7 +103,7 @@ android { | |||||
|
|
||||||
| compileSdkVersion rootProject.ext.compileSdkVersion | ||||||
|
|
||||||
| namespace "com.movableink.app" | ||||||
| namespace "com.movableink" | ||||||
|
||||||
| namespace "com.movableink" | |
| namespace "com.movableink.app" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,14 +3,14 @@ | |||||
| <uses-permission android:name="android.permission.INTERNET" /> | ||||||
|
|
||||||
| <application | ||||||
| android:name="com.movableink.MainApplication" | ||||||
| android:name=".MainApplication" | ||||||
|
||||||
| android:name=".MainApplication" | |
| android:name="com.movableink.MainApplication" |
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -12,6 +12,7 @@ import com.facebook.react.defaults.DefaultReactNativeHost | |||
| import com.facebook.react.flipper.ReactNativeFlipper | ||||
| import com.facebook.soloader.SoLoader | ||||
| import com.rnmovableink.BuildConfig | ||||
| import com.wix.reactnativenotifications.RNNotificationsPackage; | ||||
|
||||
| import com.wix.reactnativenotifications.RNNotificationsPackage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Their docs explicitly say to add this:
https://wix.github.io/react-native-notifications/docs/installation-android
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Maven repository URL has been changed from 's01.oss.sonatype.org/content/repositories/snapshots/' to 'central.sonatype.com/repository/maven-snapshots/'. However, 'central.sonatype.com' is not a valid Maven repository URL for fetching artifacts. The correct URL for Sonatype Central snapshots should be 'https://s01.oss.sonatype.org/content/repositories/snapshots/' or 'https://oss.sonatype.org/content/repositories/snapshots/'. The current URL will likely fail when attempting to resolve dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is interesting, when it was https://s01.oss.sonatype.org/content/repositories/snapshots/, the snapshot couldn't be found, but when I changed it, it could... @Graydyn Any ideas about this?