@rentlydev/rently-tuya 0.2.2 → 0.2.4
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 +4 -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 +100 -97
- 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 +9 -11
- package/android/src/main/java/com/rentlytuya/dashboard/OfflineScreen.kt +11 -9
- package/android/src/main/java/com/rentlytuya/dashboard/Playback.kt +3 -3
- package/android/src/main/java/com/rentlytuya/tuya/Tuya.kt +2 -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/res/drawable/update_complete.png +0 -0
- 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 +3 -2
- package/ios/dashboard/FirmwareSettings.swift +11 -9
- package/ios/dashboard/Messages.swift +5 -3
- package/ios/dashboard/NavigationController.swift +38 -4
- package/ios/dashboard/Playback.swift +7 -5
- package/ios/dashboard/PreviewManager.swift +20 -4
- package/ios/dashboard/Settings.swift +7 -7
- package/ios/generated/RNRentlyTuyaSpec/RNRentlyTuyaSpec.h +18 -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/RentlyTuya.mm +4 -1
- package/ios/listener/RentlyTuyaImpl.swift +7 -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 +51 -2
- 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 +3 -0
- package/lib/typescript/commonjs/src/NativeRentlyTuya.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.d.ts +3 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/NativeRentlyTuya.d.ts +3 -0
- package/lib/typescript/module/src/NativeRentlyTuya.d.ts.map +1 -1
- package/lib/typescript/module/src/index.d.ts +3 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeRentlyTuya.ts +3 -0
- package/src/index.tsx +3 -0
- package/android/src/main/res/drawable/green_complete.png +0 -0
- package/android/src/main/res/drawable/white_complete.png +0 -0
|
@@ -24,7 +24,7 @@ struct Messages: View {
|
|
|
24
24
|
ZStack {
|
|
25
25
|
if tuya.messagesLoader && messages.isEmpty {
|
|
26
26
|
ProgressView()
|
|
27
|
-
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.
|
|
27
|
+
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.blackColor))
|
|
28
28
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
|
29
29
|
} else if messages.isEmpty {
|
|
30
30
|
NoMessages()
|
|
@@ -157,6 +157,7 @@ struct NoMessages: View {
|
|
|
157
157
|
Label(
|
|
158
158
|
id: "noMessages",
|
|
159
159
|
title: "No activity available at the moment.",
|
|
160
|
+
blackColor: true,
|
|
160
161
|
bold: true,
|
|
161
162
|
maxLines: 2
|
|
162
163
|
)
|
|
@@ -176,13 +177,14 @@ struct MessageItem: View {
|
|
|
176
177
|
Label(
|
|
177
178
|
title: formattedDateTime ?? message.dateTime,
|
|
178
179
|
m: true,
|
|
179
|
-
|
|
180
|
+
lightGrey: true
|
|
180
181
|
)
|
|
181
182
|
.padding(.bottom, 3)
|
|
182
183
|
|
|
183
184
|
Label(
|
|
184
185
|
title: (message.attachPic != nil) ? message.msgContent : "Unable to capture detected events because the doorbell's battery is too low. Please charge it to ensure events are detected and recorded.",
|
|
185
|
-
l: true
|
|
186
|
+
l: true,
|
|
187
|
+
grey: true
|
|
186
188
|
)
|
|
187
189
|
.padding(.bottom, 4)
|
|
188
190
|
|
|
@@ -22,6 +22,8 @@ struct NavigationController: View {
|
|
|
22
22
|
@State private var updateSettingsTask: Task<Void, Never>? = nil
|
|
23
23
|
@EnvironmentObject var orientationManager: OrientationManager
|
|
24
24
|
@ObservedObject var tuya = Tuya.shared
|
|
25
|
+
@Environment(\.colorScheme) private var colorScheme
|
|
26
|
+
@State private var themeUpdateTrigger: Int = 0
|
|
25
27
|
|
|
26
28
|
private var topBarTitle: String {
|
|
27
29
|
if isFirmwareUpdateSettings {
|
|
@@ -33,7 +35,25 @@ struct NavigationController: View {
|
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
private var isSpecialTitle: Bool {
|
|
36
|
-
[.settings, .messages, .advancedSettings, .storageSettings, .firmwareUpdateSettings].contains(currentScreen)
|
|
38
|
+
[.settings, .messages, .advancedSettings, .storageSettings, .firmwareUpdateSettings, .playback].contains(currentScreen)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private func onThemeChanged(_ scheme: ColorScheme) {
|
|
42
|
+
guard tuya.useSystemTheme else { return }
|
|
43
|
+
DispatchQueue.main.async {
|
|
44
|
+
tuya.currentSystemColorScheme = scheme == .dark ? "dark" : "light"
|
|
45
|
+
tuya.darkThemefinal = tuya.currentSystemColorScheme == "dark"
|
|
46
|
+
|
|
47
|
+
Themes.configureTheme(for: tuya.flavour, darkThemeEnabled: tuya.darkThemefinal)
|
|
48
|
+
|
|
49
|
+
if let windowScene = UIApplication.shared.connectedScenes
|
|
50
|
+
.compactMap({ $0 as? UIWindowScene })
|
|
51
|
+
.first(where: { $0.activationState == .foregroundActive }),
|
|
52
|
+
let window = windowScene.windows.first(where: { $0.isKeyWindow }) {
|
|
53
|
+
window.overrideUserInterfaceStyle = tuya.darkThemefinal ? .dark : .light
|
|
54
|
+
}
|
|
55
|
+
themeUpdateTrigger += 1
|
|
56
|
+
}
|
|
37
57
|
}
|
|
38
58
|
|
|
39
59
|
var body: some View {
|
|
@@ -134,6 +154,7 @@ struct NavigationController: View {
|
|
|
134
154
|
}
|
|
135
155
|
}
|
|
136
156
|
}
|
|
157
|
+
.id(themeUpdateTrigger)
|
|
137
158
|
.onChange(of: currentScreen) { newValue in
|
|
138
159
|
HeapAnalytics.trackEvent(eventName: "\(newValue.rawValue) Screen")
|
|
139
160
|
}
|
|
@@ -152,7 +173,15 @@ struct NavigationController: View {
|
|
|
152
173
|
}
|
|
153
174
|
}
|
|
154
175
|
}
|
|
176
|
+
.onChange(of: colorScheme) { newScheme in
|
|
177
|
+
onThemeChanged(newScheme)
|
|
178
|
+
}
|
|
155
179
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification)) { _ in
|
|
180
|
+
if tuya.useSystemTheme {
|
|
181
|
+
let interfaceStyle = UITraitCollection.current.userInterfaceStyle
|
|
182
|
+
tuya.currentSystemColorScheme = interfaceStyle == .dark ? "dark" : "light"
|
|
183
|
+
onThemeChanged(interfaceStyle == .dark ? .dark : .light)
|
|
184
|
+
}
|
|
156
185
|
if currentScreen == .playback {
|
|
157
186
|
tuya.pausePlayback()
|
|
158
187
|
} else {
|
|
@@ -160,6 +189,11 @@ struct NavigationController: View {
|
|
|
160
189
|
}
|
|
161
190
|
}
|
|
162
191
|
.onReceive(NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)) { _ in
|
|
192
|
+
if tuya.useSystemTheme {
|
|
193
|
+
let interfaceStyle = UITraitCollection.current.userInterfaceStyle
|
|
194
|
+
tuya.currentSystemColorScheme = interfaceStyle == .dark ? "dark" : "light"
|
|
195
|
+
onThemeChanged(interfaceStyle == .dark ? .dark : .light)
|
|
196
|
+
}
|
|
163
197
|
if currentScreen == .dashboard {
|
|
164
198
|
tuya.connect()
|
|
165
199
|
}
|
|
@@ -180,7 +214,7 @@ struct TopBar: View {
|
|
|
180
214
|
title: title,
|
|
181
215
|
xl20: true,
|
|
182
216
|
white: !isSpecialTitle,
|
|
183
|
-
|
|
217
|
+
greyColor: isSpecialTitle,
|
|
184
218
|
semiBold: true
|
|
185
219
|
)
|
|
186
220
|
|
|
@@ -193,7 +227,7 @@ struct TopBar: View {
|
|
|
193
227
|
.resizable()
|
|
194
228
|
.aspectRatio(contentMode: .fit)
|
|
195
229
|
.frame(width: 22, height: 22)
|
|
196
|
-
.foregroundColor(isSpecialTitle ? LocalColor.Monochrome.
|
|
230
|
+
.foregroundColor(isSpecialTitle ? LocalColor.Monochrome.greyColor : LocalColor.Monochrome.whiteColor)
|
|
197
231
|
}
|
|
198
232
|
.padding(.leading, 5)
|
|
199
233
|
|
|
@@ -208,7 +242,7 @@ struct TopBar: View {
|
|
|
208
242
|
.resizable()
|
|
209
243
|
.aspectRatio(contentMode: .fit)
|
|
210
244
|
.frame(width: 24, height: 24)
|
|
211
|
-
.foregroundColor(title == "Activity History" ? LocalColor.Monochrome.
|
|
245
|
+
.foregroundColor(title == "Activity History" || title == "Playback" ? LocalColor.Monochrome.greyColor : LocalColor.Monochrome.whiteColor)
|
|
212
246
|
}
|
|
213
247
|
.padding(.trailing, 5)
|
|
214
248
|
}
|
|
@@ -86,7 +86,7 @@ struct Playback: View {
|
|
|
86
86
|
|
|
87
87
|
if tuya.playbackLoader {
|
|
88
88
|
ProgressView()
|
|
89
|
-
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.
|
|
89
|
+
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.blackColor))
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
CustomDatePicker(
|
|
@@ -293,7 +293,7 @@ struct PlaybackList: View {
|
|
|
293
293
|
id: "noPlaybackVideos",
|
|
294
294
|
title: "No Playback videos available at the moment.",
|
|
295
295
|
xl18: true,
|
|
296
|
-
|
|
296
|
+
blackColor: true,
|
|
297
297
|
semiBold: true,
|
|
298
298
|
center: true
|
|
299
299
|
)
|
|
@@ -342,7 +342,8 @@ struct VideoItem: View {
|
|
|
342
342
|
Label(
|
|
343
343
|
title: "\(convertTimestampToTime(item["startTime"] as? Int))",
|
|
344
344
|
l: true,
|
|
345
|
-
|
|
345
|
+
grey: !isSelected,
|
|
346
|
+
white: isSelected,
|
|
346
347
|
bold: true,
|
|
347
348
|
left: true
|
|
348
349
|
)
|
|
@@ -350,7 +351,8 @@ struct VideoItem: View {
|
|
|
350
351
|
Label(
|
|
351
352
|
title: ("Duration: \(calculateVideoDuration(from: item["startTime"] as? Int, to: item["endTime"] as? Int))"),
|
|
352
353
|
m: true,
|
|
353
|
-
|
|
354
|
+
lightGrey: !isSelected,
|
|
355
|
+
white: isSelected,
|
|
354
356
|
left: true
|
|
355
357
|
)
|
|
356
358
|
.padding(.top, 5)
|
|
@@ -360,7 +362,7 @@ struct VideoItem: View {
|
|
|
360
362
|
Spacer()
|
|
361
363
|
}
|
|
362
364
|
.frame(maxWidth: /*@START_MENU_TOKEN@*/.infinity/*@END_MENU_TOKEN@*/)
|
|
363
|
-
.background(isSelected ? LocalColor.
|
|
365
|
+
.background(isSelected ? LocalColor.Main.dark : LocalColor.Monochrome.white)
|
|
364
366
|
.cornerRadius(5)
|
|
365
367
|
.padding(.top, 8)
|
|
366
368
|
.padding(.horizontal, 10)
|
|
@@ -102,15 +102,31 @@ struct PreviewView: UIViewRepresentable {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
func openLivePreview(appFlavor: String) {
|
|
106
|
-
|
|
105
|
+
func openLivePreview(appFlavor: String, darkThemeEnabled: Bool = false, useSystemTheme: Bool = false, currentSystemColorScheme: String = "light") {
|
|
106
|
+
Tuya.shared.darkThemeEnabled = darkThemeEnabled
|
|
107
|
+
Tuya.shared.useSystemTheme = useSystemTheme
|
|
108
|
+
Tuya.shared.currentSystemColorScheme = currentSystemColorScheme
|
|
109
|
+
if useSystemTheme {
|
|
110
|
+
let interfaceStyle = UITraitCollection.current.userInterfaceStyle
|
|
111
|
+
Tuya.shared.currentSystemColorScheme = interfaceStyle == .dark ? "dark" : "light"
|
|
112
|
+
}
|
|
113
|
+
Tuya.shared.darkThemefinal = useSystemTheme ? (Tuya.shared.currentSystemColorScheme == "dark") : darkThemeEnabled
|
|
107
114
|
DispatchQueue.main.async {
|
|
108
|
-
Themes.configureTheme(for: appFlavor)
|
|
115
|
+
Themes.configureTheme(for: appFlavor, darkThemeEnabled: Tuya.shared.darkThemefinal)
|
|
116
|
+
|
|
117
|
+
if let windowScene = UIApplication.shared.connectedScenes
|
|
118
|
+
.compactMap({ $0 as? UIWindowScene })
|
|
119
|
+
.first(where: { $0.activationState == .foregroundActive }),
|
|
120
|
+
let window = windowScene.windows.first(where: { $0.isKeyWindow }) {
|
|
121
|
+
window.overrideUserInterfaceStyle = Tuya.shared.darkThemefinal ? .dark : .light
|
|
122
|
+
}
|
|
123
|
+
|
|
109
124
|
let orientationManager = OrientationManager()
|
|
110
125
|
let dashboardView = NavigationController().environmentObject(orientationManager)
|
|
111
126
|
let hostingController = UIHostingController(rootView: dashboardView)
|
|
112
127
|
hostingController.modalPresentationStyle = .fullScreen
|
|
113
|
-
|
|
128
|
+
|
|
129
|
+
if let windowScene = UIApplication.shared.connectedScenes
|
|
114
130
|
.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene,
|
|
115
131
|
let rootVC = windowScene.windows.first(where: { $0.isKeyWindow })?.rootViewController {
|
|
116
132
|
rootVC.present(hostingController, animated: true, completion: nil)
|
|
@@ -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 {
|
|
@@ -343,7 +343,7 @@ struct Settings: View {
|
|
|
343
343
|
Label(
|
|
344
344
|
title: "Storage Settings",
|
|
345
345
|
l: true,
|
|
346
|
-
|
|
346
|
+
grey: true
|
|
347
347
|
)
|
|
348
348
|
|
|
349
349
|
let description = sdCardStatusDescription(for: tuya.sdCardStatus)
|
|
@@ -398,7 +398,7 @@ struct Settings: View {
|
|
|
398
398
|
Label(
|
|
399
399
|
title: "Wi-Fi Signal Strength",
|
|
400
400
|
l: true,
|
|
401
|
-
|
|
401
|
+
grey: true
|
|
402
402
|
)
|
|
403
403
|
|
|
404
404
|
Spacer()
|
|
@@ -427,7 +427,7 @@ struct Settings: View {
|
|
|
427
427
|
Label(
|
|
428
428
|
title: "Reset Wi-Fi",
|
|
429
429
|
l: true,
|
|
430
|
-
|
|
430
|
+
grey: true
|
|
431
431
|
)
|
|
432
432
|
|
|
433
433
|
Spacer()
|
|
@@ -492,7 +492,7 @@ struct Settings: View {
|
|
|
492
492
|
Label(
|
|
493
493
|
title: "Power Source",
|
|
494
494
|
l: true,
|
|
495
|
-
|
|
495
|
+
grey: true
|
|
496
496
|
)
|
|
497
497
|
|
|
498
498
|
Spacer()
|
|
@@ -548,7 +548,7 @@ struct Settings: View {
|
|
|
548
548
|
Label(
|
|
549
549
|
title: "Device Info",
|
|
550
550
|
l: true,
|
|
551
|
-
|
|
551
|
+
grey: true
|
|
552
552
|
)
|
|
553
553
|
|
|
554
554
|
Spacer()
|
|
@@ -571,7 +571,7 @@ struct Settings: View {
|
|
|
571
571
|
title: "Remove Doorbell",
|
|
572
572
|
l: true,
|
|
573
573
|
secondary: true,
|
|
574
|
-
textColor: LocalColor.Monochrome.
|
|
574
|
+
textColor: LocalColor.Monochrome.whiteColor,
|
|
575
575
|
semiBold: true
|
|
576
576
|
) {
|
|
577
577
|
isRemoveDoorbellAlertVisible = true
|
|
@@ -153,6 +153,9 @@ namespace JS {
|
|
|
153
153
|
bool continuous_recording() const;
|
|
154
154
|
bool event_recording() const;
|
|
155
155
|
bool set_sensitivity_low() const;
|
|
156
|
+
bool darkThemeEnabled() const;
|
|
157
|
+
bool useSystemTheme() const;
|
|
158
|
+
NSString *currentSystemColorScheme() const;
|
|
156
159
|
bool doorbell_setting() const;
|
|
157
160
|
|
|
158
161
|
SpecOpenCameraLivePreviewParams(NSDictionary *const v) : _v(v) {}
|
|
@@ -442,6 +445,21 @@ inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::set_sensitivi
|
|
|
442
445
|
id const p = _v[@"set_sensitivity_low"];
|
|
443
446
|
return RCTBridgingToBool(p);
|
|
444
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
|
+
}
|
|
445
463
|
inline bool JS::NativeRentlyTuya::SpecOpenCameraLivePreviewParams::doorbell_setting() const
|
|
446
464
|
{
|
|
447
465
|
id const p = _v[@"doorbell_setting"];
|
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
|
|
@@ -98,7 +98,10 @@ RCT_EXPORT_MODULE()
|
|
|
98
98
|
@"continuous_recording": @(params.continuous_recording()),
|
|
99
99
|
@"event_recording": @(params.event_recording()),
|
|
100
100
|
@"set_sensitivity_low": @(params.set_sensitivity_low()),
|
|
101
|
-
@"doorbell_setting": @(params.doorbell_setting())
|
|
101
|
+
@"doorbell_setting": @(params.doorbell_setting()),
|
|
102
|
+
@"darkThemeEnabled": @(params.darkThemeEnabled()),
|
|
103
|
+
@"useSystemTheme": @(params.useSystemTheme()),
|
|
104
|
+
@"currentSystemColorScheme": params.currentSystemColorScheme()
|
|
102
105
|
};
|
|
103
106
|
|
|
104
107
|
[[RentlyTuyaImpl shared] openCameraLivePreview:paramsDict withResolve:resolve withReject:reject];
|
|
@@ -198,6 +198,9 @@ public class RentlyTuyaImpl: NSObject {
|
|
|
198
198
|
let continuousRecording = params["continuous_recording"] as? Bool ?? false
|
|
199
199
|
let eventRecording = params["event_recording"] as? Bool ?? false
|
|
200
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"
|
|
201
204
|
let doorbell_setting = params["doorbell_setting"] as? Bool ?? false
|
|
202
205
|
|
|
203
206
|
// Property Credentials
|
|
@@ -220,6 +223,9 @@ public class RentlyTuyaImpl: NSObject {
|
|
|
220
223
|
Tuya.shared.eventRecording = eventRecording
|
|
221
224
|
Tuya.shared.setSensitivityLow = setSensitivityLow
|
|
222
225
|
Tuya.shared.flavour = flavour
|
|
226
|
+
Tuya.shared.darkThemeEnabled = darkThemeEnabled
|
|
227
|
+
Tuya.shared.useSystemTheme = useSystemTheme
|
|
228
|
+
Tuya.shared.currentSystemColorScheme = currentSystemColorScheme
|
|
223
229
|
Tuya.shared.doorbell_setting = doorbell_setting
|
|
224
230
|
|
|
225
231
|
if !Tuya.shared.continuousRecording && !Tuya.shared.eventRecording {
|
|
@@ -234,7 +240,7 @@ public class RentlyTuyaImpl: NSObject {
|
|
|
234
240
|
homeId: homeId,
|
|
235
241
|
completion: { success, errorMessage, error in
|
|
236
242
|
if (success) {
|
|
237
|
-
openLivePreview(appFlavor: Tuya.shared.flavour)
|
|
243
|
+
openLivePreview(appFlavor: Tuya.shared.flavour, darkThemeEnabled: Tuya.shared.darkThemeEnabled, useSystemTheme: Tuya.shared.useSystemTheme, currentSystemColorScheme: Tuya.shared.currentSystemColorScheme)
|
|
238
244
|
resolve(true)
|
|
239
245
|
} else {
|
|
240
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
|
|