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

Subscription refactoring #5 #2930

Merged
merged 42 commits into from
Jul 5, 2024

Conversation

federicocappelli
Copy link
Member

Task/Issue URL: https://app.asana.com/0/1205842942115003/1206805455884775/f
Tech Design URL: https://app.asana.com/0/1205842942115003/1207147511614062/f
CC: @miasma13

Description:

This PR updates BSK from duckduckgo/BrowserServicesKit#874 and contains all the needed refactoring for the Subscription classes inits.
It also contains new unit test classes with example tests:

  • SubscriptionErrorReporterTests
  • SubscriptionAppStoreRestorerTests
  • SubscriptionRedirectManager

Complete tests will be implemented in follow-up tasks

Steps to test this PR:
Subscription must work as usual, manual smoke test script available in this README

Definition of Done:


Internal references:

Pull Request Review Checklist
Software Engineering Expectations
Technical Design Template
Pull Request Documentation

# Conflicts:
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
# Conflicts:
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionAppStoreRestorer.swift
#	DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionPagesUserScript.swift
#	DuckDuckGo/Tab/UserScripts/UserScripts.swift
# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
…bscription_refactoring_5

# Conflicts:
#	DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionAppStoreRestorer.swift
…bscription_refactoring_5

# Conflicts:
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	DuckDuckGo/Tab/UserScripts/Subscription/SubscriptionAppStoreRestorer.swift
#	UnitTests/Subscription/SubscriptionAppStoreRestorerTests.swift
#	UnitTests/Subscription/SubscriptionErrorReporterTests.swift
#	UnitTests/Subscription/SubscriptionPagesUserScriptTests.swift
# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	LocalPackages/DataBrokerProtection/Package.swift
#	LocalPackages/NetworkProtectionMac/Package.swift
#	LocalPackages/SubscriptionUI/Package.swift
# Conflicts:
#	DuckDuckGo.xcodeproj/project.pbxproj
#	DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
#	DuckDuckGo/Preferences/View/PreferencesRootView.swift
#	LocalPackages/SubscriptionUI/Sources/SubscriptionUI/SubscriptionAccessView/Model/ShareSubscriptionAccessModel.swift
Copy link

github-actions bot commented Jul 2, 2024

Warnings
⚠️ PR has more than 500 lines of code changing. Consider splitting into smaller PRs if possible.

Generated by 🚫 dangerJS against 4a42397

Copy link
Contributor

@afterxleep afterxleep left a comment

Choose a reason for hiding this comment

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

LGTM

DuckDuckGo/Preferences/View/PreferencesRootView.swift Outdated Show resolved Hide resolved
var pixelKit: PixelKit?

override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?

final class SubscriptionErrorReporterTests: XCTestCase {

override func setUpWithError() throws {
// Put setup code here. This method is called before the invocation of each test method in the class.
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?

@federicocappelli federicocappelli marked this pull request as ready for review July 4, 2024 07:54
federicocappelli added a commit to duckduckgo/BrowserServicesKit that referenced this pull request Jul 5, 2024
Task/Issue URL: https://app.asana.com/0/1205842942115003/1206805455884775/f
iOS PR: duckduckgo/iOS#3023
macOS PR: duckduckgo/macos-browser#2930
What kind of version bump will this require?: Major
Tech Design URL: https://app.asana.com/0/1205842942115003/1207147511614062/f

Dependency injection for many Subscription classes has been improved to allow unit tests.
Many test classes have been created and one or more example tests have been implemented to showcase the class testability and mocks
Complete tests will be implemented in follow-up tasks
@federicocappelli federicocappelli merged commit e581911 into main Jul 5, 2024
19 checks passed
@federicocappelli federicocappelli deleted the fcappelli/subscription_refactoring_5 branch July 5, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants