Skip to content

Commit

Permalink
Revert "Upgrade to Android Gradle Plugin 8"
Browse files Browse the repository at this point in the history
This reverts commit dcb9a4e.
  • Loading branch information
tung2744 committed Nov 24, 2023
1 parent 5acef73 commit c1b86c6
Show file tree
Hide file tree
Showing 16 changed files with 255 additions and 100 deletions.
31 changes: 31 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.4.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.4.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

apply plugin: 'org.jetbrains.dokka'
7 changes: 3 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Sep 17 15:50:04 CST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
59 changes: 59 additions & 0 deletions javasample/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
apply plugin: 'com.android.application'

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}

android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.authgear.exampleapp.android"
minSdkVersion 21
targetSdkVersion 32
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

buildConfigField("String", "LOCAL_AUTHGEAR_CLIENT_ID", "\"${localProperties.getProperty('local.authgear.clientId')}\"")
buildConfigField("String", "LOCAL_AUTHGEAR_ENDPOINT", "\"${localProperties.getProperty('local.authgear.endpoint')}\"")
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.lifecycle:lifecycle-viewmodel:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata:2.2.0'
implementation 'androidx.activity:activity:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:6.6.5'
implementation "androidx.biometric:biometric:1.2.0-alpha03"
// To add Authgear in your app, use the following for latest version in main branch
// implementation 'com.github.authgear:authgear-sdk-android:main-SNAPSHOT'
implementation project(':sdk')
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
66 changes: 0 additions & 66 deletions javasample/build.gradle.kts

This file was deleted.

3 changes: 2 additions & 1 deletion javasample/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
xmlns:tools="http://schemas.android.com/tools"
package="com.oursky.authgeartest">

<application
android:allowBackup="true"
Expand Down
1 change: 1 addition & 0 deletions scripts/deploy-docs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh

cd build/dokka/htmlMultiModule || exit 1
mv -- -modules.html index.html

git init
git checkout -b gh-pages
Expand Down
65 changes: 65 additions & 0 deletions sdk-okhttp/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.jetbrains.dokka'

android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
afterEvaluate {
ktlint.dependsOn ktlintFormat
check.dependsOn ktlint
preBuild.dependsOn ktlint
}
}

configurations {
ktlint
}

dependencies {
ktlint "com.pinterest:ktlint:0.33.0"
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
implementation("com.squareup.okhttp3:okhttp:4.9.0")
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation project(path: ':sdk')
}

task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "src/**/*.kt"
}

task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "src/**/*.kt"
}
5 changes: 4 additions & 1 deletion sdk-okhttp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.oursky.authgear.okhttp">

/
</manifest>
80 changes: 80 additions & 0 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
apply plugin: 'com.android.library'

apply plugin: 'kotlin-android'

apply plugin: 'kotlinx-serialization'

apply plugin: 'kotlin-android-extensions'

apply plugin: 'org.jetbrains.dokka'

android {
compileSdkVersion 32
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 21
targetSdkVersion 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
afterEvaluate {
ktlint.dependsOn ktlintFormat
check.dependsOn ktlint
preBuild.dependsOn ktlint
}
kotlinOptions {
freeCompilerArgs = ['-Xjvm-default=enable', '-Xopt-in=kotlin.RequiresOptIn']
jvmTarget = '1.8'
}
}

configurations {
ktlint
}

dependencies {
ktlint "com.pinterest:ktlint:0.33.0"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-core:1.0.0-RC"
implementation "androidx.security:security-crypto:1.1.0-alpha02"
implementation "androidx.browser:browser:1.2.0"
implementation "androidx.appcompat:appcompat:1.4.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
implementation "androidx.biometric:biometric:1.2.0-alpha03"
implementation "androidx.biometric:biometric-ktx:1.2.0-alpha03"
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.10'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

task ktlint(type: JavaExec, group: "verification") {
description = "Check Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "src/**/*.kt"
}

task ktlintFormat(type: JavaExec, group: "formatting") {
description = "Fix Kotlin code style."
classpath = configurations.ktlint
main = "com.pinterest.ktlint.Main"
args "-F", "src/**/*.kt"
}
3 changes: 2 additions & 1 deletion sdk/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.oursky.authgear">
<uses-permission android:name="android.permission.INTERNET"/>
<application>
<activity android:name=".OAuthActivity"
Expand Down
2 changes: 2 additions & 0 deletions sdk/src/main/java/com/oursky/authgear/AuthgearDelegate.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.oursky.authgear

interface AuthgearDelegate {
@JvmDefault
fun onSessionStateChanged(container: Authgear, reason: SessionStateChangeReason) {}

@JvmDefault
fun sendWechatAuthRequest(state: String) {}
}
7 changes: 2 additions & 5 deletions sdk/src/main/java/com/oursky/authgear/AuthgearException.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.oursky.authgear

import android.os.Build
import android.security.keystore.KeyPermanentlyInvalidatedException
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricPrompt
Expand All @@ -14,10 +13,8 @@ open class AuthgearException : RuntimeException {

internal fun wrapException(e: Exception): Exception {
// BiometricPrivateKeyNotFoundException
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (e is KeyPermanentlyInvalidatedException) {
return BiometricPrivateKeyNotFoundException(e)
}
if (e is KeyPermanentlyInvalidatedException) {
return BiometricPrivateKeyNotFoundException(e)
}

// CancelException
Expand Down
Loading

0 comments on commit c1b86c6

Please sign in to comment.