Skip to content

Commit af998af

Browse files
committed
fix: notch: expanded: control icons
1 parent d515b37 commit af998af

File tree

5 files changed

+54
-26
lines changed

5 files changed

+54
-26
lines changed

MewNotch.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@
317317
"@executable_path/../Frameworks",
318318
);
319319
MACOSX_DEPLOYMENT_TARGET = 14.0;
320-
MARKETING_VERSION = "1.0.3-beta";
320+
MARKETING_VERSION = 1.1.0;
321321
PRODUCT_BUNDLE_IDENTIFIER = com.monuk7735.mew.notch;
322322
PRODUCT_NAME = "$(TARGET_NAME)";
323323
SWIFT_EMIT_LOC_STRINGS = YES;
@@ -355,7 +355,7 @@
355355
"@executable_path/../Frameworks",
356356
);
357357
MACOSX_DEPLOYMENT_TARGET = 14.0;
358-
MARKETING_VERSION = "1.0.3-beta";
358+
MARKETING_VERSION = 1.1.0;
359359
PRODUCT_BUNDLE_IDENTIFIER = com.monuk7735.mew.notch;
360360
PRODUCT_NAME = "$(TARGET_NAME)";
361361
SWIFT_EMIT_LOC_STRINGS = YES;
Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,40 @@
11
//
2-
// FileShelfControlView.swift
2+
// NotchViewTypeControlView.swift
33
// MewNotch
44
//
55
// Created by Monu Kumar on 03/07/25.
66
//
77

88
import SwiftUI
99

10-
struct FileShelfControlView: View {
10+
struct NotchViewTypeControlView: View {
1111

1212
@ObservedObject var notchViewModel: NotchViewModel
1313
@ObservedObject var expandedNotchViewModel: ExpandedNotchViewModel
1414

15+
var notchViewType: ExpandedNotchViewModel.NotchViewType
16+
1517
var body: some View {
1618
GenericControlView(
1719
notchViewModel: notchViewModel
1820
) {
19-
Button(
20-
action: {
21+
Image(systemName: expandedNotchViewModel.currentView == notchViewType ? notchViewType.imageSystemNameSelected : notchViewType.imageSystemName )
22+
.resizable()
23+
.scaledToFit()
24+
.frame(
25+
maxWidth: .infinity,
26+
maxHeight: .infinity
27+
)
28+
.onTapGesture {
2129
withAnimation {
22-
let oldView = expandedNotchViewModel.currentView
23-
expandedNotchViewModel.currentView = oldView == .Shelf ? .Home : .Shelf
30+
guard notchViewType != expandedNotchViewModel.currentView else { return }
31+
withAnimation {
32+
expandedNotchViewModel.currentView = notchViewType
33+
}
2434
}
2535
}
26-
) {
27-
Image(
28-
systemName: "document.circle.fill"
29-
)
30-
.resizable()
31-
.scaledToFit()
32-
}
33-
.buttonStyle(.plain)
36+
.opacity(expandedNotchViewModel.currentView == notchViewType ? 1 : 0.7)
37+
.foregroundStyle(expandedNotchViewModel.currentView == notchViewType ? .blue : .primary)
3438
}
3539
}
3640
}

MewNotch/View/Notch/Expanded/Controls/GenericControlView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct GenericControlView<Content: View>: View {
1515

1616
var body: some View {
1717
content()
18-
.padding(notchViewModel.minimalHUDPadding * 1.5)
18+
.padding(notchViewModel.minimalHUDPadding * 1.2)
1919
.frame(
2020
width: notchViewModel.notchSize.height,
2121
height: notchViewModel.notchSize.height

MewNotch/View/Notch/Expanded/ExpandedNotchView.swift

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,19 @@ struct ExpandedNotchView: View {
2323
var body: some View {
2424
VStack {
2525
HStack(
26-
alignment: .top
26+
alignment: .top,
27+
spacing: 4
2728
) {
28-
GenericControlView(
29-
notchViewModel: notchViewModel
30-
) {
31-
Text(" ")
32-
}
29+
NotchViewTypeControlView(
30+
notchViewModel: notchViewModel,
31+
expandedNotchViewModel: expandedNotchViewModel,
32+
notchViewType: .Home
33+
)
3334

34-
FileShelfControlView(
35+
NotchViewTypeControlView(
3536
notchViewModel: notchViewModel,
36-
expandedNotchViewModel: expandedNotchViewModel
37+
expandedNotchViewModel: expandedNotchViewModel,
38+
notchViewType: .Shelf
3739
)
3840

3941
collapsedNotchView

MewNotch/ViewModel/Notch/ExpandedNotchViewModel.swift

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,31 @@ import SwiftUI
99

1010
class ExpandedNotchViewModel: ObservableObject {
1111

12-
enum NotchViewType {
12+
enum NotchViewType: String, CaseIterable, Identifiable {
13+
var id: String {
14+
self.rawValue
15+
}
16+
1317
case Home
1418
case Shelf
19+
20+
var imageSystemName: String {
21+
switch self {
22+
case .Home:
23+
return "house.circle"
24+
case .Shelf:
25+
return "bookmark.circle"
26+
}
27+
}
28+
29+
var imageSystemNameSelected: String {
30+
switch self {
31+
case .Home:
32+
return "house.circle.fill"
33+
case .Shelf:
34+
return "bookmark.circle.fill"
35+
}
36+
}
1537
}
1638

1739
@Published var currentView: NotchViewType = .Home

0 commit comments

Comments
 (0)