-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement auto-close creatives on nav away #72
Conversation
rsmith-attentive
commented
Jan 16, 2024
•
edited
Loading
edited
- Auto closes creative on nav away
- Updates example app to have tab nav for testing the above behavior
- Adds scroll to example app
- adds test for new behavior
- More logging to help debugging efforts
Signed-off-by: Reagan Smith <[email protected]>
Signed-off-by: Reagan Smith <[email protected]>
…ttentive-ios-sdk into rsmith/tab-navigation
Sources/ATTNSDK.m
Outdated
@@ -100,9 +101,10 @@ - (void)trigger:(UIView *)theView handler:(ATTNCreativeTriggerCompletionHandler) | |||
|
|||
[[wkWebViewConfiguration userContentController] addScriptMessageHandler:self name:@"log"]; | |||
|
|||
NSString *userScriptWithEventListener = @"window.addEventListener('message', (event) => {if (event.data && event.data.__attentive && event.data.__attentive.action === 'CLOSE') {window.webkit.messageHandlers.log.postMessage(event.data.__attentive.action);}}, false);"; | |||
NSString *userScriptWithEventListener = @"window.addEventListener('message', (event) => {if (event.data && event.data.__attentive) {window.webkit.messageHandlers.log.postMessage(event.data.__attentive.action);}}, false);window.addEventListener('visibilitychange', (event) => {window.webkit.messageHandlers.log.postMessage(`Document Hidden: ${document.hidden}`);}, false);"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest moving the message Document Hidden: ${document.hidden}
to a variable/function that we can template. The message as it stands is a little too "rich" in my opinion (various capitalizations, punctuation, spacing, etc) to be manually matched against down below. Maybe generate the string using a function like generateVisibilityEvent(visibility: boolean): string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point, will update
ExampleSwift/Podfile
Outdated
@@ -5,6 +5,6 @@ target 'ExampleSwift - Pod' do | |||
use_frameworks! | |||
|
|||
# Pods for Example | |||
pod 'attentive-ios-sdk' | |||
pod 'attentive-ios-sdk', '0.4.3-beta.1' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we always going to want to define the exact version for the example app now? So in future version changes we'll want to bump this as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong conviction either way. This change was to test out the beta functionality of cocoapods, but I can revert now that we know it works as expected.