From a00364ec36238cb74fa1effc03c69380faa6c1c0 Mon Sep 17 00:00:00 2001 From: halo Date: Tue, 13 Aug 2024 15:09:03 +0200 Subject: [PATCH] Add uninstall instructions --- .../Settings/Sections/UninstallView.swift | 59 ++++++++++++++++++- .../Views/Settings/SettingsDetailView.swift | 3 + 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/LinkLiar/Views/Settings/Sections/UninstallView.swift b/LinkLiar/Views/Settings/Sections/UninstallView.swift index 16416ed..5720f3d 100644 --- a/LinkLiar/Views/Settings/Sections/UninstallView.swift +++ b/LinkLiar/Views/Settings/Sections/UninstallView.swift @@ -8,8 +8,63 @@ extension SettingsView { @Environment(LinkState.self) private var state var body: some View { - VStack { - Text("Preferences...") + ScrollView { + VStack(alignment: .center) { + Image(systemName: "trash.fill") + .resizable() + .aspectRatio(contentMode: .fill) + .frame(width: 60, height: 60) + .padding(.bottom, 3) + Text("Uninstall LinkLiar").bold() + }.padding() + + if state.daemonRegistration == .notRegistered || state.daemonRegistration == .notFound { + HStack { + Text(""" + There is no background service installed. + + You can delete LinkLiar.app to uninstall. + """) + Spacer() + }.padding(.bottom) + + } else { + + VStack { + HStack { + Text(""" + You can press this button \ + to deactivate all background activity immediately: + """) + Spacer() + }.padding(.bottom) + + Button(action: { Controller.unregisterDaemon(state: state) }) { + Text("Unregister Background Service") + }.padding(.bottom) + + HStack { + Text("Then delete") + Text("LinkLiar.app").monospaced().bold() + Spacer() + }.padding(.bottom) + + } + } + + if state.daemonRegistration != .notFound { + HStack { + Text(""" + Notice that LinkLiar may still appear in your "Allow in the Background" \ + list of apps. + This is intended behavior by Apple. If it really bothers you, \ + there is a command called `sfltool resetbtm`  which you can investigate \ + to solve the problem. + """) + Spacer() + }.padding(.bottom) + } + }.padding() } } diff --git a/LinkLiar/Views/Settings/SettingsDetailView.swift b/LinkLiar/Views/Settings/SettingsDetailView.swift index 286690f..bbffc0b 100644 --- a/LinkLiar/Views/Settings/SettingsDetailView.swift +++ b/LinkLiar/Views/Settings/SettingsDetailView.swift @@ -38,6 +38,9 @@ struct SettingsDetailView: View { case SettingsView.Pane.troubleshoot.rawValue: SettingsView.TroubleshootView().environment(state) + case SettingsView.Pane.uninstall.rawValue: + SettingsView.UninstallView().environment(state) + default: if let interface = state.allInterfaces.first(where: { $0.id == selectedFolder }) { SettingsView.InterfacePolicyView().environment(state)