Skip to content
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

Minor refactoring / Update dependencies #502

Merged
merged 6 commits into from
Mar 13, 2023
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
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.android.tools.build:gradle:7.4.2'
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.5'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.22.0"
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Aug 03 13:14:19 CEST 2021
#Fri Mar 10 15:14:55 CET 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
32 changes: 12 additions & 20 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ configurations {
}

android {
namespace 'com.nextcloud.android.sso'
compileSdkVersion 31
defaultConfig {
minSdkVersion 21
targetSdkVersion 31
versionCode 1
versionName '1.0'
}

buildTypes {
Expand All @@ -40,27 +39,20 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

compileOptions {
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
lintOptions {
// translations are imported from transifex, so no need to check here
disable 'MissingTranslation'
disable 'ExtraTranslation'
disable 'MissingQuantity'
disable 'InconsistentArrays'
disable 'TypographyEllipsis'
disable 'GradleDependency'
disable 'VectorPath'
disable 'IconMissingDensityFolder'
disable 'IconDensities'

productFlavors { }

lint {
abortOnError false
htmlReport true
disable 'MissingTranslation', 'ExtraTranslation', 'MissingQuantity', 'InconsistentArrays', 'TypographyEllipsis', 'GradleDependency', 'VectorPath', 'IconMissingDensityFolder', 'IconDensities'
htmlOutput file("$project.buildDir/reports/lint/lint.html")
}
productFlavors {
htmlReport true
}

tasks.register("spotbugsDebugReport", SpotBugsTask) {
Expand Down Expand Up @@ -98,14 +90,14 @@ detekt {
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.0'

implementation "androidx.appcompat:appcompat:1.4.2"
implementation "androidx.appcompat:appcompat:1.5.1"
implementation 'androidx.annotation:annotation:1.5.0'
implementation 'androidx.core:core:1.8.0'
implementation 'androidx.core:core:1.9.0'
implementation 'androidx.fragment:fragment:1.5.5'

implementation 'com.google.android.material:material:1.6.1'
implementation 'com.google.android.material:material:1.7.0'

compileOnly "org.projectlombok:lombok:1.18.26"
annotationProcessor "org.projectlombok:lombok:1.18.24"
Expand Down
3 changes: 1 addition & 2 deletions lib/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nextcloud.android.sso">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Expand Down
10 changes: 8 additions & 2 deletions lib/src/main/java/com/nextcloud/android/sso/AccountImporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotInstalledException;
import com.nextcloud.android.sso.exceptions.NextcloudFilesAppNotSupportedException;
import com.nextcloud.android.sso.exceptions.SSOException;
import com.nextcloud.android.sso.exceptions.UnknownErrorException;
import com.nextcloud.android.sso.model.FilesAppType;
import com.nextcloud.android.sso.model.SingleSignOnAccount;
import com.nextcloud.android.sso.ui.UiExceptionManager;
Expand Down Expand Up @@ -329,8 +330,13 @@ private static void onRequestPermissionsResult(int requestCode, @NonNull String[
}

public static void handleFailedAuthRequest(Intent data) throws SSOException {
String exception = data.getStringExtra(NEXTCLOUD_SSO_EXCEPTION);
throw SSOException.parseNextcloudCustomException(new Exception(exception));
if(data != null) {
String exception = data.getStringExtra(NEXTCLOUD_SSO_EXCEPTION);
throw SSOException.parseNextcloudCustomException(new Exception(exception));
} else {
Log.e(TAG, "handleFailedAuthRequest failed - data is null");
throw new UnknownErrorException("Authentication request failed - no details available");
}
}

public static void authenticateSingleSignAccount(Fragment fragment, SingleSignOnAccount account) throws NextcloudFilesAppNotSupportedException, NextcloudFilesAppAccountPermissionNotGrantedException {
Expand Down
14 changes: 8 additions & 6 deletions sample/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 31
buildToolsVersion "31.0.0"
namespace 'com.nextcloud.android.sso.sample'

compileSdkVersion 33
buildToolsVersion "32.0.0"

defaultConfig {
applicationId "com.nextcloud.android.sso.sample"
minSdkVersion 22
targetSdkVersion 31
targetSdkVersion 33
versionCode 1
versionName "1.0"

Expand All @@ -28,11 +30,11 @@ android {
}

dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.2'

implementation project(path: ':lib')
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'

Expand Down
3 changes: 1 addition & 2 deletions sample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.nextcloud.android.sso.sample">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand Down