Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 51 additions & 4 deletions AudioKitSynthOne.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,7 @@
A02F99CB702A38B4BC2953CB /* [CP] Embed Pods Frameworks */,
C474D95D1F13172B00946035 /* Embed App Extensions */,
C4421AA920B81D0500BE9F12 /* ShellScript */,
E7D6C04A7C9CD186F83F6195 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -1738,10 +1739,32 @@
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AudioKitSynthOne/Pods-AudioKitSynthOne-frameworks.sh",
"${BUILT_PRODUCTS_DIR}/Disk/Disk.framework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Audiobus/Audiobus.framework/Audiobus",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignal/OneSignalFramework.framework/OneSignalFramework",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalCore/OneSignalCore.framework/OneSignalCore",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalExtension/OneSignalExtension.framework/OneSignalExtension",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalInAppMessages/OneSignalInAppMessages.framework/OneSignalInAppMessages",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalLiveActivities/OneSignalLiveActivities.framework/OneSignalLiveActivities",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalLocation/OneSignalLocation.framework/OneSignalLocation",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalNotifications/OneSignalNotifications.framework/OneSignalNotifications",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalOSCore/OneSignalOSCore.framework/OneSignalOSCore",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalOutcomes/OneSignalOutcomes.framework/OneSignalOutcomes",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/OneSignalXCFramework/OneSignalUser/OneSignalUser.framework/OneSignalUser",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Disk.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Audiobus.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalFramework.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalExtension.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalInAppMessages.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalLiveActivities.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalLocation.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalNotifications.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalOSCore.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalOutcomes.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/OneSignalUser.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
Expand All @@ -1761,6 +1784,28 @@
shellPath = /bin/sh;
shellScript = "#if which swiftlint >/dev/null; then\n#swiftlint\n#else\n#echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\n#fi\n";
};
E7D6C04A7C9CD186F83F6195 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-AudioKitSynthOne/Pods-AudioKitSynthOne-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/AppCenter/AppCenterAnalytics.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/AppCenter/AppCenter.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/AppCenter/AppCenterCrashes.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AppCenterAnalytics.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AppCenter.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AppCenterCrashes.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-AudioKitSynthOne/Pods-AudioKitSynthOne-resources.sh\"\n";
showEnvVarsInLog = 0;
};
F326D17312DDE12585405CB6 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -2243,12 +2288,13 @@
DEVELOPMENT_TEAM = 9W69ZP8S5F;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.3;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.audiokitpro.AudioKitSynthOne.OneSignalNotificationServiceExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -2270,12 +2316,13 @@
DEVELOPMENT_TEAM = 9W69ZP8S5F;
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = OneSignalNotificationServiceExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.3;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 1.4.1;
PRODUCT_BUNDLE_IDENTIFIER = com.audiokitpro.AudioKitSynthOne.OneSignalNotificationServiceExtension;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SWIFT_OBJC_BRIDGING_HEADER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down Expand Up @@ -2435,7 +2482,7 @@
DEVELOPMENT_TEAM = 9W69ZP8S5F;
GCC_OPTIMIZATION_LEVEL = 0;
INFOPLIST_FILE = AudioKitSynthOne/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -2479,7 +2526,7 @@
DEVELOPMENT_TEAM = 9W69ZP8S5F;
GCC_OPTIMIZATION_LEVEL = fast;
INFOPLIST_FILE = AudioKitSynthOne/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
Expand Down
21 changes: 8 additions & 13 deletions AudioKitSynthOne/AppDelegate+PlatformServices.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,24 @@

import Foundation
#if !targetEnvironment(macCatalyst)
import OneSignal
import OneSignalFramework
import AppCenter
import AppCenterAnalytics
import AppCenterCrashes

