Skip to content

Commit 6be8735

Browse files
authored
Merge pull request #707 from domoticz/beta-development
Beta development
2 parents 8a33f95 + 7dc951c commit 6be8735

File tree

18 files changed

+560
-255
lines changed

18 files changed

+560
-255
lines changed

app/build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,14 @@ dependencies {
184184
implementation "androidx.car.app:app:1.4.0-alpha01"
185185
implementation 'org.reactivestreams:reactive-streams:1.0.3'
186186
implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
187-
implementation 'com.revenuecat.purchases:purchases:5.6.3'
187+
implementation 'com.revenuecat.purchases:purchases:7.0.1'
188188

189189
implementation 'com.google.firebase:firebase-core:21.1.1'
190190
implementation 'com.google.firebase:firebase-iid:21.1.0'
191191
implementation 'com.google.firebase:firebase-analytics:21.3.0'
192-
implementation 'com.google.firebase:firebase-crashlytics:18.3.7'
193-
implementation "com.google.firebase:firebase-messaging:23.1.2"
194-
implementation "com.google.firebase:firebase-ads:22.1.0"
192+
implementation 'com.google.firebase:firebase-crashlytics:18.4.3'
193+
implementation "com.google.firebase:firebase-messaging:23.2.1"
194+
implementation "com.google.firebase:firebase-ads:22.4.0"
195195

196196
implementation 'com.google.android.ads.consent:consent-library:1.0.8'
197197
implementation "com.google.android.gms:play-services-analytics:18.0.3"
@@ -237,7 +237,7 @@ dependencies {
237237
}
238238

239239
implementation 'com.github.stfalcon:chatkit:0.3.3'
240-
implementation 'com.github.matthiasrobbers:shortbread:1.1.0'
240+
implementation 'com.github.matthiasrobbers:shortbread:1.4.0'
241241

242242
annotationProcessor 'com.github.matthiasrobbers:shortbread-compiler:1.1.0'
243243
implementation ('com.adevinta.android:leku:9.1.4') {

app/src/main/java/nl/hnogames/domoticz/adapters/DashboardAdapter.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ private void setSwitchRowData(DevicesInfo mDeviceInfo,
250250
setButtons(holder, Buttons.ADS);
251251
setAdsLayout(holder);
252252
} else if ((mDeviceInfo.getType() != null && DomoticzValues.Device.Utility.Type.THERMOSTAT.equalsIgnoreCase(mDeviceInfo.getType())) ||
253+
(mDeviceInfo.getSubType() != null && DomoticzValues.Device.Utility.SubType.SETPOINT.equalsIgnoreCase(mDeviceInfo.getSubType())) ||
253254
(mDeviceInfo.getSubType() != null && DomoticzValues.Device.Utility.SubType.SMARTWARES.equalsIgnoreCase(mDeviceInfo.getSubType()))) {
254255
setButtons(holder, Buttons.BUTTON_ON);
255256
setThermostatRowData(mDeviceInfo, holder);

app/src/main/java/nl/hnogames/domoticz/adapters/UtilityAdapter.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public void onBindViewHolder(final DataObjectHolder holder, final int position)
162162
setAdsLayout(holder);
163163
} else {
164164
if ((mUtilitiesInfo.getType() != null && DomoticzValues.Device.Utility.Type.THERMOSTAT.equalsIgnoreCase(mUtilitiesInfo.getType())) ||
165+
(mUtilitiesInfo.getSubType() != null && DomoticzValues.Device.Utility.SubType.SETPOINT.equalsIgnoreCase(mUtilitiesInfo.getSubType())) ||
165166
(mUtilitiesInfo.getSubType() != null && DomoticzValues.Device.Utility.SubType.SMARTWARES.equalsIgnoreCase(mUtilitiesInfo.getSubType()))) {
166167
setButtons(holder, Buttons.THERMOSTAT);
167168
CreateThermostatRow(holder, mUtilitiesInfo, setPoint);
@@ -290,7 +291,12 @@ public void unLiked(LikeButton likeButton) {
290291
holder.buttonLog.setId(mUtilitiesInfo.getIdx());
291292
holder.buttonLog.setOnClickListener(v -> handleLogButtonClick(v.getId()));
292293

293-
Picasso.get().load(DomoticzIcons.getDrawableIcon(mUtilitiesInfo.getTypeImg(), mUtilitiesInfo.getType(), mUtilitiesInfo.getSubType(), false, false, null)).into(holder.iconRow);
294+
Picasso.get().load(DomoticzIcons.getDrawableIcon(mUtilitiesInfo.getTypeImg(),
295+
mUtilitiesInfo.getType(),
296+
mUtilitiesInfo.getSubType(),
297+
false,
298+
mUtilitiesInfo.getUseCustomImage(),
299+
mUtilitiesInfo.getImage())).into(holder.iconRow);
294300
}
295301

296302
private void handleLogButtonClick(int idx) {
@@ -380,7 +386,12 @@ public void unLiked(LikeButton likeButton) {
380386
});
381387
}
382388

383-
Picasso.get().load(DomoticzIcons.getDrawableIcon(mUtilitiesInfo.getTypeImg(), mUtilitiesInfo.getType(), mUtilitiesInfo.getSubType(), false, false, null)).into(holder.iconRow);
389+
Picasso.get().load(DomoticzIcons.getDrawableIcon(mUtilitiesInfo.getTypeImg(),
390+
mUtilitiesInfo.getType(),
391+
mUtilitiesInfo.getSubType(),
392+
false,
393+
mUtilitiesInfo.getUseCustomImage(),
394+
mUtilitiesInfo.getImage())).into(holder.iconRow);
384395
}
385396

386397
private void CreateThermostatRow(DataObjectHolder holder, UtilitiesInfo mUtilitiesInfo, final double setPoint) {
@@ -433,7 +444,13 @@ private void CreateThermostatRow(DataObjectHolder holder, UtilitiesInfo mUtiliti
433444

434445
holder.name.setText(mUtilitiesInfo.getName());
435446
holder.hardware.setText(mUtilitiesInfo.getLastUpdate());
436-
Picasso.get().load(DomoticzIcons.getDrawableIcon(mUtilitiesInfo.getTypeImg(), mUtilitiesInfo.getType(), mUtilitiesInfo.getSubType(), false, false, null)).into(holder.iconRow);
447+
448+
Picasso.get().load(DomoticzIcons.getDrawableIcon(mUtilitiesInfo.getTypeImg(),
449+
mUtilitiesInfo.getType(),
450+
mUtilitiesInfo.getSubType(),
451+
false,
452+
mUtilitiesInfo.getUseCustomImage(),
453+
mUtilitiesInfo.getImage())).into(holder.iconRow);
437454

438455
int loadMode = mUtilitiesInfo.getModeId();
439456
final ArrayList<String> modes = mUtilitiesInfo.getModes();

app/src/main/java/nl/hnogames/domoticz/utils/DeviceUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public static boolean isAutomatedToggableDevice(DevicesInfo mDeviceInfo) {
4040
return false;
4141
if (mDeviceInfo.getSwitchTypeVal() == 0 &&
4242
(mDeviceInfo.getSwitchType() == null)) {
43-
if (mDeviceInfo.getSubType() != null && mDeviceInfo.getSubType().equals(DomoticzValues.Device.Utility.SubType.SMARTWARES)) {
43+
if ((mDeviceInfo.getSubType() != null && DomoticzValues.Device.Utility.SubType.SETPOINT.equalsIgnoreCase(mDeviceInfo.getSubType())) ||
44+
(mDeviceInfo.getSubType() != null && mDeviceInfo.getSubType().equals(DomoticzValues.Device.Utility.SubType.SMARTWARES))) {
4445
return true;
4546
} else {
4647
switch (mDeviceInfo.getType()) {
4748
case DomoticzValues.Scene.Type.GROUP:
48-
return true;
4949
case DomoticzValues.Scene.Type.SCENE:
5050
return true;
5151
case DomoticzValues.Device.Utility.Type.THERMOSTAT:
@@ -96,7 +96,8 @@ public static boolean isSupportedForExternalControl(DevicesInfo mDeviceInfo) {
9696
return false;
9797
if (mDeviceInfo.getSwitchTypeVal() == 0 &&
9898
(mDeviceInfo.getSwitchType() == null)) {
99-
if (mDeviceInfo.getSubType() != null && mDeviceInfo.getSubType().equals(DomoticzValues.Device.Utility.SubType.SMARTWARES)) {
99+
if ((mDeviceInfo.getSubType() != null && DomoticzValues.Device.Utility.SubType.SETPOINT.equalsIgnoreCase(mDeviceInfo.getSubType())) ||
100+
(mDeviceInfo.getSubType() != null && mDeviceInfo.getSubType().equals(DomoticzValues.Device.Utility.SubType.SMARTWARES))) {
100101
return true;
101102
} else {
102103
switch (mDeviceInfo.getType()) {

app/src/main/java/nl/hnogames/domoticz/utils/UsefulBits.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
import com.revenuecat.purchases.interfaces.PurchaseCallback;
5151
import com.revenuecat.purchases.models.StoreTransaction;
5252

53+
import java.io.ByteArrayOutputStream;
54+
import java.io.IOException;
55+
import java.io.ObjectOutputStream;
5356
import java.security.MessageDigest;
5457
import java.security.NoSuchAlgorithmException;
5558
import java.text.DateFormatSymbols;
@@ -612,4 +615,25 @@ public static void ShowOldVersionDialog(Context context) {
612615
public static void RestoreSubscriptions(Context context, SubscriptionsListener listener) {
613616
AppController.HandleRestoreSubscriptions(listener);
614617
}
618+
619+
public static byte[] toByteArray(Object obj) throws IOException {
620+
byte[] bytes = null;
621+
ByteArrayOutputStream bos = null;
622+
ObjectOutputStream oos = null;
623+
try {
624+
bos = new ByteArrayOutputStream();
625+
oos = new ObjectOutputStream(bos);
626+
oos.writeObject(obj);
627+
oos.flush();
628+
bytes = bos.toByteArray();
629+
} finally {
630+
if (oos != null) {
631+
oos.close();
632+
}
633+
if (bos != null) {
634+
bos.close();
635+
}
636+
}
637+
return bytes;
638+
}
615639
}

app/src/main/res/layout/small_plan_row.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<com.google.android.material.chip.Chip android:id="@+id/plan"
22
android:layout_width="wrap_content"
33
android:layout_margin="4dp"
4-
android:background="?attr/listviewRowBackground"
54
android:layout_height="wrap_content"
65
android:elevation="4dp"
76
app:chipBackgroundColor="?attr/listviewRowBackground"

app/version.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Thu Jul 06 20:36:33 CEST 2023
2-
VERSION_BUILD=9351
3-
VERSION_CODE=679
4-
VERSION_PATCH=362
1+
#Mon Jan 08 21:33:02 CET 2024
2+
VERSION_BUILD=9414
3+
VERSION_CODE=684
4+
VERSION_PATCH=367

domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/ServerInfo.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ public class ServerInfo {
8282
private boolean LOCAL_SERVER_AUTHENTICATION_METHOD = false;
8383
@Expose
8484
private Set<String> LOCAL_SERVER_SSID;
85+
@Expose
86+
private boolean DETECTV2URLS = false;
8587

8688
/* Saved in a separate file because GSON can't serialize this */
8789
private ServerUpdateInfo serverUpdateInfo;
@@ -169,6 +171,12 @@ public void setRemoteServerSecure(boolean remoteServerSecure) {
169171
REMOTE_SERVER_SECURE = remoteServerSecure;
170172
}
171173

174+
public boolean getIsV2ApiDetected() {
175+
return DETECTV2URLS;
176+
}
177+
public void setIsV2ApiDetected(boolean detected) {
178+
DETECTV2URLS = detected;
179+
}
172180
public String getRemoteServerAuthenticationMethod() {
173181
String method;
174182
if (REMOTE_SERVER_AUTHENTICATION_METHOD)

domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/UtilitiesInfo.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ public class UtilitiesInfo implements Comparable, Serializable {
6262
private int signalLevel;
6363
private String Modes;
6464
private int Mode;
65+
private boolean useCustomImage;
66+
private String Image;
6567

6668
public UtilitiesInfo() {
6769
}
@@ -86,6 +88,16 @@ public UtilitiesInfo(JSONObject row) throws JSONException {
8688
setPoint = 0;
8789
}
8890
}
91+
try {
92+
if (row.has("CustomImage"))
93+
useCustomImage = row.getInt("CustomImage") > 0;
94+
else
95+
useCustomImage = false;
96+
} catch (Exception ignored) {
97+
useCustomImage = false;
98+
}
99+
if (row.has("Image"))
100+
Image = row.getString("Image");
89101
if (row.has("Modes")) {
90102
Modes = row.getString("Modes");
91103
if (UsefulBits.isBase64Encoded(Modes))
@@ -205,6 +217,14 @@ public String getUsageDeliv() {
205217
return UsageDeliv;
206218
}
207219

220+
public boolean getUseCustomImage() {
221+
return useCustomImage;
222+
}
223+
224+
public String getImage() {
225+
return Image;
226+
}
227+
208228
public String getCounter() {
209229
return Counter;
210230
}

domoticzapi/src/main/java/nl/hnogames/domoticzapi/Containers/VersionInfo.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,22 @@
2121

2222
package nl.hnogames.domoticzapi.Containers;
2323

24+
import android.icu.text.SimpleDateFormat;
25+
2426
import org.json.JSONException;
2527
import org.json.JSONObject;
2628

2729
import java.io.Serializable;
30+
import java.text.ParseException;
31+
import java.util.Date;
32+
33+
import nl.hnogames.domoticzapi.Utils.UsefulBits;
2834

2935
public class VersionInfo implements Serializable {
3036
private boolean HaveUpdate = true;
3137
private boolean UseUpdate = true;
3238
private String build_time;
39+
private Date buildTimeDateTime;
3340
private String dzvents_version;
3441
private String hash;
3542
private String python_version;
@@ -50,6 +57,13 @@ public VersionInfo(JSONObject row) throws JSONException {
5057
version = row.getString("version");
5158
if (row.has("version"))
5259
version = row.getString("version");
60+
if(!UsefulBits.isEmpty(build_time)) {
61+
try {
62+
buildTimeDateTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(build_time);
63+
} catch (ParseException e) {
64+
e.printStackTrace();
65+
}
66+
}
5367
}
5468

5569
public boolean isHaveUpdate() {
@@ -72,6 +86,10 @@ public String getBuild_time() {
7286
return build_time;
7387
}
7488

89+
public Date getBuildDate() {
90+
return buildTimeDateTime;
91+
}
92+
7593
public void setBuild_time(String build_time) {
7694
this.build_time = build_time;
7795
}

0 commit comments

Comments
 (0)