@rownd/react-native 2.2.2 → 2.3.0
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/ios/Rownd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Rownd.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/Rownd.xcodeproj/project.xcworkspace/xcuserdata/mhamann.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Rownd.xcodeproj/xcuserdata/mhamann.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/RowndPlugin.m +2 -0
- package/ios/RowndPlugin.swift +18 -13
- package/lib/commonjs/components/GlobalContext.js +16 -0
- package/lib/commonjs/components/GlobalContext.js.map +1 -1
- package/lib/commonjs/utils/nativeModule.js +6 -1
- package/lib/commonjs/utils/nativeModule.js.map +1 -1
- package/lib/module/components/GlobalContext.js +17 -1
- package/lib/module/components/GlobalContext.js.map +1 -1
- package/lib/module/utils/nativeModule.js +4 -1
- package/lib/module/utils/nativeModule.js.map +1 -1
- package/lib/typescript/utils/nativeModule.d.ts +1 -0
- package/package.json +1 -1
- package/rownd-react-native.podspec +1 -1
- package/src/components/GlobalContext.tsx +19 -1
- package/src/utils/nativeModule.ts +5 -1
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>ReactNative.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
package/ios/RowndPlugin.m
CHANGED
package/ios/RowndPlugin.swift
CHANGED
|
@@ -5,14 +5,14 @@ import AnyCodable
|
|
|
5
5
|
|
|
6
6
|
@objc(RowndPlugin)
|
|
7
7
|
class RowndPlugin: NSObject {
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
@ObservedObject private var state = Rownd.getInstance().state().subscribe { $0 }
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
private var stateCancellable: AnyCancellable?
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
override init() {
|
|
14
14
|
super.init()
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
stateCancellable = state.$current.sink { newState in
|
|
17
17
|
do {
|
|
18
18
|
RowndPluginEventEmitter.emitter.sendEvent(withName: "update_state", body: try newState.toDictionary())
|
|
@@ -21,7 +21,7 @@ class RowndPlugin: NSObject {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
@objc(configure:withResolver:withRejecter:)
|
|
26
26
|
func configure(appKey: String, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
|
|
27
27
|
Task.init {
|
|
@@ -29,47 +29,47 @@ class RowndPlugin: NSObject {
|
|
|
29
29
|
}
|
|
30
30
|
resolve(appKey)
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
|
|
33
33
|
@objc
|
|
34
34
|
func requestSignIn() -> Void {
|
|
35
35
|
DispatchQueue.main.async {
|
|
36
36
|
Rownd.requestSignIn()
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
|
|
40
40
|
@objc
|
|
41
41
|
func signOut() -> Void {
|
|
42
42
|
DispatchQueue.main.async {
|
|
43
43
|
Rownd.signOut()
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
@objc
|
|
48
48
|
func manageAccount() -> Void {
|
|
49
49
|
DispatchQueue.main.async {
|
|
50
|
-
Rownd.
|
|
50
|
+
Rownd.manageAccount()
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
@objc(getAccessToken:withResolver:)
|
|
55
55
|
func getAccessToken(resolve: @escaping RCTPromiseResolveBlock) async -> Void {
|
|
56
56
|
let accessToken = await Rownd.getAccessToken()
|
|
57
57
|
resolve(accessToken)
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
@objc(setUserData:)
|
|
61
61
|
func setUserData(data: Dictionary<String, Any>) -> Void {
|
|
62
62
|
do {
|
|
63
63
|
let jsonData = try JSONSerialization.data(withJSONObject: data, options: .prettyPrinted)
|
|
64
64
|
let decoder = JSONDecoder()
|
|
65
65
|
let dictionary = try! decoder.decode([String: AnyCodable].self, from: jsonData)
|
|
66
|
-
|
|
66
|
+
|
|
67
67
|
Rownd.user.set(data: dictionary)
|
|
68
68
|
} catch {
|
|
69
69
|
print("FAILED TO SET USER DATA: ",error)
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
@objc(setUserDataValue:withValue:)
|
|
74
74
|
func setUserDataValue(key: String, value: Any) -> Void {
|
|
75
75
|
let json = """
|
|
@@ -80,4 +80,9 @@ class RowndPlugin: NSObject {
|
|
|
80
80
|
let dictionary = try! decoder.decode(AnyCodable.self, from: json)
|
|
81
81
|
Rownd.user.set(field: key, value: dictionary)
|
|
82
82
|
}
|
|
83
|
+
|
|
84
|
+
@objc(handleSignInLink:)
|
|
85
|
+
func handleSignInLink(url: String) -> Void {
|
|
86
|
+
Rownd.handleSignInLink(url: URL(string: url))
|
|
87
|
+
}
|
|
83
88
|
}
|
|
@@ -54,6 +54,22 @@ const RowndProvider = _ref => {
|
|
|
54
54
|
return () => {
|
|
55
55
|
subscription.remove();
|
|
56
56
|
};
|
|
57
|
+
}, []); // Handle deep linking
|
|
58
|
+
|
|
59
|
+
(0, _react.useEffect)(() => {
|
|
60
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
_reactNative.Linking.addEventListener('url', event => NativeRowndModules.handleSignInLink(event.url));
|
|
65
|
+
|
|
66
|
+
(async () => {
|
|
67
|
+
const initialUrl = await _reactNative.Linking.getInitialURL();
|
|
68
|
+
|
|
69
|
+
if (initialUrl) {
|
|
70
|
+
NativeRowndModules.handleSignInLink(initialUrl);
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
57
73
|
}, []);
|
|
58
74
|
return /*#__PURE__*/_react.default.createElement(GlobalContext.Provider, {
|
|
59
75
|
value: value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["YellowBox","ignoreWarnings","GlobalContext","createContext","undefined","eventEmitter","NativeEventEmitter","IOSRowndEventEmitter","Rownd","RowndProvider","children","config","state","dispatch","useReducer","rowndReducer","initialRowndState","value","useEffect","NativeRowndModules","configure","appKey","onSessionConnect","event","type","ActionType","UPDATE_STATE","payload","Platform","OS","JSON","parse","subscription","addListener","remove","useRowndContext","context","useContext","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config.appKey);\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":";;;;;;;;AAAA;;AAOA;;AACA;;AAEA;;AAIA;;;;;;AAEAA,sBAAA,CAAUC,cAAV,CAAyB,CACvB,sDADuB,CAAzB;;AAGAD,sBAAA,CAAUC,cAAV,CAAyB,CAAC,0CAAD,CAAzB;;AAEO,MAAMC,aAAa,gBAAG,IAAAC,oBAAA,EAE3BC,SAF2B,CAAtB;;AAIP,MAAMC,YAAY,GAAG,IAAIC,+BAAJ,CAAuBC,uCAAA,IAAwBC,wBAA/C,CAArB;;AAEA,MAAMC,aAA8C,GAAG,QAGjD;EAAA,IAHkD;IACtDC,QADsD;IAEtDC;EAFsD,CAGlD;EACJ,MAAM,CAACC,KAAD,EAAQC,QAAR,IAAoB,IAAAC,iBAAA,EAAWC,0BAAX,EAAyBC,+BAAzB,CAA1B;EACA,MAAMC,KAAK,GAAG;IAAEL,KAAF;IAASC;EAAT,CAAd;EAEA,IAAAK,gBAAA,EAAU,MAAM;IACdC,kBAAkB,CAACC,SAAnB,CAA6BT,MAAM,CAACU,MAApC;EACD,CAFD,EAEG,CAACV,MAAM,CAACU,MAAR,CAFH;EAIA,IAAAH,gBAAA,EAAU,MAAM;IACd,MAAMI,gBAAgB,GAAIC,KAAD,IAAgB;MACvCV,QAAQ,CAAC;QACPW,IAAI,EAAEC,kBAAA,CAAWC,YADV;QAEPC,OAAO,EAAEC,qBAAA,CAASC,EAAT,KAAgB,SAAhB,GAA4BC,IAAI,CAACC,KAAL,CAAWR,KAAK,CAACX,KAAjB,CAA5B,GAAsDW;MAFxD,CAAD,CAAR;IAID,CALD;;IAMA,MAAMS,YAAY,GAAG3B,YAAY,CAAC4B,WAAb,CACnB,cADmB,EAEnBX,gBAFmB,CAArB;IAKA,IAAI,CAACU,YAAL,EAAmB;IAEnB,OAAO,MAAM;MACXA,YAAY,CAACE,MAAb;IACD,CAFD;EAGD,CAjBD,EAiBG,EAjBH;
|
|
1
|
+
{"version":3,"names":["YellowBox","ignoreWarnings","GlobalContext","createContext","undefined","eventEmitter","NativeEventEmitter","IOSRowndEventEmitter","Rownd","RowndProvider","children","config","state","dispatch","useReducer","rowndReducer","initialRowndState","value","useEffect","NativeRowndModules","configure","appKey","onSessionConnect","event","type","ActionType","UPDATE_STATE","payload","Platform","OS","JSON","parse","subscription","addListener","remove","Linking","addEventListener","handleSignInLink","url","initialUrl","getInitialURL","useRowndContext","context","useContext","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform, Linking } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config.appKey);\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n // Handle deep linking\n useEffect(() => {\n if (Platform.OS !== 'ios') {\n return;\n }\n\n Linking.addEventListener('url', (event) =>\n NativeRowndModules.handleSignInLink(event.url)\n );\n\n (async () => {\n const initialUrl = await Linking.getInitialURL();\n if (initialUrl) {\n NativeRowndModules.handleSignInLink(initialUrl);\n }\n })();\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":";;;;;;;;AAAA;;AAOA;;AACA;;AAEA;;AAIA;;;;;;AAEAA,sBAAA,CAAUC,cAAV,CAAyB,CACvB,sDADuB,CAAzB;;AAGAD,sBAAA,CAAUC,cAAV,CAAyB,CAAC,0CAAD,CAAzB;;AAEO,MAAMC,aAAa,gBAAG,IAAAC,oBAAA,EAE3BC,SAF2B,CAAtB;;AAIP,MAAMC,YAAY,GAAG,IAAIC,+BAAJ,CAAuBC,uCAAA,IAAwBC,wBAA/C,CAArB;;AAEA,MAAMC,aAA8C,GAA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,CAfD,EAeG,EAfH;EAiBA,oBACE,6BAAC,aAAD,CAAe,QAAf;IAAwB,KAAK,EAAEtB;EAA/B,GAAuCP,QAAvC,CADF;AAGD,CAnDD;;;;AAqDA,SAAS+B,eAAT,GAA2B;EACzB,MAAMC,OAAO,GAAG,IAAAC,iBAAA,EAAWzC,aAAX,CAAhB;;EAEA,IAAIwC,OAAO,KAAKtC,SAAhB,EAA2B;IACzB,MAAM,IAAIwC,KAAJ,CACJ,+DADI,CAAN;EAGD;;EAED,OAAOF,OAAP;AACD"}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.Rownd = exports.LINKING_ERROR = exports.IOSRowndEventEmitter = void 0;
|
|
7
7
|
exports.configure = configure;
|
|
8
8
|
exports.getAccessToken = getAccessToken;
|
|
9
|
+
exports.handleSignInLink = handleSignInLink;
|
|
9
10
|
exports.manageAccount = manageAccount;
|
|
10
11
|
exports.requestSignIn = requestSignIn;
|
|
11
12
|
exports.setUserData = setUserData;
|
|
@@ -26,7 +27,7 @@ const Rownd = _reactNative.NativeModules.RowndPlugin ? _reactNative.NativeModule
|
|
|
26
27
|
|
|
27
28
|
});
|
|
28
29
|
exports.Rownd = Rownd;
|
|
29
|
-
const IOSRowndEventEmitter = _reactNative.Platform.OS
|
|
30
|
+
const IOSRowndEventEmitter = _reactNative.Platform.OS !== 'ios' ? null : _reactNative.NativeModules.RowndPluginEventEmitter ? _reactNative.NativeModules.RowndPluginEventEmitter : new Proxy({}, {
|
|
30
31
|
get() {
|
|
31
32
|
throw new Error(LINKING_ERROR);
|
|
32
33
|
}
|
|
@@ -69,4 +70,8 @@ function setUserDataValue(key, value) {
|
|
|
69
70
|
function setUserData(data) {
|
|
70
71
|
return Rownd.setUserData(data);
|
|
71
72
|
}
|
|
73
|
+
|
|
74
|
+
function handleSignInLink(url) {
|
|
75
|
+
return Rownd.handleSignInLink(url);
|
|
76
|
+
}
|
|
72
77
|
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Rownd","NativeModules","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","isNotAvailableInAndroidYet","console","log","configure","appKey","requestSignIn","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nexport const LINKING_ERROR =\n `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport const Rownd = NativeModules.RowndPlugin\n ? NativeModules.RowndPlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const IOSRowndEventEmitter =\n Platform.OS
|
|
1
|
+
{"version":3,"names":["LINKING_ERROR","Platform","select","ios","default","Rownd","NativeModules","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","isNotAvailableInAndroidYet","console","log","configure","appKey","requestSignIn","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nexport const LINKING_ERROR =\n `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport const Rownd = NativeModules.RowndPlugin\n ? NativeModules.RowndPlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const IOSRowndEventEmitter =\n Platform.OS !== 'ios'\n ? null\n : NativeModules.RowndPluginEventEmitter\n ? NativeModules.RowndPluginEventEmitter\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst isNotAvailableInAndroidYet = () => {\n console.log('ROWND: NOT AVAILABLE IN ANDROID YET');\n return true;\n};\n\nexport function configure(appKey: string): Promise<string> {\n return Rownd.configure(appKey);\n}\n\nexport function requestSignIn() {\n return Rownd.requestSignIn();\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n if (isNotAvailableInAndroidYet()) return Promise.resolve('');\n return Rownd.getAccessToken();\n}\n\nexport function setUserDataValue(key: string, value: any) {\n return Rownd.setUserDataValue(\n key,\n Platform.OS === 'android' ? { value } : value\n );\n}\n\nexport function setUserData(data: Record<string, any>) {\n return Rownd.setUserData(data);\n}\n\nexport function handleSignInLink(url: string) {\n return Rownd.handleSignInLink(url);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEO,MAAMA,aAAa,GACvB,8EAAD,GACAC,qBAAA,CAASC,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK;;AAMA,MAAMC,KAAK,GAAGC,0BAAA,CAAcC,WAAd,GACjBD,0BAAA,CAAcC,WADG,GAEjB,IAAIC,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CAFG;;AAWA,MAAMW,oBAAoB,GAC/BV,qBAAA,CAASW,EAAT,KAAgB,KAAhB,GACI,IADJ,GAEIN,0BAAA,CAAcO,uBAAd,GACAP,0BAAA,CAAcO,uBADd,GAEA,IAAIL,KAAJ,CACE,EADF,EAEE;EACEC,GAAG,GAAG;IACJ,MAAM,IAAIC,KAAJ,CAAUV,aAAV,CAAN;EACD;;AAHH,CAFF,CALC;;;AAcP,MAAMc,0BAA0B,GAAG,MAAM;EACvCC,OAAO,CAACC,GAAR,CAAY,qCAAZ;EACA,OAAO,IAAP;AACD,CAHD;;AAKO,SAASC,SAAT,CAAmBC,MAAnB,EAAoD;EACzD,OAAOb,KAAK,CAACY,SAAN,CAAgBC,MAAhB,CAAP;AACD;;AAEM,SAASC,aAAT,GAAyB;EAC9B,OAAOd,KAAK,CAACc,aAAN,EAAP;AACD;;AAEM,SAASC,OAAT,GAAmB;EACxB,OAAOf,KAAK,CAACe,OAAN,EAAP;AACD;;AAEM,SAASC,aAAT,GAAyB;EAC9B,OAAOhB,KAAK,CAACgB,aAAN,EAAP;AACD;;AAEM,SAASC,cAAT,GAA2C;EAChD,IAAIR,0BAA0B,EAA9B,EAAkC,OAAOS,OAAO,CAACC,OAAR,CAAgB,EAAhB,CAAP;EAClC,OAAOnB,KAAK,CAACiB,cAAN,EAAP;AACD;;AAEM,SAASG,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOtB,KAAK,CAACoB,gBAAN,CACLC,GADK,EAELzB,qBAAA,CAASW,EAAT,KAAgB,SAAhB,GAA4B;IAAEe;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;;AAEM,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAOxB,KAAK,CAACuB,WAAN,CAAkBC,IAAlB,CAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO1B,KAAK,CAACyB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useReducer, createContext, useEffect, useContext } from 'react';
|
|
2
|
-
import { NativeEventEmitter, YellowBox, Platform } from 'react-native';
|
|
2
|
+
import { NativeEventEmitter, YellowBox, Platform, Linking } from 'react-native';
|
|
3
3
|
import { initialRowndState, rowndReducer } from '../reducer/rowndReducer';
|
|
4
4
|
import * as NativeRowndModules from '../utils/nativeModule';
|
|
5
5
|
import { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';
|
|
@@ -35,6 +35,22 @@ const RowndProvider = _ref => {
|
|
|
35
35
|
return () => {
|
|
36
36
|
subscription.remove();
|
|
37
37
|
};
|
|
38
|
+
}, []); // Handle deep linking
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (Platform.OS !== 'ios') {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
Linking.addEventListener('url', event => NativeRowndModules.handleSignInLink(event.url));
|
|
46
|
+
|
|
47
|
+
(async () => {
|
|
48
|
+
const initialUrl = await Linking.getInitialURL();
|
|
49
|
+
|
|
50
|
+
if (initialUrl) {
|
|
51
|
+
NativeRowndModules.handleSignInLink(initialUrl);
|
|
52
|
+
}
|
|
53
|
+
})();
|
|
38
54
|
}, []);
|
|
39
55
|
return /*#__PURE__*/React.createElement(GlobalContext.Provider, {
|
|
40
56
|
value: value
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useReducer","createContext","useEffect","useContext","NativeEventEmitter","YellowBox","Platform","initialRowndState","rowndReducer","NativeRowndModules","Rownd","IOSRowndEventEmitter","ActionType","ignoreWarnings","GlobalContext","undefined","eventEmitter","RowndProvider","children","config","state","dispatch","value","configure","appKey","onSessionConnect","event","type","UPDATE_STATE","payload","OS","JSON","parse","subscription","addListener","remove","useRowndContext","context","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config.appKey);\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n\n return context;\n}\n\nexport { RowndProvider, useRowndContext };\n"],"mappings":"AAAA,OAAOA,KAAP,IACEC,UADF,EAEEC,aAFF,EAIEC,SAJF,EAKEC,UALF,QAMO,OANP;AAOA,SAASC,kBAAT,EAA6BC,SAA7B,EAAwCC,QAAxC,
|
|
1
|
+
{"version":3,"names":["React","useReducer","createContext","useEffect","useContext","NativeEventEmitter","YellowBox","Platform","Linking","initialRowndState","rowndReducer","NativeRowndModules","Rownd","IOSRowndEventEmitter","ActionType","ignoreWarnings","GlobalContext","undefined","eventEmitter","RowndProvider","children","config","state","dispatch","value","configure","appKey","onSessionConnect","event","type","UPDATE_STATE","payload","OS","JSON","parse","subscription","addListener","remove","addEventListener","handleSignInLink","url","initialUrl","getInitialURL","useRowndContext","context","Error"],"sources":["GlobalContext.tsx"],"sourcesContent":["import React, {\n useReducer,\n createContext,\n FunctionComponent,\n useEffect,\n useContext,\n} from 'react';\nimport { NativeEventEmitter, YellowBox, Platform, Linking } from 'react-native';\nimport { initialRowndState, rowndReducer } from '../reducer/rowndReducer';\n\nimport * as NativeRowndModules from '../utils/nativeModule';\nimport { Rownd, IOSRowndEventEmitter } from '../utils/nativeModule';\nimport type { ContextProps, GlobalState } from './GlobalContext.types';\nimport type { TAction } from '../constants/action';\nimport { ActionType } from '../constants/action';\n\nYellowBox.ignoreWarnings([\n 'Sending `update_state` with no listeners registered.',\n]);\nYellowBox.ignoreWarnings(['YellowBox has been replaced with LogBox.']);\n\nexport const GlobalContext = createContext<\n { state: GlobalState; dispatch: React.Dispatch<TAction> } | undefined\n>(undefined);\n\nconst eventEmitter = new NativeEventEmitter(IOSRowndEventEmitter || Rownd);\n\nconst RowndProvider: FunctionComponent<ContextProps> = ({\n children,\n config,\n}) => {\n const [state, dispatch] = useReducer(rowndReducer, initialRowndState);\n const value = { state, dispatch };\n\n useEffect(() => {\n NativeRowndModules.configure(config.appKey);\n }, [config.appKey]);\n\n useEffect(() => {\n const onSessionConnect = (event: any) => {\n dispatch({\n type: ActionType.UPDATE_STATE,\n payload: Platform.OS === 'android' ? JSON.parse(event.state) : event,\n });\n };\n const subscription = eventEmitter.addListener(\n 'update_state',\n onSessionConnect\n );\n\n if (!subscription) return;\n\n return () => {\n subscription.remove();\n };\n }, []);\n\n // Handle deep linking\n useEffect(() => {\n if (Platform.OS !== 'ios') {\n return;\n }\n\n Linking.addEventListener('url', (event) =>\n NativeRowndModules.handleSignInLink(event.url)\n );\n\n (async () => {\n const initialUrl = await Linking.getInitialURL();\n if (initialUrl) {\n NativeRowndModules.handleSignInLink(initialUrl);\n }\n })();\n }, []);\n\n return (\n <GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>\n );\n};\n\nfunction useRowndContext() {\n const context = useContext(GlobalContext);\n\n if (context === undefined) {\n throw new Error(\n 'useGlobalContext must be used within a GlobalContext Provider'\n );\n }\n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AsDM;MAFxD,CAAD,CAAR;IAID,CALD;;IAMA,MAAMO,YAAY,GAAGjB,YAAY,CAACkB,WAAb,CACnB,cADmB,EAEnBT,gBAFmB,CAArB;IAKA,IAAI,CAACQ,YAAL,EAAmB;IAEnB,OAAO,MAAM;MACXA,YAAY,CAACE,MAAb;IACD,CAFD;EAGD,CAjBQ,EAiBN,EAjBM,CAAT,CARI,CA2BJ;;EACAlC,SAAS,CAAC,MAAM;IACd,IAAII,QAAQ,CAACyB,EAAT,KAAgB,KAApB,EAA2B;MACzB;IACD;;IAEDxB,OAAO,CAAC8B,gBAAR,CAAyB,KAAzB,EAAiCV,KAAD,IAC9BjB,kBAAkB,CAAC4B,gBAAnB,CAAoCX,KAAK,CAACY,GAA1C,CADF;;IAIA,CAAC,YAAY;MACX,MAAMC,UAAU,GAAG,MAAMjC,OAAO,CAACkC,aAAR,EAAzB;;MACA,IAAID,UAAJ,EAAgB;QACd9B,kBAAkB,CAAC4B,gBAAnB,CAAoCE,UAApC;MACD;IACF,CALD;EAMD,CAfQ,EAeN,EAfM,CAAT;EAiBA,oBACE,oBAAC,aAAD,CAAe,QAAf;IAAwB,KAAK,EAAEjB;EAA/B,GAAuCJ,QAAvC,CADF;AAGD,CAnDD;;AAqDA,SAASuB,eAAT,GAA2B;EACzB,MAAMC,OAAO,GAAGxC,UAAU,CAACY,aAAD,CAA1B;;EAEA,IAAI4B,OAAO,KAAK3B,SAAhB,EAA2B;IACzB,MAAM,IAAI4B,KAAJ,CACJ,+DADI,CAAN;EAGD;;EAED,OAAOD,OAAP;AACD;;AAED,SAASzB,aAAT,EAAwBwB,eAAxB"}
|
|
@@ -9,7 +9,7 @@ export const Rownd = NativeModules.RowndPlugin ? NativeModules.RowndPlugin : new
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
});
|
|
12
|
-
export const IOSRowndEventEmitter = Platform.OS
|
|
12
|
+
export const IOSRowndEventEmitter = Platform.OS !== 'ios' ? null : NativeModules.RowndPluginEventEmitter ? NativeModules.RowndPluginEventEmitter : new Proxy({}, {
|
|
13
13
|
get() {
|
|
14
14
|
throw new Error(LINKING_ERROR);
|
|
15
15
|
}
|
|
@@ -45,4 +45,7 @@ export function setUserDataValue(key, value) {
|
|
|
45
45
|
export function setUserData(data) {
|
|
46
46
|
return Rownd.setUserData(data);
|
|
47
47
|
}
|
|
48
|
+
export function handleSignInLink(url) {
|
|
49
|
+
return Rownd.handleSignInLink(url);
|
|
50
|
+
}
|
|
48
51
|
//# sourceMappingURL=nativeModule.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","isNotAvailableInAndroidYet","console","log","configure","appKey","requestSignIn","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nexport const LINKING_ERROR =\n `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport const Rownd = NativeModules.RowndPlugin\n ? NativeModules.RowndPlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const IOSRowndEventEmitter =\n Platform.OS
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Rownd","RowndPlugin","Proxy","get","Error","IOSRowndEventEmitter","OS","RowndPluginEventEmitter","isNotAvailableInAndroidYet","console","log","configure","appKey","requestSignIn","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nexport const LINKING_ERROR =\n `The package '@rownd/react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nexport const Rownd = NativeModules.RowndPlugin\n ? NativeModules.RowndPlugin\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport const IOSRowndEventEmitter =\n Platform.OS !== 'ios'\n ? null\n : NativeModules.RowndPluginEventEmitter\n ? NativeModules.RowndPluginEventEmitter\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nconst isNotAvailableInAndroidYet = () => {\n console.log('ROWND: NOT AVAILABLE IN ANDROID YET');\n return true;\n};\n\nexport function configure(appKey: string): Promise<string> {\n return Rownd.configure(appKey);\n}\n\nexport function requestSignIn() {\n return Rownd.requestSignIn();\n}\n\nexport function signOut() {\n return Rownd.signOut();\n}\n\nexport function manageAccount() {\n return Rownd.manageAccount();\n}\n\nexport function getAccessToken(): Promise<string> {\n if (isNotAvailableInAndroidYet()) return Promise.resolve('');\n return Rownd.getAccessToken();\n}\n\nexport function setUserDataValue(key: string, value: any) {\n return Rownd.setUserDataValue(\n key,\n Platform.OS === 'android' ? { value } : value\n );\n}\n\nexport function setUserData(data: Record<string, any>) {\n return Rownd.setUserData(data);\n}\n\nexport function handleSignInLink(url: string) {\n return Rownd.handleSignInLink(url);\n}\n"],"mappings":"AAAA,SAASA,aAAT,EAAwBC,QAAxB,QAAwC,cAAxC;AAEA,OAAO,MAAMC,aAAa,GACvB,8EAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJK;AAMP,OAAO,MAAMC,KAAK,GAAGN,aAAa,CAACO,WAAd,GACjBP,aAAa,CAACO,WADG,GAEjB,IAAIC,KAAJ,CACE,EADF,EAEE;EAC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;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAOzB,KAAK,CAACwB,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
|
|
@@ -8,3 +8,4 @@ export declare function manageAccount(): any;
|
|
|
8
8
|
export declare function getAccessToken(): Promise<string>;
|
|
9
9
|
export declare function setUserDataValue(key: string, value: any): any;
|
|
10
10
|
export declare function setUserData(data: Record<string, any>): any;
|
|
11
|
+
export declare function handleSignInLink(url: string): any;
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
|
|
19
19
|
s.dependency "React-Core"
|
|
20
|
-
s.dependency "Rownd"
|
|
20
|
+
s.dependency "Rownd", "~> 1.9.1"
|
|
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
|
|
@@ -5,7 +5,7 @@ import React, {
|
|
|
5
5
|
useEffect,
|
|
6
6
|
useContext,
|
|
7
7
|
} from 'react';
|
|
8
|
-
import { NativeEventEmitter, YellowBox, Platform } from 'react-native';
|
|
8
|
+
import { NativeEventEmitter, YellowBox, Platform, Linking } from 'react-native';
|
|
9
9
|
import { initialRowndState, rowndReducer } from '../reducer/rowndReducer';
|
|
10
10
|
|
|
11
11
|
import * as NativeRowndModules from '../utils/nativeModule';
|
|
@@ -55,6 +55,24 @@ const RowndProvider: FunctionComponent<ContextProps> = ({
|
|
|
55
55
|
};
|
|
56
56
|
}, []);
|
|
57
57
|
|
|
58
|
+
// Handle deep linking
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (Platform.OS !== 'ios') {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Linking.addEventListener('url', (event) =>
|
|
65
|
+
NativeRowndModules.handleSignInLink(event.url)
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
(async () => {
|
|
69
|
+
const initialUrl = await Linking.getInitialURL();
|
|
70
|
+
if (initialUrl) {
|
|
71
|
+
NativeRowndModules.handleSignInLink(initialUrl);
|
|
72
|
+
}
|
|
73
|
+
})();
|
|
74
|
+
}, []);
|
|
75
|
+
|
|
58
76
|
return (
|
|
59
77
|
<GlobalContext.Provider value={value}>{children}</GlobalContext.Provider>
|
|
60
78
|
);
|
|
@@ -18,7 +18,7 @@ export const Rownd = NativeModules.RowndPlugin
|
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
export const IOSRowndEventEmitter =
|
|
21
|
-
Platform.OS
|
|
21
|
+
Platform.OS !== 'ios'
|
|
22
22
|
? null
|
|
23
23
|
: NativeModules.RowndPluginEventEmitter
|
|
24
24
|
? NativeModules.RowndPluginEventEmitter
|
|
@@ -67,3 +67,7 @@ export function setUserDataValue(key: string, value: any) {
|
|
|
67
67
|
export function setUserData(data: Record<string, any>) {
|
|
68
68
|
return Rownd.setUserData(data);
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
export function handleSignInLink(url: string) {
|
|
72
|
+
return Rownd.handleSignInLink(url);
|
|
73
|
+
}
|