Skip to content

Commit e291cab

Browse files
authored
Merge pull request #13 from Jimmy-Chung/feat/rn-sdk
feat: update sdk
2 parents 61fcad4 + 5e6b5e4 commit e291cab

File tree

85 files changed

+50056
-3343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+50056
-3343
lines changed

android/src/main/java/com/finogeeks/mop/rnsdk/FINMopSDKModule.java

Lines changed: 726 additions & 0 deletions
Large diffs are not rendered by default.

android/src/main/java/com/finogeeks/mop/rnsdk/FINMopsdkPackage.java renamed to android/src/main/java/com/finogeeks/mop/rnsdk/FINMopSDKPackage.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
import com.facebook.react.bridge.NativeModule;
99
import com.facebook.react.bridge.ReactApplicationContext;
1010
import com.facebook.react.uimanager.ViewManager;
11-
import com.facebook.react.bridge.JavaScriptModule;
1211

13-
public class FINMopsdkPackage implements ReactPackage {
12+
public class FINMopSDKPackage implements ReactPackage {
1413
@Override
1514
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16-
return Arrays.<NativeModule>asList(new FINMopsdkModule(reactContext));
15+
return Arrays.<NativeModule>asList(new FINMopSDKModule(reactContext));
1716
}
1817

1918
@Override

android/src/main/java/com/finogeeks/mop/rnsdk/FINMopsdkModule.java

Lines changed: 0 additions & 101 deletions
This file was deleted.

example/App.js

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@ import React, { Component } from 'react';
1212
import { Platform, StyleSheet, Text, View, Button } from 'react-native';
1313
import MopSDK from 'react-native-mopsdk';
1414
const onPressOpenCanvasApplet = () => {
15-
MopSDK.openApplet('5ea03fa563cb900001d73863', '', '', (data) => { });
15+
MopSDK.openApplet({appId: '5ea03fa563cb900001d73863'});
1616
};
1717
const onPressOpenDemoApplet = () => {
18-
MopSDK.openApplet('5ea0401463cb900001d73865', '', '', (data) => { });
18+
MopSDK.openApplet({appId: '5ea0401463cb900001d73865'});
1919
};
2020
const onPressOpenProfileApplet = () => {
21-
MopSDK.openApplet('5ea0412663cb900001d73867', '', '', (data) => { });
21+
MopSDK.registerAppletHandler({
22+
getCustomMenus(appId){
23+
console.log("getCustomMenus")
24+
return []
25+
}
26+
})
2227
};
2328
export default class App extends Component<{}> {
2429
state = {
@@ -32,16 +37,22 @@ export default class App extends Component<{}> {
3237
secret: 'c5cc7a8c14a2b04a',
3338
apiServer: 'https://mp.finogeeks.com',
3439
apiPrefix: '/api/v1/mop',
35-
},
36-
(data) => {
37-
console.log('message;', data);
38-
const s = JSON.stringify(data);
39-
this.setState({
40-
status: 'native callback received',
41-
message: s,
42-
});
43-
},
44-
);
40+
}
41+
).then((res) => {
42+
console.log('message: ', res);
43+
const s = JSON.stringify(res);
44+
this.setState({
45+
status: 'native callback received',
46+
message: s,
47+
});
48+
}).catch((error) => {
49+
console.log('error: ', error);
50+
const s = 'initialize fail'
51+
this.setState({
52+
status: 'native callback received',
53+
message: s,
54+
});
55+
})
4556
}
4657
render() {
4758
return (

example/android/app/src/main/AndroidManifest.xml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44
<uses-permission android:name="android.permission.INTERNET" />
55

66
<application
7-
android:name=".MainApplication"
8-
android:label="@string/app_name"
9-
android:icon="@mipmap/ic_launcher"
10-
android:roundIcon="@mipmap/ic_launcher_round"
11-
android:allowBackup="true">
12-
<activity
13-
android:name=".MainActivity"
7+
android:name=".MainApplication"
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
1410
android:label="@string/app_name"
15-
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
16-
android:launchMode="singleTask"
17-
android:windowSoftInputMode="adjustResize">
18-
<intent-filter>
19-
<action android:name="android.intent.action.MAIN" />
20-
<category android:name="android.intent.category.LAUNCHER" />
21-
</intent-filter>
22-
</activity>
23-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
11+
android:roundIcon="@mipmap/ic_launcher_round">
12+
<activity
13+
android:name=".MainActivity"
14+
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
15+
android:label="@string/app_name"
16+
android:launchMode="singleTask"
17+
android:theme="@style/AppTheme"
18+
android:windowSoftInputMode="adjustResize">
19+
<intent-filter>
20+
<action android:name="android.intent.action.MAIN" />
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
2425
</application>
2526

2627
</manifest>

example/ios/Podfile

Lines changed: 14 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,30 @@
1-
platform :ios, '9.0'
2-
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
3-
4-
def add_flipper_pods!(versions = {})
5-
versions['Flipper'] ||= '~> 0.33.1'
6-
versions['DoubleConversion'] ||= '1.1.7'
7-
versions['Flipper-Folly'] ||= '~> 2.1'
8-
versions['Flipper-Glog'] ||= '0.3.6'
9-
versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
10-
versions['Flipper-RSocket'] ||= '~> 1.0'
11-
12-
pod 'FlipperKit', versions['Flipper'], :configuration => 'Debug'
13-
pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configuration => 'Debug'
14-
pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
15-
pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configuration => 'Debug'
16-
pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configuration => 'Debug'
17-
18-
# List all transitive dependencies for FlipperKit pods
19-
# to avoid them being linked in Release builds
20-
pod 'Flipper', versions['Flipper'], :configuration => 'Debug'
21-
pod 'Flipper-DoubleConversion', versions['DoubleConversion'], :configuration => 'Debug'
22-
pod 'Flipper-Folly', versions['Flipper-Folly'], :configuration => 'Debug'
23-
pod 'Flipper-Glog', versions['Flipper-Glog'], :configuration => 'Debug'
24-
pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configuration => 'Debug'
25-
pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configuration => 'Debug'
26-
pod 'FlipperKit/Core', versions['Flipper'], :configuration => 'Debug'
27-
pod 'FlipperKit/CppBridge', versions['Flipper'], :configuration => 'Debug'
28-
pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configuration => 'Debug'
29-
pod 'FlipperKit/FBDefines', versions['Flipper'], :configuration => 'Debug'
30-
pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configuration => 'Debug'
31-
pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configuration => 'Debug'
32-
pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configuration => 'Debug'
33-
pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configuration => 'Debug'
34-
end
1+
platform :ios, '11.0'
352

36-
# Post Install processing for Flipper
37-
def flipper_post_install(installer)
38-
installer.pods_project.targets.each do |target|
39-
if target.name == 'YogaKit'
40-
target.build_configurations.each do |config|
41-
config.build_settings['SWIFT_VERSION'] = '4.1'
42-
end
43-
end
44-
end
45-
end
3+
require_relative '../node_modules/react-native/scripts/react_native_pods'
4+
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
465

476
target 'example' do
48-
# Pods for example
49-
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
50-
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
51-
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
52-
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
53-
pod 'React', :path => '../node_modules/react-native/'
54-
pod 'React-Core', :path => '../node_modules/react-native/'
55-
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
56-
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
57-
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
58-
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
59-
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
60-
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
61-
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
62-
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
63-
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
64-
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
65-
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
66-
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
7+
config = use_native_modules!
678

68-
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
69-
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
70-
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
71-
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
72-
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
73-
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
74-
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga', :modular_headers => true
75-
76-
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
77-
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
78-
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
9+
use_react_native!(
10+
:path => config[:reactNativePath],
11+
# to enable hermes on iOS, change `false` to `true` and then install pods
12+
:hermes_enabled => false
13+
)
7914

8015
target 'exampleTests' do
8116
inherit! :complete
8217
# Pods for testing
8318
end
8419

85-
use_native_modules!
86-
8720
# Enables Flipper.
8821
#
8922
# Note that if you have use_frameworks! enabled, Flipper will not work and
90-
# you should disable these next few lines.
91-
add_flipper_pods!
92-
post_install do |installer|
93-
flipper_post_install(installer)
94-
end
95-
end
96-
97-
target 'example-tvOS' do
98-
# Pods for example-tvOS
23+
# you should disable the next line.
24+
use_flipper!()
9925

100-
target 'example-tvOSTests' do
101-
inherit! :search_paths
102-
# Pods for testing
26+
post_install do |installer|
27+
react_native_post_install(installer)
28+
__apply_Xcode_12_5_M1_post_install_workaround(installer)
10329
end
10430
end

0 commit comments

Comments
 (0)