diff --git a/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.0-commonMain-2bbUHA.klib b/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.0-commonMain-2bbUHA.klib new file mode 100644 index 000000000..ed2567422 Binary files /dev/null and b/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.0-commonMain-2bbUHA.klib differ diff --git a/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.21-commonMain-WPEnbA.klib b/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.21-commonMain-WPEnbA.klib new file mode 100644 index 000000000..09432d676 Binary files /dev/null and b/.kotlin/metadata/kotlinTransformedMetadataLibraries/org.jetbrains.kotlin-kotlin-stdlib-2.0.21-commonMain-WPEnbA.klib differ diff --git a/app/build.gradle.kts b/app/build.gradle.kts index a693ea341..47c09019b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -25,8 +25,8 @@ android { minSdk = Versions.MinSdk targetSdk = Versions.TargetSdk multiDexEnabled = true - versionCode = 253 - versionName = "24.10.03" + versionCode = 254 + versionName = "24.10.04" ndk { moduleName = "suplaclient" @@ -38,8 +38,8 @@ android { } compileOptions { - sourceCompatibility(JavaVersion.VERSION_17) - targetCompatibility(JavaVersion.VERSION_17) + sourceCompatibility(JavaVersion.VERSION_21) + targetCompatibility(JavaVersion.VERSION_21) isCoreLibraryDesugaringEnabled = true } @@ -103,7 +103,7 @@ android { } kotlinOptions { - jvmTarget = "17" + jvmTarget = "21" freeCompilerArgs = listOf("-Xcontext-receivers", "-Xjvm-default=all") } } @@ -113,6 +113,8 @@ repositories { } dependencies { + implementation(project(":shared-core")) + implementation(Deps.Androidx.Core.Splash) implementation(Deps.Multidex) implementation(Deps.Androidx.Lifecycle.Extensions) diff --git a/app/src/main/java/org/supla/android/AddDeviceWizardActivity.java b/app/src/main/java/org/supla/android/AddDeviceWizardActivity.java index b91c5945f..8364cd59a 100644 --- a/app/src/main/java/org/supla/android/AddDeviceWizardActivity.java +++ b/app/src/main/java/org/supla/android/AddDeviceWizardActivity.java @@ -87,7 +87,6 @@ of the License, or (at your option) any later version. import org.supla.android.core.networking.suplaclient.SuplaClientEvent.AddWizardFinished; import org.supla.android.core.networking.suplaclient.SuplaClientEvent.AddWizardStopped; import org.supla.android.core.networking.suplaclient.SuplaClientState.Reason.AddWizardStarted; -import org.supla.android.core.networking.suplaclient.SuplaClientStateHolder; import org.supla.android.lib.SuplaConst; import org.supla.android.lib.SuplaRegistrationEnabled; import org.supla.android.profile.AuthInfo; @@ -167,7 +166,6 @@ public class AddDeviceWizardActivity extends WizardActivity @Inject ProfileManager profileManager; @Inject EspHtmlParser espHtmlParser; - @Inject SuplaClientStateHolder suplaClientStateHolder; @Inject DisconnectUseCase disconnectUseCase; @Inject SuplaSchedulers suplaSchedulers; @@ -446,8 +444,6 @@ protected void onStart() { return; } - SuplaApp.getApp().getSuplaClient(); - watchDog = new Timer(); watchDog.schedule( new TimerTask() { @@ -1117,23 +1113,20 @@ public void onAvailable(@NonNull Network network) { connectivityManager.bindProcessToNetwork(network); wizard.runOnUiThread( - new Runnable() { - @Override - public void run() { - unregisterReceivers(); - removeConfigTask(); - - espConfigTask = new ESPConfigureTask(espHtmlParser); - espConfigTask.setDelegate(wizard); - - setStep(STEP_CONFIGURE); - AuthInfo info = profileManager.getCurrentProfile().blockingGet().getAuthInfo(); - espConfigTask.execute( - getSelectedSSID(), - edPassword.getText().toString(), - info.getServerForEmail(), - info.getEmailAddress()); - } + () -> { + unregisterReceivers(); + removeConfigTask(); + + espConfigTask = new ESPConfigureTask(espHtmlParser); + espConfigTask.setDelegate(wizard); + + setStep(STEP_CONFIGURE); + AuthInfo info = profileManager.getCurrentProfile().blockingGet().getAuthInfo(); + espConfigTask.execute( + getSelectedSSID(), + edPassword.getText().toString(), + info.getServerForEmail(), + info.getEmailAddress()); }); } @@ -1142,12 +1135,10 @@ public void onUnavailable() { super.onUnavailable(); wizard.runOnUiThread( - new Runnable() { - @Override - public void run() { - unregisterCallbacks(); - showError(R.string.wizard_iodev_connect_failed); - } + () -> { + unregisterCallbacks(); + suplaClientStateHolder.handleEvent(AddWizardFinished.INSTANCE); + showError(R.string.wizard_iodev_connect_failed); }); } }; @@ -1181,6 +1172,7 @@ private void connect() { } if (iodev_NetworkID == -1) { + suplaClientStateHolder.handleEvent(AddWizardFinished.INSTANCE); showError(R.string.wizard_addnetwork_error); return; } @@ -1294,10 +1286,6 @@ public void onReceive(Context c, Intent i) { stateChangedReceiver = null; - if (SuplaApp.getApp().getSuplaClient() != null) { - SuplaApp.getApp().getSuplaClient().reconnect(); - } - setStep(STEP_DONE); showDone(result); } @@ -1332,6 +1320,8 @@ public void onReceive(Context c, Intent i) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { connectToInternet_Q(); } + + suplaClientStateHolder.handleEvent(AddWizardFinished.INSTANCE); } private String getSelectedSSID() { @@ -1429,7 +1419,6 @@ public void onWifiThrottlingDialogFinish(WifiThrottlingNotificationDialog dialog } private void resumeClientAndClose() { - suplaClientStateHolder.handleEvent(AddWizardFinished.INSTANCE); showMain(this); finish(); } diff --git a/app/src/main/java/org/supla/android/WizardActivity.java b/app/src/main/java/org/supla/android/WizardActivity.java index 982623752..7528cc469 100644 --- a/app/src/main/java/org/supla/android/WizardActivity.java +++ b/app/src/main/java/org/supla/android/WizardActivity.java @@ -1,5 +1,23 @@ package org.supla.android; +/* +Copyright (C) AC SOFTWARE SP. Z O.O. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + import android.annotation.SuppressLint; import android.os.Bundle; import android.view.View; @@ -10,6 +28,9 @@ import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; +import javax.inject.Inject; +import org.supla.android.core.networking.suplaclient.SuplaClientState.Locked; +import org.supla.android.core.networking.suplaclient.SuplaClientStateHolder; @SuppressLint("Registered") public abstract class WizardActivity extends NavigationActivity { @@ -23,6 +44,8 @@ public abstract class WizardActivity extends NavigationActivity { private RelativeLayout mContent; private ArrayList mPages = new ArrayList<>(); + @Inject SuplaClientStateHolder suplaClientStateHolder; + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -43,6 +66,15 @@ protected void onCreate(Bundle savedInstanceState) { setBtnNextEnabled(false); } + @Override + protected void onStart() { + super.onStart(); + + if (suplaClientStateHolder.stateOrNull() == Locked.INSTANCE) { + finish(); + } + } + protected View addStepPage(int layoutResId, int pageId) { View stepPage = Inflate(layoutResId, null); if (stepPage != null) { @@ -78,18 +110,6 @@ protected int getVisiblePageId() { return 0; } - protected void setBtnNextVisible(boolean visible) { - if (visible) { - mBtnNextLeftPart.setVisibility(View.VISIBLE); - mBtnNextMiddlePart.setVisibility(View.VISIBLE); - mBtnNextRightPart.setVisibility(View.VISIBLE); - } else { - mBtnNextLeftPart.setVisibility(View.GONE); - mBtnNextMiddlePart.setVisibility(View.GONE); - mBtnNextRightPart.setVisibility(View.GONE); - } - } - protected void setBtnNextEnabled(boolean enabled) { mBtnNextLeftPart.setEnabled(enabled); mBtnNextMiddlePart.setEnabled(enabled); @@ -104,10 +124,6 @@ protected void setBtnNextText(int resId) { mBtnNextMiddlePart.setText(resId, TextView.BufferType.NORMAL); } - protected void setBtnNextText(String text) { - mBtnNextMiddlePart.setText(text, TextView.BufferType.NORMAL); - } - protected boolean isBtnNextPreloaderVisible() { return mBtnNextPreloaderTimer != null; } diff --git a/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientState.kt b/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientState.kt index 3237a8383..9ea2d594d 100644 --- a/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientState.kt +++ b/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientState.kt @@ -48,6 +48,7 @@ sealed interface SuplaClientState { SuplaClientEvent.Lock, SuplaClientEvent.OnStart, SuplaClientEvent.NetworkConnected, + SuplaClientEvent.AddWizardStopped, is SuplaClientEvent.Finish -> null SuplaClientEvent.Unlock -> Connecting() @@ -60,7 +61,6 @@ sealed interface SuplaClientState { is SuplaClientEvent.Error -> throw IllegalEvent.IllegalErrorEvent("Unexpected event in Locked") SuplaClientEvent.Initialized -> throw IllegalEvent.IllegalInitializedEvent("Unexpected event in Locked") SuplaClientEvent.AddWizardFinished -> throw IllegalEvent.IllegalAddWizardFinishedEvent("Unexpected event in Locked") - SuplaClientEvent.AddWizardStopped -> throw IllegalEvent.IllegalAddWizardStoppedEvent("Unexpected event in Locked") } } } @@ -146,7 +146,7 @@ sealed interface SuplaClientState { SuplaClientEvent.Lock -> Locking is SuplaClientEvent.Finish -> Finished(reason ?: event.reason) - is SuplaClientEvent.Error -> Finished(event.reason) + is SuplaClientEvent.Error -> Finished(if (reason == Reason.AddWizardStarted) reason else event.reason) // others which should not occur SuplaClientEvent.NoAccount -> throw IllegalEvent.IllegalNoAccountEvent("Unexpected event in Disconnecting") @@ -203,7 +203,7 @@ sealed interface SuplaClientState { is SuplaClientEvent.Error -> if (event.reason != reason) Finished(event.reason) else null is SuplaClientEvent.Finish -> if (event.reason != reason && reason != Reason.AddWizardStarted) Finished(event.reason ?: reason) else null - SuplaClientEvent.AddWizardStopped -> Finished(Reason.AppInBackground) + SuplaClientEvent.AddWizardStopped -> if (reason == Reason.AddWizardStarted) Finished() else Connecting() // others which should not occur SuplaClientEvent.Connected -> throw IllegalEvent.IllegalConnectedEvent("Unexpected event in Finished") diff --git a/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientStateHolder.kt b/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientStateHolder.kt index 6765edf19..c2c1134cc 100644 --- a/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientStateHolder.kt +++ b/app/src/main/java/org/supla/android/core/networking/suplaclient/SuplaClientStateHolder.kt @@ -64,6 +64,8 @@ class SuplaClientStateHolder @Inject constructor( fun state(): Observable = stateSubject.hide() + fun stateOrNull(): SuplaClientState? = stateSubject.value + fun handleEvent(event: SuplaClientEvent) { synchronized(this) { handleEventInternally(event) diff --git a/app/src/main/java/org/supla/android/data/model/chart/ChannelChartSets.kt b/app/src/main/java/org/supla/android/data/model/chart/ChannelChartSets.kt index 0bc21bb40..e12446d90 100644 --- a/app/src/main/java/org/supla/android/data/model/chart/ChannelChartSets.kt +++ b/app/src/main/java/org/supla/android/data/model/chart/ChannelChartSets.kt @@ -19,7 +19,7 @@ package org.supla.android.data.model.chart import org.supla.android.core.ui.StringProvider import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction data class ChannelChartSets( val remoteId: Int, diff --git a/app/src/main/java/org/supla/android/data/model/general/ChannelBase.kt b/app/src/main/java/org/supla/android/data/model/general/ChannelBase.kt index f1c307e43..0c9ac8bc8 100644 --- a/app/src/main/java/org/supla/android/data/model/general/ChannelBase.kt +++ b/app/src/main/java/org/supla/android/data/model/general/ChannelBase.kt @@ -17,7 +17,7 @@ package org.supla.android.data.model.general Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction interface ChannelBase { val id: Long? diff --git a/app/src/main/java/org/supla/android/data/source/local/entity/ChannelBaseExtensions.kt b/app/src/main/java/org/supla/android/data/source/local/entity/ChannelBaseExtensions.kt index 0e4a4cd0a..cb931ec6f 100644 --- a/app/src/main/java/org/supla/android/data/source/local/entity/ChannelBaseExtensions.kt +++ b/app/src/main/java/org/supla/android/data/source/local/entity/ChannelBaseExtensions.kt @@ -18,7 +18,7 @@ package org.supla.android.data.source.local.entity */ import org.supla.android.data.model.general.ChannelBase -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction fun ChannelBase.isHvacThermostat() = function == SuplaChannelFunction.HVAC_THERMOSTAT || diff --git a/app/src/main/java/org/supla/android/data/source/local/entity/ChannelEntity.kt b/app/src/main/java/org/supla/android/data/source/local/entity/ChannelEntity.kt index d84045f58..94797ac2b 100644 --- a/app/src/main/java/org/supla/android/data/source/local/entity/ChannelEntity.kt +++ b/app/src/main/java/org/supla/android/data/source/local/entity/ChannelEntity.kt @@ -26,8 +26,8 @@ import org.supla.android.data.source.local.entity.ChannelEntity.Companion.COLUMN import org.supla.android.data.source.local.entity.ChannelEntity.Companion.COLUMN_LOCATION_ID import org.supla.android.data.source.local.entity.ChannelEntity.Companion.COLUMN_PROFILE_ID import org.supla.android.data.source.local.entity.ChannelEntity.Companion.TABLE_NAME -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.lib.SuplaChannel +import org.supla.core.shared.data.SuplaChannelFunction @Entity( tableName = TABLE_NAME, diff --git a/app/src/main/java/org/supla/android/data/source/local/entity/ChannelGroupEntity.kt b/app/src/main/java/org/supla/android/data/source/local/entity/ChannelGroupEntity.kt index 7797a5bde..8c3121fe7 100644 --- a/app/src/main/java/org/supla/android/data/source/local/entity/ChannelGroupEntity.kt +++ b/app/src/main/java/org/supla/android/data/source/local/entity/ChannelGroupEntity.kt @@ -26,9 +26,9 @@ import org.supla.android.data.source.local.entity.ChannelGroupEntity.Companion.C import org.supla.android.data.source.local.entity.ChannelGroupEntity.Companion.COLUMN_PROFILE_ID import org.supla.android.data.source.local.entity.ChannelGroupEntity.Companion.COLUMN_REMOTE_ID import org.supla.android.data.source.local.entity.ChannelGroupEntity.Companion.TABLE_NAME -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.group.totalvalue.GroupTotalValue import org.supla.android.usecases.group.totalvalue.GroupValue +import org.supla.core.shared.data.SuplaChannelFunction @Entity( tableName = TABLE_NAME, diff --git a/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelDataEntity.kt b/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelDataEntity.kt index 18c68aa49..b754089e3 100644 --- a/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelDataEntity.kt +++ b/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelDataEntity.kt @@ -24,11 +24,11 @@ import org.supla.android.data.source.local.entity.ChannelEntity import org.supla.android.data.source.local.entity.ChannelExtendedValueEntity import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.LocationEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.db.Channel import org.supla.android.db.ChannelExtendedValue import org.supla.android.db.ChannelValue import org.supla.android.lib.SuplaChannelExtendedValue +import org.supla.core.shared.data.SuplaChannelFunction data class ChannelDataEntity( @Embedded(prefix = "channel_") val channelEntity: ChannelEntity, diff --git a/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelGroupDataEntity.kt b/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelGroupDataEntity.kt index 250191a3f..79c123bb0 100644 --- a/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelGroupDataEntity.kt +++ b/app/src/main/java/org/supla/android/data/source/local/entity/complex/ChannelGroupDataEntity.kt @@ -21,8 +21,8 @@ import androidx.room.Embedded import org.supla.android.data.model.general.ChannelDataBase import org.supla.android.data.source.local.entity.ChannelGroupEntity import org.supla.android.data.source.local.entity.LocationEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.db.ChannelGroup +import org.supla.core.shared.data.SuplaChannelFunction data class ChannelGroupDataEntity( @Embedded(prefix = "group_") val channelGroupEntity: ChannelGroupEntity, diff --git a/app/src/main/java/org/supla/android/data/source/remote/SuplaChannelConfig.kt b/app/src/main/java/org/supla/android/data/source/remote/SuplaChannelConfig.kt index 65127c2f9..b099947c6 100644 --- a/app/src/main/java/org/supla/android/data/source/remote/SuplaChannelConfig.kt +++ b/app/src/main/java/org/supla/android/data/source/remote/SuplaChannelConfig.kt @@ -18,7 +18,7 @@ package org.supla.android.data.source.remote */ import org.supla.android.data.source.local.entity.ChannelEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction enum class ChannelConfigType(val value: Int) { UNKNOWN(-1), diff --git a/app/src/main/java/org/supla/android/db/ChannelBase.java b/app/src/main/java/org/supla/android/db/ChannelBase.java index 407896d9e..001e27077 100644 --- a/app/src/main/java/org/supla/android/db/ChannelBase.java +++ b/app/src/main/java/org/supla/android/db/ChannelBase.java @@ -25,10 +25,10 @@ of the License, or (at your option) any later version. import org.supla.android.SuplaApp; import org.supla.android.ValuesFormatterProvider; import org.supla.android.data.ValuesFormatter; -import org.supla.android.data.source.remote.channel.SuplaChannelFunction; import org.supla.android.extensions.ContextExtensionsKt; import org.supla.android.lib.SuplaChannelBase; import org.supla.android.lib.SuplaConst; +import org.supla.core.shared.data.SuplaChannelFunction; public abstract class ChannelBase extends DbItem { diff --git a/app/src/main/java/org/supla/android/db/room/app/AppDatabaseConverters.kt b/app/src/main/java/org/supla/android/db/room/app/AppDatabaseConverters.kt index c3d20fe8f..e52e197f5 100644 --- a/app/src/main/java/org/supla/android/db/room/app/AppDatabaseConverters.kt +++ b/app/src/main/java/org/supla/android/db/room/app/AppDatabaseConverters.kt @@ -20,7 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import androidx.room.TypeConverter import org.supla.android.data.source.local.entity.ChannelRelationType import org.supla.android.data.source.remote.ChannelConfigType -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction import java.time.LocalDateTime import java.time.ZoneOffset import java.util.Date diff --git a/app/src/main/java/org/supla/android/di/CoreSharedModule.kt b/app/src/main/java/org/supla/android/di/CoreSharedModule.kt new file mode 100644 index 000000000..0363836fe --- /dev/null +++ b/app/src/main/java/org/supla/android/di/CoreSharedModule.kt @@ -0,0 +1,34 @@ +package org.supla.android.di +/* + Copyright (C) AC SOFTWARE SP. Z O.O. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +import dagger.Module +import dagger.Provides +import dagger.hilt.InstallIn +import dagger.hilt.components.SingletonComponent +import org.supla.core.shared.usecase.GetChannelActionStringUseCase +import javax.inject.Singleton + +@Module +@InstallIn(SingletonComponent::class) +class CoreSharedModule { + + @Provides + @Singleton + fun provideGetChannelActionStringUseCase() = GetChannelActionStringUseCase() +} diff --git a/app/src/main/java/org/supla/android/extensions/LocalizedStringExtensions.kt b/app/src/main/java/org/supla/android/extensions/LocalizedStringExtensions.kt new file mode 100644 index 000000000..33465e959 --- /dev/null +++ b/app/src/main/java/org/supla/android/extensions/LocalizedStringExtensions.kt @@ -0,0 +1,33 @@ +package org.supla.android.extensions +/* + Copyright (C) AC SOFTWARE SP. Z O.O. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +import org.supla.android.R +import org.supla.core.shared.infrastructure.LocalizedString + +val LocalizedString.resourceId: Int + get() = when (this) { + LocalizedString.GENERAL_TURN_ON -> R.string.channel_btn_on + LocalizedString.GENERAL_TURN_OFF -> R.string.channel_btn_off + LocalizedString.GENERAL_OPEN -> R.string.channel_btn_open + LocalizedString.GENERAL_CLOSE -> R.string.channel_btn_close + LocalizedString.GENERAL_SHUT -> R.string.channel_btn_shut + LocalizedString.GENERAL_REVEAL -> R.string.channel_btn_reveal + LocalizedString.GENERAL_COLLAPSE -> R.string.channel_btn_collapse + LocalizedString.GENERAL_EXPAND -> R.string.channel_btn_expand + } diff --git a/app/src/main/java/org/supla/android/features/details/detailbase/history/ui/HistoryDetail.kt b/app/src/main/java/org/supla/android/features/details/detailbase/history/ui/HistoryDetail.kt index f9e48f959..ba63eabd5 100644 --- a/app/src/main/java/org/supla/android/features/details/detailbase/history/ui/HistoryDetail.kt +++ b/app/src/main/java/org/supla/android/features/details/detailbase/history/ui/HistoryDetail.kt @@ -87,7 +87,6 @@ import org.supla.android.data.model.chart.style.ChartStyle import org.supla.android.data.model.chart.style.ThermometerChartStyle import org.supla.android.data.model.general.RangeValueType import org.supla.android.data.source.local.calendar.Hour -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.extensions.weekEnd import org.supla.android.extensions.weekStart import org.supla.android.features.details.detailbase.history.HistoryDetailViewState @@ -104,6 +103,7 @@ import org.supla.android.ui.views.charts.PieChart import org.supla.android.ui.views.tools.Shadow import org.supla.android.ui.views.tools.ShadowOrientation import org.supla.android.usecases.channel.valueformatter.HumidityValueFormatter +import org.supla.core.shared.data.SuplaChannelFunction import java.util.Date interface HistoryDetailProxy : BaseViewProxy { diff --git a/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/ItemBundle.kt b/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/ItemBundle.kt index 4309c5697..019fdda33 100644 --- a/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/ItemBundle.kt +++ b/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/ItemBundle.kt @@ -19,10 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction -import org.supla.android.data.source.remote.channel.suplaFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.db.Channel +import org.supla.core.shared.data.SuplaChannelFunction +import org.supla.core.shared.data.suplaFunction import java.io.Serializable data class ItemBundle( diff --git a/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/StandardDetailViewModel.kt b/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/StandardDetailViewModel.kt index d0227eb58..80715e134 100644 --- a/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/StandardDetailViewModel.kt +++ b/app/src/main/java/org/supla/android/features/details/detailbase/standarddetail/StandardDetailViewModel.kt @@ -25,12 +25,12 @@ import org.supla.android.core.ui.StringProvider import org.supla.android.core.ui.ViewEvent import org.supla.android.core.ui.ViewState import org.supla.android.data.model.general.ChannelDataBase -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.events.UpdateEventsManager import org.supla.android.tools.SuplaSchedulers import org.supla.android.usecases.channel.ReadChannelByRemoteIdUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase +import org.supla.core.shared.data.SuplaChannelFunction abstract class StandardDetailViewModel( private val readChannelByRemoteIdUseCase: ReadChannelByRemoteIdUseCase, diff --git a/app/src/main/java/org/supla/android/features/details/switchdetail/general/SwitchGeneralViewModel.kt b/app/src/main/java/org/supla/android/features/details/switchdetail/general/SwitchGeneralViewModel.kt index f6d56cb89..bccaef0ed 100644 --- a/app/src/main/java/org/supla/android/features/details/switchdetail/general/SwitchGeneralViewModel.kt +++ b/app/src/main/java/org/supla/android/features/details/switchdetail/general/SwitchGeneralViewModel.kt @@ -33,7 +33,6 @@ import org.supla.android.data.model.general.ChannelState import org.supla.android.data.model.general.hasElectricityMeter import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.events.DownloadEventsManager import org.supla.android.extensions.ifTrue @@ -51,6 +50,7 @@ import org.supla.android.usecases.channel.electricitymeter.LoadElectricityMeterM import org.supla.android.usecases.client.ExecuteSimpleActionUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.icon.GetChannelIconUseCase +import org.supla.core.shared.data.SuplaChannelFunction import java.util.Date import javax.inject.Inject diff --git a/app/src/main/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModel.kt b/app/src/main/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModel.kt index e629f259b..67efaf02c 100644 --- a/app/src/main/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModel.kt +++ b/app/src/main/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModel.kt @@ -23,7 +23,6 @@ import org.supla.android.core.ui.StringProvider import org.supla.android.data.model.general.ChannelDataBase import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.isHvacThermostat -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.hvac.ThermostatSubfunction import org.supla.android.events.UpdateEventsManager import org.supla.android.features.details.detailbase.standarddetail.StandardDetailViewEvent @@ -33,6 +32,7 @@ import org.supla.android.tools.SuplaSchedulers import org.supla.android.usecases.channel.GetChannelCaptionUseCase import org.supla.android.usecases.channel.ReadChannelByRemoteIdUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject @HiltViewModel diff --git a/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModel.kt b/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModel.kt index 32ce8207b..527f2db6f 100644 --- a/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModel.kt +++ b/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModel.kt @@ -39,7 +39,6 @@ import org.supla.android.data.source.local.entity.custom.ChannelWithChildren import org.supla.android.data.source.remote.ChannelConfigType import org.supla.android.data.source.remote.ConfigResult import org.supla.android.data.source.remote.SuplaDeviceConfig -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.hvac.SuplaChannelHvacConfig import org.supla.android.data.source.remote.hvac.SuplaChannelWeeklyScheduleConfig import org.supla.android.data.source.remote.hvac.SuplaHvacMode @@ -68,6 +67,7 @@ import org.supla.android.usecases.channel.GetChannelValueUseCase import org.supla.android.usecases.channel.ReadChannelWithChildrenTreeUseCase import org.supla.android.usecases.icon.GetChannelIconUseCase import org.supla.android.usecases.thermostat.CreateTemperaturesListUseCase +import org.supla.core.shared.data.SuplaChannelFunction import java.util.Date import java.util.concurrent.TimeUnit import javax.inject.Inject diff --git a/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ui/ThermostatDetail.kt b/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ui/ThermostatDetail.kt index 893e1e155..f3e2b2d55 100644 --- a/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ui/ThermostatDetail.kt +++ b/app/src/main/java/org/supla/android/features/details/thermostatdetail/general/ui/ThermostatDetail.kt @@ -129,7 +129,7 @@ context (ColumnScope) @Composable private fun ThermostatView(viewState: ThermostatGeneralViewState, viewProxy: ThermostatGeneralViewProxy, modifier: Modifier = Modifier) { BoxWithConstraints(modifier = modifier) { - if (maxHeight < 250.dp) { + if (maxHeight < 298.dp) { if (viewState.isOff.not() && viewState.isAutoFunction && !viewState.programmedModeActive) { HeatingCoolingRowSmallScreen(viewState = viewState, viewProxy = viewProxy) } @@ -584,7 +584,7 @@ private fun PreviewSmall() { @Composable private fun PreviewVerySmall() { SuplaTheme { - Box(modifier = Modifier.height(330.dp)) { + Box(modifier = Modifier.height(381.dp)) { ThermostatDetail( PreviewProxy( ThermostatGeneralViewState( diff --git a/app/src/main/java/org/supla/android/ui/layouts/SlideableListItemLayout.kt b/app/src/main/java/org/supla/android/ui/layouts/SlideableListItemLayout.kt index b4f688a17..0b7dc8142 100644 --- a/app/src/main/java/org/supla/android/ui/layouts/SlideableListItemLayout.kt +++ b/app/src/main/java/org/supla/android/ui/layouts/SlideableListItemLayout.kt @@ -21,12 +21,16 @@ import android.content.Context import android.util.AttributeSet import android.view.View import android.widget.LinearLayout +import androidx.appcompat.widget.AppCompatButton import dagger.hilt.android.AndroidEntryPoint import org.supla.android.Preferences import org.supla.android.R +import org.supla.android.extensions.resourceId import org.supla.android.ui.lists.SlideableItem import org.supla.android.ui.lists.SwapableListItem import org.supla.android.ui.lists.data.SlideableListItemData +import org.supla.core.shared.data.SuplaChannelFunction +import org.supla.core.shared.usecase.GetChannelActionStringUseCase import java.lang.Integer.min import javax.inject.Inject @@ -55,6 +59,9 @@ class SlideableListItemLayout @JvmOverloads constructor( @Inject lateinit var preferences: Preferences + @Inject + lateinit var getChannelActionStringUseCase: GetChannelActionStringUseCase + override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { val desiredHeight = resources.getDimensionPixelSize(R.dimen.channel_layout_height) * getScaleFactor() @@ -96,8 +103,11 @@ class SlideableListItemLayout @JvmOverloads constructor( rightItem?.run { updateRightItemPosition(this) } } - fun bind(locationCaption: String) { + fun bind(locationCaption: String, function: SuplaChannelFunction) { this.locationCaption = locationCaption + + getChannelActionStringUseCase.leftButton(function)?.resourceId?.let { (leftItem as? AppCompatButton)?.setText(it) } + getChannelActionStringUseCase.rightButton(function)?.resourceId?.let { (rightItem as? AppCompatButton)?.setText(it) } } private fun updateLeftItemPosition(item: View) { diff --git a/app/src/main/java/org/supla/android/ui/lists/BaseChannelsAdapter.kt b/app/src/main/java/org/supla/android/ui/lists/BaseChannelsAdapter.kt index 0f37bb5fa..7a6c9affe 100644 --- a/app/src/main/java/org/supla/android/ui/lists/BaseChannelsAdapter.kt +++ b/app/src/main/java/org/supla/android/ui/lists/BaseChannelsAdapter.kt @@ -22,7 +22,6 @@ import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.RecyclerView.ViewHolder import org.supla.android.Preferences -import org.supla.android.R import org.supla.android.SuplaApp import org.supla.android.data.model.general.ChannelDataBase import org.supla.android.data.source.runtime.ItemType @@ -134,7 +133,7 @@ abstract class BaseChannelsAdapter( inner class ThermostatListItemViewHolder(val binding: LiMainThermostatItemBinding) : ViewHolder(binding.root) { fun bind(item: ListItem.HvacThermostatItem) { val data = item.toSlideableListItemData() as SlideableListItemData.Thermostat - binding.listItemRoot.bind(locationCaption = item.locationCaption) + binding.listItemRoot.bind(locationCaption = item.locationCaption, function = item.channelBase.function) binding.listItemContent.bind( itemType = ItemType.CHANNEL, remoteId = item.channel.remoteId, @@ -155,7 +154,7 @@ abstract class BaseChannelsAdapter( inner class IconValueListItemViewHolder(val binding: LiMainIconValueItemBinding) : ViewHolder(binding.root) { fun bind(item: ListItem.IconValueItem) { val data = item.toSlideableListItemData() as SlideableListItemData.Default - binding.listItemRoot.bind(locationCaption = item.locationCaption) + binding.listItemRoot.bind(locationCaption = item.locationCaption, function = item.channelBase.function) binding.listItemContent.bind( itemType = ItemType.CHANNEL, remoteId = item.channel.remoteId, @@ -174,7 +173,7 @@ abstract class BaseChannelsAdapter( inner class GpMeterListItemViewHolder(val binding: LiMainIconValueItemBinding) : ViewHolder(binding.root) { fun bind(item: ListItem.GeneralPurposeMeterItem) { val data = item.toSlideableListItemData() as SlideableListItemData.Default - binding.listItemRoot.bind(locationCaption = item.locationCaption) + binding.listItemRoot.bind(locationCaption = item.locationCaption, function = item.channelBase.function) binding.listItemContent.bind( itemType = ItemType.CHANNEL, remoteId = item.channel.remoteId, @@ -193,7 +192,7 @@ abstract class BaseChannelsAdapter( inner class GpMeasurementListItemViewHolder(val binding: LiMainIconValueItemBinding) : ViewHolder(binding.root) { fun bind(item: ListItem.GeneralPurposeMeasurementItem) { val data = item.toSlideableListItemData() as SlideableListItemData.Default - binding.listItemRoot.bind(locationCaption = item.locationCaption) + binding.listItemRoot.bind(locationCaption = item.locationCaption, function = item.channelBase.function) binding.listItemContent.bind( itemType = ItemType.CHANNEL, remoteId = item.channel.remoteId, @@ -212,7 +211,7 @@ abstract class BaseChannelsAdapter( inner class ShadingSystemListItemViewHolder(val binding: LiMainIconValueWithButtonsItemBinding) : ViewHolder(binding.root) { fun bind(item: ListItem.ShadingSystemItem) { val data = item.toSlideableListItemData() as SlideableListItemData.Default - binding.listItemRoot.bind(locationCaption = item.locationCaption) + binding.listItemRoot.bind(locationCaption = item.locationCaption, function = item.channelBase.function) binding.listItemContent.bind( itemType = ItemType.CHANNEL, remoteId = item.channel.remoteId, @@ -226,16 +225,14 @@ abstract class BaseChannelsAdapter( binding.listItemContent.setOnClickListener { listItemClickCallback(item.channel.remoteId) } binding.listItemContent.setOnLongClickListener { onLongPress(this) } binding.listItemLeftItem.setOnClickListener { onLeftButtonClick(item.channel.remoteId) } - binding.listItemLeftItem.setText(R.string.channel_btn_close) binding.listItemRightItem.setOnClickListener { onRightButtonClick(item.channel.remoteId) } - binding.listItemRightItem.setText(R.string.channel_btn_open) } } inner class SwitchListItemViewHolder(val binding: LiMainIconValueWithButtonsItemBinding) : ViewHolder(binding.root) { fun bind(item: ListItem.SwitchItem) { val data = item.toSlideableListItemData() as SlideableListItemData.Default - binding.listItemRoot.bind(locationCaption = item.locationCaption) + binding.listItemRoot.bind(locationCaption = item.locationCaption, function = item.channelBase.function) binding.listItemContent.bind( itemType = ItemType.CHANNEL, remoteId = item.channel.remoteId, @@ -249,9 +246,7 @@ abstract class BaseChannelsAdapter( binding.listItemContent.setOnClickListener { listItemClickCallback(item.channel.remoteId) } binding.listItemContent.setOnLongClickListener { onLongPress(this) } binding.listItemLeftItem.setOnClickListener { onLeftButtonClick(item.channel.remoteId) } - binding.listItemLeftItem.setText(R.string.channel_btn_off) binding.listItemRightItem.setOnClickListener { onRightButtonClick(item.channel.remoteId) } - binding.listItemRightItem.setText(R.string.channel_btn_on) } } } diff --git a/app/src/main/java/org/supla/android/ui/lists/BaseListViewModel.kt b/app/src/main/java/org/supla/android/ui/lists/BaseListViewModel.kt index 170c5fe46..05570a51f 100644 --- a/app/src/main/java/org/supla/android/ui/lists/BaseListViewModel.kt +++ b/app/src/main/java/org/supla/android/ui/lists/BaseListViewModel.kt @@ -13,13 +13,13 @@ import org.supla.android.data.model.general.ChannelDataBase import org.supla.android.data.source.local.entity.ChannelRelationType import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.lib.SuplaChannelValue import org.supla.android.lib.SuplaClientMessageHandler.OnSuplaClientMessageListener import org.supla.android.lib.SuplaClientMsg import org.supla.android.tools.SuplaSchedulers import org.supla.android.usecases.profile.CloudUrl import org.supla.android.usecases.profile.LoadActiveProfileUrlUseCase +import org.supla.core.shared.data.SuplaChannelFunction abstract class BaseListViewModel( private val preferences: Preferences, diff --git a/app/src/main/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCase.kt b/app/src/main/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCase.kt index 1fc80523a..a71d206cf 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCase.kt @@ -25,12 +25,12 @@ import org.supla.android.data.source.GeneralPurposeMeterLogRepository import org.supla.android.data.source.RoomChannelRepository import org.supla.android.data.source.TemperatureAndHumidityLogRepository import org.supla.android.data.source.TemperatureLogRepository -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_ELECTRICITY_METER import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_GENERAL_PURPOSE_MEASUREMENT import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_GENERAL_PURPOSE_METER import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_HUMIDITYANDTEMPERATURE import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_THERMOMETER +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/GetChannelDefaultCaptionUseCase.kt b/app/src/main/java/org/supla/android/usecases/channel/GetChannelDefaultCaptionUseCase.kt index a6d1c4cd2..5734c5975 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/GetChannelDefaultCaptionUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/GetChannelDefaultCaptionUseCase.kt @@ -20,7 +20,7 @@ package org.supla.android.usecases.channel import androidx.annotation.StringRes import org.supla.android.R import org.supla.android.core.ui.StringProvider -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/GetChannelStateUseCase.kt b/app/src/main/java/org/supla/android/usecases/channel/GetChannelStateUseCase.kt index 1e597d121..cfb14bdac 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/GetChannelStateUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/GetChannelStateUseCase.kt @@ -23,14 +23,14 @@ import org.supla.android.data.source.local.entity.ChannelGroupEntity import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction -import org.supla.android.data.source.remote.channel.suplaFunction import org.supla.android.data.source.remote.hvac.ThermostatSubfunction import org.supla.android.db.Channel import org.supla.android.db.ChannelBase import org.supla.android.db.ChannelGroup import org.supla.android.db.ChannelValue import org.supla.android.usecases.group.GetGroupActivePercentageUseCase +import org.supla.core.shared.data.SuplaChannelFunction +import org.supla.core.shared.data.suplaFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/GetChannelValueStringUseCase.kt b/app/src/main/java/org/supla/android/usecases/channel/GetChannelValueStringUseCase.kt index 84d2261d5..7fc11dd62 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/GetChannelValueStringUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/GetChannelValueStringUseCase.kt @@ -27,8 +27,10 @@ import org.supla.android.usecases.channel.stringvalueprovider.ElectricityMeterVa import org.supla.android.usecases.channel.stringvalueprovider.GpmValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.HumidityAndTemperatureValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.ImpulseCounterValueStringProvider +import org.supla.android.usecases.channel.stringvalueprovider.NoValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.SwitchWithElectricityMeterValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.ThermometerValueStringProvider +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton @@ -52,7 +54,10 @@ class GetChannelValueStringUseCase @Inject constructor( distanceSensorValueStringProvider, electricityMeterValueStringProvider, switchWithElectricityMeterValueStringProvider, - impulseCounterValueStringProvider + impulseCounterValueStringProvider, + NoValueStringProvider(SuplaChannelFunction.STAIRCASE_TIMER), + NoValueStringProvider(SuplaChannelFunction.POWER_SWITCH), + NoValueStringProvider(SuplaChannelFunction.LIGHTSWITCH) ) operator fun invoke(channel: ChannelDataEntity, valueType: ValueType = ValueType.FIRST, withUnit: Boolean = true): String { @@ -79,5 +84,5 @@ enum class ValueType { interface ChannelValueStringProvider { fun handle(channelData: ChannelDataEntity): Boolean - fun value(channelData: ChannelDataEntity, valueType: ValueType, withUnit: Boolean = true): String + fun value(channelData: ChannelDataEntity, valueType: ValueType, withUnit: Boolean = true): String? } diff --git a/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCase.kt b/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCase.kt index 161427c48..9ca9bc19e 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCase.kt @@ -27,7 +27,7 @@ import org.supla.android.data.source.local.entity.complex.hasMeasurements import org.supla.android.data.source.local.entity.complex.isHvacThermostat import org.supla.android.data.source.local.entity.custom.ChannelWithChildren import org.supla.android.data.source.local.entity.hasMeasurements -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction import java.util.Date import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCase.kt b/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCase.kt index 4ade56e0e..5822eda8a 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCase.kt @@ -27,9 +27,9 @@ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.isHvacThermostat import org.supla.android.data.source.local.entity.custom.ChannelWithChildren import org.supla.android.data.source.local.entity.hasMeasurements -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.measurementsprovider.TemperatureAndHumidityMeasurementsProvider import org.supla.android.usecases.channel.measurementsprovider.TemperatureMeasurementsProvider +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/GpmValueStringProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/GpmValueStringProvider.kt index 3006b22a1..38bab6545 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/GpmValueStringProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/GpmValueStringProvider.kt @@ -20,7 +20,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import com.google.gson.Gson import org.supla.android.data.ValuesFormatter import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.gpm.SuplaChannelGeneralPurposeBaseConfig import org.supla.android.di.GSON_FOR_REPO import org.supla.android.extensions.guardLet @@ -28,6 +27,7 @@ import org.supla.android.usecases.channel.ChannelValueStringProvider import org.supla.android.usecases.channel.ValueType import org.supla.android.usecases.channel.valueformatter.GpmValueFormatter import org.supla.android.usecases.channel.valueprovider.GpmValueProvider +import org.supla.core.shared.data.SuplaChannelFunction import java.util.Locale import javax.inject.Inject import javax.inject.Named diff --git a/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/HumidityAndTemperatureValueStringProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/HumidityAndTemperatureValueStringProvider.kt index 1bec4c441..0c7639001 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/HumidityAndTemperatureValueStringProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/HumidityAndTemperatureValueStringProvider.kt @@ -19,12 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. import org.supla.android.Preferences import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.ChannelValueStringProvider import org.supla.android.usecases.channel.ValueType import org.supla.android.usecases.channel.valueformatter.HumidityValueFormatter import org.supla.android.usecases.channel.valueformatter.ThermometerValueFormatter import org.supla.android.usecases.channel.valueprovider.HumidityAndTemperatureValueProvider +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/NoValueStringProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/NoValueStringProvider.kt new file mode 100644 index 000000000..fa02715b3 --- /dev/null +++ b/app/src/main/java/org/supla/android/usecases/channel/stringvalueprovider/NoValueStringProvider.kt @@ -0,0 +1,29 @@ +package org.supla.android.usecases.channel.stringvalueprovider +/* +Copyright (C) AC SOFTWARE SP. Z O.O. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +import org.supla.android.data.source.local.entity.complex.ChannelDataEntity +import org.supla.android.usecases.channel.ChannelValueStringProvider +import org.supla.android.usecases.channel.ValueType +import org.supla.core.shared.data.SuplaChannelFunction + +class NoValueStringProvider(private val function: SuplaChannelFunction) : ChannelValueStringProvider { + override fun handle(channelData: ChannelDataEntity): Boolean = channelData.function == function + + override fun value(channelData: ChannelDataEntity, valueType: ValueType, withUnit: Boolean): String? = null +} diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProvider.kt index cf9d15c49..7c94d7e46 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProvider.kt @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DistanceSensorValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DistanceSensorValueProvider.kt index 3e5b3fb5f..65ce9f4fc 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DistanceSensorValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/DistanceSensorValueProvider.kt @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ElectricityMeterValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ElectricityMeterValueProvider.kt index ad84fd189..b45de0b10 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ElectricityMeterValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ElectricityMeterValueProvider.kt @@ -21,12 +21,12 @@ import org.supla.android.core.storage.UserStateHolder import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.Electricity import org.supla.android.data.source.local.entity.custom.Phase -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.channel.SuplaElectricityMeasurementType import org.supla.android.data.source.remote.channel.suplaElectricityMeterMeasuredTypes import org.supla.android.usecases.channel.ChannelValueProvider import org.supla.android.usecases.channel.ValueType import org.supla.android.usecases.channel.valueprovider.parser.IntValueParser +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/GpmValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/GpmValueProvider.kt index 4902e8c3f..efdce902c 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/GpmValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/GpmValueProvider.kt @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProvider.kt index 55c1471ce..179177e44 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProvider.kt @@ -18,10 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.ChannelValueProvider import org.supla.android.usecases.channel.ValueType import org.supla.android.usecases.channel.valueprovider.parser.IntValueParser +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ImpulseCounterValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ImpulseCounterValueProvider.kt index c300ace4c..575107307 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ImpulseCounterValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ImpulseCounterValueProvider.kt @@ -18,10 +18,10 @@ package org.supla.android.usecases.channel.valueprovider */ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.ChannelValueProvider import org.supla.android.usecases.channel.ValueType import org.supla.android.usecases.channel.valueprovider.parser.LongValueProvider +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/SwitchWithElectricityMeterValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/SwitchWithElectricityMeterValueProvider.kt index ad898d83b..c58737640 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/SwitchWithElectricityMeterValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/SwitchWithElectricityMeterValueProvider.kt @@ -19,12 +19,12 @@ package org.supla.android.usecases.channel.valueprovider import org.supla.android.core.storage.UserStateHolder import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.channel.SuplaElectricityMeasurementType import org.supla.android.lib.SuplaChannelValue.SUBV_TYPE_ELECTRICITY_MEASUREMENTS import org.supla.android.usecases.channel.ChannelValueProvider import org.supla.android.usecases.channel.ValueType import org.supla.android.usecases.channel.valueprovider.parser.IntValueParser +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProvider.kt b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProvider.kt index 323b56dec..be5128522 100644 --- a/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProvider.kt +++ b/app/src/main/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProvider.kt @@ -18,7 +18,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/details/BaseDetailTypeProviderUseCase.kt b/app/src/main/java/org/supla/android/usecases/details/BaseDetailTypeProviderUseCase.kt index cd0b75b27..125dbd21a 100644 --- a/app/src/main/java/org/supla/android/usecases/details/BaseDetailTypeProviderUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/details/BaseDetailTypeProviderUseCase.kt @@ -17,8 +17,8 @@ package org.supla.android.usecases.details Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.features.details.detailbase.standarddetail.DetailPage +import org.supla.core.shared.data.SuplaChannelFunction abstract class BaseDetailTypeProviderUseCase { diff --git a/app/src/main/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCase.kt b/app/src/main/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCase.kt index 1a8b732b6..21a58028e 100644 --- a/app/src/main/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCase.kt @@ -23,10 +23,10 @@ import org.supla.android.data.source.local.entity.custom.ChannelWithChildren import org.supla.android.data.source.local.entity.isElectricityMeter import org.supla.android.data.source.local.entity.isImpulseCounter import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.features.details.detailbase.standarddetail.DetailPage import org.supla.android.lib.SuplaChannelValue.SUBV_TYPE_ELECTRICITY_MEASUREMENTS import org.supla.android.lib.SuplaChannelValue.SUBV_TYPE_IC_MEASUREMENTS +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCase.kt b/app/src/main/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCase.kt index b92faad08..766fe3085 100644 --- a/app/src/main/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCase.kt @@ -22,7 +22,6 @@ import org.supla.android.data.source.ChannelGroupRelationRepository import org.supla.android.data.source.ChannelGroupRepository import org.supla.android.data.source.local.entity.ChannelGroupEntity import org.supla.android.data.source.local.entity.ChannelValueEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.group.totalvalue.DimmerAndRgbGroupValue import org.supla.android.usecases.group.totalvalue.DimmerGroupValue import org.supla.android.usecases.group.totalvalue.GroupTotalValue @@ -33,6 +32,7 @@ import org.supla.android.usecases.group.totalvalue.ProjectorScreenGroupValue import org.supla.android.usecases.group.totalvalue.RgbGroupValue import org.supla.android.usecases.group.totalvalue.ShadingSystemGroupValue import org.supla.android.usecases.group.totalvalue.ShadowingBlindGroupValue +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/java/org/supla/android/usecases/icon/GetChannelIconUseCase.kt b/app/src/main/java/org/supla/android/usecases/icon/GetChannelIconUseCase.kt index 46ed12d78..d188d527e 100644 --- a/app/src/main/java/org/supla/android/usecases/icon/GetChannelIconUseCase.kt +++ b/app/src/main/java/org/supla/android/usecases/icon/GetChannelIconUseCase.kt @@ -20,7 +20,6 @@ package org.supla.android.usecases.icon import org.supla.android.data.model.general.ChannelDataBase import org.supla.android.data.model.general.ChannelState import org.supla.android.data.model.general.IconType -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.db.ChannelBase import org.supla.android.extensions.guardLet import org.supla.android.extensions.ifLet @@ -32,6 +31,7 @@ import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_DIMMERANDRGBLIGHTING import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_HUMIDITYANDTEMPERATURE import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_THERMOMETER import org.supla.android.usecases.channel.GetChannelStateUseCase +import org.supla.core.shared.data.SuplaChannelFunction import javax.inject.Inject import javax.inject.Singleton diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 5e136867c..0a8f0f637 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -444,7 +444,7 @@ Die Aktion wurde nicht erfolgreich durchgeführt Wischgeste zum Öffnen der Kanaldetails wurde gelöscht, tippe auf dem Kanal, um sie zu sehen. - Das Kanal is offline + Das Kanal ist offline Benachrichtigungen! Schalte die Notifikationen ein, um auf dem Laufenden zu halten! Um sie Ihnen zu zeigen, brauchen wir Ihre Zustimmung.\n\nDie Notifikation können Sie in Supla Cloud konfigurieren. Überspringen @@ -636,6 +636,10 @@ Blind- aufgenommen Blind- zurückgegeben Energie + Verhüllen + Enthüllen + Einklappen + Ausklappen eingeschaltet eingeschaltet diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index 207beda06..21d1fae32 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -711,6 +711,10 @@ Indukcyjna Pojemnościowa Energia + Zasłoń + Odsłoń + Zwiń + Rozwiń włączone diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fe2550f91..e6b57179e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -733,6 +733,10 @@ Forward reactive Reverse reactive Energy + Shut + Reveal + Collapse + Expand on diff --git a/app/src/test/java/org/supla/android/features/channellist/ChannelListViewModelTest.kt b/app/src/test/java/org/supla/android/features/channellist/ChannelListViewModelTest.kt index de3a3bd97..1b3d9a54a 100644 --- a/app/src/test/java/org/supla/android/features/channellist/ChannelListViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/channellist/ChannelListViewModelTest.kt @@ -45,7 +45,6 @@ import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.LocationEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.events.UpdateEventsManager import org.supla.android.features.details.detailbase.standarddetail.DetailPage @@ -63,6 +62,7 @@ import org.supla.android.usecases.details.ThermostatDetailType import org.supla.android.usecases.details.WindowDetailType import org.supla.android.usecases.location.CollapsedFlag import org.supla.android.usecases.location.ToggleLocationUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ChannelListViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/features/details/detailbase/electricitymeter/NoExtendedValueStateHandlerTest.kt b/app/src/test/java/org/supla/android/features/details/detailbase/electricitymeter/NoExtendedValueStateHandlerTest.kt index 17ddfa066..b929f1e59 100644 --- a/app/src/test/java/org/supla/android/features/details/detailbase/electricitymeter/NoExtendedValueStateHandlerTest.kt +++ b/app/src/test/java/org/supla/android/features/details/detailbase/electricitymeter/NoExtendedValueStateHandlerTest.kt @@ -26,10 +26,10 @@ import org.assertj.core.api.Assertions.assertThat import org.junit.Before import org.junit.Test import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.lib.SuplaChannelValue.SUBV_TYPE_ELECTRICITY_MEASUREMENTS import org.supla.android.usecases.channel.GetChannelValueUseCase import org.supla.android.usecases.channel.electricitymeter.ElectricityMeasurements +import org.supla.core.shared.data.SuplaChannelFunction class NoExtendedValueStateHandlerTest { @MockK diff --git a/app/src/test/java/org/supla/android/features/details/gpmdetail/GpmDetailViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/gpmdetail/GpmDetailViewModelTest.kt index ad1aef754..9bcb0fe96 100644 --- a/app/src/test/java/org/supla/android/features/details/gpmdetail/GpmDetailViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/gpmdetail/GpmDetailViewModelTest.kt @@ -36,13 +36,13 @@ import org.supla.android.Preferences import org.supla.android.core.BaseViewModelTest import org.supla.android.core.ui.StringProvider import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.events.UpdateEventsManager import org.supla.android.tools.SuplaSchedulers import org.supla.android.usecases.channel.GetChannelCaptionUseCase import org.supla.android.usecases.channel.ReadChannelByRemoteIdUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GpmDetailViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/features/details/switchdetail/SwitchDetailViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/switchdetail/SwitchDetailViewModelTest.kt index d217c2bf1..2909fa999 100644 --- a/app/src/test/java/org/supla/android/features/details/switchdetail/SwitchDetailViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/switchdetail/SwitchDetailViewModelTest.kt @@ -37,13 +37,13 @@ import org.supla.android.core.BaseViewModelTest import org.supla.android.core.ui.StringProvider import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.events.UpdateEventsManager import org.supla.android.tools.SuplaSchedulers import org.supla.android.usecases.channel.GetChannelCaptionUseCase import org.supla.android.usecases.channel.ReadChannelByRemoteIdUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class SwitchDetailViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/features/details/switchdetail/switchdetail/SwitchGeneralViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/switchdetail/switchdetail/SwitchGeneralViewModelTest.kt index d0e313eb9..c434bbb46 100644 --- a/app/src/test/java/org/supla/android/features/details/switchdetail/switchdetail/SwitchGeneralViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/switchdetail/switchdetail/SwitchGeneralViewModelTest.kt @@ -37,7 +37,6 @@ import org.supla.android.data.model.general.ChannelState import org.supla.android.data.source.local.entity.ChannelExtendedValueEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.events.DownloadEventsManager import org.supla.android.features.details.detailbase.electricitymeter.ElectricityMeterGeneralStateHandler @@ -58,6 +57,7 @@ import org.supla.android.usecases.channel.electricitymeter.LoadElectricityMeterM import org.supla.android.usecases.client.ExecuteSimpleActionUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.icon.GetChannelIconUseCase +import org.supla.core.shared.data.SuplaChannelFunction import java.util.Date @Suppress("UnusedLambdaExpressionBody") diff --git a/app/src/test/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModelTest.kt index a209fe531..b4b8f39d1 100644 --- a/app/src/test/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/thermostatdetail/ThermostatDetailViewModelTest.kt @@ -34,7 +34,6 @@ import org.supla.android.core.ui.StringProvider import org.supla.android.data.source.local.entity.ChannelEntity import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.hvac.ThermostatSubfunction import org.supla.android.data.source.remote.thermostat.ThermostatValue import org.supla.android.data.source.runtime.ItemType @@ -43,6 +42,7 @@ import org.supla.android.tools.SuplaSchedulers import org.supla.android.usecases.channel.GetChannelCaptionUseCase import org.supla.android.usecases.channel.ReadChannelByRemoteIdUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ThermostatDetailViewModelTest : diff --git a/app/src/test/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModelTest.kt index 867d434d3..e5e4d8770 100644 --- a/app/src/test/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/thermostatdetail/general/ThermostatGeneralViewModelTest.kt @@ -43,7 +43,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren import org.supla.android.data.source.remote.ConfigResult -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.hvac.SuplaChannelHvacConfig import org.supla.android.data.source.remote.hvac.SuplaChannelWeeklyScheduleConfig import org.supla.android.data.source.remote.hvac.SuplaHvacAlgorithm @@ -68,6 +67,7 @@ import org.supla.android.usecases.channel.GetChannelValueUseCase import org.supla.android.usecases.channel.ReadChannelWithChildrenTreeUseCase import org.supla.android.usecases.icon.GetChannelIconUseCase import org.supla.android.usecases.thermostat.CreateTemperaturesListUseCase +import org.supla.core.shared.data.SuplaChannelFunction import java.util.Date import java.util.concurrent.TimeUnit diff --git a/app/src/test/java/org/supla/android/features/details/windowdetail/curtain/CurtainViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/windowdetail/curtain/CurtainViewModelTest.kt index 2e843261b..26673a718 100644 --- a/app/src/test/java/org/supla/android/features/details/windowdetail/curtain/CurtainViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/windowdetail/curtain/CurtainViewModelTest.kt @@ -43,7 +43,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity import org.supla.android.data.source.local.entity.custom.GroupOnlineSummary import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.rollershutter.RollerShutterValue import org.supla.android.data.source.remote.shadingsystem.SuplaShadingSystemFlag import org.supla.android.data.source.runtime.ItemType @@ -67,6 +66,7 @@ import org.supla.android.usecases.client.LoginUseCase import org.supla.android.usecases.group.GetGroupOnlineSummaryUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.group.totalvalue.GroupTotalValue +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class CurtainViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/features/details/windowdetail/garagedoor/GarageDoorViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/windowdetail/garagedoor/GarageDoorViewModelTest.kt index 9913a9af3..357aafa2e 100644 --- a/app/src/test/java/org/supla/android/features/details/windowdetail/garagedoor/GarageDoorViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/windowdetail/garagedoor/GarageDoorViewModelTest.kt @@ -43,7 +43,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity import org.supla.android.data.source.local.entity.custom.GroupOnlineSummary import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.rollershutter.RollerShutterValue import org.supla.android.data.source.remote.shadingsystem.SuplaShadingSystemFlag import org.supla.android.data.source.runtime.ItemType @@ -66,6 +65,7 @@ import org.supla.android.usecases.client.LoginUseCase import org.supla.android.usecases.group.GetGroupOnlineSummaryUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.group.totalvalue.GroupTotalValue +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GarageDoorViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/features/details/windowdetail/projectorscreen/ProjectorScreenViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/windowdetail/projectorscreen/ProjectorScreenViewModelTest.kt index 5c3234f0d..1ae13b9ac 100644 --- a/app/src/test/java/org/supla/android/features/details/windowdetail/projectorscreen/ProjectorScreenViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/windowdetail/projectorscreen/ProjectorScreenViewModelTest.kt @@ -43,7 +43,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity import org.supla.android.data.source.local.entity.custom.GroupOnlineSummary import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.rollershutter.RollerShutterValue import org.supla.android.data.source.remote.shadingsystem.SuplaShadingSystemFlag import org.supla.android.data.source.runtime.ItemType @@ -66,6 +65,7 @@ import org.supla.android.usecases.client.LoginUseCase import org.supla.android.usecases.group.GetGroupOnlineSummaryUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.group.totalvalue.GroupTotalValue +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ProjectorScreenViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/features/details/windowdetail/rollershutter/RollerShutterViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/windowdetail/rollershutter/RollerShutterViewModelTest.kt index a032b63fa..e5cc474d4 100644 --- a/app/src/test/java/org/supla/android/features/details/windowdetail/rollershutter/RollerShutterViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/windowdetail/rollershutter/RollerShutterViewModelTest.kt @@ -47,7 +47,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity import org.supla.android.data.source.local.entity.custom.GroupOnlineSummary import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.rollershutter.RollerShutterValue import org.supla.android.data.source.remote.shadingsystem.SuplaShadingSystemFlag import org.supla.android.data.source.runtime.ItemType @@ -75,6 +74,7 @@ import org.supla.android.usecases.client.SuplaClientOperation import org.supla.android.usecases.group.GetGroupOnlineSummaryUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.group.totalvalue.GroupTotalValue +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class RollerShutterViewModelTest : diff --git a/app/src/test/java/org/supla/android/features/details/windowdetail/roofwindow/RoofWindowViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/windowdetail/roofwindow/RoofWindowViewModelTest.kt index 1d7c824ea..0c92a7d02 100644 --- a/app/src/test/java/org/supla/android/features/details/windowdetail/roofwindow/RoofWindowViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/windowdetail/roofwindow/RoofWindowViewModelTest.kt @@ -26,7 +26,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity import org.supla.android.data.source.local.entity.custom.GroupOnlineSummary import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.rollershutter.RollerShutterValue import org.supla.android.data.source.remote.shadingsystem.SuplaShadingSystemFlag import org.supla.android.data.source.runtime.ItemType @@ -49,6 +48,7 @@ import org.supla.android.usecases.client.LoginUseCase import org.supla.android.usecases.group.GetGroupOnlineSummaryUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.group.totalvalue.GroupTotalValue +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class RoofWindowViewModelTest : diff --git a/app/src/test/java/org/supla/android/features/details/windowdetail/terraceawning/TerraceAwningViewModelTest.kt b/app/src/test/java/org/supla/android/features/details/windowdetail/terraceawning/TerraceAwningViewModelTest.kt index f8b4ae7f6..35d27d00c 100644 --- a/app/src/test/java/org/supla/android/features/details/windowdetail/terraceawning/TerraceAwningViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/details/windowdetail/terraceawning/TerraceAwningViewModelTest.kt @@ -43,7 +43,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity import org.supla.android.data.source.local.entity.custom.GroupOnlineSummary import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.rollershutter.RollerShutterValue import org.supla.android.data.source.remote.shadingsystem.SuplaShadingSystemFlag import org.supla.android.data.source.runtime.ItemType @@ -66,6 +65,7 @@ import org.supla.android.usecases.client.LoginUseCase import org.supla.android.usecases.group.GetGroupOnlineSummaryUseCase import org.supla.android.usecases.group.ReadChannelGroupByRemoteIdUseCase import org.supla.android.usecases.group.totalvalue.GroupTotalValue +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class TerraceAwningViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/features/grouplist/GroupListViewModelTest.kt b/app/src/test/java/org/supla/android/features/grouplist/GroupListViewModelTest.kt index 30e1ae03b..48c50c298 100644 --- a/app/src/test/java/org/supla/android/features/grouplist/GroupListViewModelTest.kt +++ b/app/src/test/java/org/supla/android/features/grouplist/GroupListViewModelTest.kt @@ -25,7 +25,6 @@ import org.supla.android.data.model.general.ChannelDataBase import org.supla.android.data.source.ChannelRepository import org.supla.android.data.source.local.entity.LocationEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.runtime.ItemType import org.supla.android.events.UpdateEventsManager import org.supla.android.features.details.detailbase.standarddetail.DetailPage @@ -43,6 +42,7 @@ import org.supla.android.usecases.location.CollapsedFlag import org.supla.android.usecases.location.ToggleLocationUseCase import org.supla.android.usecases.profile.CloudUrl import org.supla.android.usecases.profile.LoadActiveProfileUrlUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GroupListViewModelTest : BaseViewModelTest() { diff --git a/app/src/test/java/org/supla/android/usecases/channel/ChannelActionUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/ChannelActionUseCaseTest.kt index 329dfe61e..15fe65906 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/ChannelActionUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/ChannelActionUseCaseTest.kt @@ -20,13 +20,13 @@ import org.supla.android.data.source.RoomChannelRepository import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.relay.SuplaRelayFlag import org.supla.android.data.source.remote.valve.SuplaValveFlag import org.supla.android.data.source.remote.valve.ValveValue import org.supla.android.lib.actions.ActionId import org.supla.android.lib.actions.ActionParameters import org.supla.android.lib.actions.SubjectType +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ChannelActionUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/CreateProfileChannelsListUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/CreateProfileChannelsListUseCaseTest.kt index d7929a9db..3abafe2cd 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/CreateProfileChannelsListUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/CreateProfileChannelsListUseCaseTest.kt @@ -18,13 +18,13 @@ import org.supla.android.data.source.RoomChannelRepository import org.supla.android.data.source.local.entity.ChannelRelationEntity import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.thermostat.ThermostatIndicatorIcon import org.supla.android.images.ImageId import org.supla.android.ui.lists.ListItem import org.supla.android.ui.lists.data.IssueIconType import org.supla.android.usecases.icon.GetChannelIconUseCase import org.supla.android.usecases.location.CollapsedFlag +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class CreateProfileChannelsListUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCaseTest.kt index 59a3373b9..c2c7c9eaa 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/DeleteChannelMeasurementsUseCaseTest.kt @@ -40,7 +40,7 @@ import org.supla.android.data.source.local.entity.ChannelEntity import org.supla.android.data.source.local.entity.ChannelRelationType import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class DeleteChannelMeasurementsUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/GetChannelCaptionUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/GetChannelCaptionUseCaseTest.kt index 7515cee80..8ce6f0251 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/GetChannelCaptionUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/GetChannelCaptionUseCaseTest.kt @@ -30,7 +30,7 @@ import org.mockito.kotlin.verify import org.mockito.kotlin.verifyNoInteractions import org.mockito.kotlin.whenever import org.supla.android.data.source.local.entity.ChannelEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GetChannelCaptionUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/GetChannelStateUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/GetChannelStateUseCaseTest.kt index 0fe47fc26..f003736cb 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/GetChannelStateUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/GetChannelStateUseCaseTest.kt @@ -28,9 +28,9 @@ import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.model.general.ChannelState import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.hvac.ThermostatSubfunction import org.supla.android.usecases.group.GetGroupActivePercentageUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GetChannelStateUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueStringUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueStringUseCaseTest.kt index 66ddbd37e..096cb6b0d 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueStringUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueStringUseCaseTest.kt @@ -31,7 +31,6 @@ import org.mockito.kotlin.verifyNoMoreInteractions import org.mockito.kotlin.whenever import org.supla.android.data.ValuesFormatter import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.stringvalueprovider.DepthSensorValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.DistanceSensorValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.ElectricityMeterValueStringProvider @@ -40,6 +39,7 @@ import org.supla.android.usecases.channel.stringvalueprovider.HumidityAndTempera import org.supla.android.usecases.channel.stringvalueprovider.ImpulseCounterValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.SwitchWithElectricityMeterValueStringProvider import org.supla.android.usecases.channel.stringvalueprovider.ThermometerValueStringProvider +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GetChannelValueStringUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueUseCaseTest.kt index 977055471..502f7817b 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/GetChannelValueUseCaseTest.kt @@ -30,7 +30,6 @@ import org.mockito.kotlin.verifyNoInteractions import org.mockito.kotlin.verifyNoMoreInteractions import org.mockito.kotlin.whenever import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.valueprovider.DepthSensorValueProvider import org.supla.android.usecases.channel.valueprovider.DistanceSensorValueProvider import org.supla.android.usecases.channel.valueprovider.ElectricityMeterValueProvider @@ -39,6 +38,7 @@ import org.supla.android.usecases.channel.valueprovider.HumidityAndTemperatureVa import org.supla.android.usecases.channel.valueprovider.ImpulseCounterValueProvider import org.supla.android.usecases.channel.valueprovider.SwitchWithElectricityMeterValueProvider import org.supla.android.usecases.channel.valueprovider.ThermometerValueProvider +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GetChannelValueUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/GroupActionUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/GroupActionUseCaseTest.kt index 47e973888..02aac0f6c 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/GroupActionUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/GroupActionUseCaseTest.kt @@ -18,10 +18,10 @@ import org.supla.android.core.networking.suplaclient.SuplaClientApi import org.supla.android.core.networking.suplaclient.SuplaClientProvider import org.supla.android.data.source.ChannelGroupRepository import org.supla.android.data.source.local.entity.complex.ChannelGroupDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.lib.actions.ActionId import org.supla.android.lib.actions.ActionParameters import org.supla.android.lib.actions.SubjectType +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GroupActionUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelConfigUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelConfigUseCaseTest.kt index b39c9c168..6e4d26606 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelConfigUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelConfigUseCaseTest.kt @@ -35,8 +35,8 @@ import org.supla.android.data.source.RoomChannelRepository import org.supla.android.data.source.local.entity.ChannelEntity import org.supla.android.data.source.remote.ChannelConfigType import org.supla.android.data.source.remote.SuplaChannelConfig -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channelconfig.LoadChannelConfigUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class LoadChannelConfigUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsDataRangeUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsDataRangeUseCaseTest.kt index 12fa0b754..37f9a0245 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsDataRangeUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsDataRangeUseCaseTest.kt @@ -33,8 +33,8 @@ import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.model.Optional import org.supla.android.data.model.chart.DateRange import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.extensions.date +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class LoadChannelMeasurementsDataRangeUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsUseCaseTest.kt index 3b1073e39..5538ec75f 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelMeasurementsUseCaseTest.kt @@ -32,12 +32,12 @@ import org.junit.Test import org.supla.android.data.model.chart.ChannelChartSets import org.supla.android.data.model.chart.ChartDataSpec import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.measurementsprovider.ElectricityConsumptionMeasurementsProvider import org.supla.android.usecases.channel.measurementsprovider.GeneralPurposeMeasurementMeasurementsProvider import org.supla.android.usecases.channel.measurementsprovider.GeneralPurposeMeterMeasurementsProvider import org.supla.android.usecases.channel.measurementsprovider.TemperatureAndHumidityMeasurementsProvider import org.supla.android.usecases.channel.measurementsprovider.TemperatureMeasurementsProvider +import org.supla.core.shared.data.SuplaChannelFunction class LoadChannelMeasurementsUseCaseTest : BaseLoadMeasurementsUseCaseTest() { diff --git a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCaseTest.kt index ac3e8b6b4..d02ec36a4 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsDateRangeUseCaseTest.kt @@ -41,8 +41,8 @@ import org.supla.android.data.source.local.entity.ChannelRelationType import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.extensions.date +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class LoadChannelWithChildrenMeasurementsDateRangeUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCaseTest.kt index aec5791db..b8168331d 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/LoadChannelWithChildrenMeasurementsUseCaseTest.kt @@ -39,10 +39,10 @@ import org.supla.android.data.source.local.entity.ChannelRelationType import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.extensions.date import org.supla.android.usecases.channel.measurementsprovider.TemperatureAndHumidityMeasurementsProvider import org.supla.android.usecases.channel.measurementsprovider.TemperatureMeasurementsProvider +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class LoadChannelWithChildrenMeasurementsUseCaseTest : BaseLoadMeasurementsUseCaseTest() { diff --git a/app/src/test/java/org/supla/android/usecases/channel/UpdateChannelUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/channel/UpdateChannelUseCaseTest.kt index 527a1629a..ab8204da7 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/UpdateChannelUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/UpdateChannelUseCaseTest.kt @@ -41,13 +41,13 @@ import org.supla.android.data.source.RoomProfileRepository import org.supla.android.data.source.local.entity.ChannelEntity import org.supla.android.data.source.local.entity.LocationEntity import org.supla.android.data.source.local.entity.ProfileEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.db.Location import org.supla.android.testhelpers.suplaChannel import org.supla.android.usecases.channelconfig.RequestChannelConfigUseCase import org.supla.android.widget.WidgetConfiguration import org.supla.android.widget.WidgetManager import org.supla.android.widget.WidgetPreferences +import org.supla.core.shared.data.SuplaChannelFunction @Suppress("UnusedDataClassCopyResult") @RunWith(MockitoJUnitRunner::class) diff --git a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProviderTest.kt b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProviderTest.kt index 80c03587c..fd1051b94 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProviderTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/DepthSensorValueProviderTest.kt @@ -8,7 +8,7 @@ import org.junit.runner.RunWith import org.mockito.InjectMocks import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class DepthSensorValueProviderTest : BaseDoubleValueProviderTest() { diff --git a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/GpmValueProviderTest.kt b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/GpmValueProviderTest.kt index 599694183..1daaded79 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/GpmValueProviderTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/GpmValueProviderTest.kt @@ -8,7 +8,7 @@ import org.junit.runner.RunWith import org.mockito.InjectMocks import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GpmValueProviderTest : BaseDoubleValueProviderTest() { diff --git a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProviderTest.kt b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProviderTest.kt index c893bc9a0..92d7ceecf 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProviderTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/HumidityAndTemperatureValueProviderTest.kt @@ -8,8 +8,8 @@ import org.junit.runner.RunWith import org.mockito.InjectMocks import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.usecases.channel.ValueType +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class HumidityAndTemperatureValueProviderTest { diff --git a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProviderTest.kt b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProviderTest.kt index 5bd3f1176..0a8d70a2c 100644 --- a/app/src/test/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProviderTest.kt +++ b/app/src/test/java/org/supla/android/usecases/channel/valueprovider/ThermometerValueProviderTest.kt @@ -8,7 +8,7 @@ import org.junit.runner.RunWith import org.mockito.InjectMocks import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ThermometerValueProviderTest : BaseDoubleValueProviderTest() { diff --git a/app/src/test/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCaseTest.kt index 06936284f..ecdf1950a 100644 --- a/app/src/test/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/details/ProvideChannelDetailTypeUseCaseTest.kt @@ -28,10 +28,10 @@ import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.features.details.detailbase.standarddetail.DetailPage import org.supla.android.lib.SuplaChannelValue.SUBV_TYPE_ELECTRICITY_MEASUREMENTS import org.supla.android.lib.SuplaChannelValue.SUBV_TYPE_IC_MEASUREMENTS +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ProvideChannelDetailTypeUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/details/ProvideGroupDetailTypeUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/details/ProvideGroupDetailTypeUseCaseTest.kt index dcc1289e1..9c8b5bd5a 100644 --- a/app/src/test/java/org/supla/android/usecases/details/ProvideGroupDetailTypeUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/details/ProvideGroupDetailTypeUseCaseTest.kt @@ -25,8 +25,8 @@ import org.junit.runner.RunWith import org.mockito.InjectMocks import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.features.details.detailbase.standarddetail.DetailPage +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ProvideGroupDetailTypeUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/group/GetGroupActivePercentageUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/group/GetGroupActivePercentageUseCaseTest.kt index 3afa14118..7f0ea82fe 100644 --- a/app/src/test/java/org/supla/android/usecases/group/GetGroupActivePercentageUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/group/GetGroupActivePercentageUseCaseTest.kt @@ -25,7 +25,7 @@ import org.junit.runner.RunWith import org.mockito.InjectMocks import org.mockito.junit.MockitoJUnitRunner import org.supla.android.data.source.local.entity.ChannelGroupEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class GetGroupActivePercentageUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/group/ReadGroupTiltingDetailsUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/group/ReadGroupTiltingDetailsUseCaseTest.kt index 7bfb5d0fa..c7b9d80d7 100644 --- a/app/src/test/java/org/supla/android/usecases/group/ReadGroupTiltingDetailsUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/group/ReadGroupTiltingDetailsUseCaseTest.kt @@ -16,9 +16,9 @@ import org.supla.android.data.source.ChannelGroupRelationRepository import org.supla.android.data.source.local.entity.ChannelEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupRelationDataEntity import org.supla.android.data.source.remote.ChannelConfigType -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.rollershutter.SuplaChannelFacadeBlindConfig import org.supla.android.data.source.remote.rollershutter.SuplaTiltControlType +import org.supla.core.shared.data.SuplaChannelFunction class ReadGroupTiltingDetailsUseCaseTest { diff --git a/app/src/test/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCaseTest.kt index f4f1c7c7e..86c317d64 100644 --- a/app/src/test/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/group/UpdateChannelGroupTotalValueUseCaseTest.kt @@ -38,7 +38,7 @@ import org.supla.android.data.source.ChannelGroupRepository import org.supla.android.data.source.local.entity.ChannelGroupEntity import org.supla.android.data.source.local.entity.ChannelValueEntity import org.supla.android.data.source.local.entity.complex.ChannelGroupRelationDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction +import org.supla.core.shared.data.SuplaChannelFunction @Suppress("SameParameterValue") @RunWith(MockitoJUnitRunner::class) diff --git a/app/src/test/java/org/supla/android/usecases/icon/GetChannelIconUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/icon/GetChannelIconUseCaseTest.kt index 741fdad09..59e7da1c5 100644 --- a/app/src/test/java/org/supla/android/usecases/icon/GetChannelIconUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/icon/GetChannelIconUseCaseTest.kt @@ -30,7 +30,6 @@ import org.mockito.kotlin.whenever import org.supla.android.data.model.general.ChannelState import org.supla.android.data.model.general.IconType import org.supla.android.data.source.local.entity.complex.ChannelDataEntity -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.db.Channel import org.supla.android.db.ChannelBase import org.supla.android.images.ImageCacheProxy @@ -41,6 +40,7 @@ import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_LIGHTSWITCH import org.supla.android.lib.SuplaConst.SUPLA_CHANNELFNC_THERMOMETER import org.supla.android.usecases.channel.GetChannelStateUseCase import org.supla.android.usecases.channel.ValueStateWrapper +import org.supla.core.shared.data.SuplaChannelFunction @Suppress("SameParameterValue") @RunWith(MockitoJUnitRunner::class) diff --git a/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToIconValueItemUpdateEventMapperTest.kt b/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToIconValueItemUpdateEventMapperTest.kt index eba2e649e..4b0942852 100644 --- a/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToIconValueItemUpdateEventMapperTest.kt +++ b/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToIconValueItemUpdateEventMapperTest.kt @@ -29,7 +29,6 @@ import org.mockito.junit.MockitoJUnitRunner import org.mockito.kotlin.whenever import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.db.Channel import org.supla.android.images.ImageId import org.supla.android.ui.lists.ListOnlineState @@ -37,6 +36,7 @@ import org.supla.android.ui.lists.data.SlideableListItemData import org.supla.android.usecases.channel.GetChannelCaptionUseCase import org.supla.android.usecases.channel.GetChannelValueStringUseCase import org.supla.android.usecases.icon.GetChannelIconUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ChannelWithChildrenToIconValueItemUpdateEventMapperTest { diff --git a/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToThermostatUpdateEventMapperTest.kt b/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToThermostatUpdateEventMapperTest.kt index 81d3bb2e4..88b55da75 100644 --- a/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToThermostatUpdateEventMapperTest.kt +++ b/app/src/test/java/org/supla/android/usecases/list/eventmappers/ChannelWithChildrenToThermostatUpdateEventMapperTest.kt @@ -34,7 +34,6 @@ import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren import org.supla.android.data.source.remote.channel.SuplaChannelFlag -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.data.source.remote.thermostat.ThermostatIndicatorIcon import org.supla.android.data.source.remote.thermostat.ThermostatValue import org.supla.android.db.Channel @@ -49,6 +48,7 @@ import org.supla.android.ui.lists.data.SlideableListItemData import org.supla.android.usecases.channel.GetChannelCaptionUseCase import org.supla.android.usecases.channel.GetChannelValueStringUseCase import org.supla.android.usecases.icon.GetChannelIconUseCase +import org.supla.core.shared.data.SuplaChannelFunction @RunWith(MockitoJUnitRunner::class) class ChannelWithChildrenToThermostatUpdateEventMapperTest { diff --git a/app/src/test/java/org/supla/android/usecases/thermostat/CreateTemperaturesListUseCaseTest.kt b/app/src/test/java/org/supla/android/usecases/thermostat/CreateTemperaturesListUseCaseTest.kt index 72ae300ec..9db33edec 100644 --- a/app/src/test/java/org/supla/android/usecases/thermostat/CreateTemperaturesListUseCaseTest.kt +++ b/app/src/test/java/org/supla/android/usecases/thermostat/CreateTemperaturesListUseCaseTest.kt @@ -32,12 +32,12 @@ import org.supla.android.data.source.local.entity.ChannelRelationType import org.supla.android.data.source.local.entity.complex.ChannelChildEntity import org.supla.android.data.source.local.entity.complex.ChannelDataEntity import org.supla.android.data.source.local.entity.custom.ChannelWithChildren -import org.supla.android.data.source.remote.channel.SuplaChannelFunction import org.supla.android.features.details.thermostatdetail.general.MeasurementValue import org.supla.android.images.ImageId import org.supla.android.usecases.channel.GetChannelValueStringUseCase import org.supla.android.usecases.channel.ValueType import org.supla.android.usecases.icon.GetChannelIconUseCase +import org.supla.core.shared.data.SuplaChannelFunction class CreateTemperaturesListUseCaseTest { diff --git a/build.gradle.kts b/build.gradle.kts index b5fa34946..7543821b7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,6 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { + kotlin("multiplatform") version "2.0.21" apply false id("com.google.dagger.hilt.android") version Versions.Hilt apply false } diff --git a/settings.gradle.kts b/settings.gradle.kts index 8a109a878..7116b4c9e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,2 @@ -include(":app") \ No newline at end of file +include(":app") +include(":shared-core") diff --git a/shared-core/.gitignore b/shared-core/.gitignore new file mode 100644 index 000000000..42afabfd2 --- /dev/null +++ b/shared-core/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/shared-core/build.gradle.kts b/shared-core/build.gradle.kts new file mode 100644 index 000000000..8da0401c8 --- /dev/null +++ b/shared-core/build.gradle.kts @@ -0,0 +1,66 @@ +import org.jetbrains.kotlin.gradle.plugin.mpp.apple.XCFramework + +plugins { + kotlin("multiplatform") + id("com.android.library") +} + +android { + namespace = "org.supla.core.shared" + compileSdk = 34 + + defaultConfig { + minSdk = 24 + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + isMinifyEnabled = false + } + create("internaltest") { + initWith(buildTypes.getByName("debug")) + } + create("internalTestRelease") { + initWith(buildTypes.getByName("release")) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 + } +} + +kotlin { + androidTarget() + + val xcf = XCFramework("SharedCore") + + listOf( + iosX64(), + iosArm64(), + iosSimulatorArm64() + ).forEach { + it.binaries.framework { + baseName = "SharedCore" + xcf.add(this) + } + } + + sourceSets { + val commonMain by getting + val iosX64Main by getting + val iosArm64Main by getting + val iosSimulatorArm64Main by getting + } +} + +dependencies { + testImplementation("junit:junit:4.13.2") +} + +tasks.register("applyXCFramework") { + commandLine("cp", "-R", "build/XCFrameworks/release/SharedCore.xcframework", "../../supla-ios") + dependsOn("assembleSharedCoreReleaseXCFramework") +} \ No newline at end of file diff --git a/app/src/main/java/org/supla/android/data/source/remote/channel/SuplaChannelFunction.kt b/shared-core/src/commonMain/kotlin/org/supla/core/shared/data/SuplaChannelFunction.kt similarity index 98% rename from app/src/main/java/org/supla/android/data/source/remote/channel/SuplaChannelFunction.kt rename to shared-core/src/commonMain/kotlin/org/supla/core/shared/data/SuplaChannelFunction.kt index 71dba7802..8de28669b 100644 --- a/app/src/main/java/org/supla/android/data/source/remote/channel/SuplaChannelFunction.kt +++ b/shared-core/src/commonMain/kotlin/org/supla/core/shared/data/SuplaChannelFunction.kt @@ -1,4 +1,4 @@ -package org.supla.android.data.source.remote.channel +package org.supla.core.shared.data /* Copyright (C) AC SOFTWARE SP. Z O.O. diff --git a/shared-core/src/commonMain/kotlin/org/supla/core/shared/infrastructure/LocalizedString.kt b/shared-core/src/commonMain/kotlin/org/supla/core/shared/infrastructure/LocalizedString.kt new file mode 100644 index 000000000..c9ccafe8e --- /dev/null +++ b/shared-core/src/commonMain/kotlin/org/supla/core/shared/infrastructure/LocalizedString.kt @@ -0,0 +1,29 @@ +package org.supla.core.shared.infrastructure +/* + Copyright (C) AC SOFTWARE SP. Z O.O. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +enum class LocalizedString { + GENERAL_TURN_ON, + GENERAL_TURN_OFF, + GENERAL_OPEN, + GENERAL_CLOSE, + GENERAL_SHUT, + GENERAL_REVEAL, + GENERAL_COLLAPSE, + GENERAL_EXPAND +} \ No newline at end of file diff --git a/shared-core/src/commonMain/kotlin/org/supla/core/shared/usecase/GetChannelActionStringUseCase.kt b/shared-core/src/commonMain/kotlin/org/supla/core/shared/usecase/GetChannelActionStringUseCase.kt new file mode 100644 index 000000000..1fc103453 --- /dev/null +++ b/shared-core/src/commonMain/kotlin/org/supla/core/shared/usecase/GetChannelActionStringUseCase.kt @@ -0,0 +1,63 @@ +package org.supla.core.shared.usecase +/* + Copyright (C) AC SOFTWARE SP. Z O.O. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +import org.supla.core.shared.data.SuplaChannelFunction +import org.supla.core.shared.infrastructure.LocalizedString + +class GetChannelActionStringUseCase { + fun rightButton(function: SuplaChannelFunction): LocalizedString? = + when (function) { + SuplaChannelFunction.CONTROLLING_THE_ROOF_WINDOW, + SuplaChannelFunction.ROLLER_GARAGE_DOOR -> LocalizedString.GENERAL_OPEN + + SuplaChannelFunction.CONTROLLING_THE_FACADE_BLIND, + SuplaChannelFunction.CONTROLLING_THE_ROLLER_SHUTTER, + SuplaChannelFunction.VERTICAL_BLIND, + SuplaChannelFunction.CURTAIN -> LocalizedString.GENERAL_REVEAL + + SuplaChannelFunction.TERRACE_AWNING, + SuplaChannelFunction.PROJECTOR_SCREEN -> LocalizedString.GENERAL_COLLAPSE + + SuplaChannelFunction.POWER_SWITCH, + SuplaChannelFunction.LIGHTSWITCH, + SuplaChannelFunction.STAIRCASE_TIMER -> LocalizedString.GENERAL_TURN_ON + + else -> null + } + + fun leftButton(function: SuplaChannelFunction): LocalizedString? = + when (function) { + SuplaChannelFunction.CONTROLLING_THE_ROOF_WINDOW, + SuplaChannelFunction.ROLLER_GARAGE_DOOR -> LocalizedString.GENERAL_CLOSE + + SuplaChannelFunction.CONTROLLING_THE_FACADE_BLIND, + SuplaChannelFunction.CONTROLLING_THE_ROLLER_SHUTTER, + SuplaChannelFunction.VERTICAL_BLIND, + SuplaChannelFunction.CURTAIN -> LocalizedString.GENERAL_SHUT + + SuplaChannelFunction.TERRACE_AWNING, + SuplaChannelFunction.PROJECTOR_SCREEN -> LocalizedString.GENERAL_EXPAND + + SuplaChannelFunction.POWER_SWITCH, + SuplaChannelFunction.LIGHTSWITCH, + SuplaChannelFunction.STAIRCASE_TIMER -> LocalizedString.GENERAL_TURN_OFF + + else -> null + } +} \ No newline at end of file