Skip to content

Commit c3f7cd8

Browse files
committed
chore: improve edit toolbar
1 parent d9a30a5 commit c3f7cd8

3 files changed

Lines changed: 24 additions & 14 deletions

File tree

EasyTier.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@
621621
CODE_SIGN_ENTITLEMENTS = EasyTier/EasyTier.entitlements;
622622
CODE_SIGN_IDENTITY = "Apple Development";
623623
CODE_SIGN_STYLE = Automatic;
624-
CURRENT_PROJECT_VERSION = 1;
624+
CURRENT_PROJECT_VERSION = 3;
625625
DEAD_CODE_STRIPPING = YES;
626626
DEVELOPMENT_TEAM = M2G6355ZK7;
627627
ENABLE_APP_SANDBOX = YES;
@@ -688,7 +688,7 @@
688688
CODE_SIGN_ENTITLEMENTS = EasyTier/EasyTier.entitlements;
689689
CODE_SIGN_IDENTITY = "Apple Development";
690690
CODE_SIGN_STYLE = Automatic;
691-
CURRENT_PROJECT_VERSION = 1;
691+
CURRENT_PROJECT_VERSION = 3;
692692
DEAD_CODE_STRIPPING = YES;
693693
DEVELOPMENT_TEAM = M2G6355ZK7;
694694
ENABLE_APP_SANDBOX = YES;
@@ -802,7 +802,7 @@
802802
CODE_SIGN_ENTITLEMENTS = EasyTierNetworkExtension/EasyTierNetworkExtension.entitlements;
803803
CODE_SIGN_IDENTITY = "Apple Development";
804804
CODE_SIGN_STYLE = Automatic;
805-
CURRENT_PROJECT_VERSION = 1;
805+
CURRENT_PROJECT_VERSION = 3;
806806
DEVELOPMENT_TEAM = M2G6355ZK7;
807807
ENABLE_APP_SANDBOX = YES;
808808
ENABLE_HARDENED_RUNTIME = YES;
@@ -880,7 +880,7 @@
880880
CODE_SIGN_ENTITLEMENTS = EasyTierNetworkExtension/EasyTierNetworkExtension.entitlements;
881881
CODE_SIGN_IDENTITY = "Apple Development";
882882
CODE_SIGN_STYLE = Automatic;
883-
CURRENT_PROJECT_VERSION = 1;
883+
CURRENT_PROJECT_VERSION = 3;
884884
DEVELOPMENT_TEAM = M2G6355ZK7;
885885
ENABLE_APP_SANDBOX = YES;
886886
ENABLE_HARDENED_RUNTIME = YES;
@@ -961,7 +961,7 @@
961961
CODE_SIGN_ENTITLEMENTS = EasyTierWidgetExtension/EasyTierWidgetExtension.entitlements;
962962
CODE_SIGN_IDENTITY = "Apple Development";
963963
CODE_SIGN_STYLE = Automatic;
964-
CURRENT_PROJECT_VERSION = 1;
964+
CURRENT_PROJECT_VERSION = 3;
965965
DEVELOPMENT_TEAM = M2G6355ZK7;
966966
ENABLE_APP_SANDBOX = YES;
967967
ENABLE_HARDENED_RUNTIME = YES;
@@ -1014,7 +1014,7 @@
10141014
CODE_SIGN_ENTITLEMENTS = EasyTierWidgetExtension/EasyTierWidgetExtension.entitlements;
10151015
CODE_SIGN_IDENTITY = "Apple Development";
10161016
CODE_SIGN_STYLE = Automatic;
1017-
CURRENT_PROJECT_VERSION = 1;
1017+
CURRENT_PROJECT_VERSION = 3;
10181018
DEVELOPMENT_TEAM = M2G6355ZK7;
10191019
ENABLE_APP_SANDBOX = YES;
10201020
ENABLE_HARDENED_RUNTIME = YES;

EasyTier/Views/DashboardView.swift

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ private struct ProfileTextDraft: Identifiable {
1414
let text: String
1515
}
1616

17+
private struct EditModeAwareConfirmationButton: View {
18+
@Environment(\.editMode) private var editMode
19+
20+
let action: () -> Void
21+
22+
var body: some View {
23+
if editMode?.wrappedValue.isEditing != true {
24+
Button(action: action) {
25+
Image(systemName: "checkmark")
26+
}
27+
.buttonStyle(.borderedProminent)
28+
}
29+
}
30+
}
31+
1732
private struct ProfileTextEditor: View {
1833
@State private var text: String
1934

@@ -56,12 +71,11 @@ struct DashboardView<Manager: NetworkExtensionManagerProtocol>: View {
5671
@ObservedObject var selectedSession: SelectedProfileSession
5772

5873
@AppStorage("selectedProfileName", store: UserDefaults(suiteName: APP_GROUP_ID)) var lastSelected: String?
59-
74+
6075
@State var currentProfile = NetworkProfile()
6176
@State var isLocalPending = false
6277

6378
@State var showManageSheet = false
64-
6579
@State var showNewNetworkAlert = false
6680
@State var newNetworkInput = ""
6781
@State var showEditConfigNameAlert = false
@@ -80,7 +94,7 @@ struct DashboardView<Manager: NetworkExtensionManagerProtocol>: View {
8094
@State var conflictDetails: String = ""
8195

8296
@State var darwinObserver: DarwinNotificationObserver? = nil
83-
@State private var autoSaveTask: Task<Void, Never>? = nil
97+
@State var autoSaveTask: Task<Void, Never>? = nil
8498

8599
init(manager: Manager, selectedSession: SelectedProfileSession) {
86100
_manager = ObservedObject(wrappedValue: manager)
@@ -296,12 +310,9 @@ struct DashboardView<Manager: NetworkExtensionManagerProtocol>: View {
296310
.adaptiveNavigationBarTitleInline()
297311
.toolbar {
298312
ToolbarItem(placement: .confirmationAction) {
299-
Button {
313+
EditModeAwareConfirmationButton {
300314
showManageSheet = false
301-
} label: {
302-
Image(systemName: "checkmark")
303315
}
304-
.buttonStyle(.borderedProminent)
305316
}
306317
}
307318
.listEditingToolbar(

EasyTier/Views/NetworkEditView.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ struct NetworkEditView: View {
4949
.formStyle(.grouped)
5050
#endif
5151
}
52-
.listEditingToolbar(isVisible: !profile.peerConfigs.isEmpty)
5352
}
5453

5554
var secondaryColumn: some View {

0 commit comments

Comments
 (0)