Skip to content

fix: prevent duplicate push metrics and deep link handling#405

Merged
levibostian merged 3 commits intolevi/reliable-open-metricsfrom
levi/reliable-open-metrics-prevent-duplicates
Nov 22, 2023
Merged

fix: prevent duplicate push metrics and deep link handling#405
levibostian merged 3 commits intolevi/reliable-open-metricsfrom
levi/reliable-open-metrics-prevent-duplicates

Conversation

@levibostian
Copy link
Copy Markdown
Contributor

@levibostian levibostian commented Nov 15, 2023

Merges into: #403

Prevent duplicate push metrics and deep link handling for push click handling.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 15, 2023

Sample app builds 📱

Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request.


  • CocoaPods-FCM: levi/reliable-open-metrics-prevent-duplicates (1700680211)
  • APN-UIKit: levi/reliable-open-metrics-prevent-duplicates (1700680213)

@levibostian levibostian marked this pull request as ready for review November 15, 2023 19:38
@levibostian levibostian requested a review from a team November 15, 2023 19:39
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 15, 2023

Codecov Report

Attention: 235 lines in your changes are missing coverage. Please review.

Comparison is base (8315118) 59.45% compared to head (95d8816) 57.75%.
Report is 29 commits behind head on levi/reliable-open-metrics.

❗ Current head 95d8816 differs from pull request most recent head 1ef285c. Consider uploading reports for the commit 1ef285c to get more accurate results

Files Patch % Lines
Sources/MessagingPush/PushClickHandler.swift 30.86% 112 Missing ⚠️
...essagingPushAPN/MessagingPushAPN+PushConfigs.swift 0.00% 35 Missing ⚠️
...essagingPushFCM/MessagingPushFCM+PushConfigs.swift 0.00% 31 Missing ⚠️
Sources/MessagingPushAPN/MessagingPushAPN.swift 0.00% 13 Missing ⚠️
Sources/MessagingPushFCM/MessagingPushFCM.swift 0.00% 13 Missing ⚠️
...rces/MessagingPush/MessagingPush+AppDelegate.swift 0.00% 10 Missing ⚠️
...Push/Extensions/NotificationCenterExtensions.swift 0.00% 6 Missing ⚠️
...MessagingPush/Util/NotificationCenterWrapper.swift 0.00% 6 Missing ⚠️
...ces/MessagingPush/MessagingPushConfigOptions.swift 0.00% 5 Missing ⚠️
...es/MessagingPush/CustomerIOParsedPushPayload.swift 80.00% 3 Missing ⚠️
... and 1 more
Additional details and impacted files
@@                      Coverage Diff                       @@
##           levi/reliable-open-metrics     #405      +/-   ##
==============================================================
- Coverage                       59.45%   57.75%   -1.71%     
==============================================================
  Files                             119      126       +7     
  Lines                            4627     4902     +275     
==============================================================
+ Hits                             2751     2831      +80     
- Misses                           1876     2071     +195     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

class PushHistoryImpl: PushHistory {
private let keyValueStorage: KeyValueStorage

var numberOfPushesToTrack = 100
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What does this value represent? I think adding a comment would add value to it.

Copy link
Copy Markdown
Contributor Author

@levibostian levibostian Nov 22, 2023

Choose a reason for hiding this comment

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

Thanks for asking. I changed the name to maxSizeOfHistory to be more descriptive of it's purpose. Does this new name help?

Comment thread Sources/MessagingPush/Store/PushHistory.swift
}

// sourcery: InjectRegister = "PushHistory"
class PushHistoryImpl: PushHistory {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

maybe we should make it thread-safe?

Copy link
Copy Markdown
Contributor Author

@levibostian levibostian Nov 22, 2023

Choose a reason for hiding this comment

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

Great idea. Latest commit does this. I followed the same logic as QueueStorage uses.

// push has already been handled. exit early
return
}
pushHistory.handledPushClick(deliveryId: parsedPush.deliveryId)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Did we write any tests for pushClicked anywhere? If not, can we write some?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This feature has been heavily reliant on QA testing thus far. Automated tests around swizzling and UserNotifications has been difficult to write. I have not yet found an easy or quick way to make them.

I do agree and think we can write some for this function after QA concludes, yes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am going to merge this PR to make maintenance and QA testing easier. I made a note to add these tests and codecov in the target PR should help to keep track of these missing tests.

@levibostian levibostian merged commit 536dc43 into levi/reliable-open-metrics Nov 22, 2023
@levibostian levibostian deleted the levi/reliable-open-metrics-prevent-duplicates branch November 22, 2023 19:10
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.

4 participants