mirror of
https://github.com/confirmedcode/Lockdown-iOS.git
synced 2025-12-21 12:14:02 +01:00
40 lines
1.1 KiB
Swift
40 lines
1.1 KiB
Swift
//
|
|
// IntentService.swift
|
|
// Lockdown
|
|
//
|
|
// Created by Alexander Parshakov on 12/7/22
|
|
// Copyright © 2022 Confirmed Inc. All rights reserved.
|
|
//
|
|
|
|
import CocoaLumberjackSwift
|
|
import Intents
|
|
|
|
final class IntentService {
|
|
|
|
static func donateIntents() {
|
|
INPreferences.requestSiriAuthorization { status in
|
|
switch status {
|
|
case .authorized:
|
|
DDLogInfo("User allowed access to Siri.")
|
|
|
|
self.donateDisableVPNIntent()
|
|
self.donateEnableVPNIntent()
|
|
default:
|
|
DDLogInfo("User denied access to Siri.")
|
|
}
|
|
}
|
|
}
|
|
|
|
private static func donateDisableVPNIntent() {
|
|
let intent = DisableVPNIntent()
|
|
let interaction = INInteraction(intent: intent, response: nil)
|
|
interaction.donate(completion: nil)
|
|
}
|
|
|
|
private static func donateEnableVPNIntent() {
|
|
let intent = EnableVPNIntent()
|
|
let interaction = INInteraction(intent: intent, response: nil)
|
|
interaction.donate(completion: nil)
|
|
}
|
|
}
|