@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
|
@@ -76,6 +76,8 @@ class RentlyTuyaModule(private val reactContext: ReactApplicationContext) :
|
|
|
76
76
|
scope.launch(exceptionHandler) {
|
|
77
77
|
Tuya.lastMoveOutDate =
|
|
78
78
|
if (params.hasKey("last_moveout_at")) params.getString("last_moveout_at") else null
|
|
79
|
+
Tuya.isDoorbellCallEnabled =
|
|
80
|
+
if (params.hasKey("doorbell_calling_enabled")) params.getBoolean("doorbell_calling_enabled") else false
|
|
79
81
|
Tuya.resetRequired =
|
|
80
82
|
if (params.hasKey("resetRequired")) params.getBoolean("resetRequired") else null
|
|
81
83
|
Tuya.isResident = if (params.hasKey("isResident")) params.getBoolean("isResident") else true
|
|
@@ -98,6 +100,14 @@ class RentlyTuyaModule(private val reactContext: ReactApplicationContext) :
|
|
|
98
100
|
if (params.hasKey("event_recording")) params.getBoolean("event_recording") else false
|
|
99
101
|
Tuya.setSensitivityLow =
|
|
100
102
|
if (params.hasKey("set_sensitivity_low")) params.getBoolean("set_sensitivity_low") else false
|
|
103
|
+
Tuya.darkThemeEnabled =
|
|
104
|
+
if (params.hasKey("darkThemeEnabled")) params.getBoolean("darkThemeEnabled") else false
|
|
105
|
+
Tuya.useSystemSetting =
|
|
106
|
+
if (params.hasKey("useSystemSetting")) params.getBoolean("useSystemSetting") else false
|
|
107
|
+
|
|
108
|
+
// For navigation handling for AOSU charging
|
|
109
|
+
Tuya.doorbellSetting =
|
|
110
|
+
if (params.hasKey("doorbell_setting")) params.getBoolean("doorbell_setting") else false
|
|
101
111
|
|
|
102
112
|
// If both event and continuous recording are false, set event recording to true - NB: Only for 8s Doorbell
|
|
103
113
|
if (!Tuya.eventRecording && !Tuya.continuousRecording) {
|
|
@@ -61,7 +61,7 @@ fun PermissionAlert(
|
|
|
61
61
|
.height(50.dp),
|
|
62
62
|
id = "AudioPermission_NotNow",
|
|
63
63
|
title = strings(id = R.string.notNow),
|
|
64
|
-
textColor = LocalColor.Monochrome.
|
|
64
|
+
textColor = LocalColor.Monochrome.StaticWhite,
|
|
65
65
|
primary = true,
|
|
66
66
|
semiBold = true
|
|
67
67
|
) {
|
|
@@ -74,7 +74,7 @@ fun PermissionAlert(
|
|
|
74
74
|
.height(50.dp),
|
|
75
75
|
id = "AudioPermission_Agree",
|
|
76
76
|
title = strings(id = R.string.agree),
|
|
77
|
-
textColor = LocalColor.Monochrome.
|
|
77
|
+
textColor = LocalColor.Monochrome.StaticWhite,
|
|
78
78
|
primary = true,
|
|
79
79
|
semiBold = true
|
|
80
80
|
) {
|
|
@@ -5,6 +5,7 @@ import androidx.compose.material3.TextButton
|
|
|
5
5
|
import androidx.compose.runtime.Composable
|
|
6
6
|
import androidx.compose.runtime.CompositionLocalProvider
|
|
7
7
|
import androidx.compose.ui.Modifier
|
|
8
|
+
import androidx.compose.ui.graphics.Color
|
|
8
9
|
import androidx.compose.ui.platform.LocalDensity
|
|
9
10
|
import androidx.compose.ui.semantics.contentDescription
|
|
10
11
|
import androidx.compose.ui.semantics.semantics
|
|
@@ -34,6 +35,7 @@ fun AnchorButton(
|
|
|
34
35
|
// Color
|
|
35
36
|
primary: Boolean = false,
|
|
36
37
|
black: Boolean = false,
|
|
38
|
+
customColor: Color? = null,
|
|
37
39
|
// Font Weight
|
|
38
40
|
light: Boolean = false,
|
|
39
41
|
medium: Boolean = false,
|
|
@@ -50,9 +52,9 @@ fun AnchorButton(
|
|
|
50
52
|
onClick: () -> Unit = {}
|
|
51
53
|
) {
|
|
52
54
|
|
|
53
|
-
val textColor = when {
|
|
55
|
+
val textColor = customColor ?: when {
|
|
54
56
|
primary -> LocalColor.Primary.Light
|
|
55
|
-
black -> LocalColor.Monochrome.
|
|
57
|
+
black -> LocalColor.Monochrome.BlackColor
|
|
56
58
|
else -> LocalColor.Primary.Light
|
|
57
59
|
}
|
|
58
60
|
|
|
@@ -48,6 +48,7 @@ fun Button(
|
|
|
48
48
|
grey: Boolean = false,
|
|
49
49
|
black: Boolean = false,
|
|
50
50
|
textColor: Color?,
|
|
51
|
+
backgroundColor: Color? = null,
|
|
51
52
|
borderColor: Color? = null,
|
|
52
53
|
// Font Weight
|
|
53
54
|
light: Boolean = false,
|
|
@@ -61,11 +62,11 @@ fun Button(
|
|
|
61
62
|
onClick: () -> Unit = {}
|
|
62
63
|
) {
|
|
63
64
|
|
|
64
|
-
val buttonColor = when {
|
|
65
|
+
val buttonColor = backgroundColor ?: when {
|
|
65
66
|
primary -> LocalColor.Primary.Medium
|
|
66
|
-
secondary ->
|
|
67
|
+
secondary -> LocalColor.Danger.Secondary
|
|
67
68
|
white -> LocalColor.Monochrome.White
|
|
68
|
-
grey -> LocalColor.Monochrome.
|
|
69
|
+
grey -> LocalColor.Monochrome.Grey
|
|
69
70
|
black -> LocalColor.Monochrome.Black
|
|
70
71
|
else -> LocalColor.Primary.Light
|
|
71
72
|
}
|
|
@@ -134,7 +135,7 @@ fun Button(
|
|
|
134
135
|
fontSize = fontSize,
|
|
135
136
|
fontFamily = fontFamily,
|
|
136
137
|
textAlign = TextAlign.Center,
|
|
137
|
-
color = textColor!!,
|
|
138
|
+
color = if (disabled) textColor!!.copy(alpha = 0.5f) else textColor!!,
|
|
138
139
|
maxLines = 1,
|
|
139
140
|
overflow = TextOverflow.Clip,
|
|
140
141
|
modifier = Modifier
|
|
@@ -86,21 +86,21 @@ fun DatePicker(
|
|
|
86
86
|
Column(
|
|
87
87
|
modifier = Modifier
|
|
88
88
|
.fillMaxWidth()
|
|
89
|
-
.background(LocalColor.
|
|
89
|
+
.background(LocalColor.Monochrome.DatePickerBackground)
|
|
90
90
|
.padding(start = 15.dp, top = 20.dp, bottom = 30.dp)
|
|
91
91
|
) {
|
|
92
92
|
Label(
|
|
93
93
|
modifier = Modifier.padding(bottom = 20.dp),
|
|
94
94
|
title = "Select date",
|
|
95
95
|
l = true,
|
|
96
|
-
|
|
96
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
97
97
|
bold = true
|
|
98
98
|
)
|
|
99
99
|
Label(
|
|
100
100
|
title = LocalDate.ofEpochDay(tempDate / 86400000)
|
|
101
101
|
.format(DateTimeFormatter.ofPattern("MMM dd yyyy")),
|
|
102
102
|
xl34 = true,
|
|
103
|
-
|
|
103
|
+
customColor = LocalColor.Monochrome.StaticWhite,
|
|
104
104
|
bold = true
|
|
105
105
|
)
|
|
106
106
|
}
|
|
@@ -126,7 +126,8 @@ fun DatePicker(
|
|
|
126
126
|
) {
|
|
127
127
|
Icon(
|
|
128
128
|
Icons.AutoMirrored.Filled.ArrowBack,
|
|
129
|
-
contentDescription = "Previous Month"
|
|
129
|
+
contentDescription = "Previous Month",
|
|
130
|
+
tint = LocalColor.Main.Dark
|
|
130
131
|
)
|
|
131
132
|
}
|
|
132
133
|
|
|
@@ -147,7 +148,8 @@ fun DatePicker(
|
|
|
147
148
|
) {
|
|
148
149
|
Icon(
|
|
149
150
|
Icons.AutoMirrored.Filled.ArrowForward,
|
|
150
|
-
contentDescription = "Next Month"
|
|
151
|
+
contentDescription = "Next Month",
|
|
152
|
+
tint = LocalColor.Main.Dark
|
|
151
153
|
)
|
|
152
154
|
}
|
|
153
155
|
}
|
|
@@ -234,7 +236,7 @@ fun DatePicker(
|
|
|
234
236
|
title = (day + 1).toString(),
|
|
235
237
|
m = true,
|
|
236
238
|
bold = isSelected,
|
|
237
|
-
|
|
239
|
+
customColor = if (isSelected) LocalColor.Monochrome.StaticWhite else null,
|
|
238
240
|
black = !isSelected
|
|
239
241
|
)
|
|
240
242
|
}
|
|
@@ -261,7 +263,7 @@ fun DatePicker(
|
|
|
261
263
|
modifier = Modifier.padding(5.dp),
|
|
262
264
|
id = "DatePicker_OK",
|
|
263
265
|
title = strings(id = R.string.ok).uppercase(),
|
|
264
|
-
|
|
266
|
+
customColor = LocalColor.Main.Dark,
|
|
265
267
|
semiBold = true
|
|
266
268
|
) {
|
|
267
269
|
selectedDate = tempDate
|
|
@@ -23,17 +23,13 @@ fun Divider(
|
|
|
23
23
|
modifier: Modifier = Modifier,
|
|
24
24
|
thickness: Dp = 1.dp,
|
|
25
25
|
direction: DividerDirection = DividerDirection.Horizontal,
|
|
26
|
-
primary: Boolean = false,
|
|
27
26
|
) {
|
|
28
27
|
val targetThickness = when (thickness) {
|
|
29
28
|
Dp.Hairline -> (1f / LocalDensity.current.density).dp
|
|
30
29
|
else -> thickness
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
val color =
|
|
34
|
-
primary -> LocalColor.Secondary.Light
|
|
35
|
-
else -> LocalColor.Secondary.Light
|
|
36
|
-
}
|
|
32
|
+
val color = LocalColor.Monochrome.LightGrey
|
|
37
33
|
|
|
38
34
|
Box(
|
|
39
35
|
when (direction) {
|
|
@@ -82,7 +82,7 @@ fun Label(
|
|
|
82
82
|
lightGrey -> LocalColor.Monochrome.Regular
|
|
83
83
|
grey -> LocalColor.Monochrome.Medium
|
|
84
84
|
white -> LocalColor.Monochrome.White
|
|
85
|
-
black -> LocalColor.Monochrome.
|
|
85
|
+
black -> LocalColor.Monochrome.BlackColor
|
|
86
86
|
else -> LocalColor.Primary.Light
|
|
87
87
|
}
|
|
88
88
|
|
|
@@ -52,6 +52,7 @@ import com.rentlytuya.ui.theme.LocalFont.FontSize
|
|
|
52
52
|
import com.rentlytuya.util.DateUtil.isNotNull
|
|
53
53
|
import com.rentlytuya.util.Util.strings
|
|
54
54
|
import androidx.compose.foundation.Image
|
|
55
|
+
import androidx.compose.ui.graphics.ColorFilter
|
|
55
56
|
|
|
56
57
|
|
|
57
58
|
@Composable
|
|
@@ -96,12 +97,11 @@ fun AdvancedSettings(
|
|
|
96
97
|
modifier = Modifier
|
|
97
98
|
.fillMaxSize()
|
|
98
99
|
.background(LocalColor.Main.Light)
|
|
99
|
-
.padding(
|
|
100
|
+
.padding(vertical = 15.dp, horizontal = 12.dp)
|
|
100
101
|
) {
|
|
101
102
|
Column(
|
|
102
103
|
modifier = Modifier
|
|
103
104
|
.background(LocalColor.Monochrome.White)
|
|
104
|
-
.padding(horizontal = 10.dp)
|
|
105
105
|
) {
|
|
106
106
|
Item(
|
|
107
107
|
title = strings(id = R.string.productName),
|
|
@@ -183,6 +183,7 @@ fun StorageSettings(
|
|
|
183
183
|
modifier = Modifier
|
|
184
184
|
.fillMaxSize()
|
|
185
185
|
.background(LocalColor.Main.Light)
|
|
186
|
+
.padding(horizontal = 12.dp)
|
|
186
187
|
) {
|
|
187
188
|
Column(
|
|
188
189
|
modifier = Modifier
|
|
@@ -192,19 +193,19 @@ fun StorageSettings(
|
|
|
192
193
|
Item(
|
|
193
194
|
title = strings(id = R.string.totalCapacity),
|
|
194
195
|
value = totalStorageCapacity.value,
|
|
195
|
-
background = LocalColor.
|
|
196
|
+
background = LocalColor.Monochrome.White
|
|
196
197
|
)
|
|
197
198
|
|
|
198
199
|
Item(
|
|
199
200
|
title = strings(id = R.string.used),
|
|
200
201
|
value = usedStorage.value,
|
|
201
|
-
background = LocalColor.
|
|
202
|
+
background = LocalColor.Monochrome.White
|
|
202
203
|
)
|
|
203
204
|
|
|
204
205
|
Item(
|
|
205
206
|
title = strings(id = R.string.remainingCapacity),
|
|
206
207
|
value = remainingStorageCapacity.value,
|
|
207
|
-
background = LocalColor.
|
|
208
|
+
background = LocalColor.Monochrome.White
|
|
208
209
|
)
|
|
209
210
|
|
|
210
211
|
val annotatedText = buildAnnotatedString {
|
|
@@ -214,7 +215,7 @@ fun StorageSettings(
|
|
|
214
215
|
SpanStyle(
|
|
215
216
|
fontFamily = LocalFont.FontFamily.medium,
|
|
216
217
|
fontWeight = FontWeight.Bold,
|
|
217
|
-
color = LocalColor.Monochrome.
|
|
218
|
+
color = LocalColor.Monochrome.BlackColor,
|
|
218
219
|
fontSize = FontSize.L
|
|
219
220
|
),
|
|
220
221
|
start = 0,
|
|
@@ -226,7 +227,7 @@ fun StorageSettings(
|
|
|
226
227
|
addStyle(
|
|
227
228
|
SpanStyle(
|
|
228
229
|
fontFamily = LocalFont.FontFamily.medium,
|
|
229
|
-
color = LocalColor.Monochrome.
|
|
230
|
+
color = LocalColor.Monochrome.BlackColor,
|
|
230
231
|
fontSize = FontSize.L
|
|
231
232
|
),
|
|
232
233
|
start = length - message.length,
|
|
@@ -264,7 +265,7 @@ fun StorageSettings(
|
|
|
264
265
|
.height(50.dp),
|
|
265
266
|
id = "FormatSDCard",
|
|
266
267
|
title = strings(id = R.string.format),
|
|
267
|
-
textColor = LocalColor.Monochrome.
|
|
268
|
+
textColor = LocalColor.Monochrome.StaticWhite,
|
|
268
269
|
secondary = true,
|
|
269
270
|
semiBold = true,
|
|
270
271
|
disabled = storageFunctionType.intValue == 4
|
|
@@ -356,13 +357,14 @@ fun Item(
|
|
|
356
357
|
.size(12.dp),
|
|
357
358
|
painter = painterResource(id = R.drawable.ic_arrow_blue_right),
|
|
358
359
|
contentDescription = "rightArrow",
|
|
360
|
+
colorFilter = ColorFilter.tint(LocalColor.Monochrome.BlackColor)
|
|
359
361
|
)
|
|
360
362
|
}
|
|
361
363
|
}
|
|
362
364
|
}
|
|
363
365
|
|
|
364
366
|
Divider(
|
|
365
|
-
thickness =
|
|
367
|
+
thickness = 0.5.dp
|
|
366
368
|
)
|
|
367
369
|
}
|
|
368
370
|
}
|
|
@@ -339,8 +339,8 @@ fun BoxScope.DoorbellControls(
|
|
|
339
339
|
} else {
|
|
340
340
|
strings(id = R.string.charging)
|
|
341
341
|
},
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
s = true,
|
|
343
|
+
customColor = LocalColor.Monochrome.StaticWhite
|
|
344
344
|
)
|
|
345
345
|
}
|
|
346
346
|
}
|
|
@@ -365,7 +365,7 @@ fun BoxScope.DoorbellControls(
|
|
|
365
365
|
semiBold = true,
|
|
366
366
|
grey = true,
|
|
367
367
|
disabled = isLoading.value,
|
|
368
|
-
textColor = LocalColor.Monochrome.
|
|
368
|
+
textColor = LocalColor.Monochrome.StaticWhite,
|
|
369
369
|
cornerRadius = 20.dp,
|
|
370
370
|
onClick = {
|
|
371
371
|
Tuya.changeResolution(
|
|
@@ -390,7 +390,7 @@ fun BoxScope.DoorbellControls(
|
|
|
390
390
|
medium = isMicOn.value,
|
|
391
391
|
semiBold = true,
|
|
392
392
|
disabled = isLoading.value,
|
|
393
|
-
textColor = LocalColor.Monochrome.
|
|
393
|
+
textColor = LocalColor.Monochrome.StaticWhite,
|
|
394
394
|
cornerRadius = 40.dp,
|
|
395
395
|
onClick = {
|
|
396
396
|
if (PermissionHandler.arePermissionsGranted(context, permissions)) {
|
|
@@ -8,6 +8,7 @@ import androidx.compose.foundation.background
|
|
|
8
8
|
import androidx.compose.foundation.clickable
|
|
9
9
|
import androidx.compose.foundation.interaction.MutableInteractionSource
|
|
10
10
|
import androidx.compose.foundation.layout.Arrangement
|
|
11
|
+
import androidx.compose.foundation.layout.Box
|
|
11
12
|
import androidx.compose.foundation.layout.Column
|
|
12
13
|
import androidx.compose.foundation.layout.Row
|
|
13
14
|
import androidx.compose.foundation.layout.fillMaxHeight
|
|
@@ -27,6 +28,7 @@ import androidx.compose.runtime.mutableStateOf
|
|
|
27
28
|
import androidx.compose.runtime.remember
|
|
28
29
|
import androidx.compose.ui.Alignment
|
|
29
30
|
import androidx.compose.ui.Modifier
|
|
31
|
+
import androidx.compose.ui.graphics.ColorFilter
|
|
30
32
|
import androidx.compose.ui.platform.LocalConfiguration
|
|
31
33
|
import androidx.compose.ui.platform.LocalContext
|
|
32
34
|
import androidx.compose.ui.res.painterResource
|
|
@@ -35,13 +37,11 @@ import androidx.compose.ui.unit.sp
|
|
|
35
37
|
import androidx.compose.ui.window.Dialog
|
|
36
38
|
import androidx.compose.ui.window.DialogProperties
|
|
37
39
|
import androidx.navigation.NavController
|
|
38
|
-
import com.facebook.react.ReactApplication
|
|
39
40
|
import com.rentlytuya.R
|
|
40
41
|
import com.rentlytuya.alerts.RemoveDoorbellAlert
|
|
41
42
|
import com.rentlytuya.alerts.RemoveDoorbellFailureAlert
|
|
42
43
|
import com.rentlytuya.alerts.ResetWifiAlert
|
|
43
44
|
import com.rentlytuya.components.Button
|
|
44
|
-
import com.rentlytuya.components.Divider
|
|
45
45
|
import com.rentlytuya.components.Label
|
|
46
46
|
import com.rentlytuya.components.LoadingIndicator
|
|
47
47
|
import com.rentlytuya.components.Switch
|
|
@@ -54,6 +54,7 @@ import com.rentlytuya.util.KeylessModule
|
|
|
54
54
|
import com.rentlytuya.util.Util.isLandscape
|
|
55
55
|
import com.rentlytuya.util.Util.strings
|
|
56
56
|
import com.rentlytuya.alerts.SuccessAlert
|
|
57
|
+
import com.rentlytuya.tuya.Tuya.doorbellSetting
|
|
57
58
|
|
|
58
59
|
enum class MotionSensitivityLevel(val level: String) {
|
|
59
60
|
HIGH("High"),
|
|
@@ -90,6 +91,7 @@ fun DoorbellSettings(
|
|
|
90
91
|
isWaterMarkEnabled: MutableState<Boolean>,
|
|
91
92
|
isFlipEnabled: MutableState<Boolean>,
|
|
92
93
|
isAntiDismantlingAlarmEnabled: MutableState<Boolean>,
|
|
94
|
+
isDoorbellCallEnabled: MutableState<Boolean>,
|
|
93
95
|
nightVisionLevel: MutableState<String>,
|
|
94
96
|
isMotionDetectionEnabled: MutableState<Boolean>,
|
|
95
97
|
motionSensitivityLevel: MutableState<String>,
|
|
@@ -119,7 +121,11 @@ fun DoorbellSettings(
|
|
|
119
121
|
isAdvancedSettings.value = false
|
|
120
122
|
isStorageSettings.value = false
|
|
121
123
|
navController.navigate(ScreenRoutes.SETTINGS)
|
|
122
|
-
} else {
|
|
124
|
+
} else if (doorbellSetting && isSettings.value) {
|
|
125
|
+
// If doorbellSetting is true and we're in settings, finish the activity
|
|
126
|
+
isSettings.value = false
|
|
127
|
+
activity.finish()
|
|
128
|
+
}else {
|
|
123
129
|
isSettings.value = false
|
|
124
130
|
navController.navigate(ScreenRoutes.DASHBOARD)
|
|
125
131
|
}
|
|
@@ -144,10 +150,9 @@ fun DoorbellSettings(
|
|
|
144
150
|
isResetWifiAlertVisible = isResetWifiAlertVisible.value,
|
|
145
151
|
onDismiss = { isResetWifiAlertVisible.value = false },
|
|
146
152
|
onReset = {
|
|
147
|
-
Tuya.deviceId?.let {
|
|
148
153
|
KeylessModule.instance?.sendDataToJS(
|
|
149
154
|
eventName = "RESET_WIFI",
|
|
150
|
-
|
|
155
|
+
value = Tuya.tuyaProductName ?: "",
|
|
151
156
|
onSuccess = {
|
|
152
157
|
Log.i(TAG, "Navigate to Add Doorbell Success")
|
|
153
158
|
isResetWifiAlertVisible.value = false
|
|
@@ -158,7 +163,6 @@ fun DoorbellSettings(
|
|
|
158
163
|
isResetWifiAlertVisible.value = false
|
|
159
164
|
}
|
|
160
165
|
)
|
|
161
|
-
} ?: Log.i(TAG, "Device ID is null")
|
|
162
166
|
}
|
|
163
167
|
)
|
|
164
168
|
|
|
@@ -181,7 +185,7 @@ fun DoorbellSettings(
|
|
|
181
185
|
|
|
182
186
|
KeylessModule.instance?.sendDataToJS(
|
|
183
187
|
eventName = "REMOVE_CAMERA",
|
|
184
|
-
|
|
188
|
+
value = it,
|
|
185
189
|
onSuccess = {
|
|
186
190
|
Log.i(TAG, "Remove Doorbell Success")
|
|
187
191
|
isLoading.value = false
|
|
@@ -222,7 +226,9 @@ fun DoorbellSettings(
|
|
|
222
226
|
|
|
223
227
|
else -> {
|
|
224
228
|
LazyColumn(
|
|
225
|
-
modifier = Modifier
|
|
229
|
+
modifier = Modifier
|
|
230
|
+
.fillMaxSize()
|
|
231
|
+
.background(LocalColor.Main.Light)
|
|
226
232
|
) {
|
|
227
233
|
item {
|
|
228
234
|
Heading(title = strings(id = R.string.basicSettings))
|
|
@@ -276,6 +282,21 @@ fun DoorbellSettings(
|
|
|
276
282
|
)
|
|
277
283
|
}
|
|
278
284
|
}
|
|
285
|
+
item {
|
|
286
|
+
SettingsItem(
|
|
287
|
+
title = strings(id = R.string.doorbellCall),
|
|
288
|
+
description = strings(id = R.string.doorbellCallDescription),
|
|
289
|
+
withSwitch = true,
|
|
290
|
+
checked = isDoorbellCallEnabled.value,
|
|
291
|
+
onToggle = {
|
|
292
|
+
Settings.setEnableDoorbellCall(
|
|
293
|
+
enable = it,
|
|
294
|
+
isLoading = isLoading,
|
|
295
|
+
isDoorbellCallEnabled = isDoorbellCallEnabled
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
)
|
|
299
|
+
}
|
|
279
300
|
item {
|
|
280
301
|
SettingsItem(
|
|
281
302
|
title = strings(id = R.string.irNightVision),
|
|
@@ -641,7 +662,7 @@ fun DoorbellSettings(
|
|
|
641
662
|
}
|
|
642
663
|
|
|
643
664
|
item {
|
|
644
|
-
Heading(title = strings(id = R.string.
|
|
665
|
+
Heading(title = strings(id = R.string.deviceInformation))
|
|
645
666
|
}
|
|
646
667
|
item {
|
|
647
668
|
SettingsItem(
|
|
@@ -666,7 +687,7 @@ fun DoorbellSettings(
|
|
|
666
687
|
.height(50.dp),
|
|
667
688
|
id = "RemoveDoorbell",
|
|
668
689
|
title = strings(id = R.string.removeDoorbell),
|
|
669
|
-
textColor = LocalColor.Monochrome.
|
|
690
|
+
textColor = LocalColor.Monochrome.StaticWhite,
|
|
670
691
|
secondary = true,
|
|
671
692
|
m = true,
|
|
672
693
|
semiBold = true
|
|
@@ -687,7 +708,7 @@ fun Heading(title: String) {
|
|
|
687
708
|
modifier = Modifier
|
|
688
709
|
.fillMaxWidth()
|
|
689
710
|
.height(40.dp)
|
|
690
|
-
.background(LocalColor.
|
|
711
|
+
.background(LocalColor.Main.Light),
|
|
691
712
|
verticalAlignment = Alignment.CenterVertically
|
|
692
713
|
) {
|
|
693
714
|
Label(
|
|
@@ -723,117 +744,117 @@ fun SettingsItem(
|
|
|
723
744
|
mutableStateOf(false)
|
|
724
745
|
}
|
|
725
746
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
interactionSource = remember { MutableInteractionSource() },
|
|
732
|
-
indication = if (withDropDown || onClick.isNotNull()) ripple() else null
|
|
733
|
-
) {
|
|
734
|
-
if (withDropDown) isDropDownVisible.value = true else onClick?.invoke()
|
|
735
|
-
}
|
|
736
|
-
.padding(horizontal = 20.dp),
|
|
737
|
-
horizontalArrangement = Arrangement.SpaceBetween,
|
|
738
|
-
verticalAlignment = Alignment.CenterVertically
|
|
739
|
-
) {
|
|
740
|
-
Column(
|
|
741
|
-
modifier = Modifier
|
|
742
|
-
.fillMaxWidth(0.7f)
|
|
743
|
-
.padding(vertical = 10.dp)
|
|
744
|
-
) {
|
|
745
|
-
Label(
|
|
746
|
-
modifier = Modifier,
|
|
747
|
-
id = title.lowercase(),
|
|
748
|
-
title = title,
|
|
749
|
-
m = true,
|
|
750
|
-
grey = true,
|
|
751
|
-
semiBold = true,
|
|
752
|
-
)
|
|
753
|
-
|
|
754
|
-
if (description.isNotBlank()) {
|
|
755
|
-
Label(
|
|
756
|
-
modifier = Modifier
|
|
757
|
-
.padding(top = 5.dp),
|
|
758
|
-
id = title.lowercase() + "Description",
|
|
759
|
-
title = description,
|
|
760
|
-
maxLines = 6,
|
|
761
|
-
s = true,
|
|
762
|
-
lightGrey = true,
|
|
763
|
-
medium = true,
|
|
764
|
-
lineHeight = 15.sp
|
|
765
|
-
)
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
|
|
747
|
+
Box(modifier = Modifier
|
|
748
|
+
.padding( horizontal = 12.dp)
|
|
749
|
+
.background(LocalColor.Monochrome.White))
|
|
750
|
+
{
|
|
751
|
+
Column(modifier = Modifier) {
|
|
769
752
|
Row(
|
|
770
753
|
modifier = Modifier
|
|
771
|
-
.fillMaxWidth()
|
|
772
|
-
|
|
754
|
+
.fillMaxWidth()
|
|
755
|
+
.clickable(
|
|
756
|
+
interactionSource = remember { MutableInteractionSource() },
|
|
757
|
+
indication = if (withDropDown || onClick.isNotNull()) ripple() else null
|
|
758
|
+
) {
|
|
759
|
+
if (withDropDown) isDropDownVisible.value = true else onClick?.invoke()
|
|
760
|
+
}
|
|
761
|
+
.padding(horizontal = 12.dp),
|
|
762
|
+
horizontalArrangement = Arrangement.SpaceBetween,
|
|
773
763
|
verticalAlignment = Alignment.CenterVertically
|
|
774
764
|
) {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
765
|
+
Column(
|
|
766
|
+
modifier = Modifier
|
|
767
|
+
.fillMaxWidth(0.7f)
|
|
768
|
+
.padding(vertical = 10.dp)
|
|
769
|
+
) {
|
|
770
|
+
Label(
|
|
771
|
+
modifier = Modifier,
|
|
772
|
+
id = title.lowercase(),
|
|
773
|
+
title = title,
|
|
774
|
+
m = true,
|
|
775
|
+
black = true,
|
|
776
|
+
semiBold = true,
|
|
777
|
+
)
|
|
783
778
|
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
779
|
+
if (description.isNotBlank()) {
|
|
780
|
+
Label(
|
|
781
|
+
modifier = Modifier
|
|
782
|
+
.padding(top = 5.dp),
|
|
783
|
+
id = title.lowercase() + "Description",
|
|
784
|
+
title = description,
|
|
785
|
+
maxLines = 6,
|
|
786
|
+
s = true,
|
|
787
|
+
lightGrey = true,
|
|
788
|
+
medium = true,
|
|
789
|
+
lineHeight = 15.sp
|
|
791
790
|
)
|
|
792
791
|
}
|
|
792
|
+
}
|
|
793
793
|
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
794
|
+
Row(
|
|
795
|
+
modifier = Modifier
|
|
796
|
+
.fillMaxWidth(),
|
|
797
|
+
horizontalArrangement = Arrangement.End,
|
|
798
|
+
verticalAlignment = Alignment.CenterVertically
|
|
799
|
+
) {
|
|
800
|
+
when {
|
|
801
|
+
withSwitch -> {
|
|
802
|
+
Switch(
|
|
803
|
+
id = title + "Switch",
|
|
804
|
+
checked = checked,
|
|
805
|
+
onChange = onToggle
|
|
803
806
|
)
|
|
804
807
|
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
black = true,
|
|
814
|
-
semiBold = true
|
|
808
|
+
|
|
809
|
+
withDropDown -> {
|
|
810
|
+
PopUp(
|
|
811
|
+
isVisible = isDropDownVisible,
|
|
812
|
+
dropDownTitle = dropDownTitle,
|
|
813
|
+
dropDownList = dropDownList,
|
|
814
|
+
selectedOption = selectedOption,
|
|
815
|
+
onDropDownItemSelected = onDropDownItemSelected,
|
|
815
816
|
)
|
|
816
817
|
}
|
|
817
818
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
819
|
+
else -> {
|
|
820
|
+
if (leftIcon == true) {
|
|
821
|
+
Image(
|
|
822
|
+
modifier = Modifier
|
|
823
|
+
.width(24.dp)
|
|
824
|
+
.height(24.dp)
|
|
825
|
+
.padding(end = 5.dp),
|
|
826
|
+
painter = painterResource(id = R.drawable.ic_warning),
|
|
827
|
+
contentDescription = "warningIcon",
|
|
828
|
+
)
|
|
829
|
+
}
|
|
830
|
+
if (additionalInfo != "") {
|
|
831
|
+
Label(
|
|
832
|
+
modifier = Modifier
|
|
833
|
+
.padding(end = 5.dp),
|
|
834
|
+
id = title.lowercase(),
|
|
835
|
+
title = additionalInfo,
|
|
836
|
+
maxLines = 1,
|
|
837
|
+
m = true,
|
|
838
|
+
black = true,
|
|
839
|
+
semiBold = true
|
|
840
|
+
)
|
|
841
|
+
}
|
|
842
|
+
if (rightArrow) {
|
|
843
|
+
Image(
|
|
844
|
+
modifier = Modifier
|
|
845
|
+
.size(18.dp)
|
|
846
|
+
.padding(top = 5.dp),
|
|
847
|
+
painter = painterResource(id = R.drawable.ic_arrow_blue_right),
|
|
848
|
+
contentDescription = "rightArrow",
|
|
849
|
+
colorFilter = ColorFilter.tint(LocalColor.Monochrome.BlackColor)
|
|
850
|
+
)
|
|
851
|
+
}
|
|
826
852
|
}
|
|
827
853
|
}
|
|
828
854
|
}
|
|
829
855
|
}
|
|
830
856
|
}
|
|
831
857
|
|
|
832
|
-
Divider(
|
|
833
|
-
modifier = Modifier
|
|
834
|
-
.padding(horizontal = 10.dp),
|
|
835
|
-
thickness = 1.dp
|
|
836
|
-
)
|
|
837
858
|
}
|
|
838
859
|
}
|
|
839
860
|
|
|
@@ -873,6 +894,7 @@ fun PopUp(
|
|
|
873
894
|
.size(12.dp),
|
|
874
895
|
painter = painterResource(id = R.drawable.ic_arrow_blue_right),
|
|
875
896
|
contentDescription = "rightArrow",
|
|
897
|
+
colorFilter = ColorFilter.tint(LocalColor.Monochrome.BlackColor)
|
|
876
898
|
)
|
|
877
899
|
}
|
|
878
900
|
|