@moxtradeveloper/react-native-moxo-module 10.11.2 → 10.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,8 +10,9 @@ Moxo is an AI workflow automation platform for business operations.
10
10
 
11
11
  ### Supported Platforms
12
12
 
13
- * iOS 15.0+
13
+ * iOS 15.6+
14
14
  * Android 7+
15
+ * React Native 0.80+ with the New Architecture
15
16
 
16
17
  ## Preparation
17
18
 
@@ -24,11 +25,33 @@ Below sdk or tools are required before start to use react-native-moxo-module.
24
25
 
25
26
  * Android Studio
26
27
  * Android SDK API 24+ (Android 7.0)
28
+ * compileSdk 37+
29
+ * Android Gradle Plugin 9.1+
30
+ * Kotlin 2.3+. The React Native template defaults to Kotlin 2.2, so pin the Kotlin Gradle plugin in `android/build.gradle`:
31
+
32
+ ```groovy
33
+ buildscript {
34
+ dependencies {
35
+ classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.3.20")
36
+ }
37
+ }
38
+ ```
39
+
40
+ * Jetifier, because some of the SDK's dependencies still use the Android Support Library. Add this to `android/gradle.properties`:
41
+
42
+ ```properties
43
+ android.enableJetifier=true
44
+ ```
27
45
 
28
46
  ### iOS
29
47
 
30
48
  * Xcode v26+
31
49
  * Cocoapod v1.16.2+
50
+ * Deployment target 15.6+. The React Native template defaults to 15.1, so raise it in `ios/Podfile` and set the app target's iOS Deployment Target to 15.6 in Xcode:
51
+
52
+ ```ruby
53
+ platform :ios, '15.6'
54
+ ```
32
55
 
