Skip to content

Commit

Permalink
Merge branch 'trunk' into gutenberg/try-local-post
Browse files Browse the repository at this point in the history
# Conflicts:
#	Modules/Package.swift
#	WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved
  • Loading branch information
Gerardo committed Sep 17, 2024
2 parents 981297e + 09d82f1 commit 9c886d7
Show file tree
Hide file tree
Showing 44 changed files with 412 additions and 228 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/run-danger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ on:
jobs:
dangermattic:
if: ${{ (github.event.pull_request.draft == false) }}
uses: Automattic/dangermattic/.github/workflows/[email protected].0
uses: Automattic/dangermattic/.github/workflows/[email protected].2
with:
org-slug: "automattic"
pipeline-slug: "wordpress-ios"
retry-step-key: "danger"
build-commit-sha: "${{ github.event.pull_request.head.sha }}"
org-slug: automattic
pipeline-slug: wordpress-ios
retry-step-key: danger
build-commit-sha: ${{ github.event.pull_request.head.sha }}
cancel-running-github-jobs: false
secrets:
buildkite-api-token: ${{ secrets.TRIGGER_BK_BUILD_TOKEN }}
2 changes: 1 addition & 1 deletion Modules/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ let package = Package(
.package(url: "https://github.com/zendesk/support_sdk_ios", from: "8.0.3"),
// We can't use wordpress-rs branches nor commits here. Only tags work.
.package(url: "https://github.com/Automattic/wordpress-rs", revision: "alpha-swift-20240813"),
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "21bc472bbbe9e6bea683e40a60a7502dec5aaf3f"),
.package(url: "https://github.com/wordpress-mobile/GutenbergKit", revision: "0987aa05587342f531b646dbb36d5622df12cfea"),
.package(url: "https://github.com/Automattic/color-studio", branch: "add/swift-file-output"),
],
targets: XcodeSupport.targets + [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/wordpress-mobile/GutenbergKit",
"state" : {
"revision" : "21bc472bbbe9e6bea683e40a60a7502dec5aaf3f"
"revision" : "0987aa05587342f531b646dbb36d5622df12cfea"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ extension WPStyleGuide {
@objc
class func configureTableViewActionCell(_ cell: UITableViewCell?) {
configureTableViewCell(cell)
cell?.textLabel?.textColor = UIAppColor.primary
cell?.textLabel?.textColor = UIAppColor.brand
}

@objc
Expand Down
9 changes: 3 additions & 6 deletions WordPress/Classes/Networking/WordPressClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Network

struct WordPressSite {
enum SiteType {
case dotCom(emailAddress: String, authToken: String)
case dotCom(authToken: String)
case selfHosted(username: String, authToken: String)
}

Expand All @@ -19,10 +19,7 @@ struct WordPressSite {
static func from(blog: Blog) throws -> WordPressSite {
let url = try ParsedUrl.parse(input: blog.getUrlString())
if let account = blog.account {
return WordPressSite(baseUrl: url, type: .dotCom(
emailAddress: account.email,
authToken: account.authToken
))
return WordPressSite(baseUrl: url, type: .dotCom(authToken: account.authToken))
} else {
return WordPressSite(baseUrl: url, type: .selfHosted(
username: try blog.getUsername(),
Expand Down Expand Up @@ -52,7 +49,7 @@ actor WordPressClient {
let parsedUrl = try ParsedUrl.parse(input: site.baseUrl)

switch site.type {
case let .dotCom(_, authToken):
case let .dotCom(authToken):
let api = WordPressAPI(urlSession: session, baseUrl: parsedUrl, authenticationStategy: .authorizationHeader(token: authToken))
return WordPressClient(api: api, rootUrl: parsedUrl)
case .selfHosted(let username, let authToken):
Expand Down
1 change: 0 additions & 1 deletion WordPress/Classes/System/RootViewPresenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ protocol RootViewPresenter: AnyObject {
func getMeScenePresenter() -> ScenePresenter
func currentlySelectedScreen() -> String
func currentlyVisibleBlog() -> Blog?
func willDisplayPostSignupFlow()

// MARK: Reader

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import Foundation
import UIKit

class NotificationsSplitViewContent: SplitViewDisplayable {
let supplementary: UINavigationController
let notificationsViewController: NotificationsViewController
var secondary: UINavigationController

init() {
notificationsViewController = UIStoryboard(name: "Notifications", bundle: nil).instantiateInitialViewController() as! NotificationsViewController
supplementary = UINavigationController(rootViewController: notificationsViewController)
secondary = UINavigationController()

notificationsViewController.isSidebarModeEnabled = true
}

func displayed(in splitVC: UISplitViewController) {
// Do nothing
}
}
23 changes: 23 additions & 0 deletions WordPress/Classes/System/SplitViewRootPresenter+Reader.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Foundation
import UIKit

class ReaderSplitViewContent: SplitViewDisplayable {
let sidebar: ReaderSidebarViewController
let supplementary: UINavigationController
var secondary: UINavigationController

init() {
secondary = UINavigationController()
let viewModel = ReaderSidebarViewModel()
sidebar = ReaderSidebarViewController(viewModel: viewModel)
sidebar.navigationItem.largeTitleDisplayMode = .automatic
supplementary = UINavigationController(rootViewController: sidebar)
supplementary .navigationBar.prefersLargeTitles = true
}

func displayed(in splitVC: UISplitViewController) {
if secondary.viewControllers.isEmpty {
sidebar.showInitialSelection()
}
}
}
39 changes: 39 additions & 0 deletions WordPress/Classes/System/SplitViewRootPresenter+Site.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import Foundation
import UIKit

class SiteSplitViewContent: SiteMenuViewControllerDelegate, SplitViewDisplayable {
let siteMenu: SiteMenuViewController
let supplementary: UINavigationController
var secondary: UINavigationController

var blog: Blog {
siteMenu.blog
}

init(blog: Blog) {
siteMenu = SiteMenuViewController(blog: blog)
supplementary = UINavigationController(rootViewController: siteMenu)
secondary = UINavigationController()
siteMenu.delegate = self
}

func displayed(in splitVC: UISplitViewController) {
RecentSitesService().touch(blog: blog)

// TODO: (wpsidebar) Refactor this (initial .secondary vc managed based on the VC presentation)
_ = siteMenu.view
}

func siteMenuViewController(_ siteMenuViewController: SiteMenuViewController, showDetailsViewController viewController: UIViewController) {
guard siteMenu === siteMenuViewController, let splitVC = siteMenuViewController.splitViewController else { return }

if viewController is UINavigationController ||
viewController is UISplitViewController {
splitVC.setViewController(viewController, for: .secondary)
} else {
// Reset previous navigation or split stack
let navigationVC = UINavigationController(rootViewController: viewController)
splitVC.setViewController(navigationVC, for: .secondary)
}
}
}
25 changes: 25 additions & 0 deletions WordPress/Classes/System/SplitViewRootPresenter+Welcome.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Foundation
import UIKit
import SwiftUI

class WelcomeSplitViewContent: SplitViewDisplayable {
let supplementary: UINavigationController
var secondary: UINavigationController

init(addSite: @escaping (AddSiteMenuViewModel.Selection) -> Void) {
supplementary = UINavigationController(rootViewController: UnifiedPrologueViewController())

let addSiteViewModel = AddSiteMenuViewModel(context: .shared, onSelection: addSite)
let noSitesViewModel = NoSitesViewModel(appUIType: JetpackFeaturesRemovalCoordinator.currentAppUIType, account: nil)
let noSiteView = NoSitesView(addSiteViewModel: addSiteViewModel, viewModel: noSitesViewModel)
let noSitesVC = UIHostingController(rootView: noSiteView)
noSitesVC.view.backgroundColor = .systemBackground
secondary = UINavigationController(rootViewController: noSitesVC)

supplementary.isNavigationBarHidden = true
}

func displayed(in splitVC: UISplitViewController) {
// Do nothing
}
}
Loading

0 comments on commit 9c886d7

Please sign in to comment.