@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 +37 -1
- package/android/build.gradle +31 -137
- package/android/gradle.properties +3 -5
- package/android/src/main/java/com/moxomodule/MoxoModuleModule.kt +218 -330
- package/android/src/main/java/com/moxomodule/MoxoModulePackage.kt +17 -9
- package/ios/MoxoModule.h +5 -0
- package/ios/MoxoModule.mm +123 -0
- package/ios/MoxoModuleImpl.swift +153 -0
- package/package.json +39 -55
- package/react-native-moxo-module.podspec +6 -21
- package/scripts/download-mepsdk.js +19 -9
- package/src/NativeMoxoModule.ts +30 -0
- package/src/index.tsx +63 -53
- package/android/src/main/AndroidManifest.xml +0 -4
- package/ios/MoxoModule-Bridging-Header.h +0 -4
- package/ios/MoxoModule.m +0 -39
- package/ios/MoxoModule.swift +0 -183
- package/ios/MoxoModule.xcodeproj/project.pbxproj +0 -287
- package/ios/MoxoModuleBridge.h +0 -17
- package/ios/MoxoModuleBridge.m +0 -13
- package/scripts/bootstrap.js +0 -29
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
package com.moxomodule
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.BaseReactPackage
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
-
import com.facebook.react.
|
|
6
|
+
import com.facebook.react.module.model.ReactModuleInfo
|
|
7
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider
|
|
7
8
|
|
|
9
|
+
class MoxoModulePackage : BaseReactPackage() {
|
|
10
|
+
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? =
|
|
11
|
+
if (name == MoxoModuleModule.NAME) MoxoModuleModule(reactContext) else null
|
|
8
12
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
override fun getReactModuleInfoProvider(): ReactModuleInfoProvider = ReactModuleInfoProvider {
|
|
14
|
+
mapOf(
|
|
15
|
+
MoxoModuleModule.NAME to ReactModuleInfo(
|
|
16
|
+
name = MoxoModuleModule.NAME,
|
|
17
|
+
className = MoxoModuleModule.NAME,
|
|
18
|
+
canOverrideExistingModule = false,
|
|
19
|
+
needsEagerInit = false,
|
|
20
|
+
isCxxModule = false,
|
|
21
|
+
isTurboModule = true,
|
|
22
|
+
)
|
|
23
|
+
)
|
|
16
24
|
}
|
|
17
25
|
}
|
package/ios/MoxoModule.h
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
#import "MoxoModule.h"
|
|
2
|
+
|
|
3
|
+
#import <MEPSDK/MEPSDK.h>
|
|
4
|
+
|
|
5
|
+
#if __has_include(<react_native_moxo_module/react_native_moxo_module-Swift.h>)
|
|
6
|
+
#import <react_native_moxo_module/react_native_moxo_module-Swift.h>
|
|
7
|
+
#else
|
|
8
|
+
#import "react_native_moxo_module-Swift.h"
|
|
9
|
+
#endif
|
|
10
|
+
|
|
11
|
+
@implementation MoxoModule {
|
|
12
|
+
MoxoModuleImpl *_impl;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
RCT_EXPORT_MODULE(MoxoModule)
|
|
16
|
+
|
|
17
|
+
- (instancetype)init
|
|
18
|
+
{
|
|
19
|
+
if (self = [super init]) {
|
|
20
|
+
_impl = [MoxoModuleImpl new];
|
|
21
|
+
__weak MoxoModule *weakSelf = self;
|
|
22
|
+
_impl.onUnreadMessageCountUpdated = ^(NSNumber *count) {
|
|
23
|
+
[weakSelf emitOnUnreadMessageCountUpdated:count];
|
|
24
|
+
};
|
|
25
|
+
_impl.onTapWindowClose = ^{
|
|
26
|
+
[weakSelf emitOnTapWindowClose];
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return self;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
+ (BOOL)requiresMainQueueSetup
|
|
33
|
+
{
|
|
34
|
+
return YES;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
- (void)setup:(NSString *)domain options:(NSDictionary *)options
|
|
38
|
+
{
|
|
39
|
+
[_impl setupWithDomain:domain options:options];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)link:(NSString *)token resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
43
|
+
{
|
|
44
|
+
[_impl linkWithToken:token resolve:resolve reject:reject];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)unlink:(BOOL)keepNotification
|
|
48
|
+
{
|
|
49
|
+
[_impl unlinkWithKeepNotification:keepNotification];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
- (void)showMEPWindow
|
|
53
|
+
{
|
|
54
|
+
[_impl showMEPWindow];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)hideMEPWindow
|
|
58
|
+
{
|
|
59
|
+
[_impl hideMEPWindow];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
- (void)changeLanguage:(NSString *)language
|
|
63
|
+
{
|
|
64
|
+
[_impl changeLanguage:language];
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
- (void)openChat:(NSString *)chatId
|
|
68
|
+
feedSequence:(NSNumber *)feedSequence
|
|
69
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
70
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
71
|
+
{
|
|
72
|
+
[_impl openChatWithChatId:chatId feedSequence:feedSequence resolve:resolve reject:reject];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
- (void)openRelation:(NSDictionary *)options resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
76
|
+
{
|
|
77
|
+
[_impl openRelationWithUser:options resolve:resolve reject:reject];
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
- (void)getUnreadMessageCount:(NSDictionary *)options
|
|
81
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
82
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
83
|
+
{
|
|
84
|
+
[_impl getUnreadMessageCountWithResolve:resolve];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
- (void)registerNotification:(NSString *)deviceToken
|
|
88
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
89
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
90
|
+
{
|
|
91
|
+
[_impl registerNotificationWithDeviceToken:deviceToken resolve:resolve reject:reject];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- (void)parseNotification:(NSDictionary *)payload resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
95
|
+
{
|
|
96
|
+
[_impl parseNotificationWithPayload:payload resolve:resolve reject:reject];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
- (void)showMeetRinger:(NSString *)sessionId resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
100
|
+
{
|
|
101
|
+
reject(@"-1", @"showMeetRinger is only supported on Android", nil);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
- (void)startMeet:(NSString *)topic
|
|
105
|
+
options:(NSDictionary *)options
|
|
106
|
+
resolve:(RCTPromiseResolveBlock)resolve
|
|
107
|
+
reject:(RCTPromiseRejectBlock)reject
|
|
108
|
+
{
|
|
109
|
+
[_impl startMeetWithTopic:topic options:options resolve:resolve reject:reject];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// iOS always reports close taps through MEPClientDelegate.
|
|
113
|
+
- (void)enableTapWindowCloseEvent
|
|
114
|
+
{
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
|
|
118
|
+
(const facebook::react::ObjCTurboModule::InitParams &)params
|
|
119
|
+
{
|
|
120
|
+
return std::make_shared<facebook::react::NativeMoxoModuleSpecJSI>(params);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@end
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import MEPSDK
|
|
3
|
+
|
|
4
|
+
@objc(MoxoModuleImpl)
|
|
5
|
+
public class MoxoModuleImpl: NSObject, MEPClientDelegate {
|
|
6
|
+
public typealias Resolve = (Any?) -> Void
|
|
7
|
+
public typealias Reject = (String, String, Error?) -> Void
|
|
8
|
+
|
|
9
|
+
let default_error_code = 999
|
|
10
|
+
let default_error_message = "invalid parameters"
|
|
11
|
+
|
|
12
|
+
@objc public var onUnreadMessageCountUpdated: ((NSNumber) -> Void)?
|
|
13
|
+
@objc public var onTapWindowClose: (() -> Void)?
|
|
14
|
+
|
|
15
|
+
@objc public func setup(domain: String, options: [String: Any]?) {
|
|
16
|
+
MEPClient.sharedInstance().setup(withDomain: domain, linkConfig: nil)
|
|
17
|
+
MEPClient.sharedInstance().delegate = self
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
@objc public func link(token: String, resolve: @escaping Resolve, reject: @escaping Reject) {
|
|
21
|
+
MEPClient.sharedInstance().linkUser(withAccessToken: token) { error in
|
|
22
|
+
Self.complete(error, resolve: resolve, reject: reject) { true }
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
@objc public func unlink(keepNotification: Bool) {
|
|
27
|
+
DispatchQueue.main.async {
|
|
28
|
+
if keepNotification {
|
|
29
|
+
MEPClient.sharedInstance().localUnlink()
|
|
30
|
+
} else {
|
|
31
|
+
MEPClient.sharedInstance().unlink()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@objc public func showMEPWindow() {
|
|
37
|
+
DispatchQueue.main.async {
|
|
38
|
+
MEPClient.sharedInstance().showMEPWindow()
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@objc public func hideMEPWindow() {
|
|
43
|
+
DispatchQueue.main.async {
|
|
44
|
+
MEPClient.sharedInstance().hideMEPWindow()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@objc public func changeLanguage(_ language: String) {
|
|
49
|
+
DispatchQueue.main.async {
|
|
50
|
+
MEPClient.sharedInstance().changeLanguage(language)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@objc public func openChat(chatId: String, feedSequence: NSNumber?, resolve: @escaping Resolve, reject: @escaping Reject) {
|
|
55
|
+
let sequence = feedSequence == 0 ? nil : feedSequence
|
|
56
|
+
DispatchQueue.main.async {
|
|
57
|
+
MEPClient.sharedInstance().openChat(chatId, withFeedSequence: sequence) { error in
|
|
58
|
+
Self.complete(error, resolve: resolve, reject: reject) { true }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@objc public func openRelation(user: [String: Any], resolve: @escaping Resolve, reject: @escaping Reject) {
|
|
64
|
+
DispatchQueue.main.async {
|
|
65
|
+
if let uniqueId = user["uniqueId"] as? String {
|
|
66
|
+
MEPClient.sharedInstance().openRelationChat(withUniqueID: uniqueId) { error in
|
|
67
|
+
Self.complete(error, resolve: resolve, reject: reject) { true }
|
|
68
|
+
}
|
|
69
|
+
} else if let email = user["email"] as? String {
|
|
70
|
+
MEPClient.sharedInstance().openRelationChat(withEmail: email) { error in
|
|
71
|
+
Self.complete(error, resolve: resolve, reject: reject) { true }
|
|
72
|
+
}
|
|
73
|
+
} else {
|
|
74
|
+
let err = NSError(domain: MEPSDKErrorDomain, code: self.default_error_code, userInfo: [NSLocalizedDescriptionKey: "No uniqueId or email found"])
|
|
75
|
+
reject("\(self.default_error_code)", self.default_error_message, err)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@objc public func getUnreadMessageCount(resolve: @escaping Resolve) {
|
|
81
|
+
resolve(MEPClient.sharedInstance().getUnreadMessageCount())
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@objc public func startMeet(topic: String, options: [String: Any]?, resolve: @escaping Resolve, reject: @escaping Reject) {
|
|
85
|
+
let options = options ?? [:]
|
|
86
|
+
DispatchQueue.main.async {
|
|
87
|
+
let meetOption = MEPStartMeetOptions()
|
|
88
|
+
meetOption.topic = topic
|
|
89
|
+
meetOption.chatID = options["chat_id"] as? String
|
|
90
|
+
meetOption.uniqueIDs = options["unique_ids"] as? [String]
|
|
91
|
+
meetOption.autoJoinAudio = options["auto_join_audio"] as? Bool ?? true
|
|
92
|
+
meetOption.autoStartVideo = options["auto_start_video"] as? Bool ?? false
|
|
93
|
+
meetOption.autoRecording = options["auto_recording"] as? Bool ?? false
|
|
94
|
+
meetOption.instantCall = options["instant_call"] as? Bool ?? false
|
|
95
|
+
MEPClient.sharedInstance().startMeet(withOption: meetOption) { error, meetId in
|
|
96
|
+
Self.complete(error, resolve: resolve, reject: reject) { ["session_id": meetId] }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// MARK: Notification
|
|
102
|
+
|
|
103
|
+
@objc public func registerNotification(deviceToken: String, resolve: @escaping Resolve, reject: @escaping Reject) {
|
|
104
|
+
guard let data = Data(hex: deviceToken) else {
|
|
105
|
+
reject("\(default_error_code)", "Invalid device token", nil)
|
|
106
|
+
return
|
|
107
|
+
}
|
|
108
|
+
MEPClient.sharedInstance().registerNotification(withDeviceToken: data) { error in
|
|
109
|
+
Self.complete(error, resolve: resolve, reject: reject) { true }
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
@objc public func parseNotification(payload: [String: Any], resolve: @escaping Resolve, reject: @escaping Reject) {
|
|
114
|
+
MEPClient.sharedInstance().parseRemoteNotification(payload) { error, ret in
|
|
115
|
+
Self.complete(error, resolve: resolve, reject: reject) { ret }
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// MARK: MEPClientDelegate
|
|
120
|
+
|
|
121
|
+
public func client(_ client: MEPClient, didUpdateUnreadCount unreadCount: UInt) {
|
|
122
|
+
onUnreadMessageCountUpdated?(NSNumber(value: unreadCount))
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
public func client(_ client: MEPClient, didTapClose sender: Any?) {
|
|
126
|
+
onTapWindowClose?()
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private static func complete(_ error: Error?, resolve: Resolve, reject: Reject, result: () -> Any?) {
|
|
130
|
+
if let error {
|
|
131
|
+
let err = error as NSError
|
|
132
|
+
reject("\(err.code)", err.localizedDescription, err)
|
|
133
|
+
} else {
|
|
134
|
+
resolve(result())
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
extension Data {
|
|
140
|
+
init?(hex: String) {
|
|
141
|
+
guard !hex.isEmpty, hex.count.isMultiple(of: 2) else {
|
|
142
|
+
return nil
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let chars = Array(hex)
|
|
146
|
+
let bytes = stride(from: 0, to: chars.count, by: 2)
|
|
147
|
+
.map { String(chars[$0]) + String(chars[$0 + 1]) }
|
|
148
|
+
.compactMap { UInt8($0, radix: 16) }
|
|
149
|
+
|
|
150
|
+
guard bytes.count * 2 == hex.count else { return nil }
|
|
151
|
+
self.init(bytes)
|
|
152
|
+
}
|
|
153
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moxtradeveloper/react-native-moxo-module",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.13.1",
|
|
4
4
|
"description": "Plugin for adding Moxo services to React Native Apps.",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
"lib",
|
|
13
13
|
"android",
|
|
14
14
|
"ios",
|
|
15
|
-
"cpp",
|
|
16
15
|
"scripts",
|
|
17
16
|
"*.podspec",
|
|
18
17
|
"!lib/typescript/example",
|
|
@@ -32,10 +31,8 @@
|
|
|
32
31
|
"postinstall": "node scripts/download-mepsdk.js",
|
|
33
32
|
"test": "jest",
|
|
34
33
|
"typescript": "tsc --noEmit",
|
|
35
|
-
"lint": "eslint
|
|
36
|
-
"
|
|
37
|
-
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
38
|
-
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"clean": "del-cli android/build lib",
|
|
39
36
|
"doc": "typedoc ./src/index.tsx --skipErrorChecking"
|
|
40
37
|
},
|
|
41
38
|
"keywords": [
|
|
@@ -58,38 +55,35 @@
|
|
|
58
55
|
"registry": "https://registry.npmjs.org/"
|
|
59
56
|
},
|
|
60
57
|
"devDependencies": {
|
|
61
|
-
"@react-native
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@types/
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"eslint
|
|
69
|
-
"eslint-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"react
|
|
75
|
-
"react-native
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
|
|
80
|
-
"resolutions": {
|
|
81
|
-
"@types/react": "17.0.21"
|
|
58
|
+
"@react-native/babel-preset": "^0.88.0",
|
|
59
|
+
"@react-native/eslint-config": "0.88.0",
|
|
60
|
+
"@react-native/jest-preset": "^0.88.0",
|
|
61
|
+
"@release-it/conventional-changelog": "^12.0.2",
|
|
62
|
+
"@types/jest": "^30.0.0",
|
|
63
|
+
"@types/react": "^19.3.0",
|
|
64
|
+
"del-cli": "^8.0.1",
|
|
65
|
+
"eslint": "^9.39.5",
|
|
66
|
+
"eslint-config-prettier": "^10.1.8",
|
|
67
|
+
"eslint-plugin-prettier": "^5.5.7",
|
|
68
|
+
"jest": "^30.5.2",
|
|
69
|
+
"pod-install": "^1.2.1",
|
|
70
|
+
"prettier": "^3.9.10",
|
|
71
|
+
"react": "19.3.1",
|
|
72
|
+
"react-native": "0.88.0",
|
|
73
|
+
"react-native-builder-bob": "^0.44.1",
|
|
74
|
+
"release-it": "^21.1.1",
|
|
75
|
+
"typedoc": "^0.28.20",
|
|
76
|
+
"typescript": "^5.9.3"
|
|
82
77
|
},
|
|
83
78
|
"peerDependencies": {
|
|
84
79
|
"react": "*",
|
|
85
|
-
"react-native": "
|
|
80
|
+
"react-native": ">=0.80.0"
|
|
86
81
|
},
|
|
87
82
|
"engines": {
|
|
88
|
-
"node": ">=
|
|
83
|
+
"node": ">= 22.13.0"
|
|
89
84
|
},
|
|
90
|
-
"packageManager": "^yarn@1.22.15",
|
|
91
85
|
"jest": {
|
|
92
|
-
"preset": "react-native",
|
|
86
|
+
"preset": "@react-native/jest-preset",
|
|
93
87
|
"modulePathIgnorePatterns": [
|
|
94
88
|
"<rootDir>/example/node_modules",
|
|
95
89
|
"<rootDir>/lib/"
|
|
@@ -117,29 +111,6 @@
|
|
|
117
111
|
}
|
|
118
112
|
}
|
|
119
113
|
},
|
|
120
|
-
"eslintConfig": {
|
|
121
|
-
"root": true,
|
|
122
|
-
"extends": [
|
|
123
|
-
"@react-native-community",
|
|
124
|
-
"prettier"
|
|
125
|
-
],
|
|
126
|
-
"rules": {
|
|
127
|
-
"prettier/prettier": [
|
|
128
|
-
"error",
|
|
129
|
-
{
|
|
130
|
-
"quoteProps": "consistent",
|
|
131
|
-
"singleQuote": true,
|
|
132
|
-
"tabWidth": 2,
|
|
133
|
-
"trailingComma": "es5",
|
|
134
|
-
"useTabs": false
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"eslintIgnore": [
|
|
140
|
-
"node_modules/",
|
|
141
|
-
"lib/"
|
|
142
|
-
],
|
|
143
114
|
"prettier": {
|
|
144
115
|
"quoteProps": "consistent",
|
|
145
116
|
"singleQuote": true,
|
|
@@ -163,8 +134,21 @@
|
|
|
163
134
|
},
|
|
164
135
|
"moxoSdk": {
|
|
165
136
|
"ios": {
|
|
166
|
-
"version": "10.
|
|
137
|
+
"version": "10.13.1",
|
|
167
138
|
"downloadUrl": "https://mxrepo.moxo.com/repository/customer-raw-releases/mepsdk/dynamic/Dynamic_MEPSDK_iOS_v${version}.zip"
|
|
168
139
|
}
|
|
140
|
+
},
|
|
141
|
+
"codegenConfig": {
|
|
142
|
+
"name": "MoxoModuleSpec",
|
|
143
|
+
"type": "modules",
|
|
144
|
+
"jsSrcsDir": "src",
|
|
145
|
+
"android": {
|
|
146
|
+
"javaPackageName": "com.moxomodule"
|
|
147
|
+
},
|
|
148
|
+
"ios": {
|
|
149
|
+
"modulesProvider": {
|
|
150
|
+
"MoxoModule": "MoxoModule"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
169
153
|
}
|
|
170
154
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
require "json"
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
-
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
4
|
|
|
6
5
|
Pod::Spec.new do |s|
|
|
7
6
|
s.name = "react-native-moxo-module"
|
|
@@ -11,28 +10,14 @@ Pod::Spec.new do |s|
|
|
|
11
10
|
s.license = package["license"]
|
|
12
11
|
s.authors = package["author"]
|
|
13
12
|
|
|
14
|
-
s.platforms = { :ios => "15.
|
|
13
|
+
s.platforms = { :ios => "15.6" }
|
|
15
14
|
s.source = { :git => "https://github.com/Moxtra/react-native-moxo-module.git", :tag => "#{s.version}" }
|
|
16
15
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
-
s.
|
|
18
|
-
s.swift_version =
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
s.private_header_files = "ios/**/*.h"
|
|
17
|
+
s.swift_version = "5.9"
|
|
18
|
+
|
|
21
19
|
# MEPSDK is embedded directly - downloaded via npm postinstall
|
|
22
|
-
s.vendored_frameworks =
|
|
20
|
+
s.vendored_frameworks = "ios/Frameworks/MEPSDK.xcframework"
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
26
|
-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
27
|
-
s.pod_target_xcconfig = {
|
|
28
|
-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
29
|
-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
30
|
-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
31
|
-
}
|
|
32
|
-
s.dependency "React-Codegen"
|
|
33
|
-
s.dependency "RCT-Folly"
|
|
34
|
-
s.dependency "RCTRequired"
|
|
35
|
-
s.dependency "RCTTypeSafety"
|
|
36
|
-
s.dependency "ReactCommon/turbomodule/core"
|
|
37
|
-
end
|
|
22
|
+
install_modules_dependencies(s)
|
|
38
23
|
end
|
|
@@ -24,8 +24,9 @@ const MEPSDK_DOWNLOAD_URL = (sdkConfig.downloadUrl || '').replace(
|
|
|
24
24
|
);
|
|
25
25
|
|
|
26
26
|
const FRAMEWORK_DIR = path.join(__dirname, '..', 'ios', 'Frameworks');
|
|
27
|
-
const FRAMEWORK_PATH = path.join(FRAMEWORK_DIR, '
|
|
28
|
-
const
|
|
27
|
+
const FRAMEWORK_PATH = path.join(FRAMEWORK_DIR, 'MEPSDK.xcframework');
|
|
28
|
+
const VERSION_PATH = path.join(FRAMEWORK_DIR, '.version');
|
|
29
|
+
const ZIP_PATH = path.join(FRAMEWORK_DIR, 'MEPSDK.xcframework.zip');
|
|
29
30
|
|
|
30
31
|
function downloadFile(url, dest) {
|
|
31
32
|
return new Promise((resolve, reject) => {
|
|
@@ -36,7 +37,7 @@ function downloadFile(url, dest) {
|
|
|
36
37
|
|
|
37
38
|
const request = protocol.get(url, (response) => {
|
|
38
39
|
// Handle redirects
|
|
39
|
-
if (
|
|
40
|
+
if ([301, 302, 303, 307, 308].includes(response.statusCode)) {
|
|
40
41
|
file.close();
|
|
41
42
|
fs.unlinkSync(dest);
|
|
42
43
|
return downloadFile(response.headers.location, dest)
|
|
@@ -80,13 +81,18 @@ async function main() {
|
|
|
80
81
|
process.exit(1);
|
|
81
82
|
}
|
|
82
83
|
|
|
83
|
-
// Skip if framework already exists
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
// Skip if the configured framework version already exists
|
|
85
|
+
const installedVersion = fs.existsSync(VERSION_PATH)
|
|
86
|
+
? fs.readFileSync(VERSION_PATH, 'utf8').trim()
|
|
87
|
+
: null;
|
|
88
|
+
if (fs.existsSync(FRAMEWORK_PATH) && installedVersion === MEPSDK_VERSION) {
|
|
89
|
+
console.log(
|
|
90
|
+
`MEPSDK.xcframework ${MEPSDK_VERSION} already exists, skipping download.`
|
|
91
|
+
);
|
|
86
92
|
return;
|
|
87
93
|
}
|
|
88
94
|
|
|
89
|
-
console.log(`\nš¦ Downloading
|
|
95
|
+
console.log(`\nš¦ Downloading MEPSDK ${MEPSDK_VERSION}...\n`);
|
|
90
96
|
|
|
91
97
|
// Create Frameworks directory
|
|
92
98
|
if (!fs.existsSync(FRAMEWORK_DIR)) {
|
|
@@ -98,6 +104,9 @@ async function main() {
|
|
|
98
104
|
await downloadFile(MEPSDK_DOWNLOAD_URL, ZIP_PATH);
|
|
99
105
|
console.log('Download complete. Extracting...');
|
|
100
106
|
|
|
107
|
+
// Replace any previously installed version
|
|
108
|
+
fs.rmSync(FRAMEWORK_PATH, { recursive: true, force: true });
|
|
109
|
+
|
|
101
110
|
// Extract the zip file
|
|
102
111
|
execSync(`unzip -o "${ZIP_PATH}" -d "${FRAMEWORK_DIR}"`, {
|
|
103
112
|
stdio: 'inherit',
|
|
@@ -105,10 +114,11 @@ async function main() {
|
|
|
105
114
|
|
|
106
115
|
// Clean up zip file
|
|
107
116
|
fs.unlinkSync(ZIP_PATH);
|
|
117
|
+
fs.writeFileSync(VERSION_PATH, MEPSDK_VERSION);
|
|
108
118
|
|
|
109
|
-
console.log('\nā
|
|
119
|
+
console.log('\nā
MEPSDK.xcframework installed successfully!\n');
|
|
110
120
|
} catch (error) {
|
|
111
|
-
console.error('\nā Failed to download
|
|
121
|
+
console.error('\nā Failed to download MEPSDK:', error.message);
|
|
112
122
|
console.error(
|
|
113
123
|
'\nPlease ensure the CDN URL is correct or manually download the framework.'
|
|
114
124
|
);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { TurboModuleRegistry } from 'react-native';
|
|
2
|
+
import type { CodegenTypes, TurboModule } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export interface Spec extends TurboModule {
|
|
5
|
+
setup(domain: string, options?: CodegenTypes.UnsafeObject): void;
|
|
6
|
+
link(token: string): Promise<boolean>;
|
|
7
|
+
unlink(keepNotification: boolean): void;
|
|
8
|
+
showMEPWindow(): void;
|
|
9
|
+
hideMEPWindow(): void;
|
|
10
|
+
changeLanguage(language: string): void;
|
|
11
|
+
openChat(chatId: string, feedSequence?: number): Promise<boolean>;
|
|
12
|
+
openRelation(options: CodegenTypes.UnsafeObject): Promise<boolean>;
|
|
13
|
+
getUnreadMessageCount(options?: CodegenTypes.UnsafeObject): Promise<number>;
|
|
14
|
+
registerNotification(deviceToken: string): Promise<boolean>;
|
|
15
|
+
parseNotification(
|
|
16
|
+
payload: CodegenTypes.UnsafeObject
|
|
17
|
+
): Promise<CodegenTypes.UnsafeObject>;
|
|
18
|
+
showMeetRinger(sessionId: string): Promise<string>;
|
|
19
|
+
startMeet(
|
|
20
|
+
topic: string,
|
|
21
|
+
options?: CodegenTypes.UnsafeObject
|
|
22
|
+
): Promise<CodegenTypes.UnsafeObject>;
|
|
23
|
+
// Android only takes over the close button once JS subscribes.
|
|
24
|
+
enableTapWindowCloseEvent(): void;
|
|
25
|
+
|
|
26
|
+
readonly onUnreadMessageCountUpdated: CodegenTypes.EventEmitter<number>;
|
|
27
|
+
readonly onTapWindowClose: CodegenTypes.EventEmitter<void>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default TurboModuleRegistry.get<Spec>('MoxoModule');
|