extension AppDelegate {
public func initializePlatformServices() {
let onesignalInitSettings = [kOSSettingsKeyAutoPrompt: false]

// Set your OneSignal App ID in the Private.swift file.
OneSignal.initWithLaunchOptions(launchOptions,
appId: Private.OneSignalAppID,
handleNotificationAction: nil,
settings: onesignalInitSettings)

OneSignal.inFocusDisplayType = OSNotificationDisplayType.notification
// OneSignal 5.x no longer auto-prompts; permission is requested explicitly
// from Manager+PushNotification (pushPopUp).
OneSignal.initialize(Private.OneSignalAppID, withLaunchOptions: launchOptions)

// Setup AppCenter for Crash Log Collection
if (Private.AppCenterAPIKey != "***REMOVED***") {
MSAppCenter.start(Private.AppCenterAPIKey, withServices:[
MSAnalytics.self,
MSCrashes.self
])
AppCenter.start(withAppSecret: Private.AppCenterAPIKey, services: [
Analytics.self,
Crashes.self
])
}
}
}
Expand Down
108 changes: 66 additions & 42 deletions AudioKitSynthOne/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

let conductor = Conductor.sharedInstance

var window: UIWindow?

var launchOptions: [UIApplication.LaunchOptionsKey: Any]?

/// URL the app was launched with (TuneUp). The window/scene is created by
/// SceneDelegate, which captures any launch URL here for later retrieval.
var launchURL: URL?

func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

Expand All @@ -36,54 +38,93 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
// Start Audio Engine
conductor.start()

// Determine iPhone or iPad
return true
}

func applicationWillTerminate(_ application: UIApplication) {

// Called when the application is about to terminate.
// Save data if appropriate. See also sceneDidEnterBackground:.
conductor.stopEngine()
}

func canOpenURL(_ url: URL) -> Bool {

return true
}
}

extension AppDelegate {

public func applicationLaunchedWithURL() -> URL? {

let launchUrl = self.launchURL
self.launchURL = nil
return launchUrl
}
}

// MARK: - Scene Lifecycle

/// iOS 13+ requires apps to adopt the UIScene lifecycle (enforced as a fatal
/// runtime issue starting iOS 26/27). This scene delegate owns the window and
/// carries over the behaviour that used to live in AppDelegate.
class SceneDelegate: UIResponder, UIWindowSceneDelegate {

var window: UIWindow?

private var conductor = Conductor.sharedInstance

func scene(_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = scene as? UIWindowScene else { return }

// Capture a launch URL (TuneUp) so applicationLaunchedWithURL() can return it.
if let launchURL = connectionOptions.urlContexts.first?.url {
(UIApplication.shared.delegate as? AppDelegate)?.launchURL = launchURL
}

let window = UIWindow(windowScene: windowScene)
let mainStoryboard = UIStoryboard(name: "Main", bundle: Bundle.main)

// Determine iPhone or iPad
if conductor.device == .pad {
window?.rootViewController = mainStoryboard.instantiateInitialViewController()
window.rootViewController = mainStoryboard.instantiateInitialViewController()
} else {
window?.rootViewController = mainStoryboard.instantiateViewController(withIdentifier: "iPhoneParentVC")
window.rootViewController = mainStoryboard.instantiateViewController(withIdentifier: "iPhoneParentVC")
}
window?.makeKeyAndVisible()

return true
self.window = window
window.makeKeyAndVisible()
}

func applicationDidEnterBackground(_ application: UIApplication) {

func sceneDidEnterBackground(_ scene: UIScene) {
conductor.checkIAAConnectionsEnterBackground()
}


func applicationWillEnterForeground(_ application: UIApplication) {

func sceneWillEnterForeground(_ scene: UIScene) {
conductor.checkIAAConnectionsEnterForeground()
}

func applicationWillResignActive(_ application: UIApplication) {

func sceneWillResignActive(_ scene: UIScene) {
// Prevent app from sleeping if never sleep is toggled on
// Toggle back to sleep mode after 1 minutes
// Toggle back to sleep mode after 1 minute
DispatchQueue.main.asyncAfter(deadline: .now() + 60) {
UIApplication.shared.isIdleTimerDisabled = false
}

UIApplication.shared.isIdleTimerDisabled = conductor.neverSleep
}

func applicationWillTerminate(_ application: UIApplication) {

// Called when the application is about to terminate.
// Save data if appropriate. See also applicationDidEnterBackground:.
conductor.stopEngine()
UIApplication.shared.isIdleTimerDisabled = conductor.neverSleep
}

/// TuneUp
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
guard let url = URLContexts.first?.url else { return }

// on launch tuningsPanel is not yet created -> fall back to tunings model initialization
guard let tuningsPanel = conductor.viewControllers.first(where: { $0 is TuningsPanelController })
as? TuningsPanelController else {
return true
return
}

// open url
Expand All @@ -98,22 +139,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
AKLog("error removing temporary file at \(url): \(error)")
}
}

return true
}

func canOpenURL(_ url: URL) -> Bool {

return true
}
}

