Skip to content

Commit

Permalink
Merge pull request #657 from SUPLA/develop
Browse files Browse the repository at this point in the history
v24.10.05
  • Loading branch information
przemyslawzygmunt authored Oct 28, 2024
2 parents c5ea4a2 + b227e8e commit 0e07c7a
Show file tree
Hide file tree
Showing 37 changed files with 323 additions and 350 deletions.
188 changes: 97 additions & 91 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag
import java.util.Date

plugins {
id("com.android.application")
id("com.diffplug.spotless")
kotlin("android")
kotlin("kapt")
id("com.google.gms.google-services")
id("com.google.dagger.hilt.android") version Versions.Hilt
id("org.jetbrains.kotlin.plugin.compose") version Versions.Kotlin
kotlin("plugin.serialization") version "2.0.0"
alias(libs.plugins.android.application)
alias(libs.plugins.spotless)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kapt)
alias(libs.plugins.google.services)
alias(libs.plugins.hilt)
alias(libs.plugins.kotlin.compose)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.ksp)
}

android {
compileSdk = Versions.Sdk
buildToolsVersion = Versions.BuildTools
compileSdk = libs.versions.compileSdk.get().toInt()
buildToolsVersion = libs.versions.buildTools.get()
namespace = "org.supla.android"

useLibrary("android.test.runner")
Expand All @@ -22,11 +24,11 @@ android {

defaultConfig {
applicationId = "org.supla.android"
minSdk = Versions.MinSdk
targetSdk = Versions.TargetSdk
minSdk = libs.versions.minSdk.get().toInt()
targetSdk = libs.versions.targetSdk.get().toInt()
multiDexEnabled = true
versionCode = 254
versionName = "24.10.04"
versionCode = 255
versionName = "24.10.05"

ndk {
moduleName = "suplaclient"
Expand Down Expand Up @@ -106,85 +108,89 @@ android {
jvmTarget = "21"
freeCompilerArgs = listOf("-Xcontext-receivers", "-Xjvm-default=all")
}
}

repositories {
maven(url = "https://jitpack.io")
packaging {
jniLibs {
useLegacyPackaging = false
}
}
}

dependencies {
implementation(project(":shared-core"))

implementation(Deps.Androidx.Core.Splash)
implementation(Deps.Multidex)
implementation(Deps.Androidx.Lifecycle.Extensions)
implementation(Deps.AndroidChart)
implementation(Deps.RxJava.RxJava)
implementation(Deps.RxJava.RxAndroid)
implementation(Deps.RxJava.RxKotlin)
implementation(Deps.Retrofit.Retrofit)
implementation(Deps.Retrofit.Gson)
implementation(Deps.Retrofit.RxJavaAdapter)
implementation(Deps.Retrofit.Logging)
implementation(Deps.GoogleMaterial)
implementation(Deps.Androidx.ConstraintLayout)
implementation(Deps.Androidx.Core.Core)
implementation(Deps.Androidx.Core.Ktx)
implementation(Deps.Androidx.Lifecycle.Runtime)
implementation(Deps.Androidx.Lifecycle.Viewmodel)
implementation(Deps.Androidx.Room.Runtime)
implementation(Deps.Androidx.Room.RxJava)
implementation(Deps.Androidx.AppCompat)
implementation(Deps.Androidx.Biometric)
implementation(Deps.Kotlin)
implementation(Deps.Coroutines)
implementation(Deps.Androidx.Fragment)
implementation(Deps.Androidx.Lifecycle.Livedata)
implementation(Deps.Androidx.Navigation.Fragment)
implementation(Deps.Androidx.Navigation.UI)
implementation(Deps.Androidx.Preferences)
implementation(Deps.Androidx.Worker)
implementation(Deps.Androidx.RecyclerView)
implementation(Deps.Hilt.Hilt)
implementation(Deps.Hilt.Worker)
implementation(Deps.FragmentViewBinding)
implementation(platform(Deps.Firebase.Bom))
implementation(Deps.Firebase.Messaging)
implementation(Deps.Androidx.Security.Crypto)
implementation(Deps.Androidx.Compose.UI)
implementation(Deps.Androidx.Compose.Icons)
implementation(Deps.Androidx.Compose.Material3.Core)
implementation(Deps.Androidx.Compose.Material3.Adaptive)
implementation(Deps.Androidx.Compose.Tooling)
implementation(Deps.Androidx.Compose.ToolingPreview)
implementation(Deps.Androidx.Compose.ConstraintLayout)
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.1")

coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.0.4")

annotationProcessor(Deps.Androidx.Room.Compiler)

kapt(Deps.Hilt.Kapt)
kapt(Deps.Hilt.WorkerKapt)
kapt(Deps.Androidx.Room.Compiler)

testImplementation(Deps.Testing.Androidx.Core)
testImplementation(Deps.Testing.Androidx.Runner)
testImplementation(Deps.Testing.Androidx.Rules)
testImplementation(Deps.Testing.Androidx.JUnitExtension)
testImplementation(Deps.Testing.Androidx.ArchCore)
testImplementation(Deps.Testing.Mockito.Core)
testImplementation(Deps.Testing.Mockito.Kotlin)
testImplementation(Deps.Testing.Robolectric)
testImplementation(Deps.Testing.JUnit)
testImplementation(Deps.Testing.Hamcrest)
testImplementation(Deps.Testing.Coroutines)
testImplementation(Deps.Testing.Mockk)
testImplementation(Deps.Testing.AssertJ)
testImplementation(Deps.Testing.Kotlin.Reflect)
androidTestImplementation(Deps.Testing.Androidx.Navigation)

implementation(files("src/main/libs/jsoup-1.13.1.jar"))
implementation(libs.multidex)
implementation(libs.androidChart)
implementation(libs.googleMaterial)
implementation(libs.coroutines)
implementation(libs.fragmentViewBinding)

implementation(libs.hilt)
implementation(libs.hilt.worker)

implementation(libs.androidx.constraintLayout)
implementation(libs.androidx.fragment)
implementation(libs.androidx.preferences)
implementation(libs.androidx.recyclerView)
implementation(libs.androidx.appCompat)
implementation(libs.androidx.biometric)
implementation(libs.androidx.worker)
implementation(libs.androidx.core)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.core.splash)
implementation(libs.androidx.lifecycle.runtime)
implementation(libs.androidx.lifecycle.viewmodel)
implementation(libs.androidx.lifecycle.livedata)
implementation(libs.androidx.lifecycle.extensions)
implementation(libs.androidx.room.runtime)
implementation(libs.androidx.room.rxjava)
implementation(libs.androidx.security.crypto)
implementation(libs.androidx.navigation.fragment)
implementation(libs.androidx.navigation.ui)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.compose.ui.tooling)
implementation(libs.androidx.compose.ui.toolingPreview)
implementation(libs.androidx.compose.material.icons)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material3.adaptive)
implementation(libs.androidx.compose.constraintLayout)

implementation(libs.rxjava)
implementation(libs.rxandroid)
implementation(libs.rxkotlin)
implementation(libs.retrofit)
implementation(libs.retrofit.gson)
implementation(libs.retrofit.rxJavaAdapter)
implementation(libs.retrofit.logging)

implementation(platform(libs.firebase))
implementation(libs.firebase.messaging)

implementation(libs.kotlin.stdlib)
implementation(libs.kotlinx.serialization)
implementation(libs.jsoup)

coreLibraryDesugaring(libs.android.tools.desugar)

annotationProcessor(libs.androidx.room.compiler)

kapt(libs.hilt.kapt)
kapt(libs.hilt.worker.kapt)
ksp(libs.androidx.room.compiler)

testImplementation(libs.testing.junit)
testImplementation(libs.testing.hamcrest)
testImplementation(libs.testing.coroutines)
testImplementation(libs.testing.mockk)
testImplementation(libs.testing.assertj)
testImplementation(libs.testing.mockito)
testImplementation(libs.testing.mockito.kotlin)
testImplementation(libs.testing.androidx)
testImplementation(libs.testing.androidx.navigation)
testImplementation(libs.testing.androidx.runner)
testImplementation(libs.testing.androidx.rules)
testImplementation(libs.testing.androidx.junit)
testImplementation(libs.testing.androidx.arch.core)
testImplementation(libs.testing.kotlin.relfect)
}

