mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Removed redundant trimming
This commit is contained in:
parent
8809c85957
commit
e3379eaf69
1 changed files with 4 additions and 6 deletions
|
|
@ -434,19 +434,17 @@ extension FocusModeType {
|
|||
}
|
||||
|
||||
static func resolve(identifier: String?, name: String?) -> FocusModeType {
|
||||
let trimmedName = name?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
if !trimmedName.isEmpty {
|
||||
if let name, !name.isEmpty {
|
||||
if let match = FocusModeType.allCases.first(where: {
|
||||
guard !$0.displayName.isEmpty else { return false }
|
||||
return $0.displayName.compare(trimmedName, options: [.caseInsensitive, .diacriticInsensitive]) == .orderedSame
|
||||
return $0.displayName.compare(name, options: [.caseInsensitive, .diacriticInsensitive]) == .orderedSame
|
||||
}) {
|
||||
return match
|
||||
}
|
||||
}
|
||||
|
||||
let trimmedIdentifier = identifier?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
||||
if !trimmedIdentifier.isEmpty {
|
||||
return FocusModeType(identifier: trimmedIdentifier)
|
||||
if let identifier, !identifier.isEmpty {
|
||||
return FocusModeType(identifier: identifier)
|
||||
}
|
||||
|
||||
return .doNotDisturb
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue