Skip to content

Commit dda90f2

Browse files
Revert "Merge branch 'add-login-prompt' into master" (schibsted#77)
This reverts commit 249267b, reversing changes made to 96b90bc.
1 parent 249267b commit dda90f2

File tree

16 files changed

+18
-389
lines changed

16 files changed

+18
-389
lines changed

app/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ apply plugin: 'com.android.application'
22
apply plugin: 'kotlin-android'
33

44
android {
5-
compileSdkVersion 33
5+
compileSdkVersion 32
66

77
defaultConfig {
88
applicationId "com.schibsted.account"
99
minSdkVersion 21
10-
targetSdkVersion 32
10+
targetSdkVersion 30
1111
versionCode 1
1212
versionName "1.0"
1313

app/src/main/java/com/schibsted/account/example/MainActivity.kt

-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import androidx.lifecycle.Observer
88
import com.schibsted.account.databinding.ActivityMainBinding
99
import com.schibsted.account.webflows.activities.AuthResultLiveData
1010
import com.schibsted.account.webflows.activities.NotAuthed
11-
import com.schibsted.account.webflows.loginPrompt.LoginPromptFragment
1211
import com.schibsted.account.webflows.user.User
1312
import com.schibsted.account.webflows.util.Either
1413
import timber.log.Timber
@@ -40,11 +39,6 @@ class MainActivity : AppCompatActivity() {
4039
binding.manualLoginButton.setOnClickListener {
4140
startActivity(Intent(this, ManualLoginActivity::class.java))
4241
}
43-
44-
binding.showLoginPrompt.setOnClickListener {
45-
val loginPromptFragment = LoginPromptFragment()
46-
loginPromptFragment.show(supportFragmentManager, "12345")
47-
}
4842
}
4943

5044
private fun observeAuthResultLiveData() {

app/src/main/res/layout/activity_main.xml

-11
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,4 @@
2525
app:layout_constraintLeft_toLeftOf="parent"
2626
app:layout_constraintRight_toRightOf="parent"
2727
app:layout_constraintTop_toTopOf="@id/loginButton" />
28-
29-
<Button
30-
android:id="@+id/showLoginPrompt"
31-
android:layout_width="wrap_content"
32-
android:layout_height="wrap_content"
33-
android:text="Trigger login prompt"
34-
app:layout_constraintBottom_toBottomOf="parent"
35-
app:layout_constraintLeft_toLeftOf="parent"
36-
app:layout_constraintRight_toRightOf="parent"
37-
app:layout_constraintTop_toTopOf="@id/manualLoginButton" />
38-
3928
</androidx.constraintlayout.widget.ConstraintLayout>

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<color name="colorPrimary">#3274D4</color>
4-
<color name="colorPrimaryDark">#2196F3</color>
3+
<color name="colorPrimary">#6200EE</color>
4+
<color name="colorPrimaryDark">#3700B3</color>
55
<color name="colorAccent">#03DAC5</color>
66
</resources>

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

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
<resources>
22
<!-- Base application theme. -->
3-
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight">
3+
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
44
<!-- Customize your theme here. -->
55
<item name="colorPrimary">@color/colorPrimary</item>
66
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
77
<item name="colorAccent">@color/colorAccent</item>
8-
<item name="toolbarStyle">@style/AppToolbar</item>
9-
</style>
10-
11-
<style name="AppToolbar" parent="Widget.MaterialComponents.Toolbar.Primary">
12-
<item name="titleTextColor">@android:color/white</item>
138
</style>
149

1510
</resources>

webflows/build.gradle

+3-10
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ apply plugin: 'maven-publish'
66
apply plugin: 'signing'
77

88
android {
9-
compileSdkVersion 33
9+
compileSdkVersion 32
1010

1111
defaultConfig {
1212
minSdkVersion 21
13-
targetSdkVersion 33
13+
targetSdkVersion 30
1414

1515
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1616
consumerProguardFiles "consumer-rules.pro"
@@ -21,10 +21,6 @@ android {
2121
targetCompatibility JavaVersion.VERSION_1_8
2222
}
2323

24-
buildFeatures {
25-
viewBinding true
26-
}
27-
2824
buildTypes {
2925
release {
3026
minifyEnabled false
@@ -64,18 +60,15 @@ dependencies {
6460

6561
api "androidx.browser:browser:1.4.0"
6662
implementation 'com.nimbusds:nimbus-jose-jwt:9.24.3'
67-
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
6863

6964
//Logging
7065
implementation "com.jakewharton.timber:timber:$timber_version"
71-
implementation 'androidx.constraintlayout:constraintlayout:2.2.0-alpha09'
72-
implementation 'com.google.android.material:material:1.8.0'
7366

7467
testImplementation 'junit:junit:4.13.2'
7568
testImplementation "io.mockk:mockk:${mockkVersion}"
7669
testImplementation "com.squareup.okhttp3:mockwebserver:${okHttpVersion}"
7770

78-
testImplementation 'org.robolectric:robolectric:4.9.1'
71+
testImplementation 'org.robolectric:robolectric:4.8.2'
7972
testImplementation 'androidx.test.ext:junit:1.1.3'
8073
testImplementation "androidx.test.espresso:espresso-core:${espressoVersion}"
8174
testImplementation "androidx.test.espresso:espresso-intents:${espressoVersion}"

webflows/src/main/java/com/schibsted/account/webflows/api/UserProfileResponse.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ data class Address(
9292
@SerializedName("invoice")
9393
INVOICE;
9494

95-
override fun toString(): String = super.toString().lowercase(Locale.ROOT)
95+
override fun toString(): String = super.toString().toLowerCase(Locale.ROOT)
9696
}
9797
}
9898

webflows/src/main/java/com/schibsted/account/webflows/client/Client.kt

+9-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import com.schibsted.account.webflows.util.Either
2323
import com.schibsted.account.webflows.util.Either.Left
2424
import com.schibsted.account.webflows.util.Either.Right
2525
import com.schibsted.account.webflows.util.Util
26-
import com.schibsted.account.webflows.util.Util.isCustomTabsSupported
2726
import okhttp3.HttpUrl.Companion.toHttpUrl
2827
import okhttp3.OkHttpClient
2928
import org.json.JSONException
@@ -96,7 +95,7 @@ class Client {
9695
@JvmOverloads
9796
fun getAuthenticationIntent(context: Context, authRequest: AuthRequest = AuthRequest()): Intent {
9897
val loginUrl = generateLoginUrl(authRequest)
99-
val intent: Intent = if (isCustomTabsSupported(context)) {
98+
val intent: Intent = if (this.isCustomTabsSupported(context)) {
10099
buildCustomTabsIntent()
101100
.apply {
102101
intent.data = loginUrl
@@ -115,7 +114,7 @@ class Client {
115114
@JvmOverloads
116115
fun launchAuth(context: Context, authRequest: AuthRequest = AuthRequest()) {
117116
val loginUrl = generateLoginUrl(authRequest)
118-
if (isCustomTabsSupported(context)) {
117+
if (this.isCustomTabsSupported(context)) {
119118
buildCustomTabsIntent().launchUrl(context, loginUrl)
120119
} else {
121120
val intent = Intent(Intent.ACTION_VIEW, loginUrl).addCategory(Intent.CATEGORY_BROWSABLE)
@@ -134,6 +133,13 @@ class Client {
134133
return Uri.parse(loginUrl)
135134
}
136135

136+
private fun isCustomTabsSupported(context: Context): Boolean {
137+
val serviceIntent = Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION)
138+
val resolveInfos = context.packageManager.queryIntentServices(serviceIntent, 0)
139+
140+
return !resolveInfos.isEmpty()
141+
}
142+
137143
/**
138144
* Call this with the intent received via deep link to complete the login flow.
139145
*

webflows/src/main/java/com/schibsted/account/webflows/loginPrompt/LoginPromptFragment.kt

-79
This file was deleted.

webflows/src/main/java/com/schibsted/account/webflows/util/Util.kt

-10
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.schibsted.account.webflows.util
22

3-
import android.content.Context
4-
import android.content.Intent
5-
import androidx.browser.customtabs.CustomTabsService
63
import java.net.URLDecoder
74
import kotlin.random.Random
85

@@ -45,11 +42,4 @@ internal object Util {
4542

4643
return "${split[0]}.${split[1]}"
4744
}
48-
49-
fun isCustomTabsSupported(context: Context): Boolean {
50-
val serviceIntent = Intent(CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION)
51-
val resolveInfos = context.packageManager.queryIntentServices(serviceIntent, 0)
52-
53-
return !resolveInfos.isEmpty()
54-
}
5545
}

0 commit comments

Comments
 (0)