Update setup usages
This commit is contained in:
@@ -16,22 +16,23 @@ open class ExtensionProvider: NEPacketTunnelProvider {
|
|||||||
override open func startTunnel(options _: [String: NSObject]?) async throws {
|
override open func startTunnel(options _: [String: NSObject]?) async throws {
|
||||||
LibboxClearServiceError()
|
LibboxClearServiceError()
|
||||||
|
|
||||||
|
let options = LibboxSetupOptions()
|
||||||
|
options.basePath = FilePath.sharedDirectory.relativePath
|
||||||
|
options.workingPath = FilePath.workingDirectory.relativePath
|
||||||
|
options.tempPath = FilePath.cacheDirectory.relativePath
|
||||||
|
var error: NSError?
|
||||||
|
#if os(tvOS)
|
||||||
|
options.isTVOS = true
|
||||||
|
#endif
|
||||||
if let username {
|
if let username {
|
||||||
var error: NSError?
|
options.username = username
|
||||||
LibboxSetupWithUsername(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, username, &error)
|
}
|
||||||
if let error {
|
LibboxSetup(options, &error)
|
||||||
writeFatalError("(packet-tunnel) error: setup service: \(error.localizedDescription)")
|
if let error {
|
||||||
return
|
writeFatalError("(packet-tunnel) error: setup service: \(error.localizedDescription)")
|
||||||
}
|
return
|
||||||
} else {
|
|
||||||
var isTVOS = false
|
|
||||||
#if os(tvOS)
|
|
||||||
isTVOS = true
|
|
||||||
#endif
|
|
||||||
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, isTVOS)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var error: NSError?
|
|
||||||
LibboxRedirectStderr(FilePath.cacheDirectory.appendingPathComponent("stderr.log").relativePath, &error)
|
LibboxRedirectStderr(FilePath.cacheDirectory.appendingPathComponent("stderr.log").relativePath, &error)
|
||||||
if let error {
|
if let error {
|
||||||
writeFatalError("(packet-tunnel) redirect stderr error: \(error.localizedDescription)")
|
writeFatalError("(packet-tunnel) redirect stderr error: \(error.localizedDescription)")
|
||||||
|
|||||||
@@ -8,7 +8,12 @@ import UserNotifications
|
|||||||
open class ApplicationDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate {
|
open class ApplicationDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDelegate {
|
||||||
public func applicationDidFinishLaunching(_: Notification) {
|
public func applicationDidFinishLaunching(_: Notification) {
|
||||||
NSLog("Here I stand")
|
NSLog("Here I stand")
|
||||||
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, false)
|
let options = LibboxSetupOptions()
|
||||||
|
options.basePath = FilePath.sharedDirectory.relativePath
|
||||||
|
options.workingPath = FilePath.workingDirectory.relativePath
|
||||||
|
options.tempPath = FilePath.cacheDirectory.relativePath
|
||||||
|
var error: NSError?
|
||||||
|
LibboxSetup(options, &error)
|
||||||
LibboxSetLocale(Locale.current.identifier)
|
LibboxSetLocale(Locale.current.identifier)
|
||||||
let notificationCenter = UNUserNotificationCenter.current()
|
let notificationCenter = UNUserNotificationCenter.current()
|
||||||
notificationCenter.setNotificationCategories([
|
notificationCenter.setNotificationCategories([
|
||||||
|
|||||||
@@ -11,7 +11,12 @@ class ApplicationDelegate: NSObject, UIApplicationDelegate, UNUserNotificationCe
|
|||||||
|
|
||||||
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||||
NSLog("Here I stand")
|
NSLog("Here I stand")
|
||||||
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, false)
|
let options = LibboxSetupOptions()
|
||||||
|
options.basePath = FilePath.sharedDirectory.relativePath
|
||||||
|
options.workingPath = FilePath.workingDirectory.relativePath
|
||||||
|
options.tempPath = FilePath.cacheDirectory.relativePath
|
||||||
|
var error: NSError?
|
||||||
|
LibboxSetup(options, &error)
|
||||||
LibboxSetLocale(Locale.current.identifier)
|
LibboxSetLocale(Locale.current.identifier)
|
||||||
let notificationCenter = UNUserNotificationCenter.current()
|
let notificationCenter = UNUserNotificationCenter.current()
|
||||||
notificationCenter.setNotificationCategories([
|
notificationCenter.setNotificationCategories([
|
||||||
|
|||||||
@@ -7,7 +7,13 @@ import UIKit
|
|||||||
class ApplicationDelegate: NSObject, UIApplicationDelegate {
|
class ApplicationDelegate: NSObject, UIApplicationDelegate {
|
||||||
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
|
||||||
NSLog("Here I stand")
|
NSLog("Here I stand")
|
||||||
LibboxSetup(FilePath.sharedDirectory.relativePath, FilePath.workingDirectory.relativePath, FilePath.cacheDirectory.relativePath, true)
|
let options = LibboxSetupOptions()
|
||||||
|
options.basePath = FilePath.sharedDirectory.relativePath
|
||||||
|
options.workingPath = FilePath.workingDirectory.relativePath
|
||||||
|
options.tempPath = FilePath.cacheDirectory.relativePath
|
||||||
|
options.isTVOS = true
|
||||||
|
var error: NSError?
|
||||||
|
LibboxSetup(options, &error)
|
||||||
LibboxSetLocale(Locale.current.identifier)
|
LibboxSetLocale(Locale.current.identifier)
|
||||||
setup()
|
setup()
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user