Skip to content

Commit

Permalink
extend support to API 23 (#162)
Browse files Browse the repository at this point in the history
Co-authored-by: Oleksandr Sarapulov <[email protected]>
  • Loading branch information
SimeoneVilardo and oleksandrsarapulovgl authored Jul 27, 2021
1 parent f259cea commit 1ed1a7f
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ android {
compileOptions {
sourceCompatibility Config.javaVersion
targetCompatibility Config.javaVersion
coreLibraryDesugaringEnabled true
}

kotlinOptions {
Expand Down Expand Up @@ -106,7 +107,8 @@ dependencies {
implementation Deps.room_ktx
implementation Deps.androidx_worker_ktx
implementation Deps.kotlinx_coroutines
implementation Deps.zxing
implementation(Deps.zxing) { transitive = false }
implementation Deps.zxing_core
implementation Deps.guava_conflict_resolver
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.4.0-alpha02"

Expand All @@ -129,4 +131,5 @@ dependencies {
testImplementation Deps.test_junit
// testImplementation Deps.mockito_core
// testImplementation Deps.mockito_kotlin
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
2 changes: 2 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
xmlns:tools="http://schemas.android.com/tools"
package="dgca.verifier.app.android">

<uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

Expand Down
29 changes: 29 additions & 0 deletions app/src/main/java/dgca/verifier/app/android/BackportUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* ---license-start
* eu-digital-green-certificates / dgca-verifier-app-android
* ---
* Copyright (C) 2021 T-Systems International GmbH and all other contributors
* ---
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ---license-end
*
* Created by Admin on 7/26/21, 3:18 AM
*/

package dgca.verifier.app.android;

public class BackportUtils {
public static int byteToUnsignedInt(byte x) {
return x & 0xff;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
package dgca.verifier.app.android.network

import android.os.Build
import dgca.verifier.app.android.BackportUtils
import okhttp3.Interceptor
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.Request
Expand Down Expand Up @@ -78,7 +79,7 @@ private fun String.sha256(): String {
digest.update(this.toByteArray())
val byteData: ByteArray = digest.digest()
for (x in byteData) {
val str = Integer.toHexString(java.lang.Byte.toUnsignedInt(x))
val str = Integer.toHexString(BackportUtils.byteToUnsignedInt(x))
if (str.length < 2) {
sb.append('0')
}
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/AppConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.gradle.api.JavaVersion

object Config {
const val minSdk = 26
const val minSdk = 23
const val compileSdk = 29
const val targetSdk = 29
val javaVersion = JavaVersion.VERSION_1_8
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ object Deps {
const val google_licenses_plugin = "com.google.android.gms:oss-licenses-plugin:${Versions.google_licenses_version}"

const val zxing = "com.journeyapps:zxing-android-embedded:${Versions.zxing}"
const val zxing_core = "com.google.zxing:core:${Versions.zxing_core}"
const val guava_conflict_resolver = "com.google.guava:listenablefuture:${Versions.guave_conflict_resolver_version}"
const val kotlin_reflect = "org.jetbrains.kotlin:kotlin-reflect:${Versions.kotlin_reflect}"
const val java_cose = "com.augustcellars.cose:cose-java:${Versions.java_cose}"
Expand Down
1 change: 1 addition & 0 deletions buildSrc/src/main/java/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ object Versions {

// QR
const val zxing = "4.2.0"
const val zxing_core = "3.3.0"
const val guave_conflict_resolver_version = "9999.0-empty-to-avoid-conflict-with-guava"

// Decoder
Expand Down

0 comments on commit 1ed1a7f

Please sign in to comment.