Skip to content

Commit a43b358

Browse files
Merge pull request #5 from torusresearch/FD-601-ml8
feat: updated iOS and Android API
2 parents 9240b98 + 170eb32 commit a43b358

File tree

24 files changed

+15355
-77609
lines changed

24 files changed

+15355
-77609
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@ android/keystores/debug.keystore
5858

5959
# generated by bob
6060
lib/
61+
62+
# large files
63+
android/caches
64+
android/wrapper
Lines changed: 60 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
import * as React from 'react';
1+
import React, {useState} from 'react';
22

33
import {StyleSheet, View, Text, Button} from 'react-native';
44
import OpenloginReactNativeSdk, {
5+
LoginResponse,
56
LoginProvider,
67
OpenloginNetwork,
78
} from 'openlogin-react-native-sdk';
89

910
export default function App() {
10-
const [authState, setAuthState] = React.useState({});
11+
const [result, setResult] = useState('');
1112

1213
React.useEffect(() => {
13-
OpenloginReactNativeSdk.addOpenloginAuthStateChangedEventListener(state => {
14-
console.log(state);
15-
setAuthState(state);
16-
});
1714
OpenloginReactNativeSdk.init({
1815
clientId:
1916
'BKJ3HmEqVmMHbFeW6E-CVPmdnVrnPhdBEI82kxgBVJGtaS4XlylvAE-1gmsv_Fa1CDj-xIhvTf3Kgd6mTn8nJtw',
@@ -24,35 +21,55 @@ export default function App() {
2421
.catch(err => console.log(`error: ${err}`));
2522
}, []);
2623

27-
// React.useEffect(() => {
28-
// // OpenloginReactNativeSdk.multiply(3, 7).then(setResult);
29-
// }, []);
30-
3124
return (
3225
<View style={styles.container}>
33-
<Button
34-
title="Login"
35-
onPress={() =>
36-
OpenloginReactNativeSdk.login({
37-
provider: LoginProvider.GOOGLE,
38-
})
39-
.then(result => console.log(`success: ${result}`))
40-
.catch(err => console.log(`error: ${err}`))
41-
}
42-
/>
43-
<Button
44-
title="Logout"
45-
onPress={() =>
46-
OpenloginReactNativeSdk.logout({
47-
provider: LoginProvider.GOOGLE,
48-
})
49-
.then(result => console.log(`success: ${result}`))
50-
.catch(err => console.log(`error: ${err}`))
51-
}
52-
/>
53-
<Text style={styles.authStateText}>
54-
Result: {JSON.stringify(authState)}
55-
</Text>
26+
<View style={styles.box}>
27+
<Button
28+
title="Login with Google"
29+
onPress={() =>
30+
OpenloginReactNativeSdk.login({
31+
provider: LoginProvider.GOOGLE,
32+
})
33+
.then(result => setResult(JSON.stringify(result)))
34+
.catch(err => console.log(`error: ${err}`))
35+
}
36+
/>
37+
</View>
38+
<View style={styles.box}>
39+
<Button
40+
title="Login with Apple"
41+
onPress={() =>
42+
OpenloginReactNativeSdk.login({
43+
provider: LoginProvider.APPLE,
44+
})
45+
.then(result => setResult(JSON.stringify(result)))
46+
.catch(err => console.log(`error: ${err}`))
47+
}
48+
/>
49+
</View>
50+
<View style={styles.box}>
51+
<Button
52+
title="Login with OpenLogin"
53+
onPress={() =>
54+
OpenloginReactNativeSdk.login({})
55+
.then(result => setResult(JSON.stringify(result)))
56+
.catch(err => console.log(`error: ${err}`))
57+
}
58+
/>
59+
</View>
60+
<View style={styles.box}>
61+
<Button
62+
title="Logout"
63+
onPress={() =>
64+
OpenloginReactNativeSdk.logout({
65+
provider: LoginProvider.GOOGLE,
66+
})
67+
.then(result => setResult(''))
68+
.catch(err => console.log(`error: ${err}`))
69+
}
70+
/>
71+
</View>
72+
<Text style={styles.text}>Result: {result}</Text>
5673
</View>
5774
);
5875
}
@@ -64,11 +81,16 @@ const styles = StyleSheet.create({
6481
justifyContent: 'center',
6582
},
6683
box: {
67-
width: 60,
68-
height: 60,
69-
marginVertical: 20,
84+
width: 200,
85+
height: 40,
86+
marginTop: 15,
7087
},
71-
authStateText: {
72-
color: 'white',
88+
text: {
89+
textAlign: 'center',
90+
fontWeight: 'bold',
91+
fontSize: 16,
92+
marginTop: 20,
93+
width: '100%',
94+
backgroundColor: 'white',
7395
},
7496
});

OpenLoginReactNativeSDKDemo2/android/app/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ android {
153153
keyPassword 'android'
154154
}
155155
}
156-
buildTypes {
156+
buildTypes {
157157
debug {
158158
signingConfig signingConfigs.debug
159159
if (nativeArchitectures) {
@@ -225,3 +225,9 @@ task copyDownloadableDepsToLibs(type: Copy) {
225225
}
226226

227227
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
228+
229+
configurations.all {
230+
resolutionStrategy {
231+
force 'androidx.core:core-ktx:1.6.0'
232+
}
233+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
<activity
1414
android:name=".MainActivity"
1515
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
16-
android:exported="true"
1716
android:label="@string/app_name"
1817
android:launchMode="singleTask"
19-
android:windowSoftInputMode="adjustResize">
18+
android:windowSoftInputMode="adjustResize"
19+
android:exported="true">
2020
<intent-filter>
2121
<action android:name="android.intent.action.MAIN" />
2222
<category android:name="android.intent.category.LAUNCHER" />

OpenLoginReactNativeSDKDemo2/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "30.0.2"
65
minSdkVersion = 21
76
compileSdkVersion = 31
87
targetSdkVersion = 31
@@ -13,7 +12,8 @@ buildscript {
1312
mavenCentral()
1413
}
1514
dependencies {
16-
classpath('com.android.tools.build:gradle:7.0.3')
15+
classpath('com.android.tools.build:gradle:7.0.4')
16+
1717
// NOTE: Do not place your application dependencies here; they belong
1818
// in the individual module build.gradle files
1919
}

OpenLoginReactNativeSDKDemo2/ios/OpenLoginReactNativeSDKDemo2/Images.xcassets/AppIcon.appiconset/Contents.json

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,52 @@
22
"images" : [
33
{
44
"idiom" : "iphone",
5-
"size" : "29x29",
6-
"scale" : "2x"
5+
"scale" : "2x",
6+
"size" : "20x20"
77
},
88
{
99
"idiom" : "iphone",
10-
"size" : "29x29",
11-
"scale" : "3x"
10+
"scale" : "3x",
11+
"size" : "20x20"
1212
},
1313
{
1414
"idiom" : "iphone",
15-
"size" : "40x40",
16-
"scale" : "2x"
15+
"scale" : "2x",
16+
"size" : "29x29"
1717
},
1818
{
1919
"idiom" : "iphone",
20-
"size" : "40x40",
21-
"scale" : "3x"
20+
"scale" : "3x",
21+
"size" : "29x29"
2222
},
2323
{
2424
"idiom" : "iphone",
25-
"size" : "60x60",
26-
"scale" : "2x"
25+
"scale" : "2x",
26+
"size" : "40x40"
2727
},
2828
{
2929
"idiom" : "iphone",
30-
"size" : "60x60",
31-
"scale" : "3x"
30+
"scale" : "3x",
31+
"size" : "40x40"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"scale" : "2x",
36+
"size" : "60x60"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"scale" : "3x",
41+
"size" : "60x60"
42+
},
43+
{
44+
"idiom" : "ios-marketing",
45+
"scale" : "1x",
46+
"size" : "1024x1024"
3247
}
3348
],
3449
"info" : {
35-
"version" : 1,
36-
"author" : "xcode"
50+
"author" : "xcode",
51+
"version" : 1
3752
}
38-
}
53+
}

OpenLoginReactNativeSDKDemo2/ios/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ target 'OpenLoginReactNativeSDKDemo2' do
77
config = use_native_modules!
88

99

10-
pod 'OpenLogin', :git => "https://github.com/torusresearch/openlogin-swift-sdk.git", :branch => "fix/main-thread"
10+
pod 'OpenLogin', '1.0.0'
1111

1212
use_react_native!(
1313
:path => config[:reactNativePath],

OpenLoginReactNativeSDKDemo2/ios/Podfile.lock

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ PODS:
7373
- fmt (6.2.1)
7474
- glog (0.3.5)
7575
- libevent (2.1.12)
76-
- OpenLogin (0.1.0)
76+
- OpenLogin (1.0.0)
7777
- openlogin-react-native-sdk (0.1.0):
7878
- OpenLogin
7979
- React-Core
@@ -372,7 +372,7 @@ DEPENDENCIES:
372372
- FlipperKit/FlipperKitUserDefaultsPlugin (= 0.99.0)
373373
- FlipperKit/SKIOSNetworkPlugin (= 0.99.0)
374374
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
375-
- OpenLogin (from `https://github.com/torusresearch/openlogin-swift-sdk.git`, branch `fix/main-thread`)
375+
- OpenLogin (= 1.0.0)
376376
- openlogin-react-native-sdk (from `../node_modules/openlogin-react-native-sdk`)
377377
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
378378
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
@@ -416,6 +416,7 @@ SPEC REPOS:
416416
- FlipperKit
417417
- fmt
418418
- libevent
419+
- OpenLogin
419420
- OpenSSL-Universal
420421
- YogaKit
421422

@@ -430,9 +431,6 @@ EXTERNAL SOURCES:
430431
:path: "../node_modules/react-native/React/FBReactNativeSpec"
431432
glog:
432433
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
433-
OpenLogin:
434-
:branch: fix/main-thread
435-
:git: https://github.com/torusresearch/openlogin-swift-sdk.git
436434
openlogin-react-native-sdk:
437435
:path: "../node_modules/openlogin-react-native-sdk"
438436
RCT-Folly:
@@ -486,11 +484,6 @@ EXTERNAL SOURCES:
486484
Yoga:
487485
:path: "../node_modules/react-native/ReactCommon/yoga"
488486

489-
CHECKOUT OPTIONS:
490-
OpenLogin:
491-
:commit: 20cf07e7475459b164c1979a82004d19d1c49015
492-
:git: https://github.com/torusresearch/openlogin-swift-sdk.git
493-
494487
SPEC CHECKSUMS:
495488
boost: a7c83b31436843459a1961bfd74b96033dc77234
496489
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
@@ -509,7 +502,7 @@ SPEC CHECKSUMS:
509502
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
510503
glog: 5337263514dd6f09803962437687240c5dc39aa4
511504
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
512-
OpenLogin: 650f1ae71014559d36a010e80524acd464d31760
505+
OpenLogin: 055c3108e8ada81a1e833c2c59188faed302e32b
513506
openlogin-react-native-sdk: 01d8215ea71e3f232b5c4c331ebd451cb62e0bc8
514507
OpenSSL-Universal: 1aa4f6a6ee7256b83db99ec1ccdaa80d10f9af9b
515508
RCT-Folly: a21c126816d8025b547704b777a2ba552f3d9fa9
@@ -539,6 +532,6 @@ SPEC CHECKSUMS:
539532
Yoga: 32a18c0e845e185f4a2a66ec76e1fd1f958f22fa
540533
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
541534

542-
PODFILE CHECKSUM: bbd82cbfe84656e73966f7ad41030e5707329601
535+
PODFILE CHECKSUM: c2aa5d35f844d5e7a411cddb5201a81ba32e0078
543536

544537
COCOAPODS: 1.11.2

0 commit comments

Comments
 (0)