Skip to content

Commit 95073e9

Browse files
authored
Merge pull request #9 from torusresearch/fix/update
Update deps + add working example
2 parents 56a987b + 9882e11 commit 95073e9

File tree

10 files changed

+47
-47
lines changed

10 files changed

+47
-47
lines changed

.idea/gradle.xml

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

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

app/build.gradle

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ plugins {
44
}
55

66
android {
7-
compileSdkVersion 30
7+
compileSdkVersion 31
88
buildToolsVersion "30.0.3"
99

1010
defaultConfig {
1111
applicationId "com.openlogin.app"
1212
minSdkVersion 21
13-
targetSdkVersion 30
13+
targetSdkVersion 31
1414
versionCode 1
1515
versionName "1.0"
1616

@@ -35,19 +35,19 @@ android {
3535
dependencies {
3636
// Default
3737
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
38-
implementation 'androidx.core:core-ktx:1.3.2'
39-
implementation 'androidx.appcompat:appcompat:1.2.0'
40-
implementation 'com.google.android.material:material:1.3.0'
41-
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
38+
implementation 'androidx.core:core-ktx:1.7.0'
39+
implementation 'androidx.appcompat:appcompat:1.4.0'
40+
implementation 'com.google.android.material:material:1.4.0'
41+
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
4242

4343
// Encoding
44-
implementation 'com.google.code.gson:gson:2.8.6'
44+
implementation 'com.google.code.gson:gson:2.8.9'
4545

4646
// OpenLogin
4747
implementation project(":core")
4848

4949
// Test
50-
testImplementation 'junit:junit:4.+'
51-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
52-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
50+
testImplementation 'junit:junit:4.13.2'
51+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
52+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
5353
}

app/src/main/AndroidManifest.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
<activity
1616
android:launchMode="singleTop"
17-
android:name=".MainActivity">
17+
android:name=".MainActivity"
18+
android:exported="true">
1819
<intent-filter>
1920
<action android:name="android.intent.action.MAIN" />
2021

@@ -26,11 +27,11 @@
2627
<category android:name="android.intent.category.DEFAULT" />
2728
<category android:name="android.intent.category.BROWSABLE" />
2829

29-
<!-- Accept URIs: http://localhost[:*]/app-links/* -->
30+
<!-- Accept URIs: http://localhost[:*]/redirect/* -->
3031
<data
31-
android:host="localhost"
32-
android:pathPrefix="/app-links"
33-
android:scheme="http" />
32+
android:host="org.torusresearch.openloginexample"
33+
android:pathPrefix="/redirect"
34+
android:scheme="torusapp" />
3435
</intent-filter>
3536
<intent-filter>
3637
<action android:name="android.intent.action.VIEW" />

app/src/main/java/com/openlogin/app/MainActivity.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@ import android.view.View
77
import android.widget.Button
88
import android.widget.TextView
99
import androidx.appcompat.app.AppCompatActivity
10+
import com.google.gson.Gson
1011
import com.openlogin.core.AuthStateChangeListener
1112
import com.openlogin.core.OpenLogin
1213

1314
class MainActivity : AppCompatActivity() {
1415
private lateinit var openlogin: OpenLogin
1516

17+
private val gson = Gson()
18+
1619
private fun signIn() {
1720
openlogin.login(OpenLogin.Provider.GOOGLE)
1821
}
@@ -27,8 +30,9 @@ class MainActivity : AppCompatActivity() {
2730
val signOutButton = findViewById<Button>(R.id.signOutButton)
2831

2932
val key = openlogin.state.privKey
33+
val userInfo = openlogin.state.userInfo
3034
if (key is String && key.isNotEmpty()) {
31-
contentTextView.text = key
35+
contentTextView.text = gson.toJson(openlogin.state)
3236
contentTextView.visibility = View.VISIBLE
3337
signInButton.visibility = View.GONE
3438
signOutButton.visibility = View.VISIBLE
@@ -49,7 +53,7 @@ class MainActivity : AppCompatActivity() {
4953
this,
5054
clientId = getString(R.string.openlogin_project_id),
5155
network = OpenLogin.Network.MAINNET,
52-
redirectUrl = Uri.parse("http://localhost/app-links/auth"),
56+
redirectUrl = Uri.parse("torusapp://org.torusresearch.openloginexample/redirect"),
5357
)
5458
openlogin.setResultUrl(intent.data)
5559
openlogin.addAuthStateChangeListener(AuthStateChangeListener {

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<resources>
22
<string name="app_name">Torus OpenLogin</string>
3-
<string name="openlogin_project_id">BC01p_js5KUIjvqYYAzWlDKt6ft--5joV0TbZEKO7YbDTqnmU5v0sq_4wgkyh0QAfZZAi-v6nKD4kcxkAqPuj8U</string>
3+
<string name="openlogin_project_id">BCtbnOamqh0cJFEUYA0NB5YkvBECZ3HLZsKfvSRBvew2EiiKW3UxpyQASSR0artjQkiUOCHeZ_ZeygXpYpxZjOs</string>
44
<string name="sign_in">Sign in</string>
55
<string name="not_logged_in">Not logged in</string>
66
<string name="sign_out">Sign out</string>

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
buildscript {
2-
ext.kotlin_version = "1.4.32"
2+
ext.kotlin_version = "1.6.0"
33
repositories {
44
google()
55
jcenter()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:4.2.1'
8+
classpath 'com.android.tools.build:gradle:4.2.2'
99
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1010
}
1111
}

core/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,12 @@ android {
3535
dependencies {
3636
// Default
3737
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
38-
implementation 'androidx.core:core-ktx:1.3.2'
39-
implementation 'androidx.appcompat:appcompat:1.2.0'
40-
implementation 'com.google.android.material:material:1.3.0'
38+
implementation 'androidx.core:core-ktx:1.7.0'
39+
implementation 'androidx.appcompat:appcompat:1.4.0'
40+
implementation 'com.google.android.material:material:1.4.0'
4141

4242
// Custom Tabs
43-
implementation 'androidx.browser:browser:1.3.0'
43+
implementation 'androidx.browser:browser:1.4.0'
4444

4545
// Encoding
4646
implementation 'com.google.code.gson:gson:2.8.6'
@@ -51,6 +51,6 @@ dependencies {
5151

5252
// Test
5353
testImplementation 'junit:junit:4.+'
54-
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
55-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
54+
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
55+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
5656
}

core/src/main/java/com/openlogin/core/OpenLogin.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,22 @@ class OpenLogin(
2020
}
2121

2222
enum class Provider {
23-
GOOGLE, FACEBOOK, REDDIT, DISCORD, TWITCH, APPLE, LINE, GITHUB, KAKAO, LINKEDIN, TWITTER, WEIBO, WECHAT, EMAIL_PASSWORDLESS, WEBAUTHN
23+
GOOGLE, FACEBOOK, REDDIT, DISCORD, TWITCH, APPLE, LINE, GITHUB, KAKAO, LINKEDIN, TWITTER, WEIBO, WECHAT, EMAIL_PASSWORDLESS
24+
}
25+
26+
class UserInfo {
27+
var email: String = "";
28+
var name: String = "";
29+
var profileImage: String = "";
30+
var aggregateVerifier: String = "";
31+
var verifier: String = "";
32+
var verifierId: String = "";
33+
var typeOfLogin: String = "";
2434
}
2535

2636
data class State(
2737
val privKey: String? = null,
28-
val walletKey: String? = null,
29-
val tKey: String? = null,
30-
val oAuthPrivateKey: String? = null
38+
val userInfo: UserInfo? = null,
3139
)
3240

3341
private val gson = Gson()
@@ -100,7 +108,6 @@ class OpenLogin(
100108
fastLogin: Boolean? = null,
101109
relogin: Boolean? = null,
102110
skipTKey: Boolean? = null,
103-
getWalletKey: Boolean? = null,
104111
extraLoginOptions: Map<String, Any>? = null,
105112
redirectUrl: Uri? = null,
106113
appState: String? = null,
@@ -111,7 +118,6 @@ class OpenLogin(
111118
if (fastLogin != null) params["fastLogin"] = fastLogin
112119
if (relogin != null) params["relogin"] = relogin
113120
if (skipTKey != null) params["skipTKey"] = skipTKey
114-
if (getWalletKey != null) params["getWalletKey"] = getWalletKey
115121
if (extraLoginOptions != null) params["extraLoginOptions"] = extraLoginOptions
116122
if (redirectUrl != null) params["redirectUrl"] = redirectUrl.toString()
117123
if (appState != null) params["appState"] = appState
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Thu Apr 22 12:54:03 ICT 2021
1+
#Mon Nov 22 12:32:04 SGT 2021
22
distributionBase=GRADLE_USER_HOME
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
34
distributionPath=wrapper/dists
4-
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
6+
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)