@moxtradeveloper/react-native-moxo-module 9.9.7 → 10.1.3
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
|
@@ -56,6 +56,25 @@ install! 'cocoapods', :deterministic_uuids => false
|
|
|
56
56
|
# Rest of the file.....
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
+
Exception:
|
|
60
|
+

|
|
61
|
+
if you getting this error post moxo plugin installation, please also add master cocoapod repo as source into Podfile under your iOS project.
|
|
62
|
+
Usually is https://github.com/CocoaPods/Specs.git
|
|
63
|
+
|
|
64
|
+
```ruby
|
|
65
|
+
require_relative '../node_modules/react-native/scripts/react_native_pods'
|
|
66
|
+
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
|
|
67
|
+
#Add moxo source here
|
|
68
|
+
source 'https://maven.moxtra.com/repo/moxtra-specs.git'
|
|
69
|
+
source 'https://github.com/CocoaPods/Specs.git'
|
|
70
|
+
|
|
71
|
+
#Change platform version if is not iOS 13
|
|
72
|
+
platform :ios, '13.0'
|
|
73
|
+
install! 'cocoapods', :deterministic_uuids => false
|
|
74
|
+
|
|
75
|
+
# Rest of the file.....
|
|
76
|
+
```
|
|
77
|
+
|
|
59
78
|
## Initialization
|
|
60
79
|
|
|
61
80
|
### Login
|
package/android/build.gradle
CHANGED
|
@@ -148,7 +148,7 @@ dependencies {
|
|
|
148
148
|
//noinspection GradleDynamicVersion
|
|
149
149
|
implementation "com.facebook.react:react-native:+"
|
|
150
150
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
151
|
-
implementation "com.moxtra:mep-sdk:
|
|
151
|
+
implementation "com.moxtra:mep-sdk:10.1.3"
|
|
152
152
|
// From node_modules
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -9,6 +9,7 @@ import com.moxtra.mepsdk.MEPClient
|
|
|
9
9
|
import com.moxtra.mepsdk.MEPClientDelegate
|
|
10
10
|
import com.moxtra.mepsdk.data.MEPStartMeetOptions
|
|
11
11
|
import com.moxtra.sdk.LinkConfig
|
|
12
|
+
import com.moxtra.sdk.common.ActionListener
|
|
12
13
|
import com.moxtra.sdk.common.ApiCallback
|
|
13
14
|
import org.json.JSONArray
|
|
14
15
|
import org.json.JSONException
|
|
@@ -22,7 +23,8 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
22
23
|
private var mReactContext = reactContext
|
|
23
24
|
|
|
24
25
|
private val UNREAD_MSG_EVENT = "onUnreadMessageCountUpdated"
|
|
25
|
-
|
|
26
|
+
private val TAP_WINDOW_CLOSE_EVENT = "tapWindowCloseEvent"
|
|
27
|
+
|
|
26
28
|
override fun getName(): String {
|
|
27
29
|
return NAME
|
|
28
30
|
}
|
|
@@ -32,17 +34,15 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
32
34
|
Log.d(TAG, "setup called with domain: $domain, options: $options")
|
|
33
35
|
var linkConfig: LinkConfig? = null
|
|
34
36
|
try {
|
|
35
|
-
if (domain
|
|
36
|
-
if (options != null && options is String) {
|
|
37
|
+
if (!domain.isNullOrEmpty() && !options.isNullOrEmpty()) {
|
|
37
38
|
linkConfig = LinkConfig()
|
|
38
39
|
val jsonObject = JSONObject(options)
|
|
39
40
|
val certOrgName: String? = jsonObject.getString("certOrgName")
|
|
40
41
|
val certPublicKey: String? = jsonObject.getString("certPublicKey")
|
|
41
42
|
val ignoreBadCert: Boolean = jsonObject.getBoolean("ignoreBadCert")
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
43
|
+
linkConfig.certOrganization = certOrgName
|
|
44
|
+
linkConfig.certPublicKey = certPublicKey
|
|
45
|
+
linkConfig.isIgnoreBadCert = ignoreBadCert
|
|
46
46
|
}
|
|
47
47
|
} catch (e: JSONException) {
|
|
48
48
|
|
|
@@ -51,16 +51,13 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
51
51
|
mReactContext.runOnUiQueueThread {
|
|
52
52
|
MEPClient.initialize(mReactContext?.applicationContext as Application)
|
|
53
53
|
MEPClient.setupDomain(domain, linkConfig)
|
|
54
|
-
|
|
55
|
-
//setup callbacks
|
|
56
|
-
onUnreadMessageCountUpdated()
|
|
57
54
|
}
|
|
58
55
|
}
|
|
59
56
|
|
|
60
57
|
@ReactMethod
|
|
61
58
|
fun link(token: String?, promise: Promise?) {
|
|
62
59
|
Log.d(TAG, "link called with token: $token")
|
|
63
|
-
if (token
|
|
60
|
+
if (token.isNullOrEmpty()) {
|
|
64
61
|
promise?.reject("-1", "token is empty or null")
|
|
65
62
|
return
|
|
66
63
|
}
|
|
@@ -138,7 +135,7 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
138
135
|
promise?.reject("-1", "Not linked")
|
|
139
136
|
return
|
|
140
137
|
}
|
|
141
|
-
if (chatId
|
|
138
|
+
if (!chatId.isNullOrEmpty()) {
|
|
142
139
|
MEPClient.openChat(chatId, feedSequence?.toLong() ?: 0, object : ApiCallback<Void?> {
|
|
143
140
|
override fun onCompleted(rult: Void?) {
|
|
144
141
|
Log.d(TAG, "openChat successful...")
|
|
@@ -179,9 +176,9 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
179
176
|
)
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
|
-
if (uniqueId
|
|
179
|
+
if (!uniqueId.isNullOrEmpty()) {
|
|
183
180
|
MEPClient.openRelationChat(uniqueId, callback)
|
|
184
|
-
} else if (email
|
|
181
|
+
} else if (!email.isNullOrEmpty()) {
|
|
185
182
|
MEPClient.openRelationChatWithEmail(email, callback)
|
|
186
183
|
} else {
|
|
187
184
|
promise?.reject("-1", "Invalid parameter")
|
|
@@ -198,8 +195,19 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
198
195
|
|
|
199
196
|
MEPClient.getClientDelegate().setOnUnreadMessageListener(listener)
|
|
200
197
|
}
|
|
198
|
+
|
|
199
|
+
private fun onTapWindowClose() {
|
|
200
|
+
Log.d(TAG, "onTapWindowClose called...")
|
|
201
|
+
val listener: ActionListener<Void> = ActionListener { _, _ ->
|
|
202
|
+
run {
|
|
203
|
+
Log.d(TAG, "onTapWindowClose button clicked...")
|
|
204
|
+
sendEvent(mReactContext, TAP_WINDOW_CLOSE_EVENT, null)
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
MEPClient.getClientDelegate().setOnCloseButtonListener(listener)
|
|
208
|
+
}
|
|
201
209
|
|
|
202
|
-
private fun sendEvent(reactContext: ReactContext, eventName: String, params:
|
|
210
|
+
private fun sendEvent(reactContext: ReactContext, eventName: String, params: Any?) {
|
|
203
211
|
reactContext
|
|
204
212
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
205
213
|
.emit(eventName, params)
|
|
@@ -208,6 +216,10 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
208
216
|
@ReactMethod
|
|
209
217
|
fun addListener(eventName: String) {
|
|
210
218
|
Log.d(TAG, "addListener called...")
|
|
219
|
+
when (eventName) {
|
|
220
|
+
TAP_WINDOW_CLOSE_EVENT ->
|
|
221
|
+
onTapWindowClose()
|
|
222
|
+
}
|
|
211
223
|
}
|
|
212
224
|
|
|
213
225
|
@ReactMethod
|
|
@@ -221,7 +233,7 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
221
233
|
TAG,
|
|
222
234
|
"registerNotification called and token is " + (if (deviceToken == null) "null" else "not null")
|
|
223
235
|
)
|
|
224
|
-
if (deviceToken
|
|
236
|
+
if (!deviceToken.isNullOrEmpty()) {
|
|
225
237
|
MEPClient.registerNotification(
|
|
226
238
|
deviceToken,
|
|
227
239
|
null, null, null,
|
|
@@ -267,7 +279,7 @@ class MoxoModuleModule(reactContext: ReactApplicationContext) :
|
|
|
267
279
|
else -> continue
|
|
268
280
|
}
|
|
269
281
|
}
|
|
270
|
-
promise?.resolve(jsonObject
|
|
282
|
+
promise?.resolve(json2WritableNativeMap(jsonObject))
|
|
271
283
|
}
|
|
272
284
|
|
|
273
285
|
override fun onError(errorCode: Int, errorMsg: String?) {
|
package/ios/MoxoModule.swift
CHANGED
|
@@ -3,6 +3,7 @@ class MoxoModule: RCTEventEmitter, MEPClientDelegate {
|
|
|
3
3
|
let default_error_code = 999
|
|
4
4
|
let default_error_message = "invalid parameters"
|
|
5
5
|
let unread_message_event = "onUnreadMessageCountUpdated"
|
|
6
|
+
let tap_close_event = "tapWindowCloseEvent"
|
|
6
7
|
private var onUnreadMessageCountUpdated:RCTResponseSenderBlock? = nil;
|
|
7
8
|
|
|
8
9
|
override class func moduleName() -> String! {
|
|
@@ -155,9 +156,13 @@ class MoxoModule: RCTEventEmitter, MEPClientDelegate {
|
|
|
155
156
|
sendEvent(withName: unread_message_event, body: unreadCount)
|
|
156
157
|
}
|
|
157
158
|
|
|
159
|
+
func client(_ client: MEPClient, didTapClose sender: Any?) {
|
|
160
|
+
sendEvent(withName: tap_close_event, body: nil)
|
|
161
|
+
}
|
|
162
|
+
|
|
158
163
|
//MARK: RCTBridgeModule
|
|
159
164
|
override func supportedEvents() -> [String]! {
|
|
160
|
-
return [unread_message_event]
|
|
165
|
+
return [unread_message_event, tap_close_event]
|
|
161
166
|
}
|
|
162
167
|
}
|
|
163
168
|
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.public_header_files = 'ios/*.h'
|
|
18
18
|
s.swift_version = '5.0'
|
|
19
19
|
s.dependency "React-Core"
|
|
20
|
-
s.dependency 'MEPSDKDylib', '~>
|
|
20
|
+
s.dependency 'MEPSDKDylib', '~> 10.1.3'
|
|
21
21
|
|
|
22
22
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
23
23
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
package/src/index.tsx
CHANGED
|
@@ -5,6 +5,7 @@ const LINKING_ERROR =
|
|
|
5
5
|
'- You rebuilt the app after installing the package\n' +
|
|
6
6
|
'- You are not using Expo Go\n';
|
|
7
7
|
const UNREAD_MSG_EVENT = "onUnreadMessageCountUpdated";
|
|
8
|
+
const TAP_WINDOW_CLOSE_EVENT = "tapWindowCloseEvent";
|
|
8
9
|
|
|
9
10
|
const MoxoModule = NativeModules.MoxoModule
|
|
10
11
|
? NativeModules.MoxoModule
|
|
@@ -172,3 +173,11 @@ export function startMeet(topic: string, options?: object): Promise<object> {
|
|
|
172
173
|
return MoxoModule.startMeet(topic, options);
|
|
173
174
|
}
|
|
174
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Set the callback when user tap close button on MEP window
|
|
178
|
+
* You should call hideMEPWindow() to hide MEP window in this callback if you want to hide MEP window
|
|
179
|
+
*/
|
|
180
|
+
export function onTapWindowClose(callback: () => void) {
|
|
181
|
+
MoxoEventEmitter.addListener(TAP_WINDOW_CLOSE_EVENT, callback);
|
|
182
|
+
}
|
|
183
|
+
|