OnLaunch 是一项允许应用程序开发者通知应用用户关于更新、警告和维护的服务。我们的开源框架提供了一个易于集成的客户端,用于与后端通信并显示用户界面。
您可以使用 Swift Package Manager 将 OnLaunch
集成到您的项目中。
https://github.com/kula-app/OnLaunch-iOS-Client
main
为最新的开发版本)。OnLaunch
的目标。OnLaunch
iOS 客户端导入到您的 App
文件中import OnLaunch
View
上应用配置视图修饰符以设置您的公钥@main
struct MainApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.configureOnLaunch { options in
// Configure the public key to authenticate with the API endpoint
options.publicKey = "<YOUR PUBLIC APP KEY>"
}
}
}
}
options
来配置 OnLaunch
客户端...
.configureOnLaunch { options in
// Configure the public key to authenticate with the API endpoint
options.publicKey = "<YOUR PUBLIC APP KEY>"
// (Optional) Configure a custom base URL to your API host
// options.baseURL = "https://your-domain.com/api"
}
...
OnLaunch
iOS 客户端导入到您的 SceneDelegate
文件中import OnLaunch
hostScene
func sceneDidBecomeActive(_ scene: UIScene) {
OnLaunch.configure { options in
// Configure the public key to authenticate with the API endpoint
options.publicKey = "K2UX4fVPFyixVaeLn8Fky_uWhjMr-frADqKqpOCZW2c"
// Configure the host scene to present the UI
options.hostScene = scene
// or: configure the host view controller to present the UI
// options.hostViewController = (scene as? UIWindowScene)?.keyWindow?.rootViewController
}
}
options
来配置 OnLaunch
客户端...
.configureOnLaunch { options in
// Configure the public key to authenticate with the API endpoint
options.publicKey = "<YOUR PUBLIC APP KEY>"
// (Optional) Configure a custom base URL to your API host
// options.baseURL = "https://your-domain.com/api"
}
...
如果您的应用不使用场景,您也可以在 AppDelegate
中配置 OnLaunch。
OnLaunch iOS 客户端提供了一些配置选项
名称 | 描述 | 默认值 |
---|---|---|
baseURL |
OnLaunch API 托管的基本 URL。 更改此设置以指向您自托管的 OnLaunch 服务器实例。 | https://api.onlaunch.app/api/ |
publicKey |
用于向 API 验证身份的公钥 | |
shouldCheckOnConfigure |
一个标志,指示客户端是否应在配置后立即检查新消息。 | true |
hostScene |
用于托管 OnLaunch 客户端 UI 的场景。 如果您将 UIKit 与场景一起使用,则为必需 | |
hostViewController |
用于托管 OnLaunch 客户端 UI 的 UIViewController 实例。 如果您将 UIKit 与不使用场景,则为必需 |
|
theme |
OnLaunch 客户端 UI 使用的自定义主题。 调整这些值以更改主题以匹配您的偏好。 要查看所有可能的配置值,请参阅 Theme.swift |
Theme.swift 中 Theme.standard 中定义的默认值 Theme.swift |
bundleId |
服务器端规则使用的捆绑包标识符。 | 使用 Bundle.main.bundleIdentifier 中设置的值 |
bundleVersion |
标识捆绑包迭代的构建版本。 | 在 Info.plist 中定义的 CFBundleVersion |
releaseVersion |
捆绑包的发布版本或版本号。 | 在 Info.plist 中定义的 CFBundleShortVersionString |
appStoreId |
应用在 App Store 中的 ID。 如果未定义,则 ActionType.openInAppStore 将抛出非崩溃断言 |
请参阅我们的贡献指南。
在 MIT 许可证下分发