extension AppDelegate {

public func applicationLaunchedWithURL() -> URL? {

let launchUrl = self.launchOptions?[.url] as? URL
self.launchOptions = nil
return launchUrl
}
}
2 changes: 1 addition & 1 deletion AudioKitSynthOne/DSP/AudioKitSynthOne-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import "S1Parameter.h"
#import "AKSynthOneRate.h"
#if !TARGET_OS_MACCATALYST
#import "Audiobus.h"
#import <Audiobus/Audiobus.h>
#endif
// Set the ABLETON_ENABLED user setting to 1 (at the project level) to enable Ableton Link support
// Note: you will need the files from their SDK!
Expand Down
19 changes: 17 additions & 2 deletions AudioKitSynthOne/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,23 @@
<string>audio</string>
<string>remote-notification</string>
</array>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict>
<key>UIWindowSceneSessionRoleApplication</key>
<array>
<dict>
<key>UISceneConfigurationName</key>
<string>Default Configuration</string>
<key>UISceneDelegateClassName</key>
<string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
</dict>
</array>
</dict>
</dict>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
6 changes: 3 additions & 3 deletions AudioKitSynthOne/Manager/Manager+PushNotification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import Foundation

#if !targetEnvironment(macCatalyst)
import OneSignal
import OneSignalFramework
extension Manager {

func pushPopUp() {
Expand All @@ -23,9 +23,9 @@ extension Manager {
let submitAction = UIAlertAction(title: "Yes! 👍🏼", style: .default) { (_) in
self.appSettings.pushNotifications = true
self.saveAppSettingValues()
OneSignal.promptForPushNotifications(userResponse: { accepted in
OneSignal.Notifications.requestPermission({ accepted in
print("User accepted notifications: \(accepted)")
})
}, fallbackToSettings: true)
}

let cancelAction = UIAlertAction(title: "Later", style: .default) { (_) in
Expand Down
10 changes: 6 additions & 4 deletions OneSignalNotificationServiceExtension/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import UserNotifications

import OneSignal
import OneSignalExtension

class NotificationService: UNNotificationServiceExtension {

Expand All @@ -23,8 +23,9 @@ class NotificationService: UNNotificationServiceExtension {
bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)

if let bestAttemptContent = bestAttemptContent {
OneSignal.didReceiveNotificationExtensionRequest(self.receivedRequest, with: self.bestAttemptContent)
contentHandler(bestAttemptContent)
OneSignalExtension.didReceiveNotificationExtensionRequest(self.receivedRequest,
with: bestAttemptContent,
withContentHandler: contentHandler)
}
}

Expand All @@ -33,7 +34,8 @@ class NotificationService: UNNotificationServiceExtension {
// Use this as an opportunity to deliver your "best attempt" at modified content,
// otherwise the original push payload will be used.
if let contentHandler = contentHandler, let bestAttemptContent = bestAttemptContent {
OneSignal.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
OneSignalExtension.serviceExtensionTimeWillExpireRequest(self.receivedRequest,
with: bestAttemptContent)
contentHandler(bestAttemptContent)
}
}
Expand Down
Loading