Do some housekeeping (#347)

- Be consistent with on-demand rules
- Use shortcut reduce(into:)
This commit is contained in:
Davide De Rosa 2023-09-08 16:20:42 +02:00 committed by GitHub
parent c80d17ceb4
commit 0f84859354
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 5 deletions

View File

@ -50,7 +50,7 @@ final class IntentsManager: NSObject, ObservableObject {
isReloadingShortcuts = true isReloadingShortcuts = true
do { do {
let vs = try await INVoiceShortcutCenter.shared.allVoiceShortcuts() let vs = try await INVoiceShortcutCenter.shared.allVoiceShortcuts()
shortcuts = vs.reduce(into: [UUID: Shortcut]()) { shortcuts = vs.reduce(into: [:]) {
$0[$1.identifier] = Shortcut($1) $0[$1.identifier] = Shortcut($1)
} }
isReloadingShortcuts = false isReloadingShortcuts = false

View File

@ -58,11 +58,9 @@ private extension Profile.OnDemand {
// apply exceptions (unless .any) // apply exceptions (unless .any)
if withCustomRules && policy != .any { if withCustomRules && policy != .any {
#if os(iOS)
if Utils.hasCellularData() && withMobileNetwork { if Utils.hasCellularData() && withMobileNetwork {
rules.append(cellularRule()) rules.append(cellularRule())
} }
#endif
if Utils.hasEthernet() && withEthernetNetwork { if Utils.hasEthernet() && withEthernetNetwork {
if let rule = ethernetRule() { if let rule = ethernetRule() {
rules.append(rule) rules.append(rule)

View File

@ -39,7 +39,7 @@ extension Profile.Account: StrippableContent {
extension Profile.OnDemand: StrippableContent { extension Profile.OnDemand: StrippableContent {
public var stripped: Self { public var stripped: Self {
var copy = self var copy = self
copy.withSSIDs = copy.withSSIDs.reduce(into: [String: Bool]()) { copy.withSSIDs = copy.withSSIDs.reduce(into: [:]) {
guard let strippedKey = $1.key.strippedNotEmpty else { guard let strippedKey = $1.key.strippedNotEmpty else {
return return
} }

View File

@ -111,7 +111,7 @@ private extension CDProfileRepository {
context: context, context: context,
request: request, request: request,
mapping: { mapping: {
$0.reduce(into: [UUID: Profile]()) { $0.reduce(into: [:]) {
guard let dto = $1 as? CDProfile else { guard let dto = $1 as? CDProfile else {
return return
} }