@rentlydev/rently-tuya 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/rentlytuya/RentlyTuyaModule.kt +10 -0
- package/android/src/main/java/com/rentlytuya/alerts/PermissionAlert.kt +2 -2
- package/android/src/main/java/com/rentlytuya/components/AnchorButton.kt +4 -2
- package/android/src/main/java/com/rentlytuya/components/Button.kt +5 -4
- package/android/src/main/java/com/rentlytuya/components/CustomDatePicker.kt +9 -7
- package/android/src/main/java/com/rentlytuya/components/Divider.kt +1 -5
- package/android/src/main/java/com/rentlytuya/components/Label.kt +1 -1
- package/android/src/main/java/com/rentlytuya/dashboard/AdvancedSettings.kt +11 -9
- package/android/src/main/java/com/rentlytuya/dashboard/Dashboard.kt +4 -4
- package/android/src/main/java/com/rentlytuya/dashboard/DoorbellSettings.kt +125 -103
- package/android/src/main/java/com/rentlytuya/dashboard/FirmwareUpdate.kt +5 -8
- package/android/src/main/java/com/rentlytuya/dashboard/Messages.kt +3 -4
- package/android/src/main/java/com/rentlytuya/dashboard/NavController.kt +28 -13
- package/android/src/main/java/com/rentlytuya/dashboard/OfflineScreen.kt +12 -12
- package/android/src/main/java/com/rentlytuya/dashboard/Playback.kt +3 -3
- package/android/src/main/java/com/rentlytuya/tuya/Settings.kt +28 -1
- package/android/src/main/java/com/rentlytuya/tuya/Tuya.kt +6 -1
- package/android/src/main/java/com/rentlytuya/ui/theme/LocalColor.kt +34 -21
- package/android/src/main/java/com/rentlytuya/ui/theme/Theme.kt +13 -1
- package/android/src/main/java/com/rentlytuya/util/KeylessModule.kt +16 -4
- package/android/src/main/res/drawable/update_complete.png +0 -0
- package/android/src/main/res/values/strings.xml +4 -2
- package/ios/components/Alert.swift +5 -7
- package/ios/components/AnchorButton.swift +2 -0
- package/ios/components/Button.swift +17 -2
- package/ios/components/CustomDatePicker.swift +5 -5
- package/ios/components/Label.swift +6 -1
- package/ios/dashboard/AdvanceSettings.swift +5 -5
- package/ios/dashboard/Dashboard.swift +43 -6
- package/ios/dashboard/FirmwareSettings.swift +11 -9
- package/ios/dashboard/Messages.swift +5 -3
- package/ios/dashboard/NavigationController.swift +51 -8
- package/ios/dashboard/OfflineScreen.swift +5 -7
- package/ios/dashboard/Playback.swift +7 -5
- package/ios/dashboard/PreviewManager.swift +20 -4
- package/ios/dashboard/Settings.swift +39 -21
- package/ios/generated/RNRentlyTuyaSpec/RNRentlyTuyaSpec.h +30 -0
- package/ios/icons/cloud.png +0 -0
- package/ios/icons/cloud@2x.png +0 -0
- package/ios/icons/cloud@3x.png +0 -0
- package/ios/icons/down_update.png +0 -0
- package/ios/icons/down_update@2x.png +0 -0
- package/ios/icons/down_update@3x.png +0 -0
- package/ios/listener/KeylessListener.swift +11 -5
- package/ios/listener/RentlyTuya.mm +6 -1
- package/ios/listener/RentlyTuyaImpl.swift +11 -1
- package/ios/theme/LocalColor.swift +66 -20
- package/ios/theme/Theme.swift +162 -25
- package/ios/tuya/CameraManager.swift +1 -1
- package/ios/tuya/Tuya.swift +8 -0
- package/ios/utils/PermissionManager.swift +41 -0
- package/lib/commonjs/NativeRentlyTuya.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/NativeRentlyTuya.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/commonjs/src/NativeRentlyTuya.d.ts +5 -0
- package/lib/typescript/commonjs/src/NativeRentlyTuya.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +5 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeRentlyTuya.d.ts +5 -0
- package/lib/typescript/module/src/NativeRentlyTuya.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +5 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeRentlyTuya.ts +5 -0
- package/src/index.tsx +5 -0
- package/android/src/main/res/drawable/green_complete.png +0 -0
- package/android/src/main/res/drawable/white_complete.png +0 -0
|
@@ -162,7 +162,7 @@ struct Settings: View {
|
|
|
162
162
|
|
|
163
163
|
if tuya.settingsLoader {
|
|
164
164
|
ProgressView()
|
|
165
|
-
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.
|
|
165
|
+
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.blackColor))
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
.onAppear {
|
|
@@ -198,6 +198,26 @@ struct Settings: View {
|
|
|
198
198
|
dpKey: ThingSmartCameraDPKey.init(rawValue: "231")
|
|
199
199
|
)
|
|
200
200
|
}
|
|
201
|
+
SettingsManager.shared.toggleSwitch(
|
|
202
|
+
id: "doorbellCallSwitch",
|
|
203
|
+
title: "Doorbell Call",
|
|
204
|
+
description: "Enabling this will initiate doorbell call when someone press doorbell ring button.",
|
|
205
|
+
isChecked: $tuya.isDoorbellCallEnabled,
|
|
206
|
+
onToggle: { newValue in
|
|
207
|
+
tuya.settingsLoader = true
|
|
208
|
+
if let id = tuya.id {
|
|
209
|
+
KeylessListener.emitter.enableDoorbellCall(withID: id, enabled: newValue) { success, message in
|
|
210
|
+
if success {
|
|
211
|
+
print("Tuya: Doorbell call updated to \(newValue)")
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
print("Tuya: Doorbell call update failed")
|
|
215
|
+
}
|
|
216
|
+
tuya.settingsLoader = false
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
)
|
|
201
221
|
NightVisionPicker
|
|
202
222
|
}
|
|
203
223
|
}
|
|
@@ -233,7 +253,7 @@ struct Settings: View {
|
|
|
233
253
|
SettingsManager.shared.toggleSwitch(
|
|
234
254
|
id: "motionDetectionSwitch",
|
|
235
255
|
title: "Motion Detection",
|
|
236
|
-
description: is8s ? "Triggered motion will send push notifications." : "If motion detection is enabled and motion is detected, the
|
|
256
|
+
description: is8s ? "Triggered motion will send push notifications." : "If motion detection is enabled and motion is detected, the app will record the event and send a push notification.",
|
|
237
257
|
isChecked: is8s || isAosu ? $tuya.isMotionDetectionEnabled : $tuya.isPIRDetectionEnabled,
|
|
238
258
|
dpKey: is8s || isAosu ? ThingSmartCameraDPKey.motionDetectDPName : ThingSmartCameraDPKey.init(rawValue: "240")
|
|
239
259
|
)
|
|
@@ -323,7 +343,7 @@ struct Settings: View {
|
|
|
323
343
|
Label(
|
|
324
344
|
title: "Storage Settings",
|
|
325
345
|
l: true,
|
|
326
|
-
|
|
346
|
+
grey: true
|
|
327
347
|
)
|
|
328
348
|
|
|
329
349
|
let description = sdCardStatusDescription(for: tuya.sdCardStatus)
|
|
@@ -378,7 +398,7 @@ struct Settings: View {
|
|
|
378
398
|
Label(
|
|
379
399
|
title: "Wi-Fi Signal Strength",
|
|
380
400
|
l: true,
|
|
381
|
-
|
|
401
|
+
grey: true
|
|
382
402
|
)
|
|
383
403
|
|
|
384
404
|
Spacer()
|
|
@@ -407,7 +427,7 @@ struct Settings: View {
|
|
|
407
427
|
Label(
|
|
408
428
|
title: "Reset Wi-Fi",
|
|
409
429
|
l: true,
|
|
410
|
-
|
|
430
|
+
grey: true
|
|
411
431
|
)
|
|
412
432
|
|
|
413
433
|
Spacer()
|
|
@@ -425,19 +445,17 @@ struct Settings: View {
|
|
|
425
445
|
withCancelButton: true,
|
|
426
446
|
secondaryButtonTitle: "Cancel",
|
|
427
447
|
primaryAction: {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
isResetWifiAlertVisible = false
|
|
438
|
-
}
|
|
448
|
+
KeylessListener.emitter.resetWifiForDoorbell(
|
|
449
|
+
withTuyaProductName: tuya.tuyaProductName ?? "") { success, message in
|
|
450
|
+
if success {
|
|
451
|
+
print("Tuya: Successfully navigated to the 'Add Doorbell' screen.")
|
|
452
|
+
isResetWifiAlertVisible = false
|
|
453
|
+
AppUtility.disconnectAndClose()
|
|
454
|
+
} else {
|
|
455
|
+
print("Tuya: Failed to navigate to the 'Add Doorbell' screen.")
|
|
456
|
+
isResetWifiAlertVisible = false
|
|
439
457
|
}
|
|
440
|
-
|
|
458
|
+
}
|
|
441
459
|
}
|
|
442
460
|
)
|
|
443
461
|
}
|
|
@@ -474,7 +492,7 @@ struct Settings: View {
|
|
|
474
492
|
Label(
|
|
475
493
|
title: "Power Source",
|
|
476
494
|
l: true,
|
|
477
|
-
|
|
495
|
+
grey: true
|
|
478
496
|
)
|
|
479
497
|
|
|
480
498
|
Spacer()
|
|
@@ -525,12 +543,12 @@ struct Settings: View {
|
|
|
525
543
|
}
|
|
526
544
|
|
|
527
545
|
private var AdvancedSettingsSection: some View {
|
|
528
|
-
Section(header: Label(title: "
|
|
546
|
+
Section(header: Label(title: "Device Information", s: true, lightGrey: true, bold: true)) {
|
|
529
547
|
HStack {
|
|
530
548
|
Label(
|
|
531
549
|
title: "Device Info",
|
|
532
550
|
l: true,
|
|
533
|
-
|
|
551
|
+
grey: true
|
|
534
552
|
)
|
|
535
553
|
|
|
536
554
|
Spacer()
|
|
@@ -553,7 +571,7 @@ struct Settings: View {
|
|
|
553
571
|
title: "Remove Doorbell",
|
|
554
572
|
l: true,
|
|
555
573
|
secondary: true,
|
|
556
|
-
textColor: LocalColor.Monochrome.
|
|
574
|
+
textColor: LocalColor.Monochrome.whiteColor,
|
|
557
575
|
semiBold: true
|
|
558
576
|
) {
|
|
559
577
|
isRemoveDoorbellAlertVisible = true
|
|
@@ -148,10 +148,15 @@ namespace JS {
|
|
|
148
148
|
NSString *serial_no() const;
|
|
149
149
|
NSString *flavour() const;
|
|
150
150
|
bool doorbell_default_settings_updated() const;
|
|
151
|
+
bool doorbell_calling_enabled() const;
|
|
151
152
|
bool motion_detection() const;
|
|
152
153
|
bool continuous_recording() const;
|
|
153
154
|
bool event_recording() const;
|
|
154
155
|
bool set_sensitivity_low() const;
|
|
156
|
+
bool darkThemeEnabled() const;
|
|
157
|
+
bool useSystemTheme() const;
|
|
158
|
+
NSString *currentSystemColorScheme() const;
|
|
159
|
+
bool doorbell_setting() const;
|
|
155
160
|
|
|
156
161
|
SpecOpenCameraLivePreviewParams(NSDictionary *const v) : _v(v) {}
|
|
157
162
|
private:
|
|
@@ -415,6 +420,11 @@ inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::doorbell_defa
|
|
|
415
420
|
id const p = _v[@"doorbell_default_settings_updated"];
|
|
416
421
|
return RCTBridgingToBool(p);
|
|
417
422
|
}
|
|
423
|
+
inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::doorbell_calling_enabled() const
|
|
424
|
+
{
|
|
425
|
+
id const p = _v[@"doorbell_calling_enabled"];
|
|
426
|
+
return RCTBridgingToBool(p);
|
|
427
|
+
}
|
|
418
428
|
inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::motion_detection() const
|
|
419
429
|
{
|
|
420
430
|
id const p = _v[@"motion_detection"];
|
|
@@ -435,6 +445,26 @@ inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::set_sensitivi
|
|
|
435
445
|
id const p = _v[@"set_sensitivity_low"];
|
|
436
446
|
return RCTBridgingToBool(p);
|
|
437
447
|
}
|
|
448
|
+
inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::darkThemeEnabled() const
|
|
449
|
+
{
|
|
450
|
+
id const p = _v[@"darkThemeEnabled"];
|
|
451
|
+
return RCTBridgingToBool(p);
|
|
452
|
+
}
|
|
453
|
+
inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::useSystemTheme() const
|
|
454
|
+
{
|
|
455
|
+
id const p = _v[@"useSystemTheme"];
|
|
456
|
+
return RCTBridgingToBool(p);
|
|
457
|
+
}
|
|
458
|
+
inline NSString *JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::currentSystemColorScheme() const
|
|
459
|
+
{
|
|
460
|
+
id const p = _v[@"currentSystemColorScheme"];
|
|
461
|
+
return RCTBridgingToString(p);
|
|
462
|
+
}
|
|
463
|
+
inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::doorbell_setting() const
|
|
464
|
+
{
|
|
465
|
+
id const p = _v[@"doorbell_setting"];
|
|
466
|
+
return RCTBridgingToBool(p);
|
|
467
|
+
}
|
|
438
468
|
inline NSString *JS::NativeRentlyTuya::SpecRegisterForPushNotificationParams::token() const
|
|
439
469
|
{
|
|
440
470
|
id const p = _v[@"token"];
|
package/ios/icons/cloud.png
CHANGED
|
Binary file
|
package/ios/icons/cloud@2x.png
CHANGED
|
Binary file
|
package/ios/icons/cloud@3x.png
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -14,7 +14,7 @@ open class KeylessListener: RCTEventEmitter {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
open override func supportedEvents() -> [String] {
|
|
17
|
-
return ["REMOVE_CAMERA", "RESET_WIFI", "RESET_DEFAULT_SETTINGS_FLAG"]
|
|
17
|
+
return ["REMOVE_CAMERA", "RESET_WIFI", "RESET_DEFAULT_SETTINGS_FLAG", "ENABLE_DOORBELL_CALL"]
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
@objc static public override func requiresMainQueueSetup() -> Bool {
|
|
@@ -28,10 +28,9 @@ open class KeylessListener: RCTEventEmitter {
|
|
|
28
28
|
self.keylessListenerCallback = callback
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
@objc func resetWifiForDoorbell(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
KeylessListener.emitter.sendEvent(withName: "RESET_WIFI", body: ["device_id": deviceID])
|
|
31
|
+
@objc func resetWifiForDoorbell(withTuyaProductName tuyaProductName: String, callback: @escaping (Bool, String) -> Void) {
|
|
32
|
+
|
|
33
|
+
KeylessListener.emitter.sendEvent(withName: "RESET_WIFI", body: ["doorbellType": tuyaProductName])
|
|
35
34
|
self.keylessListenerCallback = callback
|
|
36
35
|
}
|
|
37
36
|
|
|
@@ -42,6 +41,13 @@ open class KeylessListener: RCTEventEmitter {
|
|
|
42
41
|
self.keylessListenerCallback = callback
|
|
43
42
|
}
|
|
44
43
|
|
|
44
|
+
@objc func enableDoorbellCall(withID id: String, enabled: Bool, callback: @escaping (Bool, String) -> Void) {
|
|
45
|
+
guard !id.isEmpty else { return }
|
|
46
|
+
|
|
47
|
+
KeylessListener.emitter.sendEvent(withName: "ENABLE_DOORBELL_CALL", body: ["id": id, "doorbell_calling_enabled": enabled])
|
|
48
|
+
self.keylessListenerCallback = callback
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
// Callbacks received from react native
|
|
46
52
|
@objc func successCallback(_ command: String) {
|
|
47
53
|
DispatchQueue.main.async {
|
|
@@ -93,10 +93,15 @@ RCT_EXPORT_MODULE()
|
|
|
93
93
|
@"serial_no": params.serial_no(),
|
|
94
94
|
@"flavour": params.flavour(),
|
|
95
95
|
@"doorbell_default_settings_updated": @(params.doorbell_default_settings_updated()),
|
|
96
|
+
@"doorbell_calling_enabled": @(params.doorbell_calling_enabled()),
|
|
96
97
|
@"motion_detection": @(params.motion_detection()),
|
|
97
98
|
@"continuous_recording": @(params.continuous_recording()),
|
|
98
99
|
@"event_recording": @(params.event_recording()),
|
|
99
|
-
@"set_sensitivity_low": @(params.set_sensitivity_low())
|
|
100
|
+
@"set_sensitivity_low": @(params.set_sensitivity_low()),
|
|
101
|
+
@"doorbell_setting": @(params.doorbell_setting()),
|
|
102
|
+
@"darkThemeEnabled": @(params.darkThemeEnabled()),
|
|
103
|
+
@"useSystemTheme": @(params.useSystemTheme()),
|
|
104
|
+
@"currentSystemColorScheme": params.currentSystemColorScheme()
|
|
100
105
|
};
|
|
101
106
|
|
|
102
107
|
[[RentlyTuyaImpl shared] openCameraLivePreview:paramsDict withResolve:resolve withReject:reject];
|
|
@@ -185,6 +185,7 @@ public class RentlyTuyaImpl: NSObject {
|
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
let lastMoveoutAt = params["last_moveout_at"] as? String
|
|
188
|
+
let isDoorbellCallEnabled = params["doorbell_calling_enabled"] as? Bool ?? false
|
|
188
189
|
let resetRequired = params["resetRequired"] as? Bool
|
|
189
190
|
let isResident = params["isResident"] as? Bool ?? true
|
|
190
191
|
let displayRemoveDoorbellButton = params["display_remove_doorbell_button"] as? Bool
|
|
@@ -197,12 +198,17 @@ public class RentlyTuyaImpl: NSObject {
|
|
|
197
198
|
let continuousRecording = params["continuous_recording"] as? Bool ?? false
|
|
198
199
|
let eventRecording = params["event_recording"] as? Bool ?? false
|
|
199
200
|
let setSensitivityLow = params["set_sensitivity_low"] as? Bool ?? false
|
|
201
|
+
let darkThemeEnabled = params["darkThemeEnabled"] as? Bool ?? false
|
|
202
|
+
let useSystemTheme = params["useSystemTheme"] as? Bool ?? false
|
|
203
|
+
let currentSystemColorScheme = params["currentSystemColorScheme"] as? String ?? "light"
|
|
204
|
+
let doorbell_setting = params["doorbell_setting"] as? Bool ?? false
|
|
200
205
|
|
|
201
206
|
// Property Credentials
|
|
202
207
|
let propertyCredentialUsername = params["propertyCredentialUsername"] as? String
|
|
203
208
|
let propertyCredentialPassword = params["propertyCredentialPassword"] as? String
|
|
204
209
|
|
|
205
210
|
Tuya.shared.lastMoveoutAt = lastMoveoutAt
|
|
211
|
+
Tuya.shared.isDoorbellCallEnabled = isDoorbellCallEnabled
|
|
206
212
|
Tuya.shared.resetRequired = resetRequired
|
|
207
213
|
Tuya.shared.isResident = isResident
|
|
208
214
|
Tuya.shared.displayRemoveDoorbellButton = displayRemoveDoorbellButton
|
|
@@ -217,6 +223,10 @@ public class RentlyTuyaImpl: NSObject {
|
|
|
217
223
|
Tuya.shared.eventRecording = eventRecording
|
|
218
224
|
Tuya.shared.setSensitivityLow = setSensitivityLow
|
|
219
225
|
Tuya.shared.flavour = flavour
|
|
226
|
+
Tuya.shared.darkThemeEnabled = darkThemeEnabled
|
|
227
|
+
Tuya.shared.useSystemTheme = useSystemTheme
|
|
228
|
+
Tuya.shared.currentSystemColorScheme = currentSystemColorScheme
|
|
229
|
+
Tuya.shared.doorbell_setting = doorbell_setting
|
|
220
230
|
|
|
221
231
|
if !Tuya.shared.continuousRecording && !Tuya.shared.eventRecording {
|
|
222
232
|
Tuya.shared.eventRecording = true
|
|
@@ -230,7 +240,7 @@ public class RentlyTuyaImpl: NSObject {
|
|
|
230
240
|
homeId: homeId,
|
|
231
241
|
completion: { success, errorMessage, error in
|
|
232
242
|
if (success) {
|
|
233
|
-
openLivePreview(appFlavor: Tuya.shared.flavour)
|
|
243
|
+
openLivePreview(appFlavor: Tuya.shared.flavour, darkThemeEnabled: Tuya.shared.darkThemeEnabled, useSystemTheme: Tuya.shared.useSystemTheme, currentSystemColorScheme: Tuya.shared.currentSystemColorScheme)
|
|
234
244
|
resolve(true)
|
|
235
245
|
} else {
|
|
236
246
|
reject("sync_failed", errorMessage, error)
|
|
@@ -1,38 +1,84 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
3
|
struct LocalColor {
|
|
4
|
+
struct Background {
|
|
5
|
+
static var primary: Color = Color(hex: "#F9FAFB")
|
|
6
|
+
static var secondary: Color = Color.white
|
|
7
|
+
static var tertiary: Color = Color(hex: "#1A1A1A")
|
|
8
|
+
}
|
|
9
|
+
struct Surface {
|
|
10
|
+
static var primary: Color = Color.white
|
|
11
|
+
static var secondary: Color = Color(hex: "#242526")
|
|
12
|
+
}
|
|
13
|
+
struct Text {
|
|
14
|
+
static var primary: Color = Color(hex: "#374151")
|
|
15
|
+
static var secondary: Color = Color(hex: "#6B7280")
|
|
16
|
+
static var tertiary: Color = Color(hex: "#D1D5DB")
|
|
17
|
+
static var inverted: Color = Color.white
|
|
18
|
+
}
|
|
19
|
+
struct Accent {
|
|
20
|
+
static var primary: Color = Color(hex: "#177BB5")
|
|
21
|
+
static var secondary: Color = Color(hex: "#177BB5")
|
|
22
|
+
}
|
|
23
|
+
struct Border {
|
|
24
|
+
static var primary: Color = Color(hex: "#D1D5DB")
|
|
25
|
+
}
|
|
26
|
+
struct Custom {
|
|
27
|
+
static let brown = Color(#colorLiteral(red: 0.7064316869, green: 0.3275339603, blue: 0.03773720562, alpha: 1))
|
|
28
|
+
}
|
|
4
29
|
struct Main {
|
|
5
|
-
static var light
|
|
6
|
-
|
|
30
|
+
static var light: Color {
|
|
31
|
+
get { Background.primary }
|
|
32
|
+
set { Background.primary = newValue }
|
|
33
|
+
}
|
|
34
|
+
static var dark: Color {
|
|
35
|
+
get { Accent.primary }
|
|
36
|
+
set { Accent.primary = newValue }
|
|
37
|
+
}
|
|
7
38
|
}
|
|
8
|
-
|
|
9
39
|
struct Primary {
|
|
10
40
|
static let light = Color(#colorLiteral(red: 0, green: 0.6419225335, blue: 0.9344936609, alpha: 1))
|
|
11
|
-
static
|
|
12
|
-
|
|
41
|
+
static var secondary: Color {
|
|
42
|
+
get { Text.primary }
|
|
43
|
+
set { Text.primary = newValue }
|
|
44
|
+
}
|
|
13
45
|
static let medium = Color(#colorLiteral(red: 0, green: 0.5515162945, blue: 0.8891028762, alpha: 1))
|
|
14
46
|
}
|
|
15
47
|
|
|
16
48
|
struct Secondary {
|
|
17
|
-
static let white = Color(#colorLiteral(red: 0.9466181397, green: 0.9815257192, blue: 1, alpha: 1))
|
|
18
49
|
static let light = Color(#colorLiteral(red: 0.8319713473, green: 0.9325252771, blue: 0.9908282161, alpha: 1))
|
|
19
50
|
}
|
|
20
|
-
|
|
21
|
-
struct Danger {
|
|
22
|
-
static let primary = Color(#colorLiteral(red: 0.8711757064, green: 0, blue: 0, alpha: 1))
|
|
23
|
-
}
|
|
24
|
-
|
|
25
51
|
struct Monochrome {
|
|
26
|
-
static
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
52
|
+
static var white: Color {
|
|
53
|
+
get { Surface.primary }
|
|
54
|
+
set { Surface.primary = newValue }
|
|
55
|
+
}
|
|
56
|
+
static var whiteColor: Color {
|
|
57
|
+
get { Text.inverted }
|
|
58
|
+
set { Text.inverted = newValue }
|
|
59
|
+
}
|
|
30
60
|
static let black = Color.black
|
|
61
|
+
static var blackColor: Color {
|
|
62
|
+
get { Text.primary }
|
|
63
|
+
set { Text.primary = newValue }
|
|
64
|
+
}
|
|
65
|
+
static var regular: Color {
|
|
66
|
+
get { Text.secondary }
|
|
67
|
+
set { Text.secondary = newValue }
|
|
68
|
+
}
|
|
69
|
+
static var medium: Color {
|
|
70
|
+
get { Text.primary }
|
|
71
|
+
set { Text.primary = newValue }
|
|
72
|
+
}
|
|
73
|
+
static let grey = Color(#colorLiteral(red: 0.2156862617, green: 0.2156862617, blue: 0.2156862617, alpha: 1))
|
|
74
|
+
static var greyColor: Color {
|
|
75
|
+
get { Text.primary }
|
|
76
|
+
set { Text.primary = newValue }
|
|
77
|
+
}
|
|
78
|
+
static var paleWhite: Color {
|
|
79
|
+
get { Text.tertiary }
|
|
80
|
+
set { Text.tertiary = newValue }
|
|
81
|
+
}
|
|
31
82
|
static let transparent = Color.clear
|
|
32
83
|
}
|
|
33
|
-
|
|
34
|
-
struct Custom {
|
|
35
|
-
static let brown = Color(#colorLiteral(red: 0.7064316869, green: 0.3275339603, blue: 0.03773720562, alpha: 1))
|
|
36
|
-
}
|
|
37
|
-
|
|
38
84
|
}
|
package/ios/theme/Theme.swift
CHANGED
|
@@ -1,39 +1,176 @@
|
|
|
1
1
|
import SwiftUI
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
protocol ColorPalette {
|
|
5
|
+
var backgroundPrimary: Color { get }
|
|
6
|
+
var backgroundSecondary: Color { get }
|
|
7
|
+
var backgroundTertiary: Color { get }
|
|
8
|
+
var surfacePrimary: Color { get }
|
|
9
|
+
var surfaceSecondary: Color { get }
|
|
10
|
+
var textPrimary: Color { get }
|
|
11
|
+
var textSecondary: Color { get }
|
|
12
|
+
var textTertiary: Color { get }
|
|
13
|
+
var textInverted: Color { get }
|
|
14
|
+
var accentPrimary: Color { get }
|
|
15
|
+
var accentSecondary: Color { get }
|
|
16
|
+
var borderPrimary: Color { get }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
struct SmartHomeLightPalette: ColorPalette {
|
|
20
|
+
let backgroundPrimary = Color(hex: "#F9FAFB")
|
|
21
|
+
let backgroundSecondary = Color.white
|
|
22
|
+
let backgroundTertiary = Color(hex: "#F9FAFB")
|
|
23
|
+
let surfacePrimary = Color.white
|
|
24
|
+
let surfaceSecondary = Color.white
|
|
25
|
+
let textPrimary = Color(hex: "#374151")
|
|
26
|
+
let textSecondary = Color(hex: "#6B7280")
|
|
27
|
+
let textTertiary = Color(hex: "#4B5563")
|
|
28
|
+
let textInverted = Color.white
|
|
29
|
+
let accentPrimary = Color(hex: "#177BB5")
|
|
30
|
+
let accentSecondary = Color(hex: "#177BB5")
|
|
31
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
struct SmartHomeDarkPalette: ColorPalette {
|
|
35
|
+
let backgroundPrimary = Color(hex: "#1A1A1A")
|
|
36
|
+
let backgroundSecondary = Color(hex: "#242526")
|
|
37
|
+
let backgroundTertiary = Color(hex: "#1A1A1A")
|
|
38
|
+
let surfacePrimary = Color(hex: "#242526")
|
|
39
|
+
let surfaceSecondary = Color(hex: "#242526")
|
|
40
|
+
let textPrimary = Color(hex: "#F9FAFB")
|
|
41
|
+
let textSecondary = Color(hex: "#D1D5DB")
|
|
42
|
+
let textTertiary = Color(hex: "#D1D5DB")
|
|
43
|
+
let textInverted = Color(hex: "#F9FAFB")
|
|
44
|
+
let accentPrimary = Color(hex: "#177BB5")
|
|
45
|
+
let accentSecondary = Color(hex: "#177BB5")
|
|
46
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
struct BellanetLightPalette: ColorPalette {
|
|
51
|
+
let backgroundPrimary = Color(hex: "#E9F0FF")
|
|
52
|
+
let backgroundSecondary = Color.white
|
|
53
|
+
let backgroundTertiary = Color(hex: "#E9F0FF")
|
|
54
|
+
let surfacePrimary = Color.white
|
|
55
|
+
let surfaceSecondary = Color.white
|
|
56
|
+
let textPrimary = Color(hex: "#374151")
|
|
57
|
+
let textSecondary = Color(hex: "#6B7280")
|
|
58
|
+
let textTertiary = Color(hex: "#4B5563")
|
|
59
|
+
let textInverted = Color.white
|
|
60
|
+
let accentPrimary = Color(hex: "#0B1E44")
|
|
61
|
+
let accentSecondary = Color(hex: "#0B1E44")
|
|
62
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
struct BellanetDarkPalette: ColorPalette {
|
|
66
|
+
let backgroundPrimary = Color(hex: "#0B1E44")
|
|
67
|
+
let backgroundSecondary = Color(hex: "#1A2B50")
|
|
68
|
+
let backgroundTertiary = Color(hex: "#0B1E44")
|
|
69
|
+
let surfacePrimary = Color(hex: "#1A2B50")
|
|
70
|
+
let surfaceSecondary = Color(hex: "#1A2B50")
|
|
71
|
+
let textPrimary = Color(hex: "#F9FAFB")
|
|
72
|
+
let textSecondary = Color(hex: "#D1D5DB")
|
|
73
|
+
let textTertiary = Color(hex: "#D1D5DB")
|
|
74
|
+
let textInverted = Color(hex: "#F9FAFB")
|
|
75
|
+
let accentPrimary = Color(hex: "#E9F0FF")
|
|
76
|
+
let accentSecondary = Color(hex: "#E9F0FF")
|
|
77
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
struct CoveyHomesLightPalette: ColorPalette {
|
|
82
|
+
let backgroundPrimary = Color(hex: "#FAF6F6")
|
|
83
|
+
let backgroundSecondary = Color.white
|
|
84
|
+
let backgroundTertiary = Color(hex: "#FAF6F6")
|
|
85
|
+
let surfacePrimary = Color.white
|
|
86
|
+
let surfaceSecondary = Color.white
|
|
87
|
+
let textPrimary = Color(hex: "#374151")
|
|
88
|
+
let textSecondary = Color(hex: "#6B7280")
|
|
89
|
+
let textTertiary = Color(hex: "#4B5563")
|
|
90
|
+
let textInverted = Color.white
|
|
91
|
+
let accentPrimary = Color(hex: "#99855E")
|
|
92
|
+
let accentSecondary = Color(hex: "#99855E")
|
|
93
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
struct CoveyHomesDarkPalette: ColorPalette {
|
|
97
|
+
let backgroundPrimary = Color(hex: "#2A2420")
|
|
98
|
+
let backgroundSecondary = Color(hex: "#3A3430")
|
|
99
|
+
let backgroundTertiary = Color(hex: "#2A2420")
|
|
100
|
+
let surfacePrimary = Color(hex: "#3A3430")
|
|
101
|
+
let surfaceSecondary = Color(hex: "#3A3430")
|
|
102
|
+
let textPrimary = Color(hex: "#F9FAFB")
|
|
103
|
+
let textSecondary = Color(hex: "#D1D5DB")
|
|
104
|
+
let textTertiary = Color(hex: "#D1D5DB")
|
|
105
|
+
let textInverted = Color(hex: "#F9FAFB")
|
|
106
|
+
let accentPrimary = Color(hex: "#99855E")
|
|
107
|
+
let accentSecondary = Color(hex: "#99855E")
|
|
108
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
struct ProgressLightPalette: ColorPalette {
|
|
112
|
+
let backgroundPrimary = Color(hex: "#EFF5F4")
|
|
113
|
+
let backgroundSecondary = Color.white
|
|
114
|
+
let backgroundTertiary = Color(hex: "#EFF5F4")
|
|
115
|
+
let surfacePrimary = Color.white
|
|
116
|
+
let surfaceSecondary = Color.white
|
|
117
|
+
let textPrimary = Color(hex: "#374151")
|
|
118
|
+
let textSecondary = Color(hex: "#6B7280")
|
|
119
|
+
let textTertiary = Color(hex: "#4B5563")
|
|
120
|
+
let textInverted = Color.white
|
|
121
|
+
let accentPrimary = Color(hex: "#279989")
|
|
122
|
+
let accentSecondary = Color(hex: "#279989")
|
|
123
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
struct ProgressDarkPalette: ColorPalette {
|
|
127
|
+
let backgroundPrimary = Color(hex: "#1A2726")
|
|
128
|
+
let backgroundSecondary = Color(hex: "#2A3736")
|
|
129
|
+
let backgroundTertiary = Color(hex: "#1A2726")
|
|
130
|
+
let surfacePrimary = Color(hex: "#2A3736")
|
|
131
|
+
let surfaceSecondary = Color(hex: "#2A3736")
|
|
132
|
+
let textPrimary = Color(hex: "#F9FAFB")
|
|
133
|
+
let textSecondary = Color(hex: "#D1D5DB")
|
|
134
|
+
let textTertiary = Color(hex: "#D1D5DB")
|
|
135
|
+
let textInverted = Color(hex: "#F9FAFB")
|
|
136
|
+
let accentPrimary = Color(hex: "#279989")
|
|
137
|
+
let accentSecondary = Color(hex: "#279989")
|
|
138
|
+
let borderPrimary = Color(hex: "#D1D5DB")
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
3
142
|
struct Themes {
|
|
4
|
-
static func configureTheme(for flavor: String) {
|
|
143
|
+
static func configureTheme(for flavor: String, darkThemeEnabled: Bool = false) {
|
|
144
|
+
let palette: ColorPalette
|
|
5
145
|
switch flavor.lowercased() {
|
|
6
146
|
case "keyless":
|
|
7
|
-
|
|
147
|
+
palette = darkThemeEnabled ? SmartHomeDarkPalette() : SmartHomeLightPalette()
|
|
8
148
|
case "bellanet":
|
|
9
|
-
|
|
149
|
+
palette = darkThemeEnabled ? BellanetDarkPalette() : BellanetLightPalette()
|
|
10
150
|
case "coveyhomes":
|
|
11
|
-
|
|
151
|
+
palette = darkThemeEnabled ? CoveyHomesDarkPalette() : CoveyHomesLightPalette()
|
|
12
152
|
case "progress":
|
|
13
|
-
|
|
153
|
+
palette = darkThemeEnabled ? ProgressDarkPalette() : ProgressLightPalette()
|
|
14
154
|
default:
|
|
15
|
-
|
|
155
|
+
palette = darkThemeEnabled ? SmartHomeDarkPalette() : SmartHomeLightPalette()
|
|
16
156
|
}
|
|
157
|
+
|
|
158
|
+
applyPalette(palette)
|
|
17
159
|
}
|
|
18
|
-
|
|
19
|
-
private static func
|
|
20
|
-
LocalColor.
|
|
21
|
-
LocalColor.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
LocalColor.
|
|
26
|
-
LocalColor.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
LocalColor.
|
|
31
|
-
LocalColor.
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private static func configureProgressTheme() {
|
|
35
|
-
LocalColor.Main.light = Color(hex: "#EFF5F4")
|
|
36
|
-
LocalColor.Main.dark = Color(hex: "#279989")
|
|
160
|
+
|
|
161
|
+
private static func applyPalette(_ palette: ColorPalette) {
|
|
162
|
+
LocalColor.Background.primary = palette.backgroundPrimary
|
|
163
|
+
LocalColor.Background.secondary = palette.backgroundSecondary
|
|
164
|
+
LocalColor.Background.tertiary = palette.backgroundTertiary
|
|
165
|
+
LocalColor.Surface.primary = palette.surfacePrimary
|
|
166
|
+
LocalColor.Surface.secondary = palette.surfaceSecondary
|
|
167
|
+
LocalColor.Text.primary = palette.textPrimary
|
|
168
|
+
LocalColor.Text.secondary = palette.textSecondary
|
|
169
|
+
LocalColor.Text.tertiary = palette.textTertiary
|
|
170
|
+
LocalColor.Text.inverted = palette.textInverted
|
|
171
|
+
LocalColor.Accent.primary = palette.accentPrimary
|
|
172
|
+
LocalColor.Accent.secondary = palette.accentSecondary
|
|
173
|
+
LocalColor.Border.primary = palette.borderPrimary
|
|
37
174
|
}
|
|
38
175
|
}
|
|
39
176
|
|
|
@@ -76,7 +76,7 @@ class CameraManager: NSObject, ThingSmartCameraDelegate {
|
|
|
76
76
|
Tuya.shared.changeResolution(resolution: .high)
|
|
77
77
|
}
|
|
78
78
|
DispatchQueue.global(qos: .userInitiated).async {
|
|
79
|
-
Tuya.shared.enableMute(enable: false, type: .preview)
|
|
79
|
+
Tuya.shared.enableMute(enable: Tuya.shared.doorbell_setting ?? false, type: .preview)
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
package/ios/tuya/Tuya.swift
CHANGED
|
@@ -38,6 +38,8 @@ class Tuya: NSObject, ObservableObject {
|
|
|
38
38
|
@Published var isFlipEnabled: Bool = false
|
|
39
39
|
@Published var isAntiDismantlingAlarmEnabled: Bool = false
|
|
40
40
|
@Published var nightVisionLevel: String = ThingSmartCameraNightvision.auto.rawValue
|
|
41
|
+
@Published var isDoorbellCallEnabled: Bool = false
|
|
42
|
+
|
|
41
43
|
@Published var isMotionDetectionEnabled: Bool = false
|
|
42
44
|
@Published var motionSensitivityLevel: String = ThingSmartCameraMotion.low.rawValue
|
|
43
45
|
@Published var isPIRDetectionEnabled: Bool = false
|
|
@@ -52,6 +54,11 @@ class Tuya: NSObject, ObservableObject {
|
|
|
52
54
|
@Published var totalCapacity = 0.0
|
|
53
55
|
@Published var remainingCapacity = 0.0
|
|
54
56
|
@Published var used = 0.0
|
|
57
|
+
@Published var darkThemeEnabled: Bool = false
|
|
58
|
+
@Published var darkThemefinal: Bool = false
|
|
59
|
+
@Published var useSystemTheme: Bool = false
|
|
60
|
+
@Published var currentSystemColorScheme: String = "light"
|
|
61
|
+
|
|
55
62
|
|
|
56
63
|
@Published var wifiSignalStrength: String = ""
|
|
57
64
|
|
|
@@ -82,6 +89,7 @@ class Tuya: NSObject, ObservableObject {
|
|
|
82
89
|
var serialNumber: String? = nil
|
|
83
90
|
var id: String? = nil
|
|
84
91
|
var flavour: String = "smarthome"
|
|
92
|
+
var doorbell_setting: Bool? = false
|
|
85
93
|
|
|
86
94
|
// Default Settings values
|
|
87
95
|
var isDefaultSettingsUpdated: Bool = false
|