유저가 앱을 푸시를 통해 실행했을 때, 홈이 아닌 다른 뷰를 열어둔 상황에서 푸시를 수신했을 때 등의 여러 상황을 고려하여 푸시 수신시 동작을 정의합니다.
Braze는 SPM과 CocoaPods 모두로 탑재할 수 있습니다.
본 서비스의 경우 SPM으로 탑재한 SDK가 존재하지 않아 Braze도 CocoaPods로 탑재하였습니다.
인앱메세지 탑재가 필요한 경우 BrazeUI도 함께 탑재해야 합니다. 본 서비스의 경우 인앱 메세지를 탑재하여 BrazeKit 과 동일한 버전의 BrazeUI 도 pod으로 설치하였습니다.
// AppDelegate
import BrazeKit
class AppDelegate: UIResponder, UIApplicationDelegate {
static var braze: Braze? = nil
}
// application:didFinishLaunchingWithOptions: method
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
// Braze
Braze.prepareForDelayedInitialization(pushAutomation: true)
let brazeConfig = Braze.Configuration(apiKey: Constants.BRAZE_API_KEY, endpoint: Constants.BRAZE_SDK_END_POINT)
brazeConfig.logger.level = .debug
let braze = Braze(configuration: brazeConfig)
AppDelegate.braze = braze
// Push integration
// BrazeUI: InAppMessaging
...
}