@rownd/react-native 2.3.0 → 2.5.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/README.md +31 -24
- package/ios/Rownd.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -3
- package/ios/RowndPlugin.m +5 -0
- package/ios/RowndPlugin.swift +14 -0
- package/lib/commonjs/hooks/rownd.js.map +1 -1
- package/lib/commonjs/utils/nativeModule.js +3 -1
- package/lib/commonjs/utils/nativeModule.js.map +1 -1
- package/lib/module/hooks/rownd.js.map +1 -1
- package/lib/module/utils/nativeModule.js +3 -1
- package/lib/module/utils/nativeModule.js.map +1 -1
- package/lib/typescript/hooks/rownd.d.ts +2 -5
- package/lib/typescript/utils/nativeModule.d.ts +2 -1
- package/package.json +1 -1
- package/rownd-react-native.podspec +1 -1
- package/src/hooks/rownd.ts +2 -5
- package/src/utils/nativeModule.ts +4 -1
- package/ios/Rownd.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
- package/ios/Rownd.xcodeproj/project.xcworkspace/xcuserdata/mhamann.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Rownd.xcodeproj/xcuserdata/mhamann.xcuserdatad/xcschemes/xcschememanagement.plist +0 -14
package/README.md
CHANGED
|
@@ -15,39 +15,50 @@ npm install @rownd/react-native
|
|
|
15
15
|
|
|
16
16
|
### Android
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
1. Ensure the Sdk versions match or are above provided versions. File: *android/build.gradle*
|
|
19
|
+
```
|
|
20
|
+
ext {
|
|
21
|
+
...
|
|
22
|
+
minSdkVersion = 26
|
|
23
|
+
compileSdkVersion = 32
|
|
24
|
+
targetSdkVersion = 31
|
|
25
|
+
...
|
|
26
|
+
}
|
|
20
27
|
```
|
|
28
|
+
2. Install the Rownd library and dependencies.
|
|
21
29
|
```sh
|
|
22
|
-
./gradlew build
|
|
30
|
+
cd android && ./gradlew build
|
|
23
31
|
```
|
|
24
32
|
|
|
25
33
|
### iOS
|
|
26
34
|
|
|
27
|
-
|
|
35
|
+
1. Ensure iOS version is at least 14. File: *ios/Podfile*
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
platform :ios, '14.0'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
2. Add the code below to install the Sodium pod dependency correctly. Place inside the target. File: *ios/Podfile*
|
|
28
42
|
```
|
|
29
43
|
dynamic_frameworks = ['Sodium']
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
end
|
|
44
|
+
pre_install do |installer|
|
|
45
|
+
installer.pod_targets.each do |pod|
|
|
46
|
+
if dynamic_frameworks.include?(pod.name)
|
|
47
|
+
puts "Overriding the dynamic_framework? method for #{pod.name}"
|
|
48
|
+
def pod.dynamic_framework?;
|
|
49
|
+
true
|
|
50
|
+
end
|
|
51
|
+
def pod.build_type;
|
|
52
|
+
Pod::BuildType.dynamic_framework
|
|
40
53
|
end
|
|
41
54
|
end
|
|
42
55
|
end
|
|
56
|
+
end
|
|
43
57
|
```
|
|
44
|
-
|
|
58
|
+
3. Install the Rownd pod and it's dependencies
|
|
45
59
|
|
|
46
60
|
```sh
|
|
47
|
-
cd ios
|
|
48
|
-
```
|
|
49
|
-
```sh
|
|
50
|
-
pod install
|
|
61
|
+
cd ios && pod install
|
|
51
62
|
```
|
|
52
63
|
|
|
53
64
|
## Setup
|
|
@@ -143,13 +154,9 @@ Retrieves the active, valid access token for the current user. 
|
|
|
143
154
|
```javascript
|
|
144
155
|
const { getAccessToken } = useRownd();
|
|
145
156
|
|
|
146
|
-
let accessToken = await getAccessToken(
|
|
147
|
-
waitForToken: false
|
|
148
|
-
});
|
|
157
|
+
let accessToken = await getAccessToken(=);
|
|
149
158
|
```
|
|
150
159
|
|
|
151
|
-
* `waitForToken: boolean` - when `true`, if no access token is present or if it's expired, the promise will not resolve until a valid token is available. While unlikely, this could result in waiting forever.
|
|
152
|
-
|
|
153
160
|
#### is\_authenticated
|
|
154
161
|
|
|
155
162
|
Indicates whether the current user is signed in or not.
|
package/ios/RowndPlugin.m
CHANGED
|
@@ -11,6 +11,11 @@ RCT_EXTERN_METHOD(configure:(NSString *)appKey
|
|
|
11
11
|
withRejecter:(RCTPromiseRejectBlock)reject)
|
|
12
12
|
|
|
13
13
|
RCT_EXTERN_METHOD(requestSignIn)
|
|
14
|
+
|
|
15
|
+
RCT_EXTERN_METHOD(requestSignInApple)
|
|
16
|
+
|
|
17
|
+
RCT_EXTERN_METHOD(requestSignInGoogle)
|
|
18
|
+
|
|
14
19
|
RCT_EXTERN_METHOD(signOut)
|
|
15
20
|
|
|
16
21
|
RCT_EXTERN_METHOD(manageAccount)
|
package/ios/RowndPlugin.swift
CHANGED
|
@@ -36,6 +36,20 @@ class RowndPlugin: NSObject {
|
|
|
36
36
|
Rownd.requestSignIn()
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
+
|
|
40
|
+
@objc
|
|
41
|
+
func requestSignInApple() -> Void {
|
|
42
|
+
DispatchQueue.main.async {
|
|
43
|
+
Rownd.requestSignIn(with: RowndSignInHint.appleId)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
@objc
|
|
48
|
+
func requestSignInGoogle() -> Void {
|
|
49
|
+
DispatchQueue.main.async {
|
|
50
|
+
Rownd.requestSignIn(with: RowndSignInHint.googleId)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
39
53
|
|
|
40
54
|
@objc
|
|
41
55
|
func signOut() -> Void {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRownd","state","useRowndContext","requestSignIn","signOut","manageAccount","getAccessToken","user","data","setValue","setUserDataValue","set","setUserData","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\
|
|
1
|
+
{"version":3,"names":["useRownd","state","useRowndContext","requestSignIn","signOut","manageAccount","getAccessToken","user","data","setValue","setUserDataValue","set","setUserData","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInOpts = {\n type?: 'google' | 'apple';\n};\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n auth: state.auth,\n access_token: state.auth.access_token,\n };\n}\n"],"mappings":";;;;;;;AAAA;;AAQA;;AAoCO,SAASA,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAY,IAAAC,8BAAA,GAAlB;EAEA,OAAO;IACLC,aAAa,EAAbA,2BADK;IAELC,OAAO,EAAPA,qBAFK;IAGLC,aAAa,EAAbA,2BAHK;IAILC,cAAc,EAAdA,4BAJK;IAKLC,IAAI,EAAE;MACJC,IAAI,EAAEP,KAAK,CAACM,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEC,8BAFN;MAGJC,GAAG,EAAEC;IAHD,CALD;IAULC,gBAAgB,EAAE,CAAC,CAACZ,KAAK,CAACa,IAAN,CAAWC,YAV1B;IAWLC,eAAe,EAAE,CAAC,CAACf,KAAK,CAACa,IAAN,CAAWG,MAXzB;IAYLH,IAAI,EAAEb,KAAK,CAACa,IAZP;IAaLC,YAAY,EAAEd,KAAK,CAACa,IAAN,CAAWC;EAbpB,CAAP;AAeD"}
|
|
@@ -44,7 +44,9 @@ function configure(appKey) {
|
|
|
44
44
|
return Rownd.configure(appKey);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
function requestSignIn() {
|
|
47
|
+
function requestSignIn(method) {
|
|
48
|
+
if ((method === null || method === void 0 ? void 0 : method.type) === 'apple') return Rownd.requestSignInApple();
|
|
49
|
+
if ((method === null || method === void 0 ? void 0 : method.type) === 'google') return Rownd.requestSignInGoogle();
|
|
48
50
|
return Rownd.requestSignIn();
|
|
49
51
|
}
|
|
50
52
|
|
|
@@ -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","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;;
|
|
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","method","type","requestSignInApple","requestSignInGoogle","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport type { RequestSignInOpts } from 'src/hooks/rownd';\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(method?: RequestSignInOpts) {\n if (method?.type === 'apple') return Rownd.requestSignInApple();\n if (method?.type === 'google') return Rownd.requestSignInGoogle();\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;;AAGO,MAAMA,aAAa,GAC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AT,GAAyB;EAC9B,OAAOpB,KAAK,CAACoB,aAAN,EAAP;AACD;;AAEM,SAASC,cAAT,GAA2C;EAChD,IAAIZ,0BAA0B,EAA9B,EAAkC,OAAOa,OAAO,CAACC,OAAR,CAAgB,EAAhB,CAAP;EAClC,OAAOvB,KAAK,CAACqB,cAAN,EAAP;AACD;;AAEM,SAASG,gBAAT,CAA0BC,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAO1B,KAAK,CAACwB,gBAAN,CACLC,GADK,EAEL7B,qBAAA,CAASW,EAAT,KAAgB,SAAhB,GAA4B;IAAEmB;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;;AAEM,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAO5B,KAAK,CAAC2B,WAAN,CAAkBC,IAAlB,CAAP;AACD;;AAEM,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO9B,KAAK,CAAC6B,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","user","data","setValue","set","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\
|
|
1
|
+
{"version":3,"names":["requestSignIn","signOut","manageAccount","getAccessToken","setUserDataValue","setUserData","useRowndContext","useRownd","state","user","data","setValue","set","is_authenticated","auth","access_token","is_initializing","app_id"],"sources":["rownd.ts"],"sourcesContent":["import {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n setUserDataValue,\n setUserData,\n} from '../utils/nativeModule';\nimport { useRowndContext } from '../components/GlobalContext';\n\nexport type TRowndContext = {\n requestSignIn: (opts?: RequestSignInOpts) => void;\n signOut: () => void;\n manageAccount: () => void;\n getAccessToken: () => Promise<string>;\n user: UserContext;\n is_authenticated: boolean;\n is_initializing: boolean;\n access_token: string | null;\n auth: AuthContext;\n};\n\ntype UserContext = {\n data: {\n id?: string;\n email?: string | null;\n phone?: string | null;\n [key: string]: any;\n };\n set: (data: Record<string, any>) => void;\n setValue: (key: string, value: any) => void;\n //set: (data: any) => void;\n};\n\ntype AuthContext = {\n access_token: string | null;\n app_id: string | null;\n is_verified_user?: boolean;\n};\n\nexport type RequestSignInOpts = {\n type?: 'google' | 'apple';\n};\n\nexport function useRownd(): TRowndContext {\n const { state } = useRowndContext();\n\n return {\n requestSignIn,\n signOut,\n manageAccount,\n getAccessToken,\n user: {\n data: state.user.data,\n setValue: setUserDataValue,\n set: setUserData,\n },\n is_authenticated: !!state.auth.access_token,\n is_initializing: !!state.auth.app_id,\n auth: state.auth,\n access_token: state.auth.access_token,\n };\n}\n"],"mappings":"AAAA,SACEA,aADF,EAEEC,OAFF,EAGEC,aAHF,EAIEC,cAJF,EAKEC,gBALF,EAMEC,WANF,QAOO,uBAPP;AAQA,SAASC,eAAT,QAAgC,6BAAhC;AAoCA,OAAO,SAASC,QAAT,GAAmC;EACxC,MAAM;IAAEC;EAAF,IAAYF,eAAe,EAAjC;EAEA,OAAO;IACLN,aADK;IAELC,OAFK;IAGLC,aAHK;IAILC,cAJK;IAKLM,IAAI,EAAE;MACJC,IAAI,EAAEF,KAAK,CAACC,IAAN,CAAWC,IADb;MAEJC,QAAQ,EAAEP,gBAFN;MAGJQ,GAAG,EAAEP;IAHD,CALD;IAULQ,gBAAgB,EAAE,CAAC,CAACL,KAAK,CAACM,IAAN,CAAWC,YAV1B;IAWLC,eAAe,EAAE,CAAC,CAACR,KAAK,CAACM,IAAN,CAAWG,MAXzB;IAYLH,IAAI,EAAEN,KAAK,CAACM,IAZP;IAaLC,YAAY,EAAEP,KAAK,CAACM,IAAN,CAAWC;EAbpB,CAAP;AAeD"}
|
|
@@ -24,7 +24,9 @@ const isNotAvailableInAndroidYet = () => {
|
|
|
24
24
|
export function configure(appKey) {
|
|
25
25
|
return Rownd.configure(appKey);
|
|
26
26
|
}
|
|
27
|
-
export function requestSignIn() {
|
|
27
|
+
export function requestSignIn(method) {
|
|
28
|
+
if ((method === null || method === void 0 ? void 0 : method.type) === 'apple') return Rownd.requestSignInApple();
|
|
29
|
+
if ((method === null || method === void 0 ? void 0 : method.type) === 'google') return Rownd.requestSignInGoogle();
|
|
28
30
|
return Rownd.requestSignIn();
|
|
29
31
|
}
|
|
30
32
|
export function signOut() {
|
|
@@ -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","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;
|
|
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","method","type","requestSignInApple","requestSignInGoogle","signOut","manageAccount","getAccessToken","Promise","resolve","setUserDataValue","key","value","setUserData","data","handleSignInLink","url"],"sources":["nativeModule.ts"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\nimport type { RequestSignInOpts } from 'src/hooks/rownd';\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(method?: RequestSignInOpts) {\n if (method?.type === 'apple') return Rownd.requestSignInApple();\n if (method?.type === 'google') return Rownd.requestSignInGoogle();\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;AAGA,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;EACEC,GAAG,G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,GAA1B,EAAuCC,KAAvC,EAAmD;EACxD,OAAOzB,KAAK,CAACuB,gBAAN,CACLC,GADK,EAEL7B,QAAQ,CAACW,EAAT,KAAgB,SAAhB,GAA4B;IAAEmB;EAAF,CAA5B,GAAwCA,KAFnC,CAAP;AAID;AAED,OAAO,SAASC,WAAT,CAAqBC,IAArB,EAAgD;EACrD,OAAO3B,KAAK,CAAC0B,WAAN,CAAkBC,IAAlB,CAAP;AACD;AAED,OAAO,SAASC,gBAAT,CAA0BC,GAA1B,EAAuC;EAC5C,OAAO7B,KAAK,CAAC4B,gBAAN,CAAuBC,GAAvB,CAAP;AACD"}
|
|
@@ -24,11 +24,8 @@ declare type AuthContext = {
|
|
|
24
24
|
app_id: string | null;
|
|
25
25
|
is_verified_user?: boolean;
|
|
26
26
|
};
|
|
27
|
-
declare type RequestSignInOpts = {
|
|
28
|
-
|
|
29
|
-
auto_sign_in?: boolean;
|
|
30
|
-
init_data?: Record<string, any>;
|
|
31
|
-
post_login_redirect?: string;
|
|
27
|
+
export declare type RequestSignInOpts = {
|
|
28
|
+
type?: 'google' | 'apple';
|
|
32
29
|
};
|
|
33
30
|
export declare function useRownd(): TRowndContext;
|
|
34
31
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { RequestSignInOpts } from 'src/hooks/rownd';
|
|
1
2
|
export declare const LINKING_ERROR: string;
|
|
2
3
|
export declare const Rownd: any;
|
|
3
4
|
export declare const IOSRowndEventEmitter: any;
|
|
4
5
|
export declare function configure(appKey: string): Promise<string>;
|
|
5
|
-
export declare function requestSignIn(): any;
|
|
6
|
+
export declare function requestSignIn(method?: RequestSignInOpts): any;
|
|
6
7
|
export declare function signOut(): any;
|
|
7
8
|
export declare function manageAccount(): any;
|
|
8
9
|
export declare function getAccessToken(): Promise<string>;
|
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", "~> 1.
|
|
20
|
+
s.dependency "Rownd", "~> 1.12.0"
|
|
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/hooks/rownd.ts
CHANGED
|
@@ -38,11 +38,8 @@ type AuthContext = {
|
|
|
38
38
|
is_verified_user?: boolean;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
type RequestSignInOpts = {
|
|
42
|
-
|
|
43
|
-
auto_sign_in?: boolean;
|
|
44
|
-
init_data?: Record<string, any>;
|
|
45
|
-
post_login_redirect?: string;
|
|
41
|
+
export type RequestSignInOpts = {
|
|
42
|
+
type?: 'google' | 'apple';
|
|
46
43
|
};
|
|
47
44
|
|
|
48
45
|
export function useRownd(): TRowndContext {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
import type { RequestSignInOpts } from 'src/hooks/rownd';
|
|
2
3
|
|
|
3
4
|
export const LINKING_ERROR =
|
|
4
5
|
`The package '@rownd/react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
@@ -40,7 +41,9 @@ export function configure(appKey: string): Promise<string> {
|
|
|
40
41
|
return Rownd.configure(appKey);
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
export function requestSignIn() {
|
|
44
|
+
export function requestSignIn(method?: RequestSignInOpts) {
|
|
45
|
+
if (method?.type === 'apple') return Rownd.requestSignInApple();
|
|
46
|
+
if (method?.type === 'google') return Rownd.requestSignInGoogle();
|
|
44
47
|
return Rownd.requestSignIn();
|
|
45
48
|
}
|
|
46
49
|
|
|
Binary file
|
package/ios/Rownd.xcodeproj/xcuserdata/mhamann.xcuserdatad/xcschemes/xcschememanagement.plist
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
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>
|