mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-04 00:44:35 +00:00
iOS: gate capabilities by permissions and add settings controls
This commit is contained in:
committed by
mbelinky
parent
39816e61b0
commit
660b6025de
22
apps/ios/Sources/Model/NodeAppModel+Permissions.swift
Normal file
22
apps/ios/Sources/Model/NodeAppModel+Permissions.swift
Normal file
@@ -0,0 +1,22 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
@MainActor
|
||||
extension NodeAppModel {
|
||||
func permissionSnapshot() -> IOSPermissionSnapshot {
|
||||
IOSPermissionCenter.statusSnapshot()
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func requestPermission(_ permission: IOSPermissionKind) async -> IOSPermissionSnapshot {
|
||||
_ = await IOSPermissionCenter.request(permission)
|
||||
return IOSPermissionCenter.statusSnapshot()
|
||||
}
|
||||
|
||||
func openSystemSettings() {
|
||||
guard let url = URL(string: UIApplication.openSettingsURLString) else {
|
||||
return
|
||||
}
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user