-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to AndroidX #609
Migrate to AndroidX #609
Conversation
android.enableJetifier=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will remain true
until we reach the end of the project and try to turn it off.
@@ -1,5 +1,5 @@ | |||
plugins { | |||
id "com.auth0.gradle.oss-library.android" version "0.12.1" | |||
id "com.auth0.gradle.oss-library.android" version "0.15.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
latest release plugin version
versionCode 1 | ||
versionName project.version | ||
consumerProguardFiles '../proguard/proguard-gson.pro', '../proguard/proguard-otto.pro', '../proguard/proguard-lock-2.pro' | ||
// Required since Android Gradle Plugin 4.1 - https://issuetracker.google.com/issues/154275579 | ||
buildConfigField "String", "VERSION_NAME", "\"$versionName\"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this value was historically available but got removed recently. We use it to construct the auth0 user info header.
@@ -26,7 +26,7 @@ | |||
|
|||
import android.os.Parcel; | |||
import android.os.Parcelable; | |||
import android.support.annotation.NonNull; | |||
import androidx.annotation.NonNull; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these changes are repeated all over the diff. This is the migration to AndroidX.
@@ -80,9 +81,11 @@ public void shouldCreateAccountFromResources() { | |||
Mockito.when(activity.getApplicationContext()).thenReturn(RuntimeEnvironment.application); | |||
Mockito.when(activity.registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class))).thenReturn(null); | |||
Mockito.when(activity.getResources()).thenReturn(resources); | |||
Mockito.when(resources.getIdentifier(anyString(), anyString(), anyString())).thenReturn(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer expecting "anything" but rather matching against the 2 specific values I know we consume
@@ -528,7 +529,7 @@ public void shouldCallEnterpriseOAuthAuthenticationWithActiveFlow() { | |||
public void shouldCallOAuthAuthenticationWithCustomProvider() { | |||
AuthProvider customProvider = mock(AuthProvider.class); | |||
AuthHandler handler = mock(AuthHandler.class); | |||
when(handler.providerFor(anyString(), eq("custom-connection"))).thenReturn(customProvider); | |||
when(handler.providerFor((String) isNull(), eq("custom-connection"))).thenReturn(customProvider); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matches against a null value, I have to cast to String because Java
@@ -77,12 +80,14 @@ public void shouldThrowIfAccountIsMissingAlsoFromResources() { | |||
public void shouldCreateAccountFromResources() { | |||
Activity activity = Mockito.mock(Activity.class); | |||
Resources resources = Mockito.mock(Resources.class); | |||
Mockito.when(activity.getApplicationContext()).thenReturn(RuntimeEnvironment.application); | |||
Mockito.when(activity.getApplicationContext()).thenReturn(ApplicationProvider.getApplicationContext()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the old way is deprecated and will probably be updated across more files if I see them
Mockito.when(activity.registerReceiver(any(BroadcastReceiver.class), any(IntentFilter.class))).thenReturn(null); | ||
Mockito.when(activity.getResources()).thenReturn(resources); | ||
Mockito.when(resources.getIdentifier(anyString(), anyString(), anyString())).thenReturn(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer expecting "anything" but rather matching against the 2 specific values I know we consume
This PR migrates to AndroidX dependencies, mostly achieved by running the AndroidX migration tool. It also updates other dependencies, including testing dependencies. It fixes compilation issues and replaces deprecated methods.
It also removes the Bintray gradle plugin. No longer required as we're now uploading packages directly to Central.