Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
193 changes: 117 additions & 76 deletions .swiftformat
Original file line number Diff line number Diff line change
@@ -1,87 +1,128 @@
--acronyms ID,URL,UUID
--allman false
--anonymousforeach convert
--assetliterals visual-width
--asynccapturing
--beforemarks
--binarygrouping 4,8
--categorymark "MARK: %c"
--classthreshold 0
--closingparen balanced
--closurevoid remove
--commas inline
--conflictmarkers reject
--decimalgrouping 3,6
--doccomments before-declarations
--elseposition same-line
--emptybraces no-space
--enumnamespaces always
--enumthreshold 0
--exponentcase lowercase
--exponentgrouping disabled
--extensionacl on-extension
--extensionlength 0
--extensionmark "MARK: - %t + %c"
--fractiongrouping disabled
--allow-partial-wrapping true
--anonymous-for-each convert
--asset-literals visual-width
--async-capturing
--before-marks
--binary-grouping 4,8
--blank-line-after-switch-case multiline-only
--call-site-paren balanced
--category-mark "MARK: %c"
--class-threshold 0
--closing-paren balanced
--closure-void remove
--complex-attributes preserve
--computed-var-attributes preserve
--conditional-assignment after-property
--conflict-markers reject
--date-format system
--decimal-grouping 3,6
--default-test-suite-attributes
--doc-comments before-declarations
--else-position same-line
--empty-braces no-space
--enum-namespaces always
--enum-threshold 0
--equatable-macro none
--exponent-case lowercase
--exponent-grouping disabled
--extension-acl on-extension
--extension-mark "MARK: - %t + %c"
--extension-threshold 0
--file-macro "#file"
--fraction-grouping disabled
--fragment false
--funcattributes preserve
--generictypes
--groupedextension "MARK: %c"
--guardelse auto
--func-attributes preserve
--generic-types
--group-blank-lines true
--grouped-extension "MARK: %c"
--guard-else auto
--header ignore
--hexgrouping 4,8
--hexliteralcase uppercase
--hex-grouping 4,8
--hex-literal-case uppercase
--ifdef indent
--importgrouping alpha
--import-grouping alpha
--indent 4
--indentcase false
--indentstrings false
--indent-case false
--indent-strings false
--inferred-types always
--init-coder-nil false
--language-mode 0
--lifecycle
--lineaftermarks true
--line-after-marks true
--line-between-guards false
--linebreaks lf
--markcategories true
--markextensions always
--marktypes always
--maxwidth none
--modifierorder
--nevertrailing
--nospaceoperators ...
--nowrapoperators
--octalgrouping 4,8
--onelineforeach ignore
--operatorfunc spaced
--organizetypes actor,class,enum,struct
--patternlet hoist
--mark-categories true
--mark-class-threshold 0
--mark-enum-threshold 0
--mark-extension-threshold 0
--mark-extensions always
--mark-struct-threshold 0
--mark-types always
--markdown-files ignore
--max-width none
--modifier-order
--never-trailing
--nil-init remove
--no-space-operators ...
--no-wrap-operators
--non-complex-attributes
--octal-grouping 4,8
--operator-func spaced
--organization-mode visibility
--organize-types actor,class,enum,struct
--pattern-let hoist
--prefer-synthesized-init-for-internal-structs never
--preserve-acronyms
--preserve-decls
--preserved-property-types Package
--property-types infer-locals-only
--ranges spaced
--redundanttype infer-locals-only
--redundant-async tests-only
--redundant-throws tests-only
--self init-only
--selfrequired
--semicolons inline
--shortoptionals except-properties
--smarttabs enabled
--someany true
--stripunusedargs always
--structthreshold 0
--swiftversion 6.0
--tabwidth unspecified
--throwcapturing
--trailingclosures
--trimwhitespace always
--typeattributes preserve
--typeblanklines remove
--typemark "MARK: - %t"
--varattributes preserve
--voidtype tuple
--wraparguments preserve
--wrapcollections preserve
--wrapconditions preserve
--wrapeffects preserve
--wrapenumcases always
--wrapparameters default
--wrapreturntype preserve
--wrapternary default
--wraptypealiases preserve
--xcodeindentation disabled
--yodaswap always
--disable wrapMultilineStatementBraces
--self-required
--semicolons inline-only
--short-optionals except-properties
--single-line-for-each ignore
--smart-tabs enabled
--some-any true
--sort-swiftui-properties none
--sorted-patterns
--stored-var-attributes preserve
--strip-unused-args always
--struct-threshold 0
--swift-version 6.0
--tab-width unspecified
--throw-capturing
--timezone system
--trailing-closures
--trailing-commas never
--trim-whitespace always
--type-attributes preserve
--type-blank-lines remove
--type-body-marks preserve
--type-delimiter space-after
--type-mark "MARK: - %t"
--type-marks
--type-order
--url-macro none
--visibility-marks
--visibility-order
--void-type tuple
--wrap-arguments before-first
--wrap-collections preserve
--wrap-conditions preserve
--wrap-effects preserve
--wrap-enum-cases always
--wrap-parameters default
--wrap-return-type preserve
--wrap-string-interpolation default
--wrap-ternary default
--wrap-type-aliases preserve
--xcode-indentation disabled
--xctest-symbols
--yoda-swap always
--disable genericExtensions,redundantProperty,simplifyGenericConstraints,wrapMultilineStatementBraces,wrapPropertyBodies
--enable isEmpty
8 changes: 8 additions & 0 deletions Loop.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@
DEVELOPMENT_TEAM = 5F967GYF84;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -257,6 +259,7 @@
MARKETING_VERSION = "$(VERSION)";
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
STRING_CATALOG_GENERATE_SYMBOLS = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEVELOPMENT;
Expand Down Expand Up @@ -292,6 +295,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.MrKai77.Loop;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -345,6 +349,7 @@
DEVELOPMENT_TEAM = 5F967GYF84;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
Expand Down Expand Up @@ -414,6 +419,7 @@
DEVELOPMENT_TEAM = 5F967GYF84;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu11;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand Down Expand Up @@ -461,6 +467,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.MrKai77.Loop;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -498,6 +505,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.MrKai77.Loop;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_APPROACHABLE_CONCURRENCY = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2600"
LastUpgradeVersion = "2620"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Loop.xcodeproj/xcshareddata/xcschemes/Loop.xcscheme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "2600"
LastUpgradeVersion = "2620"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
7 changes: 4 additions & 3 deletions Loop/Accent Color/AccentColorController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SwiftUI