kapt {
Expand All @@ -195,14 +201,14 @@ spotless {
java {
target(fileTree("dir" to "src", "include" to "**/*.java"))

googleJavaFormat("1.19.2")
googleJavaFormat(libs.versions.googleJavaFormat.get())
removeUnusedImports()
trimTrailingWhitespace()
endWithNewline()
}
kotlin {
target(fileTree("dir" to "src", "include" to "**/*.kt"))
ktlint(Versions.KtLint).editorConfigOverride(
ktlint(libs.versions.ktlint.get()).editorConfigOverride(
mapOf(
"ktlint_standard_no-wildcard-imports" to "disabled",
"ktlint_standard_filename" to "disabled",
Expand All @@ -217,6 +223,6 @@ spotless {
}

composeCompiler {
enableStrongSkippingMode.set(true)
featureFlags.add(ComposeFeatureFlag.StrongSkipping)
}

1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<application
android:name="org.supla.android.SuplaApp"
android:allowBackup="false"
android:extractNativeLibs="false"
android:fullBackupContent="@xml/backup_descriptor"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ of the License, or (at your option) any later version.
import android.widget.TextView;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.core.content.res.ResourcesCompat;
import dagger.hilt.android.AndroidEntryPoint;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
Expand All @@ -46,6 +47,7 @@ of the License, or (at your option) any later version.
import org.supla.android.lib.ZWaveNode;
import org.supla.android.lib.ZWaveWakeUpSettings;

@AndroidEntryPoint
public class ZWaveConfigurationWizardActivity extends WizardActivity
implements AdapterView.OnItemSelectedListener {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import java.util.regex.Pattern
import javax.inject.Inject
import javax.inject.Singleton

private const val STATE_PATTERN = "^LAST\\ STATE:\\ (.*)\\<br\\>Firmware:\\ (.*)\\<br\\>GUID:\\ (.*)\\<br\\>MAC:\\ (.*)$"
private const val STATE_PATTERN = "LAST\\ STATE:\\ (.*)\\<br\\>[\\n ]*Firmware:\\ (.*)\\<br\\>[\\n ]*GUID:\\ (.*)\\<br\\>[\\n ]*MAC:\\ (.*)"

private const val INPUT_NAME_NO_CHANNELS = "no_visible_channels"
private const val INPUT_VALUE_NO_CHANNELS = "1"
Expand Down Expand Up @@ -73,8 +73,8 @@ class EspHtmlParser @Inject constructor() {

result.needsCloudConfig = fieldMap[INPUT_NAME_NO_CHANNELS]?.let { it == INPUT_VALUE_NO_CHANNELS } ?: false

doc.getElementsByTag("h1")?.also {
it.next()?.also { elements ->
doc.getElementsByTag("h1").also {
it.next().also { elements ->
for (element in elements) {
if (element.html().contains("LAST STATE").not()) {
continue
Expand All @@ -83,7 +83,7 @@ class EspHtmlParser @Inject constructor() {
val pattern = Pattern.compile(STATE_PATTERN)
val matcher = pattern.matcher(element.html())
if (matcher.find() && matcher.groupCount() == 4) {
result.deviceName = it.html()
result.deviceName = it.text()
result.deviceLastState = matcher.group(1)
result.deviceFirmwareVersion = matcher.group(2)
result.deviceGUID = matcher.group(3)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ enum class ChartRange(val stringRes: Int, val roundedDaysCount: Int) : SpinnerIt
LAST_WEEK(R.string.history_range_last_week, 7),
LAST_MONTH(R.string.history_range_last_30_days, 30),
LAST_QUARTER(R.string.history_range_last_90_days, 90),
LAST_YEAR(R.string.history_range_last_365_days, 365),

DAY(R.string.history_range_current_day, 1),
WEEK(R.string.history_range_current_week, 7),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ data class DateRange(
ChartRange.LAST_DAY,
ChartRange.LAST_WEEK,
ChartRange.LAST_MONTH,
ChartRange.LAST_QUARTER -> shift(if (forward) range.roundedDaysCount else -range.roundedDaysCount)
ChartRange.LAST_QUARTER,
ChartRange.LAST_YEAR -> shift(if (forward) range.roundedDaysCount else -range.roundedDaysCount)

ChartRange.DAY -> if (forward) nextDay() else previousDay()
ChartRange.WEEK -> if (forward) nextWeek() else previousWeek()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ abstract class ChartData(
ChartRange.LAST_WEEK,
ChartRange.LAST_MONTH,
ChartRange.LAST_QUARTER,
ChartRange.LAST_YEAR,
ChartRange.CUSTOM,
ChartRange.ALL_HISTORY -> false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,8 @@ abstract class BaseHistoryDetailViewModel(
ChartRange.LAST_DAY,
ChartRange.LAST_WEEK,
ChartRange.LAST_MONTH,
ChartRange.LAST_QUARTER -> currentDate.shift(-range.roundedDaysCount)
ChartRange.LAST_QUARTER,
ChartRange.LAST_YEAR -> currentDate.shift(-range.roundedDaysCount)

ChartRange.WEEK -> date.weekStart()
ChartRange.MONTH -> date.monthStart()
Expand All @@ -545,7 +546,8 @@ abstract class BaseHistoryDetailViewModel(
ChartRange.LAST_DAY,
ChartRange.LAST_WEEK,
ChartRange.LAST_MONTH,
ChartRange.LAST_QUARTER -> currentDate
ChartRange.LAST_QUARTER,
ChartRange.LAST_YEAR -> currentDate

ChartRange.WEEK -> end.weekEnd()
ChartRange.MONTH -> end.monthEnd()
Expand Down Expand Up @@ -680,7 +682,8 @@ data class HistoryDetailViewState(

ChartRange.WEEK,
ChartRange.LAST_QUARTER,
ChartRange.QUARTER -> dateString(dateRange)
ChartRange.QUARTER,
ChartRange.LAST_YEAR -> dateString(dateRange)

ChartRange.MONTH -> dateFormatter.getMonthAndYearString(dateRange.start)?.capitalize(Locale.current)
ChartRange.YEAR -> dateFormatter.getYearString(dateRange.start)
Expand Down
Binary file removed app/src/main/libs/jsoup-1.10.3.jar
Binary file not shown.
Binary file removed app/src/main/libs/jsoup-1.13.1.jar
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
<string name="history_range_last_week">Posledních 7 dní</string>
<string name="history_range_last_30_days">Posledních 30 dní</string>
<string name="history_range_last_90_days">Posledních 90 dní</string>
<string name="history_range_last_365_days">Posledních 365 dní</string>
<string name="all_available_history">Kompletní dostupná historie</string>
<string name="retrieving_data_from_the_server">Stahování dat ze serveru ...</string>
<string name="no_chart_data_available">Žádné údaje o graf.</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
<string name="history_range_last_week">Die letzten 7 Tage</string>
<string name="history_range_last_30_days">Die letzten 30 Tage</string>
<string name="history_range_last_90_days">Die letzten 90 Tage</string>
<string name="history_range_last_365_days">Die letzten 365 Tage</string>
<string name="all_available_history">Gesamte verfügbare Geschichte</string>
<string name="retrieving_data_from_the_server">Daten werden vom Server heruntergeladen...</string>
<string name="no_chart_data_available">Keine Daten für das Diagramm in ausgewälte Zeitraum.</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-el/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
<string name="history_range_last_week">Οι τελευταίες 7 ημέρες</string>
<string name="history_range_last_30_days">Οι τελευταίες 30 ημέρες</string>
<string name="history_range_last_90_days">Οι τελευταίες 90 ημέρες</string>
<string name="history_range_last_365_days">Οι τελευταίες 365 ημέρες</string>
<string name="all_available_history">Όλο το διαθέσιμο ιστορικό</string>
<string name="retrieving_data_from_the_server">Λήψη δεδομένων από διακομιστή...</string>
<string name="no_chart_data_available">Δεν υπάρχουν δεδομένα για το γράφημα.</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="history_range_last_week">Últimos 7 días</string>
<string name="history_range_last_30_days">Últimos 30 días</string>
<string name="history_range_last_90_days">Últimos 90 días</string>
<string name="history_range_last_365_days">Últimos 365 días</string>
<string name="all_available_history">Todo el historial disponible</string>
<string name="retrieving_data_from_the_server">Descargando datos del servidor...</string>
<string name="no_chart_data_available">No hay datos para el gráfico.</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<string name="history_range_last_week">Derniers 7 jours</string>
<string name="history_range_last_30_days">Derniers 30 jours</string>
<string name="history_range_last_90_days">Derniers 90 jours</string>
<string name="history_range_last_365_days">Derniers 365 jours</string>
<string name="all_available_history">Tout l\'historique disponible</string>
<string name="retrieving_data_from_the_server">Téléchargement des données du serveur...</string>
<string name="no_chart_data_available">Manquent les données pour pour le graphique</string>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
<string name="history_range_last_week">Az elmúlt 7 nap</string>
<string name="history_range_last_30_days">Az elmúlt 30 nap</string>
<string name="history_range_last_90_days">Az elmúlt 90 nap</string>
<string name="history_range_last_365_days">Az elmúlt 365 nap</string>
<string name="all_available_history">Az összes elérhető eseménytörténet</string>
<string name="retrieving_data_from_the_server">Adatok letöltése a szerverről ...</string>
<string name="no_chart_data_available">A diagramhoz nincs adat.</string>
Expand Down
Loading

0 comments on commit 0e07c7a

Please sign in to comment.