Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17
java-version: 21
- name: Build
run: ./gradlew build
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 17
java-version: 21
- name: Build
run: ./gradlew build
- name: Publish to Maven Repository
Expand Down
21 changes: 5 additions & 16 deletions accessibility-toolbox/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
@file:Suppress("UnstableApiUsage")

import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.dokka.get().pluginId)
id(libs.plugins.kotlin.parcelize.get().pluginId)
}

apply {
from("../scripts/maven.gradle")
}
apply(from = "../scripts/maven.gradle")

description = "Accessibility-Toolbox: Make it easy to make your app accessible"

Expand Down Expand Up @@ -40,21 +35,15 @@ android {
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

sourceSets {
getByName("main").java.srcDirs("src/main/kotlin")
getByName("test").java.srcDirs("src/test/kotlin")
getByName("androidTest").java.srcDirs("src/androidTest/kotlin")
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.addAll(
"-Xjvm-default=all"
"-jvm-default=enable"
)
}
}
Expand Down
15 changes: 5 additions & 10 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
@file:Suppress("UnstableApiUsage")

import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
id(libs.plugins.androidLibrary.get().pluginId)
id(libs.plugins.kotlin.android.get().pluginId)
id(libs.plugins.dokka.get().pluginId)
id(libs.plugins.kotlin.parcelize.get().pluginId)
}

apply {
from("../scripts/maven.gradle")
}
apply(from = "../scripts/maven.gradle")

description = "Snabble Core: The business logic of the Snabble SDK"

Expand Down Expand Up @@ -44,15 +39,15 @@ android {

compileOptions {
isCoreLibraryDesugaringEnabled = true
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

kotlin {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
jvmTarget = JvmTarget.JVM_21
freeCompilerArgs.addAll(
"-Xjvm-default=all"
"-jvm-default=enable"
)
}
}
Expand Down
69 changes: 48 additions & 21 deletions core/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,28 +1,55 @@
-dontwarn java.lang.invoke.**
#-dontwarn java.lang.invoke.**
#
## OkHttp
#-keepattributes Signature
#-keepattributes *Annotation*
#-keep class okhttp3.** { *; }
#-keep interface okhttp3.** { *; }
#-dontwarn okhttp3.**
#
## Okio
#-keep class sun.misc.Unsafe { *; }
#-dontwarn java.nio.file.*
#-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
#-dontwarn okio.**
#
## Picasso
#-dontwarn com.squareup.okhttp.**

# OkHttp
# Gson: keep any field annotated with @SerializedName so R8 cannot rename or remove it.
# This is the single rule that makes all @SerializedName annotations work under R8 strict mode.
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}

# Gson needs generic type signatures to deserialize parameterized types (e.g. List<Foo>).
-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**

# Okio
-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**
# Retain TypeToken so Gson can resolve generic types at runtime.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken

# Picasso
-dontwarn com.squareup.okhttp.**
# SDK
# Keep enum values()/valueOf() for Gson @SerializedName resolution.
# Keep public static final fields so .name() returns the declared constant name,
# not the obfuscated one — required for resource lookup in SnabbleInitializer.
-keepclassmembers enum io.snabble.sdk.** {
public static **[] values();
public static ** valueOf(java.lang.String);
public static final ** *;
}

# Gson
-keepattributes Signature
-keepattributes *Annotation*
-dontwarn sun.misc.**
-keep class * implements com.google.gson.TypeAdapterFactory
-keep class * implements com.google.gson.JsonSerializer
-keep class * implements com.google.gson.JsonDeserializer
# Keep Parcelable CREATOR — required for cross-process parcel reconstruction
-keep class io.snabble.sdk.** implements android.os.Parcelable {
public static final ** CREATOR;
}