/// In charge of processing and storing an up-to-date version of the user's accent color(s), according to their settings.
/// Automatically refreshes when the user updates the following preferences: `accentColorMode`, `customAccentColor`, `useGradient` and `gradientColor`.
@Loggable
@MainActor
final class AccentColorController: ObservableObject {
static let shared = AccentColorController()
Expand Down Expand Up @@ -49,16 +50,16 @@ final class AccentColorController: ObservableObject {
func refresh(ignoreThrottle: Bool = false) async {
switch Defaults[.accentColorMode] {
case .system:
Log.info("Refreshing accent color based on system accent setting", category: .accentColorController)
log.info("Refreshing accent color based on system accent setting")
color1 = Color.accentColor
color2 = Defaults[.useGradient] ? Color(nsColor: NSColor.controlAccentColor.blended(withFraction: 0.5, of: .black)!) : Color.accentColor
case .wallpaper:
Log.info("Refreshing accent color based on wallpaper analysis", category: .accentColorController)
log.info("Refreshing accent color based on wallpaper analysis")
let colors = await wallpaperProcessor.fetchLatest(ignoreThrottle: ignoreThrottle)
color1 = colors.primary
color2 = Defaults[.useGradient] ? colors.secondary : colors.primary
case .custom:
Log.info("Refreshing accent color based on custom selection", category: .accentColorController)
log.info("Refreshing accent color based on custom selection")
color1 = Defaults[.customAccentColor]
color2 = Defaults[.useGradient] ? Defaults[.gradientColor] : Defaults[.customAccentColor]
}
Expand Down
1 change: 1 addition & 0 deletions Loop/Accent Color/WallpaperImageFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ final class WallpaperImageFetcher {
/// The direct wallpaper capture is preferred as it gets only the wallpaper without desktop icons,
/// but requires accessibility permissions (this is accepted required for Loop, so it's fine).
/// The fallback ensures we still get colors even if permissions aren't granted.
@concurrent
func takeScreenshot() async throws -> NSImage? {
let screen = NSScreen.screenWithMouse ?? NSScreen.main ?? NSScreen.screens[0]
let screenFrame = screen.displayBounds
Expand Down
Loading