Skip to content
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

Merged
merged 18 commits into from
Jan 31, 2024

Conversation

rsmith-attentive
Copy link
Contributor

@rsmith-attentive rsmith-attentive commented Jan 16, 2024

  • 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

@rsmith-attentive rsmith-attentive marked this pull request as ready for review January 16, 2024 21:19
@@ -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);";
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, will update

@@ -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'
Copy link
Contributor

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?

Copy link
Contributor Author

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.

TWaltze
TWaltze previously approved these changes Jan 31, 2024
@rsmith-attentive rsmith-attentive merged commit fe41dcc into main Jan 31, 2024
2 checks passed
@rsmith-attentive rsmith-attentive deleted the rsmith/tab-navigation branch January 31, 2024 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants