Skip to content

Commit

Permalink
Fix notification subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
Philipp0002 committed Mar 17, 2024
1 parent 840434e commit 946e0da
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public static boolean isMonitoring(Context context, NotifyDevice device) {
try {
JSONArray array = new JSONArray(notifyDevicesRaw);
for (int i = 0; i < array.length(); i++) {
NotifyDevice existingDevice = new NotifyDevice().setFromJson(array.getJSONObject(0));
NotifyDevice existingDevice = new NotifyDevice().setFromJson(array.getJSONObject(i));
if(existingDevice.id.equals(device.id)){
return true;
}
Expand All @@ -89,7 +89,7 @@ public static void stopMonitoring(Context context, NotifyDevice device) {
try {
JSONArray array = new JSONArray(notifyDevicesRaw);
for (int i = 0; i < array.length(); i++) {
NotifyDevice existingDevice = new NotifyDevice().setFromJson(array.getJSONObject(0));
NotifyDevice existingDevice = new NotifyDevice().setFromJson(array.getJSONObject(i));
if (!existingDevice.id.equals(device.id)) {
newArray.put(existingDevice.getAsJson());
}
Expand Down

0 comments on commit 946e0da

Please sign in to comment.