@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
|
@@ -149,7 +149,6 @@ fun NavController(
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
Column(modifier = Modifier.fillMaxSize()) {
|
|
152
|
-
|
|
153
152
|
if (configuration.orientation == Configuration.ORIENTATION_PORTRAIT ||
|
|
154
153
|
(configuration.orientation == Configuration.ORIENTATION_LANDSCAPE &&
|
|
155
154
|
currentDestination.value != ScreenRoutes.DASHBOARD && currentDestination.value != ScreenRoutes.PLAYBACK && currentDestination.value != ScreenRoutes.ACTIVITY_HISTORY)
|
|
@@ -163,6 +162,7 @@ fun NavController(
|
|
|
163
162
|
currentDestination.value == ScreenRoutes.DASHBOARD -> deviceName.value
|
|
164
163
|
else -> currentDestination.value
|
|
165
164
|
},
|
|
165
|
+
currentRoute = currentDestination.value,
|
|
166
166
|
onTrailingIconClick = {
|
|
167
167
|
when (currentDestination.value) {
|
|
168
168
|
ScreenRoutes.PLAYBACK -> isDatePickerVisible.value = true
|
|
@@ -334,17 +334,19 @@ fun NavController(
|
|
|
334
334
|
@Composable
|
|
335
335
|
fun TopBar(
|
|
336
336
|
title: String,
|
|
337
|
+
currentRoute: String = "",
|
|
337
338
|
onBack: () -> Unit = {},
|
|
338
339
|
onTrailingIconClick: () -> Unit = {}
|
|
339
340
|
) {
|
|
340
341
|
|
|
341
342
|
val isSpecialTitle = title in listOf(ScreenRoutes.SETTINGS, ScreenRoutes.ACTIVITY_HISTORY, strings(id = R.string.deviceInformation), strings(id = R.string.activityStorage), strings(id = R.string.firmwareVersion), strings(id = R.string.updateFirmware))
|
|
343
|
+
val isDashboard = currentRoute == ScreenRoutes.DASHBOARD
|
|
342
344
|
|
|
343
345
|
Box(
|
|
344
346
|
modifier = Modifier
|
|
345
347
|
.fillMaxWidth()
|
|
346
348
|
.fillMaxHeight(0.075f)
|
|
347
|
-
.background(if (
|
|
349
|
+
.background(if (isDashboard) LocalColor.Monochrome.DarkGrey else LocalColor.Main.Light)
|
|
348
350
|
) {
|
|
349
351
|
IconButton(
|
|
350
352
|
modifier = Modifier
|
|
@@ -360,9 +362,10 @@ fun TopBar(
|
|
|
360
362
|
Image(
|
|
361
363
|
modifier = Modifier.size(35.dp),
|
|
362
364
|
painter = painterResource(
|
|
363
|
-
id = if (
|
|
365
|
+
id = if (isDashboard) R.drawable.ic_arrow_backward_white else R.drawable.ic_action_arrow_backward
|
|
364
366
|
),
|
|
365
|
-
contentDescription = "back"
|
|
367
|
+
contentDescription = "back",
|
|
368
|
+
colorFilter = if (isDashboard) null else ColorFilter.tint(color = LocalColor.Monochrome.BlackColor)
|
|
366
369
|
)
|
|
367
370
|
}
|
|
368
371
|
|
|
@@ -377,8 +380,7 @@ fun TopBar(
|
|
|
377
380
|
title = title,
|
|
378
381
|
semiBold = true,
|
|
379
382
|
xl20 = true,
|
|
380
|
-
|
|
381
|
-
black = isSpecialTitle
|
|
383
|
+
customColor = if (isDashboard) LocalColor.Monochrome.StaticWhite else LocalColor.Monochrome.BlackColor
|
|
382
384
|
)
|
|
383
385
|
}
|
|
384
386
|
if (!isSpecialTitle || title == ScreenRoutes.PLAYBACK || title == ScreenRoutes.ACTIVITY_HISTORY) {
|
|
@@ -394,11 +396,7 @@ fun TopBar(
|
|
|
394
396
|
id = if (title == ScreenRoutes.PLAYBACK || title == ScreenRoutes.ACTIVITY_HISTORY) R.drawable.ic_calendar else R.drawable.ic_setting
|
|
395
397
|
),
|
|
396
398
|
contentDescription = "trailingIcon",
|
|
397
|
-
colorFilter = if (
|
|
398
|
-
ColorFilter.tint(color = LocalColor.Monochrome.Grey)
|
|
399
|
-
} else {
|
|
400
|
-
null
|
|
401
|
-
}
|
|
399
|
+
colorFilter = if (isDashboard) null else ColorFilter.tint(color = LocalColor.Monochrome.BlackColor)
|
|
402
400
|
)
|
|
403
401
|
}
|
|
404
402
|
}
|
|
@@ -17,6 +17,7 @@ import androidx.compose.runtime.Composable
|
|
|
17
17
|
import androidx.compose.runtime.DisposableEffect
|
|
18
18
|
import androidx.compose.ui.Alignment
|
|
19
19
|
import androidx.compose.ui.Modifier
|
|
20
|
+
import androidx.compose.ui.graphics.Color
|
|
20
21
|
import androidx.compose.ui.platform.LocalContext
|
|
21
22
|
import androidx.compose.ui.unit.dp
|
|
22
23
|
import com.facebook.react.ReactApplication
|
|
@@ -63,7 +64,7 @@ fun OfflineScreen(
|
|
|
63
64
|
modifier = Modifier
|
|
64
65
|
.padding(bottom = 15.dp),
|
|
65
66
|
title = strings(id = R.string.connectionFailed),
|
|
66
|
-
|
|
67
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
67
68
|
xl20 = true,
|
|
68
69
|
bold = true,
|
|
69
70
|
center = true
|
|
@@ -73,7 +74,7 @@ fun OfflineScreen(
|
|
|
73
74
|
modifier = Modifier
|
|
74
75
|
.padding(bottom = 10.dp),
|
|
75
76
|
title = strings(id = R.string.pleaseCheckTheFollowing),
|
|
76
|
-
|
|
77
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
77
78
|
maxLines = 2
|
|
78
79
|
)
|
|
79
80
|
|
|
@@ -81,7 +82,7 @@ fun OfflineScreen(
|
|
|
81
82
|
modifier = Modifier
|
|
82
83
|
.padding(start = 10.dp, bottom = 10.dp),
|
|
83
84
|
title = strings(id = R.string.moveYourWiFi),
|
|
84
|
-
|
|
85
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
85
86
|
maxLines = 2
|
|
86
87
|
)
|
|
87
88
|
|
|
@@ -93,7 +94,7 @@ fun OfflineScreen(
|
|
|
93
94
|
} else {
|
|
94
95
|
strings(id = R.string.pressTheDoorbellButtonFor15s)
|
|
95
96
|
},
|
|
96
|
-
|
|
97
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
97
98
|
maxLines = 6
|
|
98
99
|
)
|
|
99
100
|
|
|
@@ -102,7 +103,7 @@ fun OfflineScreen(
|
|
|
102
103
|
modifier = Modifier
|
|
103
104
|
.padding(start = 10.dp, top = 10.dp),
|
|
104
105
|
title = strings(id = R.string.ensureTheHomeBaseIsPlugged),
|
|
105
|
-
|
|
106
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
106
107
|
maxLines = 4
|
|
107
108
|
)
|
|
108
109
|
}
|
|
@@ -111,7 +112,7 @@ fun OfflineScreen(
|
|
|
111
112
|
modifier = Modifier
|
|
112
113
|
.padding(top = 25.dp),
|
|
113
114
|
title = strings(id = R.string.firstTimeUsingDoorbell),
|
|
114
|
-
|
|
115
|
+
customColor = LocalColor.Monochrome.StaticWhite
|
|
115
116
|
)
|
|
116
117
|
|
|
117
118
|
AnchorButton(
|
|
@@ -119,7 +120,7 @@ fun OfflineScreen(
|
|
|
119
120
|
.padding(bottom = 20.dp),
|
|
120
121
|
id = "Connect_Doorbell_To_WiFi",
|
|
121
122
|
title = strings(id = R.string.connectDoorbellToWiFi),
|
|
122
|
-
|
|
123
|
+
customColor = LocalColor.Primary.Light,
|
|
123
124
|
underLine = true,
|
|
124
125
|
onClick = {
|
|
125
126
|
KeylessModule.instance?.sendDataToJS(
|
|
@@ -146,7 +147,8 @@ fun OfflineScreen(
|
|
|
146
147
|
xl20 = true,
|
|
147
148
|
black = true,
|
|
148
149
|
iconId = R.drawable.ic_retry,
|
|
149
|
-
textColor = LocalColor.
|
|
150
|
+
textColor = LocalColor.Monochrome.StaticWhite,
|
|
151
|
+
backgroundColor = LocalColor.Monochrome.Black,
|
|
150
152
|
borderColor = LocalColor.Primary.Light
|
|
151
153
|
) {
|
|
152
154
|
onReConnect()
|
|
@@ -156,7 +158,7 @@ fun OfflineScreen(
|
|
|
156
158
|
modifier = Modifier
|
|
157
159
|
.padding(bottom = 5.dp),
|
|
158
160
|
title = strings(id = R.string.contactSupport),
|
|
159
|
-
|
|
161
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
160
162
|
center = true,
|
|
161
163
|
maxLines = 2
|
|
162
164
|
)
|
|
@@ -485,7 +485,7 @@ fun VideoItem(
|
|
|
485
485
|
.height(78.dp)
|
|
486
486
|
.padding(top = 10.dp)
|
|
487
487
|
.shadow(1.dp)
|
|
488
|
-
.background(if (selectedItem.value == video) LocalColor.
|
|
488
|
+
.background(if (selectedItem.value == video) LocalColor.Main.Dark else LocalColor.Monochrome.White)
|
|
489
489
|
.clickable {
|
|
490
490
|
if (selectedItem.value == video) {
|
|
491
491
|
currentSliderValue.intValue = 0
|
|
@@ -508,7 +508,7 @@ fun VideoItem(
|
|
|
508
508
|
) {
|
|
509
509
|
Label(
|
|
510
510
|
title = DateUtil.convertTimestampToTime(video.startTime).uppercase(),
|
|
511
|
-
|
|
511
|
+
customColor = if (selectedItem.value == video) LocalColor.Monochrome.StaticWhite else LocalColor.Monochrome.BlackColor,
|
|
512
512
|
l = true,
|
|
513
513
|
center = true,
|
|
514
514
|
semiBold = true
|
|
@@ -520,7 +520,7 @@ fun VideoItem(
|
|
|
520
520
|
endTime = video.endTime
|
|
521
521
|
)
|
|
522
522
|
}",
|
|
523
|
-
|
|
523
|
+
customColor = if (selectedItem.value == video) LocalColor.Monochrome.StaticWhite else LocalColor.Primary.Secondary,
|
|
524
524
|
semiBold = true,
|
|
525
525
|
center = true,
|
|
526
526
|
s = true,
|
|
@@ -55,12 +55,13 @@ object Tuya {
|
|
|
55
55
|
var continuousRecording: Boolean = false
|
|
56
56
|
var eventRecording: Boolean = false
|
|
57
57
|
var setSensitivityLow: Boolean = false
|
|
58
|
+
var darkThemeEnabled: Boolean = false
|
|
59
|
+
var useSystemSetting: Boolean = false
|
|
58
60
|
|
|
59
61
|
// For navigation handling for AOSU charging
|
|
60
62
|
var doorbellSetting: Boolean = false
|
|
61
63
|
|
|
62
64
|
val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
|
|
63
|
-
|
|
64
65
|
suspend fun login(
|
|
65
66
|
uid: String,
|
|
66
67
|
password: String,
|
|
@@ -1,46 +1,53 @@
|
|
|
1
1
|
package com.rentlytuya.ui.theme
|
|
2
2
|
|
|
3
3
|
import android.util.Log
|
|
4
|
+
import androidx.compose.runtime.getValue
|
|
5
|
+
import androidx.compose.runtime.mutableStateOf
|
|
6
|
+
import androidx.compose.runtime.setValue
|
|
4
7
|
import androidx.compose.ui.graphics.Color
|
|
5
8
|
import com.rentlytuya.tuya.Tuya.TAG
|
|
6
9
|
|
|
7
10
|
object LocalColor {
|
|
8
11
|
|
|
9
12
|
object Main {
|
|
10
|
-
var Light
|
|
11
|
-
var Dark
|
|
13
|
+
var Light by mutableStateOf(Color(0xFFf3faff))
|
|
14
|
+
var Dark by mutableStateOf(Color(0xFF329ddc))
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
object Primary {
|
|
15
|
-
var Light
|
|
16
|
-
var Secondary
|
|
17
|
-
var Dark
|
|
18
|
-
var Medium
|
|
18
|
+
var Light by mutableStateOf(Color(0xFF39a1e8))
|
|
19
|
+
var Secondary by mutableStateOf(Color(0xFF6a97b5))
|
|
20
|
+
var Dark by mutableStateOf(Color(0xFF329ddc))
|
|
21
|
+
var Medium by mutableStateOf(Color(0xFF008adc))
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
object Secondary {
|
|
22
|
-
var
|
|
23
|
-
var Light = Color(0xFFd9edfb)
|
|
25
|
+
var Light by mutableStateOf(Color(0xFFd9edfb))
|
|
24
26
|
}
|
|
25
27
|
|
|
26
28
|
object Danger {
|
|
27
|
-
var Primary
|
|
29
|
+
var Primary by mutableStateOf(Color(0xFFcb0000))
|
|
30
|
+
var Secondary by mutableStateOf(Color(0xFFEF4343))
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
object Monochrome {
|
|
31
|
-
var White
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
var
|
|
34
|
+
var White by mutableStateOf(Color(0xFFFFFFFF))
|
|
35
|
+
var BlackColor by mutableStateOf(Color(0xFF000000))
|
|
36
|
+
var LightGrey by mutableStateOf(Color(0xFF1A1A1A))
|
|
37
|
+
var DarkGrey by mutableStateOf(Color(0xFF1A1A1A))
|
|
38
|
+
var Regular by mutableStateOf(Color(0xFF86858C))
|
|
39
|
+
var Medium by mutableStateOf(Color(0xFF3f4d59))
|
|
40
|
+
var Grey by mutableStateOf(Color(0xFF373737))
|
|
41
|
+
var Black by mutableStateOf(Color(0xFF000000))
|
|
42
|
+
var Brown by mutableStateOf(Color(0xFFB45309))
|
|
43
|
+
var DatePickerBackground by mutableStateOf(Color(0xFF177BB5))
|
|
44
|
+
val StaticWhite = Color(0xFFFFFFFF)
|
|
38
45
|
}
|
|
39
46
|
|
|
40
|
-
fun setTheme(flavour: String) {
|
|
47
|
+
fun setTheme(flavour: String, darkThemeEnabled: Boolean = false) {
|
|
41
48
|
when (flavour.lowercase()) {
|
|
42
49
|
"keyless" -> {
|
|
43
|
-
setSmartHomeTheme()
|
|
50
|
+
setSmartHomeTheme(darkThemeEnabled)
|
|
44
51
|
}
|
|
45
52
|
|
|
46
53
|
"progress" -> {
|
|
@@ -60,9 +67,15 @@ object LocalColor {
|
|
|
60
67
|
}
|
|
61
68
|
}
|
|
62
69
|
|
|
63
|
-
private fun setSmartHomeTheme() {
|
|
64
|
-
LocalColor.Main.Light = Color(
|
|
65
|
-
LocalColor.Main.Dark = Color(
|
|
70
|
+
private fun setSmartHomeTheme(darkThemeEnabled: Boolean = false) {
|
|
71
|
+
LocalColor.Main.Light = if (darkThemeEnabled) Color(0xFF1A1A1A) else Color(0xFFF9FAFB)
|
|
72
|
+
LocalColor.Main.Dark = Color(0xFF177BB5)
|
|
73
|
+
LocalColor.Primary.Secondary = if (darkThemeEnabled) Color(0xFFF9FAFB) else Color(0xFF374151)
|
|
74
|
+
LocalColor.Monochrome.White = if (darkThemeEnabled) Color(0xFF242526) else Color(0xFFFFFFFF)
|
|
75
|
+
LocalColor.Monochrome.Medium = if (darkThemeEnabled) Color(0xFFF9FAFB) else Color(0xFF3f4d59)
|
|
76
|
+
LocalColor.Monochrome.Regular = if (darkThemeEnabled) Color(0xFFD1D5DB) else Color(0xFF6B7280)
|
|
77
|
+
LocalColor.Monochrome.BlackColor = if (darkThemeEnabled) Color(0xFFF9FAFB) else Color(0xFF000000)
|
|
78
|
+
LocalColor.Monochrome.DatePickerBackground = if (darkThemeEnabled) Color(0xFF373737) else Color(0xFF177BB5)
|
|
66
79
|
}
|
|
67
80
|
|
|
68
81
|
private fun setProgressTheme() {
|
|
@@ -8,6 +8,7 @@ import androidx.compose.runtime.SideEffect
|
|
|
8
8
|
import androidx.compose.ui.graphics.toArgb
|
|
9
9
|
import androidx.compose.ui.platform.LocalView
|
|
10
10
|
import androidx.core.view.WindowCompat
|
|
11
|
+
import com.rentlytuya.tuya.Tuya
|
|
11
12
|
|
|
12
13
|
@Composable
|
|
13
14
|
fun TuyaTheme(
|
|
@@ -16,6 +17,17 @@ fun TuyaTheme(
|
|
|
16
17
|
dynamicColor: Boolean = true,
|
|
17
18
|
content: @Composable () -> Unit
|
|
18
19
|
) {
|
|
20
|
+
|
|
21
|
+
val effectiveDark = if (Tuya.useSystemSetting) {
|
|
22
|
+
darkTheme
|
|
23
|
+
} else {
|
|
24
|
+
Tuya.darkThemeEnabled
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Modify this if other flavors needs to support dark theme
|
|
28
|
+
SideEffect {
|
|
29
|
+
LocalColor.setTheme("keyless", effectiveDark)
|
|
30
|
+
}
|
|
19
31
|
|
|
20
32
|
val view = LocalView.current
|
|
21
33
|
if (!view.isInEditMode) {
|
|
@@ -23,7 +35,7 @@ fun TuyaTheme(
|
|
|
23
35
|
val window = (view.context as Activity).window
|
|
24
36
|
// window.statusBarColor = LocalColor.Monochrome.Grey.toArgb()
|
|
25
37
|
window.navigationBarColor = LocalColor.Monochrome.Grey.toArgb()
|
|
26
|
-
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars =
|
|
38
|
+
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = effectiveDark
|
|
27
39
|
}
|
|
28
40
|
}
|
|
29
41
|
|
|
Binary file
|
|
@@ -10,8 +10,8 @@ func getAlert(
|
|
|
10
10
|
primaryAction: @escaping () -> Void,
|
|
11
11
|
secondaryAction: @escaping () -> Void = {}
|
|
12
12
|
) -> Alert {
|
|
13
|
-
|
|
14
|
-
updateAlertBackgroundColor()
|
|
13
|
+
// This is commented out for supporting dark mode for system alerts and pickers.
|
|
14
|
+
// updateAlertBackgroundColor()
|
|
15
15
|
|
|
16
16
|
return Alert(
|
|
17
17
|
title: Text(title),
|
|
@@ -30,8 +30,7 @@ func getAlert(
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
func getAlertwithSingleButton(title: String, message: String) -> Alert {
|
|
33
|
-
|
|
34
|
-
updateAlertBackgroundColor()
|
|
33
|
+
// updateAlertBackgroundColor()
|
|
35
34
|
|
|
36
35
|
return Alert(
|
|
37
36
|
title: Text(title),
|
|
@@ -44,7 +43,7 @@ func getAlertwithSingleButton(title: String, message: String) -> Alert {
|
|
|
44
43
|
|
|
45
44
|
func getSuccessAlert(title: String, action: (() -> Void)? = nil) -> Alert {
|
|
46
45
|
|
|
47
|
-
updateAlertBackgroundColor()
|
|
46
|
+
// updateAlertBackgroundColor()
|
|
48
47
|
|
|
49
48
|
if let action = action {
|
|
50
49
|
return Alert(
|
|
@@ -62,8 +61,7 @@ func getSuccessAlert(title: String, action: (() -> Void)? = nil) -> Alert {
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
func getFailureAlert(title: String, action: (() -> Void)? = nil) -> Alert {
|
|
65
|
-
|
|
66
|
-
updateAlertBackgroundColor()
|
|
64
|
+
// updateAlertBackgroundColor()
|
|
67
65
|
|
|
68
66
|
if let action = action {
|
|
69
67
|
return Alert(
|
|
@@ -19,6 +19,7 @@ struct AnchorButton: View {
|
|
|
19
19
|
var primary: Bool = false
|
|
20
20
|
var secondary: Bool = false
|
|
21
21
|
var black: Bool = false
|
|
22
|
+
var paleWhite: Bool = false
|
|
22
23
|
|
|
23
24
|
// Font Weight
|
|
24
25
|
var light: Bool = false
|
|
@@ -58,6 +59,7 @@ struct AnchorButton: View {
|
|
|
58
59
|
if primary { return LocalColor.Primary.light }
|
|
59
60
|
if secondary { return LocalColor.Main.dark }
|
|
60
61
|
if black { return LocalColor.Monochrome.black }
|
|
62
|
+
if paleWhite { return LocalColor.Monochrome.paleWhite }
|
|
61
63
|
return LocalColor.Primary.light
|
|
62
64
|
}
|
|
63
65
|
|
|
@@ -19,6 +19,9 @@ struct CustomButton: View {
|
|
|
19
19
|
var secondary: Bool = false
|
|
20
20
|
var tertiary: Bool = false
|
|
21
21
|
var black: Bool = false
|
|
22
|
+
|
|
23
|
+
//disabled Button Color
|
|
24
|
+
var greyDisabled: Bool = false
|
|
22
25
|
|
|
23
26
|
// Text/Border Color
|
|
24
27
|
var textColor: Color = .black
|
|
@@ -42,7 +45,7 @@ struct CustomButton: View {
|
|
|
42
45
|
if primary {
|
|
43
46
|
return LocalColor.Primary.medium
|
|
44
47
|
} else if secondary {
|
|
45
|
-
return Color(
|
|
48
|
+
return Color(hex: "#EF4343")
|
|
46
49
|
} else if tertiary {
|
|
47
50
|
return LocalColor.Monochrome.regular
|
|
48
51
|
} else if black {
|
|
@@ -52,6 +55,18 @@ struct CustomButton: View {
|
|
|
52
55
|
}
|
|
53
56
|
}
|
|
54
57
|
|
|
58
|
+
var disabledButtonColor: Color? {
|
|
59
|
+
if greyDisabled {
|
|
60
|
+
return Color(hex: "#6B7280")
|
|
61
|
+
} else if black {
|
|
62
|
+
return LocalColor.Monochrome.black
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
return LocalColor.Primary.light
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
55
70
|
var body: some View {
|
|
56
71
|
|
|
57
72
|
let font: Font = {
|
|
@@ -97,7 +112,7 @@ struct CustomButton: View {
|
|
|
97
112
|
.frame(maxWidth: .infinity)
|
|
98
113
|
}
|
|
99
114
|
.padding()
|
|
100
|
-
.background(buttonColor)
|
|
115
|
+
.background( (Tuya.shared.darkThemefinal && !secondary) ? disabledButtonColor ?? buttonColor : buttonColor)
|
|
101
116
|
.opacity(disabled ? 0.5 : 1)
|
|
102
117
|
.cornerRadius(cornerRadius)
|
|
103
118
|
.overlay(
|
|
@@ -52,7 +52,7 @@ struct CustomDatePicker: View {
|
|
|
52
52
|
Spacer()
|
|
53
53
|
}
|
|
54
54
|
.frame(maxWidth: .infinity)
|
|
55
|
-
.background(LocalColor.Main.dark)
|
|
55
|
+
.background(Tuya.shared.darkThemefinal ? Color(hex: "#242526") : LocalColor.Main.dark)
|
|
56
56
|
|
|
57
57
|
HStack {
|
|
58
58
|
Button(action: {
|
|
@@ -70,7 +70,7 @@ struct CustomDatePicker: View {
|
|
|
70
70
|
Label(
|
|
71
71
|
title: formatMonthYear(date: displayedDate),
|
|
72
72
|
xl18: true,
|
|
73
|
-
|
|
73
|
+
blackColor: true,
|
|
74
74
|
bold: true
|
|
75
75
|
)
|
|
76
76
|
|
|
@@ -93,7 +93,7 @@ struct CustomDatePicker: View {
|
|
|
93
93
|
VStack {
|
|
94
94
|
Spacer()
|
|
95
95
|
ProgressView()
|
|
96
|
-
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.
|
|
96
|
+
.progressViewStyle(CircularProgressViewStyle(tint: LocalColor.Monochrome.blackColor))
|
|
97
97
|
Spacer()
|
|
98
98
|
}
|
|
99
99
|
.frame(maxWidth: .infinity)
|
|
@@ -117,7 +117,7 @@ struct CustomDatePicker: View {
|
|
|
117
117
|
id: "DatePicker_Cancel",
|
|
118
118
|
title: "Cancel",
|
|
119
119
|
l: true,
|
|
120
|
-
|
|
120
|
+
paleWhite: true,
|
|
121
121
|
center: true
|
|
122
122
|
) {
|
|
123
123
|
onCancel()
|
|
@@ -205,7 +205,7 @@ struct CalendarView: View {
|
|
|
205
205
|
.font(.footnote)
|
|
206
206
|
.frame(width: 30, height: 30)
|
|
207
207
|
.background(isSelected ? LocalColor.Main.dark : LocalColor.Monochrome.transparent)
|
|
208
|
-
.foregroundColor(isSelected ? LocalColor.Monochrome.
|
|
208
|
+
.foregroundColor(isSelected ? LocalColor.Monochrome.whiteColor : (isAvailable ? LocalColor.Monochrome.blackColor : LocalColor.Monochrome.greyColor))
|
|
209
209
|
.overlay(
|
|
210
210
|
Circle()
|
|
211
211
|
.stroke(isAvailable ? LocalColor.Main.dark : LocalColor.Monochrome.transparent, lineWidth: 1)
|
|
@@ -22,7 +22,10 @@ struct Label: View {
|
|
|
22
22
|
var lightGrey: Bool = false
|
|
23
23
|
var grey: Bool = false
|
|
24
24
|
var white: Bool = false
|
|
25
|
+
var whiteColor: Bool = false
|
|
25
26
|
var black: Bool = false
|
|
27
|
+
var blackColor: Bool = false
|
|
28
|
+
var greyColor: Bool = false
|
|
26
29
|
var customColor: Color? = nil
|
|
27
30
|
|
|
28
31
|
// Font Weight Options
|
|
@@ -58,8 +61,10 @@ struct Label: View {
|
|
|
58
61
|
if secondary { return LocalColor.Primary.secondary }
|
|
59
62
|
if lightGrey { return LocalColor.Monochrome.regular }
|
|
60
63
|
if grey { return LocalColor.Monochrome.medium }
|
|
61
|
-
if white { return LocalColor.Monochrome.
|
|
64
|
+
if white { return LocalColor.Monochrome.whiteColor }
|
|
62
65
|
if black { return LocalColor.Monochrome.black }
|
|
66
|
+
if blackColor { return LocalColor.Monochrome.blackColor }
|
|
67
|
+
if greyColor { return LocalColor.Monochrome.greyColor }
|
|
63
68
|
return LocalColor.Primary.light
|
|
64
69
|
}()
|
|
65
70
|
|
|
@@ -64,11 +64,11 @@ struct StorageSettings: View {
|
|
|
64
64
|
VStack(alignment: .leading) {
|
|
65
65
|
Text("Note:")
|
|
66
66
|
.font(.custom(LocalFont.FontFamily.bold, size: LocalFont.FontSize.L))
|
|
67
|
-
.foregroundColor(LocalColor.Monochrome.
|
|
67
|
+
.foregroundColor(LocalColor.Monochrome.greyColor)
|
|
68
68
|
+
|
|
69
69
|
Text(" Formatting will delete all recorded activities on the SD Card.")
|
|
70
70
|
.font(.custom(LocalFont.FontFamily.semiBold, size: LocalFont.FontSize.L))
|
|
71
|
-
.foregroundColor(LocalColor.Monochrome.
|
|
71
|
+
.foregroundColor(LocalColor.Monochrome.greyColor)
|
|
72
72
|
Spacer()
|
|
73
73
|
HStack {
|
|
74
74
|
Spacer()
|
|
@@ -76,7 +76,7 @@ struct StorageSettings: View {
|
|
|
76
76
|
id: "FormatSDCard",
|
|
77
77
|
title: "Format",
|
|
78
78
|
secondary: true,
|
|
79
|
-
textColor: LocalColor.Monochrome.
|
|
79
|
+
textColor: LocalColor.Monochrome.whiteColor,
|
|
80
80
|
semiBold: true,
|
|
81
81
|
disabled: tuya.sdCardStatus == 4
|
|
82
82
|
) {
|
|
@@ -107,7 +107,7 @@ struct Item: View {
|
|
|
107
107
|
id: title,
|
|
108
108
|
title: title,
|
|
109
109
|
l: true,
|
|
110
|
-
|
|
110
|
+
grey: true,
|
|
111
111
|
semiBold: true
|
|
112
112
|
)
|
|
113
113
|
Spacer()
|
|
@@ -116,7 +116,7 @@ struct Item: View {
|
|
|
116
116
|
id: value,
|
|
117
117
|
title: value,
|
|
118
118
|
l: true,
|
|
119
|
-
|
|
119
|
+
lightGrey: true,
|
|
120
120
|
medium: true,
|
|
121
121
|
right: true,
|
|
122
122
|
maxLines: 3
|
|
@@ -146,7 +146,7 @@ struct Dashboard: View {
|
|
|
146
146
|
}
|
|
147
147
|
|
|
148
148
|
if tuya.isConnected {
|
|
149
|
-
tuya.enableMute(enable: false, type: .preview)
|
|
149
|
+
tuya.enableMute(enable: tuya.doorbell_setting ?? false, type: .preview)
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
orientationManager.updateOrientationFlag()
|
|
@@ -237,7 +237,8 @@ struct DoorbellControls: View {
|
|
|
237
237
|
title: tuya.isMicOn ? "Tap to mute" : "Tap to speak",
|
|
238
238
|
l: true,
|
|
239
239
|
tertiary: !tuya.isMicOn,
|
|
240
|
-
|
|
240
|
+
greyDisabled: !tuya.isMicOn,
|
|
241
|
+
textColor: Color.white,
|
|
241
242
|
medium: tuya.isMicOn,
|
|
242
243
|
semiBold: true,
|
|
243
244
|
cornerRadius: 40,
|
|
@@ -15,13 +15,13 @@ struct FirmwareSettings: View {
|
|
|
15
15
|
if tuya.isFirmwareUpdateInProgress {
|
|
16
16
|
ZStack {
|
|
17
17
|
Circle()
|
|
18
|
-
.stroke(LocalColor.
|
|
18
|
+
.stroke(LocalColor.Main.dark.opacity(0.2), lineWidth: 6)
|
|
19
19
|
.frame(width: 132, height: 132)
|
|
20
20
|
.padding(20)
|
|
21
21
|
|
|
22
22
|
Circle()
|
|
23
23
|
.trim(from: 0.0, to: CGFloat(tuya.firmwareUpdateProgress) / 100)
|
|
24
|
-
.stroke(LocalColor.
|
|
24
|
+
.stroke(LocalColor.Main.dark, style: StrokeStyle(lineWidth: 6, lineCap: .round))
|
|
25
25
|
.rotationEffect(.degrees(-90))
|
|
26
26
|
.frame(width: 132, height: 132)
|
|
27
27
|
.padding(20)
|
|
@@ -43,7 +43,7 @@ struct FirmwareSettings: View {
|
|
|
43
43
|
Spacer()
|
|
44
44
|
Label(title: tuya.firmwareUpdateProgress >= 50 && tuya.firmwareUpdateProgress < 100 ? "Please keep the doorbell powered on while we complete this update. Thank you for your patience." : "This might take a few minutes. During this time you will not be able to use your video doorbell.",
|
|
45
45
|
l: true,
|
|
46
|
-
|
|
46
|
+
blackColor: true,
|
|
47
47
|
center: true)
|
|
48
48
|
.padding(20)
|
|
49
49
|
}
|
|
@@ -61,26 +61,26 @@ struct FirmwareSettings: View {
|
|
|
61
61
|
Label(
|
|
62
62
|
title: "Current Firmware Version:",
|
|
63
63
|
l: true,
|
|
64
|
-
|
|
64
|
+
grey: true,
|
|
65
65
|
semiBold: true
|
|
66
66
|
)
|
|
67
67
|
Label(
|
|
68
68
|
title: (tuya.firmwareNewVersion != nil) ? "New Version Available:" : "",
|
|
69
69
|
l: true,
|
|
70
|
-
|
|
70
|
+
grey: true,
|
|
71
71
|
semiBold: true
|
|
72
72
|
)
|
|
73
73
|
VStack(alignment: .leading, spacing: 0) {
|
|
74
74
|
Label(
|
|
75
75
|
title: Tuya.shared.whatsNew != nil ? "What's new?" : "",
|
|
76
76
|
l: true,
|
|
77
|
-
|
|
77
|
+
grey: true,
|
|
78
78
|
semiBold: true
|
|
79
79
|
)
|
|
80
80
|
Label(
|
|
81
81
|
title: Tuya.shared.whatsNew ?? "",
|
|
82
82
|
l: true,
|
|
83
|
-
|
|
83
|
+
grey: true,
|
|
84
84
|
semiBold: true
|
|
85
85
|
)
|
|
86
86
|
.padding(12)
|
|
@@ -91,13 +91,14 @@ struct FirmwareSettings: View {
|
|
|
91
91
|
Label(
|
|
92
92
|
title: Tuya.shared.firmwareVersion ?? "",
|
|
93
93
|
l: true,
|
|
94
|
-
|
|
94
|
+
lightGrey: true,
|
|
95
95
|
semiBold: true
|
|
96
96
|
)
|
|
97
97
|
|
|
98
98
|
Label(
|
|
99
99
|
title: Tuya.shared.firmwareNewVersion ?? "",
|
|
100
100
|
l: true,
|
|
101
|
+
lightGrey: true,
|
|
101
102
|
semiBold: true
|
|
102
103
|
)
|
|
103
104
|
Spacer()
|
|
@@ -146,7 +147,8 @@ struct FirmwareSettings: View {
|
|
|
146
147
|
id: "UpdateFirmware",
|
|
147
148
|
title: "Update Firmware",
|
|
148
149
|
l: true,
|
|
149
|
-
|
|
150
|
+
greyDisabled: tuya.isAutomaticUpdateEnabled || !tuya.isFirmwareUpdateAvailable || tuya.isFirmwareUpdateInProgress,
|
|
151
|
+
textColor: LocalColor.Monochrome.whiteColor,
|
|
150
152
|
medium: true,
|
|
151
153
|
semiBold: true,
|
|
152
154
|
disabled: tuya.isAutomaticUpdateEnabled || !tuya.isFirmwareUpdateAvailable || tuya.isFirmwareUpdateInProgress,
|