mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
feat(ios): create paywall api (#13602)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Introduced a new iOS Paywall plugin with a simple API to display a paywall and receive a success response. - Added JavaScript wrapper and type definitions for easy integration. - Refactor - Reorganized the iOS project structure for plugins. - Chores - Removed unused legacy iOS plugins to streamline the app and reduce build complexity. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import Capacitor
|
||||
import Foundation
|
||||
|
||||
@objc(PayWallPlugin)
|
||||
public class PayWallPlugin: CAPPlugin, CAPBridgedPlugin {
|
||||
public let identifier = "PayWallPlugin"
|
||||
public let jsName = "PayWall"
|
||||
public let pluginMethods: [CAPPluginMethod] = [
|
||||
CAPPluginMethod(name: "showPayWall", returnType: CAPPluginReturnPromise),
|
||||
]
|
||||
|
||||
@objc func showPayWall(_ call: CAPPluginCall) {
|
||||
do {
|
||||
let type = try call.getStringEnsure("type")
|
||||
|
||||
// TODO: Implement actual paywall logic here
|
||||
// For now, just log the type and resolve
|
||||
print("PayWall: Showing paywall of type: \(type)")
|
||||
|
||||
call.resolve(["success": true, "type": type])
|
||||
} catch {
|
||||
call.reject("Failed to show paywall", nil, error)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user