# SDK
-keep class io.snabble.sdk.** { *; }
# Keep Serializable lifecycle methods
-keepclassmembers class io.snabble.sdk.** implements java.io.Serializable {
static final long serialVersionUID;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
12 changes: 6 additions & 6 deletions core/src/main/java/io/snabble/sdk/Assets.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ public enum Type {
}

private class ApiAsset {
String name;
Map<Variant, String> variants;
@SerializedName("name") String name;
@SerializedName("variants") Map<Variant, String> variants;
}

private class ApiManifest {
ApiAsset[] files;
@SerializedName("files") ApiAsset[] files;
}

private class Asset {
public String filePath;
public String hash;
@SerializedName("filePath") public String filePath;
@SerializedName("hash") public String hash;

public Asset(String filePath, String hash) {
this.filePath = filePath;
Expand All @@ -114,7 +114,7 @@ public Asset(String filePath, String hash) {
}

private class Manifest {
Map<String, Asset> assets;
@SerializedName("assets") Map<String, Asset> assets;
}

private interface DownloadCallback {
Expand Down
8 changes: 5 additions & 3 deletions core/src/main/java/io/snabble/sdk/Brand.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package io.snabble.sdk

import com.google.gson.annotations.SerializedName

data class Brand(
val id: String,
val name: String,
@SerializedName("id") val id: String,
@SerializedName("name") val name: String,
) : Comparable<Brand> {
override fun compareTo(other: Brand) = compareValuesBy(this, other,
{ it.id },
)
}
}
39 changes: 13 additions & 26 deletions core/src/main/java/io/snabble/sdk/Company.kt
Original file line number Diff line number Diff line change
@@ -1,32 +1,19 @@
package io.snabble.sdk

import com.google.gson.annotations.SerializedName

/**
* Class describing a company
*/
data class Company(
/**
* Get the name of the city
*/
@JvmField
val city: String?,
/**
* Get the name of the country
*/
@JvmField
val country: String?,
/**
* Get the companies name
*/
@JvmField
val name: String?,
/**
* Get the name of the street, including the house number
*/
@JvmField
val street: String?,
/**
* Get the zip code
*/
@JvmField
val zip: String?
)
/** Get the name of the city */
@JvmField @SerializedName("city") val city: String?,
/** Get the name of the country */
@JvmField @SerializedName("country") val country: String?,
/** Get the companies name */
@JvmField @SerializedName("name") val name: String?,
/** Get the name of the street, including the house number */
@JvmField @SerializedName("street") val street: String?,
/** Get the zip code */
@JvmField @SerializedName("zip") val zip: String?
)
2 changes: 2 additions & 0 deletions core/src/main/java/io/snabble/sdk/Config.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.snabble.sdk

import android.content.Context
import androidx.annotation.Keep
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
Expand All @@ -19,6 +20,7 @@ import java.util.concurrent.TimeUnit
/**
* Configuration of the snabble SDK.
*/
@Keep
data class Config (
/**
* The endpoint url of the snabble backend. For example "https://api.snabble.io" for the Production environment.
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/io/snabble/sdk/Environment.kt
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package io.snabble.sdk

import androidx.annotation.Keep

/**
* Enum describing the environment the app is using
*/
@Keep
enum class Environment(val domain: String) {

TESTING("snabble-testing.io"),
STAGING("snabble-staging.io"),
PRODUCTION("snabble.io");
Expand All @@ -19,6 +23,7 @@ enum class Environment(val domain: String) {
val wildcardUrl: String = "*.$domain"

companion object {

/**
* Determine the environment by a url string
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.snabble.sdk

import androidx.annotation.Keep

/**
* Mutable LiveData with the current (possible not yet published) value. You
* can observe changes like with regular MutableLiveData, just not inherited.
Expand All @@ -12,6 +14,7 @@ package io.snabble.sdk
* You can directly compare the value with the LiveData's value directly as
* syntactic sugar.
*/
@Keep
class MutableAccessibleLiveData<T>: AccessibleLiveData<T> {
constructor() : super()
constructor(initialValue: T) : super(initialValue)
Expand All @@ -26,4 +29,4 @@ class MutableAccessibleLiveData<T>: AccessibleLiveData<T> {
public override fun setValue(value: T) {
this.value = value
}
}
}
10 changes: 5 additions & 5 deletions core/src/main/java/io/snabble/sdk/PaymentMethod.kt
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,13 @@ enum class PaymentMethod(
fun fromIdAndOrigin(id: String, origin: List<String>): PaymentMethod? {
entries.forEach { pm ->
if (pm.id == id && pm.id == TEGUT_EMPLOYEE_CARD.id) {
when (origin[0]) {
"tegutEmployeeID" -> return TEGUT_EMPLOYEE_CARD
"contactPersonCredentials" -> return EXTERNAL_BILLING
return when (origin.firstOrNull()) {
"tegutEmployeeID" -> TEGUT_EMPLOYEE_CARD
"contactPersonCredentials" -> EXTERNAL_BILLING
else -> null
}
} else if (pm.id == id && pm.id == PAYONE_SEPA.id) {
//needed for deserialization
return when (origin[0]) {
return when (origin.firstOrNull()) {
"payoneSepaData" -> PAYONE_SEPA
else -> DE_DIRECT_DEBIT
}
Expand Down
Loading
Loading