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

[5.0.0] Fix direct session influence #1288

Merged
merged 4 commits into from
Aug 10, 2023

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented Aug 8, 2023

Description

One Line Summary

Fix direct session influence to detect that we opened a notification and will send the influences to the outcomes endpoint.

Details

Motivation

We needed to track a session is started from a notification click for influences and outcomes.

Scope

Fix session logic from a notification clicked

  • This was a remaining TODO
  • Moved where appEntryState lives away from OneSignal to the OneSignalOutcomes module
  • Also server expects session_time as an int >= 1, not float

Fix Background Task Manager

  • Removed weak reference to delegate as it was immediately null after being set in startup code
  • Rename OSBackgroundTaskManagerDelegate -> OSBackgroundTaskHandler because it is not truly a delegate, but is a concrete implementation that is injected

Other

A followup PR is made to refactor background tasks further

Testing

Unit testing

No

Manual testing

iPhone 13 pro 16.6 iOS version

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

* This was a remaining TODO
* Moved where `appEntryState` lives away from `OneSignal` to the `OneSignalOutcomes` module, and lives on `OSSessionManager`
* Also server expects session_time as an int, not float
* We truncate session time to an int and it may become 0 seconds, but we will receive an error response from the server if we send 0 seconds of session_time
* Removed `weak` reference to delegate as it was immediately null after being set in startup code
* Therefore, all calls to the delegate were falling through the guard statement
@nan-li nan-li changed the title 5.0.0/fix session influence WIP 5.0.0/fix session influence Aug 9, 2023
@nan-li nan-li force-pushed the 5.0.0/fix_session_influence branch from f123761 to cd47dda Compare August 10, 2023 10:29
* Rename `OSBackgroundTaskManagerDelegate` -> `OSBackgroundTaskHandler` because it is not truly a delegate, but is a concrete implementation that is injected
@nan-li nan-li changed the title WIP 5.0.0/fix session influence [5.0.0] Fix direct session influence Aug 10, 2023
@nan-li nan-li merged commit 265277f into major_release_5.0.0 Aug 10, 2023
1 of 2 checks passed
@nan-li nan-li deleted the 5.0.0/fix_session_influence branch August 10, 2023 17:46
nan-li added a commit that referenced this pull request Oct 30, 2023
nan-li added a commit that referenced this pull request Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants