-
Notifications
You must be signed in to change notification settings - Fork 1.2k
WordPress to Jetpack flow: main flow implementation #19563
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
9d3a0df
Add MigrationDpendencyContainer, dependency injection container for w…
14ebd9d
Add MigrationNavigationController, custom, state-based navigation con…
48a4c65
Update MigrationFlowCoordinator, extract ui logic from coordinator
30a79ab
Add MigrationStepConfiguration, a refactor of existing configuration …
e2cdb12
Add MigrationStepView, a common base view for migration step screens
3b8216f
Add MigrationNotificationsViewController, view controller for the wp-…
45e1c2e
Add MigrationNotificationsViewModel, view model for the wp-to-jp migr…
8e7786a
Add MigrationDoneViewController, view controller for the wp-to-jp mig…
81dfb16
Add MigrationDoneViewModel, view model for the wp-to-jp migration-fin…
58bffd0
Update WindowManager, default optional completion to nil
6205faf
Update JetpackWindowManager, refactor to enable showing the wp-to-jp …
a89c8a2
Update MigrationStep, add missing steps and extract in separate file
e73c00e
Update MigrationActionsView, refactors based on the refactor of confi…
b1bb8e9
Update MigrationHeaderView, refactors based on the refactor of config…
493c694
Files and groups re-arranged in WordPress-to-Jetpack migration group
dadb84f
Update MigrationStepConfiguration, put separate types in separate files
be02a8b
Update MigrationDoneViewController, MigrationNotificationsViewControl…
f258dd3
Update MigrationDependencyContainer, remove incorrect comment
2660dca
Update MigrationStepView, remove unnecessary settings
85e8e05
Fix trailing space violations
b60e047
Update migration view models, improve code legibility
39864a3
Update MigrationDependencyContainer, extract view controller factory,…
a33da86
Update MigrationNavigationController, use view controller factory to …
ff32f03
Merge branch trunk into task/migration-notifications-premission
15e7a29
Update JetpackWindowManager, simplify logic and make sure that the ui…
3bf7ef7
Update MigrationFlowCoordinator, add logic to skip notifications perm…
3387916
Update MigrationNavigationController, always create and assign view c…
1d7ccdc
Update migration view models, add notification permission logic and f…
eabe689
Update MigrationDependencyContainer, changed to struct since we don't…
959f687
Update MigrationNavigationController, instantiate with rootViewContro…
40127da
Update MigrationViewControllerFactory, add method initialViewControll…
40be348
Update MigrationNavigationController, set initial root from factory a…
313c203
Update MigrationFlowCoordinator, add comments
5d9d95f
Update JetpackWindowManager, small refactor
750bafa
Update JetpackWindowManager, small refactor
670a52e
Update JetpackWindowManager, disable migration UI
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 0 additions & 85 deletions
85
...ress/Jetpack/Classes/ViewRelated/WordPress Migration/Types/MigrationFlowCoordinator.swift
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
WordPress/Jetpack/Classes/ViewRelated/WordPress Migration/Types/MigrationStep.swift
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
WordPress/Jetpack/Classes/ViewRelated/WordPress Migration/Types/MigrationStepViewModel.swift
This file was deleted.
Oops, something went wrong.
75 changes: 0 additions & 75 deletions
75
...s/Jetpack/Classes/ViewRelated/WordPress Migration/Welcome/MigrationWelcomeViewModel.swift
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
...ses/ViewRelated/WordPress-to-Jetpack Migration/All done/MigrationDoneViewController.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| import UIKit | ||
|
|
||
| class MigrationDoneViewController: UIViewController { | ||
|
|
||
| private let viewModel: MigrationDoneViewModel | ||
|
|
||
| init(viewModel: MigrationDoneViewModel) { | ||
| self.viewModel = viewModel | ||
| super.init(nibName: nil, bundle: nil) | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| fatalError("init(coder:) has not been implemented") | ||
| } | ||
|
|
||
| override func loadView() { | ||
| // TODO: replace this blank center view with the actual content | ||
| let centerView = UIView() | ||
| centerView.translatesAutoresizingMaskIntoConstraints = false | ||
| centerView.setContentHuggingPriority(UILayoutPriority.defaultLow, for: .vertical) | ||
|
|
||
| view = MigrationStepView(headerView: MigrationHeaderView(configuration: viewModel.configuration.headerConfiguration), | ||
| actionsView: MigrationActionsView(configuration: viewModel.configuration.actionsConfiguration), | ||
| centerView: centerView) | ||
| } | ||
| } |
15 changes: 15 additions & 0 deletions
15
.../Classes/ViewRelated/WordPress-to-Jetpack Migration/All done/MigrationDoneViewModel.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| class MigrationDoneViewModel { | ||
|
|
||
| let configuration: MigrationStepConfiguration | ||
|
|
||
| init(coordinator: MigrationFlowCoordinator) { | ||
|
|
||
| let headerConfiguration = MigrationHeaderConfiguration(step: .done) | ||
|
|
||
| let actionsConfiguration = MigrationActionsViewConfiguration(step: .done, primaryHandler: { [weak coordinator] in | ||
| coordinator?.transitionToNextStep() | ||
| }) | ||
| configuration = MigrationStepConfiguration(headerConfiguration: headerConfiguration, | ||
| actionsConfiguration: actionsConfiguration) | ||
| } | ||
| } |
70 changes: 70 additions & 0 deletions
70
...sses/ViewRelated/WordPress-to-Jetpack Migration/Common/MigrationDependencyContainer.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| struct MigrationDependencyContainer { | ||
|
|
||
| let migrationCoordinator = MigrationFlowCoordinator() | ||
|
|
||
| func makeInitialViewController() -> UIViewController { | ||
| MigrationNavigationController(coordinator: migrationCoordinator, | ||
| factory: MigrationViewControllerFactory(coordinator: migrationCoordinator)) | ||
| } | ||
| } | ||
|
|
||
| struct MigrationViewControllerFactory { | ||
|
|
||
| let coordinator: MigrationFlowCoordinator | ||
|
|
||
| init(coordinator: MigrationFlowCoordinator) { | ||
| self.coordinator = coordinator | ||
| } | ||
|
|
||
| func viewController(for step: MigrationStep) -> UIViewController? { | ||
| switch step { | ||
| case .welcome: | ||
| return makeWelcomeViewController() | ||
| case .notifications: | ||
| return makeNotificationsViewController() | ||
| case .done: | ||
| return makeDoneViewController() | ||
| case .dismiss: | ||
| return nil | ||
| } | ||
| } | ||
|
|
||
| func initialViewController() -> UIViewController? { | ||
| viewController(for: coordinator.currentStep) | ||
| } | ||
|
|
||
| private func makeAccount() -> WPAccount? { | ||
|
|
||
| let context = ContextManager.shared.mainContext | ||
| do { | ||
| return try WPAccount.lookupDefaultWordPressComAccount(in: context) | ||
| } catch { | ||
| DDLogError("Account lookup failed with error: \(error)") | ||
| return nil | ||
| } | ||
| } | ||
|
|
||
| private func makeWelcomeViewModel() -> MigrationWelcomeViewModel { | ||
| MigrationWelcomeViewModel(account: makeAccount(), coordinator: coordinator) | ||
| } | ||
|
|
||
| private func makeWelcomeViewController() -> UIViewController { | ||
| MigrationWelcomeViewController(viewModel: makeWelcomeViewModel()) | ||
| } | ||
|
|
||
| private func makeNotificationsViewModel() -> MigrationNotificationsViewModel { | ||
| MigrationNotificationsViewModel(coordinator: coordinator) | ||
| } | ||
|
|
||
| private func makeNotificationsViewController() -> UIViewController { | ||
| MigrationNotificationsViewController(viewModel: makeNotificationsViewModel()) | ||
| } | ||
|
|
||
| private func makeDoneViewModel() -> MigrationDoneViewModel { | ||
| MigrationDoneViewModel(coordinator: coordinator) | ||
| } | ||
|
|
||
| private func makeDoneViewController() -> UIViewController { | ||
| MigrationDoneViewController(viewModel: makeDoneViewModel()) | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 like this, it's better than passing a closure 👍