Skip to content

Improve compatibility with Kotlin and run Lint on CI #596

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

Merged
merged 3 commits into from
Sep 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ jobs:
- checkout
- restore_cache:
keys:
- v1-dep-{{ .Branch }}-
- v1-dep-{{ checksum "lib/build.gradle" }}
- run: ./gradlew androidDependencies
- save_cache:
key: v1-dep-{{ .Branch }}-{{ epoch }}
key: v1-dep-{{ checksum "lib/build.gradle" }}
paths:
- ~/.gradle
- ~/.android
- /usr/local/android-sdk-linux/extras
- run: ./gradlew clean test --continue --console=plain --max-workers=4
- run:
name: Run checks
command: ./gradlew clean test lint --continue --console=plain --max-workers=4
- store_artifacts:
path: lib/build/reports
destination: reports
- store_test_results:
path: lib/build/test-results
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,6 @@ As in the previous version, `Lock` can be configured with extra options. Check b

#### Renamed options from v1

- shouldUseWebView: Renamed to `useBrowser`. Whether to use the WebView or the Browser to request calls to the `/authorize` endpoint. Using the Browser has some [restrictions](#some-restrictions).
- shouldUseEmail: Renamed to `withUsernameStyle`. Defines if it should ask for email only, username only, or both of them. By default, it'll respect the Dashboard configuration of the parameter `requires_username`.
- isClosable: Renamed to `closable`. Defines if the LockActivity can be closed. By default, it's not closable.
- setFullscreen: Renamed to `fullscreen`. Defines if the LockActivity it's displayed in fullscreen. By default, it's not fullscreen.
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/java/com/auth0/android/lock/app/DemoActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ private void showResult(String message) {
Snackbar.make(rootLayout, message, Snackbar.LENGTH_LONG).show();
}

private LockCallback callback = new AuthenticationCallback() {
private final LockCallback callback = new AuthenticationCallback() {
@Override
public void onAuthentication(Credentials credentials) {
public void onAuthentication(@NonNull Credentials credentials) {
showResult("OK > " + credentials.getAccessToken());
}

Expand All @@ -294,12 +294,12 @@ public void onCanceled() {
}

@Override
public void onError(LockException error) {
public void onError(@NonNull LockException error) {
showResult(error.getMessage());
}
};

private AuthCallback loginCallback = new AuthCallback() {
private final AuthCallback loginCallback = new AuthCallback() {
@Override
public void onFailure(@NonNull Dialog dialog) {
dialog.show();
Expand All @@ -316,9 +316,9 @@ public void onSuccess(@NonNull Credentials credentials) {
}
};

private VoidCallback logoutCallback = new VoidCallback() {
private final VoidCallback logoutCallback = new VoidCallback() {
@Override
public void onFailure(Auth0Exception error) {
public void onFailure(@NonNull Auth0Exception error) {
showResult("Log out cancelled");
}

Expand Down
5 changes: 5 additions & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ android {
consumerProguardFiles '../proguard/proguard-gson.pro', '../proguard/proguard-otto.pro', '../proguard/proguard-lock-2.pro'
}

lintOptions {
disable 'ContentDescription', 'SyntheticAccessor'
abortOnError true
}

testOptions {
unitTests {
includeAndroidResources = true
Expand Down
11 changes: 7 additions & 4 deletions lib/src/main/java/com/auth0/android/lock/Auth0Parcelable.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

import com.auth0.android.Auth0;
import com.auth0.android.util.Telemetry;
Expand All @@ -38,12 +39,13 @@ public class Auth0Parcelable implements Parcelable {

private static final double WITHOUT_DATA = 0x00;
private static final double WITH_DATA = 0x01;
private Auth0 auth0;
private final Auth0 auth0;

public Auth0Parcelable(Auth0 auth0) {
public Auth0Parcelable(@NonNull Auth0 auth0) {
this.auth0 = auth0;
}

@NonNull
public Auth0 getAuth0() {
return auth0;
}
Expand All @@ -55,7 +57,7 @@ public int describeContents() {
}

@Override
public void writeToParcel(Parcel dest, int flags) {
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeString(auth0.getClientId());
dest.writeString(auth0.getDomainUrl());
dest.writeString(auth0.getConfigurationUrl());
Expand All @@ -80,7 +82,8 @@ public Auth0Parcelable[] newArray(int size) {
}
};

private Auth0Parcelable(Parcel in) {
@SuppressWarnings("ConstantConditions")
private Auth0Parcelable(@NonNull Parcel in) {
String clientId = in.readString();
String domain = in.readString();
String configurationDomain = in.readString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.auth0.android.lock;

import android.content.Intent;
import android.support.annotation.NonNull;
import android.util.Log;

import com.auth0.android.result.Credentials;
Expand All @@ -43,15 +44,15 @@ public abstract class AuthenticationCallback implements LockCallback {
*
* @param credentials with the tokens.
*/
public abstract void onAuthentication(Credentials credentials);
public abstract void onAuthentication(@NonNull Credentials credentials);

/**
* Called when the user goes back and closes the activity, without using an Authentication flow.
*/
public abstract void onCanceled();

@Override
public void onEvent(@LockEvent int event, Intent data) {
public void onEvent(@LockEvent int event, @NonNull Intent data) {
switch (event) {
case LockEvent.CANCELED:
onCanceled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.text.Editable;
Expand Down Expand Up @@ -82,7 +83,7 @@ public class CountryCodeActivity extends AppCompatActivity {
ListView listView;

@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.com_auth0_lock_passwordless_activity_country_code);
Expand Down
Loading