Files
AFFiNE-Mirror/packages/frontend/apps/ios/App/App/AffineViewController+AIButton.swift
T
Lakr b46bf91575 fix(ios): add AI privacy consent alert (#14421)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **New Features**
* Added AI feature consent flow requiring user agreement before enabling
AI capabilities.
* Added calendar integration support including CalDAV account linking
and management.
* Expanded workspace administration capabilities with detailed workspace
analytics and configuration options.

* **Improvements**
  * Enhanced workspace sharing and configuration controls.
  * Added support for calendar provider presets and subscriptions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-02-12 18:25:18 +08:00

45 lines
1.4 KiB
Swift

//
// AffineViewController+AIButton.swift
// App
//
// Created by on 2025/1/8.
//
import Intelligents
import UIKit
extension AFFiNEViewController: IntelligentsButtonDelegate {
private static let aiConsentKey = "com.affine.intelligents.userConsented"
private var hasUserConsented: Bool {
UserDefaults.standard.bool(forKey: Self.aiConsentKey)
}
func onIntelligentsButtonTapped(_: IntelligentsButton) {
if hasUserConsented {
presentIntelligentsController()
return
}
showAIConsentAlert()
}
private func presentIntelligentsController() {
let controller = IntelligentsController()
present(controller, animated: true)
}
private func showAIConsentAlert() {
let alert = UIAlertController(
title: "AI Feature Data Usage",
message: "To provide AI-powered features, your input (such as document content and conversation messages) will be sent to a third-party AI service for processing. This data is used solely to generate responses and is not used for any other purpose.\n\nBy continuing, you agree to share this data with the AI service.",
preferredStyle: .alert
)
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel))
alert.addAction(UIAlertAction(title: "Agree & Continue", style: .default) { [weak self] _ in
UserDefaults.standard.set(true, forKey: Self.aiConsentKey)
self?.presentIntelligentsController()
})
present(alert, animated: true)
}
}