From 3ffc098b01f7ee3fa59f3419417ca926dba057e1 Mon Sep 17 00:00:00 2001 From: Kai Azim <68963405+MrKai77@users.noreply.github.com> Date: Sat, 2 Sep 2023 17:15:51 -0600 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20window=20animation=20settings?= =?UTF-8?q?=20in=20settings=20window?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Loop/Extensions/Defaults+Extensions.swift | 3 ++ Loop/Helpers/Views/BetaIndicator.swift | 30 +++++++++++++++++++ .../{ => Views}/VisualEffectView.swift | 0 Loop/Settings/Views/GeneralSettingsView.swift | 8 +++++ 4 files changed, 41 insertions(+) create mode 100644 Loop/Helpers/Views/BetaIndicator.swift rename Loop/Helpers/{ => Views}/VisualEffectView.swift (100%) diff --git a/Loop/Extensions/Defaults+Extensions.swift b/Loop/Extensions/Defaults+Extensions.swift index f5814095..8acbabc3 100644 --- a/Loop/Extensions/Defaults+Extensions.swift +++ b/Loop/Extensions/Defaults+Extensions.swift @@ -98,4 +98,7 @@ extension Defaults.Keys { "rightThird", default: [[.kVK_ANSI_L]] ) + + // BETA + static let animateWindowResizes = Key("animateWindowResizes", default: false) } diff --git a/Loop/Helpers/Views/BetaIndicator.swift b/Loop/Helpers/Views/BetaIndicator.swift new file mode 100644 index 00000000..4b653995 --- /dev/null +++ b/Loop/Helpers/Views/BetaIndicator.swift @@ -0,0 +1,30 @@ +// +// BetaIndicator.swift +// Loop +// +// Created by Kai Azim on 2023-09-02. +// + +import SwiftUI + +struct BetaIndicator: View { + let text: String + let color: Color + + init(_ text: String, color: Color = .green) { + self.text = text + self.color = color + } + + var body: some View { + Text(text) + .font(.caption2) + .padding(.horizontal, 4) + .padding(.vertical, 2) + .background { + RoundedRectangle(cornerRadius: 50) + .stroke(lineWidth: 1) + } + .foregroundStyle(color) + } +} diff --git a/Loop/Helpers/VisualEffectView.swift b/Loop/Helpers/Views/VisualEffectView.swift similarity index 100% rename from Loop/Helpers/VisualEffectView.swift rename to Loop/Helpers/Views/VisualEffectView.swift diff --git a/Loop/Settings/Views/GeneralSettingsView.swift b/Loop/Settings/Views/GeneralSettingsView.swift index b2ce46a9..a70c9afb 100644 --- a/Loop/Settings/Views/GeneralSettingsView.swift +++ b/Loop/Settings/Views/GeneralSettingsView.swift @@ -20,6 +20,7 @@ struct GeneralSettingsView: View { @Default(.gradientColor) var gradientColor @Default(.currentIcon) var currentIcon @Default(.timesLooped) var timesLooped + @Default(.animateWindowResizes) var animateWindowResizes let iconManager = IconManager() @@ -37,6 +38,13 @@ struct GeneralSettingsView: View { try? SMAppService().unregister() } } + + Toggle(isOn: $animateWindowResizes, label: { + HStack { + Text("Animate windows being resized") + BetaIndicator("BETA") + } + }) } Section("Loop's icon") {