@moxtradeveloper/react-native-moxo-module 8.9.5
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/LICENSE +6 -0
- package/README.md +179 -0
- package/android/build.gradle +161 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/moxomodule/MoxoModuleModule.kt +287 -0
- package/android/src/main/java/com/moxomodule/MoxoModulePackage.kt +17 -0
- package/ios/MoxoModule-Bridging-Header.h +4 -0
- package/ios/MoxoModule.m +34 -0
- package/ios/MoxoModule.swift +149 -0
- package/ios/MoxoModule.xcodeproj/project.pbxproj +287 -0
- package/ios/MoxoModule.xcodeproj/project.xcworkspace/contents.xcworkspacedata +4 -0
- package/ios/MoxoModuleBridge.h +17 -0
- package/ios/MoxoModuleBridge.m +13 -0
- package/package.json +164 -0
- package/react-native-moxo-module.podspec +36 -0
- package/src/index.tsx +136 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
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
|
+
|
|
6
|
+
Pod::Spec.new do |s|
|
|
7
|
+
s.name = "react-native-moxo-module"
|
|
8
|
+
s.version = package["version"]
|
|
9
|
+
s.summary = package["description"]
|
|
10
|
+
s.homepage = package["homepage"]
|
|
11
|
+
s.license = package["license"]
|
|
12
|
+
s.authors = package["author"]
|
|
13
|
+
|
|
14
|
+
s.platforms = { :ios => "13.0" }
|
|
15
|
+
s.source = { :git => "https://github.com/johnhu-moxo/react-native-moxo-module.git", :tag => "#{s.version}" }
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
17
|
+
s.public_header_files = 'ios/*.h'
|
|
18
|
+
s.swift_version = '5.0'
|
|
19
|
+
s.dependency "React-Core"
|
|
20
|
+
s.dependency 'MEPSDK', '~> 8.9.5'
|
|
21
|
+
|
|
22
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
23
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
24
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
25
|
+
s.pod_target_xcconfig = {
|
|
26
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
27
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
28
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
29
|
+
}
|
|
30
|
+
s.dependency "React-Codegen"
|
|
31
|
+
s.dependency "RCT-Folly"
|
|
32
|
+
s.dependency "RCTRequired"
|
|
33
|
+
s.dependency "RCTTypeSafety"
|
|
34
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
35
|
+
end
|
|
36
|
+
end
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR =
|
|
3
|
+
`The package 'react-native-moxo-module' doesn't seem to be linked. Make sure: \n\n` +
|
|
4
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
5
|
+
'- You rebuilt the app after installing the package\n' +
|
|
6
|
+
'- You are not using Expo Go\n';
|
|
7
|
+
const UNREAD_MSG_EVENT = "onUnreadMessageCountUpdated";
|
|
8
|
+
|
|
9
|
+
const MoxoModule = NativeModules.MoxoModule
|
|
10
|
+
? NativeModules.MoxoModule
|
|
11
|
+
: new Proxy(
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
)
|
|
19
|
+
const MoxoEventEmitter = new NativeEventEmitter(MoxoModule);
|
|
20
|
+
/**
|
|
21
|
+
* Setup domain
|
|
22
|
+
* Notice: This API MUST be invoked first before 'link'
|
|
23
|
+
*
|
|
24
|
+
* @param {string} baseDomain - Your server domain
|
|
25
|
+
* @param {object} options - SSL cert options, sample:
|
|
26
|
+
* {
|
|
27
|
+
* //SSL cert organization name. Optional, default is null.
|
|
28
|
+
* "certOrgName" : "Moxo, Inc."
|
|
29
|
+
*
|
|
30
|
+
* //SSL cert public key.
|
|
31
|
+
* "certPublicKey" : "-----BEGIN PUBLIC KEY-----\nYOUR PUBLIC KEY\n-----END PUBLIC KEY-----\n"
|
|
32
|
+
*
|
|
33
|
+
* //Ignore bad SSL cert or not. Default is true.
|
|
34
|
+
* ignoreBadCert : false
|
|
35
|
+
* }
|
|
36
|
+
*/
|
|
37
|
+
export function setup(domain: string, options?:object) {
|
|
38
|
+
return MoxoModule.setup(domain,options);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Link user with access token.
|
|
43
|
+
* @param {string} token - User access token
|
|
44
|
+
*/
|
|
45
|
+
export function link(token: string): Promise<boolean> {
|
|
46
|
+
return MoxoModule.link(token);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Unlink user.
|
|
51
|
+
* @param {boolean} keepNotification - Keep notification after user unlink
|
|
52
|
+
*/
|
|
53
|
+
export function unlink(keepNotification: boolean = false) {
|
|
54
|
+
return MoxoModule.unlink(keepNotification);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Show mep main window.
|
|
59
|
+
*/
|
|
60
|
+
export function showMEPWindow() {
|
|
61
|
+
return MoxoModule.showMEPWindow();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Hide mep main window.
|
|
66
|
+
*/
|
|
67
|
+
export function hideMEPWindow() {
|
|
68
|
+
return MoxoModule.hideMEPWindow();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Open chat with chat Id and scroll to the specified feed
|
|
73
|
+
* @param {string} chatId - Id of chat.
|
|
74
|
+
* @param {number} feedSequence - Sequence of feed.
|
|
75
|
+
*/
|
|
76
|
+
export function openChat(chatId: string, feedSequence:number): Promise<boolean> {
|
|
77
|
+
return MoxoModule.openChat(chatId,feedSequence);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Open relation chat with user
|
|
82
|
+
* @param {object} options - User object, includes either uniqueId or email of target relation user, sample:
|
|
83
|
+
* {
|
|
84
|
+
* "uniqueId" : "user_unique_id_1"
|
|
85
|
+
* //or
|
|
86
|
+
* "email" : "user_email "
|
|
87
|
+
* }
|
|
88
|
+
*/
|
|
89
|
+
export function openRelation(options: object): Promise<boolean> {
|
|
90
|
+
return MoxoModule.openRelation(options);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Get unread message count of current user.
|
|
95
|
+
* @param {object} options - Reserved option.
|
|
96
|
+
*/
|
|
97
|
+
export function getUnreadMessageCount(options?:object): Promise<number> {
|
|
98
|
+
return MoxoModule.getUnreadMessageCount(options);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Set the callback when unread messages count updated
|
|
103
|
+
*
|
|
104
|
+
* @param {function} callback - Would be invoked when user unread messages count updated, with an integer parameter which represents unread messages count post update
|
|
105
|
+
*/
|
|
106
|
+
export function onUnreadMessageCountUpdated(callback:(count:number) => void) {
|
|
107
|
+
MoxoEventEmitter.addListener(UNREAD_MSG_EVENT,callback);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Register Moxo notification with device token
|
|
112
|
+
*
|
|
113
|
+
* @param {string} deviceToken - Device token
|
|
114
|
+
*/
|
|
115
|
+
export function registerNotification(deviceToken:string) {
|
|
116
|
+
return MoxoModule.registerNotification(deviceToken);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Parse the notification to extract related info.
|
|
121
|
+
* When parse success, it will return with object like below:
|
|
122
|
+
* {
|
|
123
|
+
* //For chat:
|
|
124
|
+
* "chat_id": "CBPErkesrtOeFfURA6gusJAD"
|
|
125
|
+
* "feed_sequence": 191
|
|
126
|
+
*
|
|
127
|
+
* //For meet:
|
|
128
|
+
* "session_id": "255576178"
|
|
129
|
+
* }
|
|
130
|
+
*
|
|
131
|
+
* @param {object} payload - Notification payload
|
|
132
|
+
*/
|
|
133
|
+
export function parseNotification(payload:object): Promise<object> {
|
|
134
|
+
return MoxoModule.parseNotification(payload);
|
|
135
|
+
}
|
|
136
|
+
|