Do some housekeeping (#347)
- Be consistent with on-demand rules - Use shortcut reduce(into:)
This commit is contained in:
parent
c80d17ceb4
commit
0f84859354
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue