Skip to content

Commit 1e447a4

Browse files
authored
Merge pull request #130 from what3words/staging
Staging to main
2 parents de20a98 + 3ef7f7d commit 1e447a4

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Sources/W3WSwiftComponentsOcr/Presenters/Ocr/Views/Modifiers/BorderSwitchToggleStyle.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import SwiftUI
99
import W3WSwiftThemes
1010
import W3WSwiftDesignSwiftUI
11+
import W3WSwiftAppTypes
1112

1213

1314
/// styling the SwiftUI toggle
@@ -51,14 +52,14 @@ struct BorderedSwitchToggleStyle: ToggleStyle {
5152
.padding(4)
5253
.frame(maxWidth: .infinity, alignment: configuration.isOn ? .trailing : .leading)
5354

54-
if isLocked {
55+
if isLocked, !W3WAppConstants.padlockConfig.isHidden {
5556
W3WIconImage(
5657
iconImage: .w3wLock,
5758
iconSize: 12,
58-
color: W3WCoreColor.white.suColor
59+
color: W3WAppConstants.padlockConfig.foregroundColor.suColor
5960
)
6061
.frame(width: 14, height: 14)
61-
.background(W3WTheme.what3words.brandBase?.suColor)
62+
.background(W3WAppConstants.padlockConfig.backgroundColor.suColor)
6263
.clipShape(.circle)
6364
.offset(x: 23.0, y: -13.0)
6465
}

Sources/W3WSwiftComponentsOcr/Presenters/Ocr/Views/Modifiers/View+Lock.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import SwiftUI
99
import W3WSwiftThemes
1010
import W3WSwiftDesignSwiftUI
11+
import W3WSwiftAppTypes
1112

1213

1314
// hack to copy lock funtionality, the original is in
@@ -21,23 +22,22 @@ public extension View {
2122
_ value: Bool,
2223
alignment: Alignment = .topTrailing,
2324
offsetX: CGFloat = 0,
24-
offsetY: CGFloat = 0,
25-
lockColor: Color = .white
25+
offsetY: CGFloat = 0
2626
) -> some View {
27-
self.cornerOverlay(
28-
isVisible: value,
27+
let isLockVisible = value && !W3WAppConstants.padlockConfig.isHidden
28+
return self.cornerOverlay(
29+
isVisible: isLockVisible,
2930
alignment: alignment,
3031
offsetX: offsetX,
3132
offsetY: offsetY,
3233
overlayView: {
33-
// TODO: Add lock images when ready
3434
W3WIconImage(
3535
iconImage: .w3wLock,
3636
iconSize: 12,
37-
color: lockColor
37+
color: W3WAppConstants.padlockConfig.foregroundColor.suColor
3838
)
3939
.frame(width: 14, height: 14)
40-
.background(W3WTheme.what3words.brandBase?.suColor)
40+
.background(W3WAppConstants.padlockConfig.backgroundColor.suColor)
4141
.clipShape(.circle)
4242
})
4343
}

0 commit comments

Comments
 (0)