mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-26 04:18:37 +00:00
iOS: gate capabilities by permissions and add settings controls (#22135)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: 92c2660d08
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Co-authored-by: mbelinky <132747814+mbelinky@users.noreply.github.com>
Reviewed-by: @mbelinky
This commit is contained in:
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