Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,7 @@ android/keystores/debug.keystore
lib/
.yarn/install-state.gz
example/.yarn/install-state.gz

google-services.json


15 changes: 10 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
google()
mavenCentral()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url 'https://central.sonatype.com/repository/maven-snapshots/'
Copy link

Copilot AI Jan 30, 2026

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.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

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?

}
}

Expand Down Expand Up @@ -75,8 +75,13 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += ["-Xskip-metadata-version-check"]
}

}
Expand All @@ -85,7 +90,7 @@ repositories {
mavenCentral()
google()
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
url 'https://central.sonatype.com/repository/maven-snapshots/'
}
}

Expand All @@ -97,7 +102,7 @@ dependencies {
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "com.movableink.sdk:inked:2.2.0"
implementation "com.movableink.sdk:inked:2.3.0-SNAPSHOT"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.7.0"

}
Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RNMovableInk_kotlinVersion=1.8.0
RNMovableInk_kotlinVersion=2.2.0
RNMovableInk_minSdkVersion=24
RNMovableInk_targetSdkVersion=33
RNMovableInk_compileSdkVersion=33
Expand Down
56 changes: 31 additions & 25 deletions android/src/main/java/com/rnmovableink/RNMovableInkModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type conversion using toString() may not preserve the original type information from the notification payload. This converts all values to strings, which could cause issues if the underlying MIClient.handlePushNotificationOpened expects other types like booleans, numbers, or nested objects. Consider preserving the original types or documenting that all notification data must be string-based.

Suggested change
val map: Map<String, String> = properties.toHashMap().mapValues { it.value.toString() }
MIClient.handlePushNotificationOpened(map)
}
MIClient.handlePushNotificationOpened(properties.toHashMap())
}

Copilot uses AI. Check for mistakes.
fun ReadableArray.toStringList(): List<String> {
val stringList = mutableListOf<String>()
for (i in 0 until size()) {
Expand Down
27 changes: 26 additions & 1 deletion example/android/app/build.gradle
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

Expand Down Expand Up @@ -53,6 +54,14 @@ react {
// hermesFlags = ["-O", "-output-source-map"]
}

repositories {
google()
mavenCentral()
maven {
url 'https://central.sonatype.com/repository/maven-snapshots/'
}
}

/**
* Set this to true to create four separate APKs instead of one,
* one for each native architecture. This is useful if you don't
Expand Down Expand Up @@ -94,7 +103,7 @@ android {

compileSdkVersion rootProject.ext.compileSdkVersion

namespace "com.movableink.app"
namespace "com.movableink"
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namespace has been changed from "com.movableink.app" to "com.movableink", but the applicationId remains "com.movableink.app". While this is valid (namespace and applicationId can differ), it could be confusing and may lead to issues. Ensure this discrepancy is intentional, as the namespace affects how Android resolves package references while applicationId is the unique identifier on Google Play.

Suggested change
namespace "com.movableink"
namespace "com.movableink.app"

Copilot uses AI. Check for mistakes.
defaultConfig {
applicationId "com.movableink.app"
minSdkVersion rootProject.ext.minSdkVersion
Expand Down Expand Up @@ -147,13 +156,29 @@ android {

// }
// }

kotlinOptions {
jvmTarget = "17"
freeCompilerArgs += ["-Xskip-metadata-version-check"]
}

packagingOptions {
resources {
excludes += ['META-INF/versions/9/OSGI-INF/MANIFEST.MF']
}
}
}

dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
implementation("com.facebook.react:flipper-integration")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.0.0")

// Firebase for push notifications
implementation platform('com.google.firebase:firebase-bom:32.7.0')
implementation 'com.google.firebase:firebase-messaging'
implementation project(':react-native-notifications')

// debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
// debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<uses-permission android:name="android.permission.INTERNET" />

<application
android:name="com.movableink.MainApplication"
android:name=".MainApplication"
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The android:name is changed to use relative package resolution ('.MainApplication' instead of 'com.movableink.MainApplication'). While this works with the namespace change in build.gradle (line 106), ensure this is intentional. The relative reference depends on the namespace being correctly set, which could cause issues if the namespace is ever misconfigured.

Suggested change
android:name=".MainApplication"
android:name="com.movableink.MainApplication"

Copilot uses AI. Check for mistakes.
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name="com.movableink.MainActivity"
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Copy link

Copilot AI Jan 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The RNNotificationsPackage import is unused. Since React Native's autolinking automatically includes the react-native-notifications package, this manual import is not necessary and can be removed.

Suggested change
import com.wix.reactnativenotifications.RNNotificationsPackage;

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


class MainApplication : Application(), ReactApplication {

Expand Down
9 changes: 7 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ buildscript {
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "25.1.8937393"
kotlinVersion = "1.9.24"
}
repositories {
google()
mavenCentral()
maven {
url 'https://central.sonatype.com/repository/maven-snapshots/'
}
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.android.tools.build:gradle:8.1.1")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("com.google.gms:google-services:4.4.0")
}
}

Expand Down
2 changes: 2 additions & 0 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ rootProject.name = 'MovableInkExample'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')
include ':react-native-notifications'
project(':react-native-notifications').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-notifications/lib/android/app')
16 changes: 16 additions & 0 deletions example/ios/MovableInkExample/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#import <React/RCTBundleURLProvider.h>
#import <MovableInk/MovableInk-Swift.h>
#import <React/RCTLinkingManager.h>
#import "RNNotifications.h"

@implementation AppDelegate

Expand All @@ -13,6 +14,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
// They will be passed down to the ViewController used by React Native.
self.initialProps = @{};

[RNNotifications startMonitorNotifications];

return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

Expand All @@ -27,6 +30,19 @@ - (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserAct
restorationHandler:restorationHandler];
}

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"Device Token: %@", deviceToken);
[RNNotifications didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}

- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
[RNNotifications didFailToRegisterForRemoteNotificationsWithError:error];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
[RNNotifications didReceiveBackgroundNotification:userInfo withCompletionHandler:completionHandler];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
Expand Down
2 changes: 2 additions & 0 deletions example/ios/MovableInkExample/MovableInkExample.entitlements
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>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:mi-mobile-sandbox.mimobile.xyz</string>
Expand Down
1 change: 1 addition & 0 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"dependencies": {
"react": "18.2.0",
"react-native": "0.73.5",
"react-native-notifications": "^5.2.2",
"react-native-svg": "^15.1.0",
"react-native-svg-transformer": "^1.3.0"
},
Expand Down
Loading