Slide 40
Slide 40 text
func test_thatACustomPushPromptInAppMessage_shouldNotShow_ifTheFeatureSwichIsEnabled() {
// There is a feature switch, "enable_immediate_notification_request",
// that reverts to the old behavior; meaning we should not prompt
// the message.
let delegate = LocalInAppMessageControllerDelegate()
inAppMessageModal.extras = ["custom_push_prompt": "true"]
withFeatures([EnableImmediateNotificationRequest]) {
XCTAssertEqual(delegate.shouldShowCustomPushPrompt(
for: inAppMessageModal,
notificationCenter: MockNotificationRequester(authorizationStatus: .authorized)), .shouldNotShow
)
XCTAssertEqual(delegate.shouldShowCustomPushPrompt(
for: inAppMessageModal,
notificationCenter: MockNotificationRequester(authorizationStatus: .denied)), .shouldNotShow
)
if #available(iOS 12.0, *) {
XCTAssertEqual(delegate.shouldShowCustomPushPrompt(
for: inAppMessageModal,
notificationCenter: MockNotificationRequester(authorizationStatus: .provisional)), .shouldNotShow
)
}
XCTAssertEqual(delegate.shouldShowCustomPushPrompt(
for: inAppMessageModal,
notificationCenter: MockNotificationRequester(authorizationStatus: .notDetermined)), .shouldNotShow
)
}
}
36 — @basthomas