33
56
  For more react-native set up details, please ref to [react native official site](https://reactnative.dev/docs/environment-setup)
34
57
 
@@ -96,6 +119,19 @@ If user is logged in, call open chat API to open existing chat. If not logged in
96
119
  moxo.openChat('CBSmiUUjyIJP7gR8YIpiagvH', '')
97
120
  ```
98
121
 
122
+ ### Events
123
+
124
+ Event callbacks return a subscription. Call `remove()` on it when you no longer need the callback.
125
+
126
+ ```js
127
+ const subscription = moxo.onUnreadMessageCountUpdated((count) => {
128
+ console.log(`Unread messages: ${count}`);
129
+ });
130
+
131
+ // Later
132
+ subscription.remove();
133
+ ```
134
+
99
135
  ### Notification
100
136
 
101
137
  To enable notification feature, you'll need to integrate a notification module first, here we take [react-native-notifications](https://www.npmjs.com/package/react-native-notifications) for example, which can help to get device token and notification payload.
@@ -1,169 +1,63 @@
1
- buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
- def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : project.properties['MoxoModule_kotlinVersion']
4
-
5
- repositories {
6
- google()
7
- mavenCentral()
8
- maven() {
9
- url "https://mxrepo.moxo.com/repository/customer-maven-releases/"
10
- }
11
- }
12
-
13
- dependencies {
14
- classpath 'com.android.tools.build:gradle:3.5.3'
15
- // noinspection DifferentKotlinGradleVersion
16
- classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
17
- }
1
+ def getExtOrDefault(name) {
2
+ return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['MoxoModule_' + name]
18
3
  }
19
4
 
20
- rootProject.allprojects {
21
- repositories {
22
- google()
23
- mavenCentral()
24
- jcenter()
25
- maven() {
26
- url "https://mxrepo.moxo.com/repository/customer-maven-releases/"
27
- }
28
- }
5
+ def getExtOrIntegerDefault(name) {
6
+ return getExtOrDefault(name).toInteger()
29
7
  }
30
8
 
31
- def isNewArchitectureEnabled() {
32
- return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
33
- }
9
+ // AGP 9 compiles Kotlin itself unless the app opts out with android.builtInKotlin=false.
10
+ def builtInKotlin = (project.findProperty('android.builtInKotlin') ?: 'true').toString().toBoolean()
34
11
 
35
12
  apply plugin: 'com.android.library'
36
- apply plugin: 'kotlin-android'
37
-
38
- if (isNewArchitectureEnabled()) {
39
- apply plugin: 'com.facebook.react'
40
- }
41
-
42
- def getExtOrDefault(name) {
43
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['MoxoModule_' + name]
13
+ if (!builtInKotlin) {
14
+ apply plugin: 'org.jetbrains.kotlin.android'
44
15
  }
16
+ apply plugin: 'com.facebook.react'
45
17
 
46
- def getExtOrIntegerDefault(name) {
47
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['MoxoModule_' + name]).toInteger()
18
+ // The app has to resolve mep-sdk and its dependencies from the Moxo repository.
19
+ rootProject.allprojects {
20
+ repositories {
21
+ maven {
22
+ url = 'https://mxrepo.moxo.com/repository/customer-maven-releases/'
23
+ }
24
+ }
48
25
  }
49
26
 
50
27
  android {
51
- compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
52
- namespace "com.moxomodule"
28
+ namespace = 'com.moxomodule'
29
+ compileSdk = getExtOrIntegerDefault('compileSdkVersion')
53
30
 
54
31
  defaultConfig {
55
- minSdkVersion getExtOrIntegerDefault('minSdkVersion')
56
- targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
57
- buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
32
+ minSdk = getExtOrIntegerDefault('minSdkVersion')
33
+ targetSdk = getExtOrIntegerDefault('targetSdkVersion')
58
34
  }
35
+
59
36
  buildTypes {
60
37
  release {
61
- minifyEnabled false
38
+ minifyEnabled = false
62
39
  }
63
40
  }
64
41
 
65
- lintOptions {
42
+ lint {
66
43
  disable 'GradleCompatible'
67
44
  }
68
45
 
69
46
  compileOptions {
70
- sourceCompatibility JavaVersion.VERSION_17
71
- targetCompatibility JavaVersion.VERSION_17
72
- }
73
-
74
- kotlinOptions {
75
- jvmTarget = "17"
47
+ sourceCompatibility = JavaVersion.VERSION_17
48
+ targetCompatibility = JavaVersion.VERSION_17
76
49
  }
77
-
78
- buildFeatures {
79
- buildConfig true
80
- }
81
50
  }
82
51
 
83
- repositories {
84
- mavenCentral()
85
- google()
86
-
87
- def found = false
88
- def defaultDir = null
89
- def androidSourcesName = 'React Native sources'
90
-
91
- if (rootProject.ext.has('reactNativeAndroidRoot')) {
92
- defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
93
- } else {
94
- defaultDir = new File(
95
- projectDir,
96
- '/../../../node_modules/react-native/android'
97
- )
98
- }
99
-
100
- if (defaultDir.exists()) {
101
- maven {
102
- url defaultDir.toString()
103
- name androidSourcesName
52
+ if (!builtInKotlin) {
53
+ kotlin {
54
+ compilerOptions {
55
+ jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_17
104
56
  }
105
-
106
- logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
107
- found = true
108
- } else {
109
- def parentDir = rootProject.projectDir
110
-
111
- 1.upto(5, {
112
- if (found) return true
113
- parentDir = parentDir.parentFile
114
-
115
- def androidSourcesDir = new File(
116
- parentDir,
117
- 'node_modules/react-native'
118
- )
119
-
120
- def androidPrebuiltBinaryDir = new File(
121
- parentDir,
122
- 'node_modules/react-native/android'
123
- )
124
-
125
- if (androidPrebuiltBinaryDir.exists()) {
126
- maven {
127
- url androidPrebuiltBinaryDir.toString()
128
- name androidSourcesName
129
- }
130
-
131
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
132
- found = true
133
- } else if (androidSourcesDir.exists()) {
134
- maven {
135
- url androidSourcesDir.toString()
136
- name androidSourcesName
137
- }
138
-
139
- logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
140
- found = true
141
- }
142
- })
143
- }
144
-
145
- if (!found) {
146
- throw new GradleException(
147
- "${project.name}: unable to locate React Native android sources. " +
148
- "Ensure you have you installed React Native as a dependency in your project and try again."
149
- )
150
57
  }
151
58
  }
152
59
 
153
- def kotlin_version = getExtOrDefault('kotlinVersion')
154
-
155
60
  dependencies {
156
- //noinspection GradleDynamicVersion
157
- implementation "com.facebook.react:react-native:+"
158
- implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
159
- implementation "com.moxtra:mep-sdk:10.11.1"
160
- // From node_modules
161
- }
162
-
163
- if (isNewArchitectureEnabled()) {
164
- react {
165
- jsRootDir = file("../src/")
166
- libraryName = "MoxoModule"
167
- codegenJavaPackageName = "com.moxomodule"
168
- }
61
+ implementation 'com.facebook.react:react-android'
62
+ implementation 'com.moxtra:mep-sdk:10.13.1'
169
63
  }
@@ -1,5 +1,3 @@
1
- MoxoModule_kotlinVersion=1.7.0
2
- MoxoModule_minSdkVersion=21
3
- MoxoModule_targetSdkVersion=31
4
- MoxoModule_compileSdkVersion=31
5
- MoxoModule_ndkversion=21.4.7075529
1
+ MoxoModule_minSdkVersion=24
2
+ MoxoModule_targetSdkVersion=36
3
+ MoxoModule_compileSdkVersion=37