Skip to content

Commit

Permalink
Merge branch 'develop' into feature/14009-unify-site-address-vi
Browse files Browse the repository at this point in the history
  • Loading branch information
mindgraffiti committed Jun 24, 2020
2 parents ee454be + 6d045a7 commit ab6a5fd
Show file tree
Hide file tree
Showing 11 changed files with 52 additions and 17 deletions.
4 changes: 3 additions & 1 deletion Scripts/fastlane/appstoreres/metadata/source/description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ WordPress for iOS is an Open Source project, which means you too can contribute

WordPress for iOS supports WordPress.com and self-hosted WordPress.org sites running WordPress 4.0 or higher.

Need help with the app? Visit the forums at https://ios.forums.wordpress.org/ or tweet us @WordPressiOS.\n
Need help with the app? Visit the forums at https://ios.forums.wordpress.org/ or tweet us @WordPressiOS.

View the Privacy Notice for California Users at https://automattic.com/privacy/#california-consumer-privacy-act-ccpa.
2 changes: 1 addition & 1 deletion WordPress/Classes/Services/ReaderPostService.m
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ - (ReaderPost *)createOrReplaceFromRemotePost:(RemoteReaderPost *)remotePost for
}

if ([Feature enabled:FeatureFlagReaderWebview]) {
post.content = remotePost.content;
post.content = [RichContentFormatter removeForbiddenTags:remotePost.content];
} else {
post.content = [RichContentFormatter formatContentString:remotePost.content isPrivateSite:remotePost.isBlogPrivate];
}
Expand Down
2 changes: 1 addition & 1 deletion WordPress/Classes/System/WordPressAppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ extension WordPressAppDelegate {
let maximumPointSize = WPStyleGuide.maxFontSize

UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white,
NSAttributedString.Key.font: WPStyleGuide.fixedFont(for: UIFont.TextStyle.headline, weight: UIFont.Weight.bold)]
NSAttributedString.Key.font: WPStyleGuide.fixedFont(for: UIFont.TextStyle.headline, weight: UIFont.Weight.semibold)]

WPStyleGuide.configureSearchBarTextAppearance()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enum FeatureFlag: Int, CaseIterable {
case .unifiedAuth:
return BuildConfiguration.current ~= [.localDeveloper, .a8cBranchTest]
case .unifiedSiteAddress:
return BuildConfiguration.current == .localDeveloper
return false
case .unifiedGoogle:
return BuildConfiguration.current ~= [.localDeveloper, .a8cBranchTest]
case .meMove:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ class AztecPostViewController: UIViewController, PostEditor {
self?.mapUIContentToPostAndSave(immediate: true)
}

var wordCount: UInt {
return richTextView.wordCount
}

// MARK: - Styling Options

private lazy var optionsTablePresenter = OptionsTablePresenter(presentingViewController: self, presentingTextView: editorView.richTextView)
Expand Down Expand Up @@ -808,7 +812,6 @@ class AztecPostViewController: UIViewController, PostEditor {

func setHTML(_ html: String) {
editorView.setHTML(html)

if editorView.editingMode == .richText {
processMediaAttachments()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ class GutenbergViewController: UIViewController, PostEditor {
self?.requestHTML(for: .autoSave)
}

var wordCount: UInt {
guard let currentMetrics = contentInfo else {
return 0
}

return UInt(currentMetrics.wordCount)
}

/// Media Library Data Source
///
lazy var mediaLibraryDataSource: MediaLibraryPickerDataSource = {
Expand Down
6 changes: 1 addition & 5 deletions WordPress/Classes/ViewRelated/Post/PostEditor+Publish.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,8 @@ extension PostEditor where Self: UIViewController {
return
}

let originalWordCount = post.original?.content?.wordCount() ?? 0
let wordCount = post.content?.wordCount() ?? 0
let wordCount = self.wordCount
var properties: [String: Any] = ["word_count": wordCount, WPAppAnalyticsKeyEditorSource: analyticsEditorSource]
if post.hasRemote() {
properties["word_diff_count"] = originalWordCount
}

properties[WPAppAnalyticsKeyPostType] = postTypeValue

Expand Down
3 changes: 3 additions & 0 deletions WordPress/Classes/ViewRelated/Post/PostEditor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ protocol PostEditor: class, UIViewControllerTransitioningDelegate {
var autosaver: Autosaver { get set }
/// true if the post is the result of a reblog
var postIsReblogged: Bool { get set }

/// Returns the word counts of the content in the editor.
var wordCount: UInt { get }
}

extension PostEditor {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Foundation

/// A struct that returns the Reader CSS URL
/// If you need to fix an issue in the CSS, see pbArwn-GU-p2
///
struct ReaderCSS {
private let store: KeyValueDatabase
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ class ReaderDetailWebviewViewController: UIViewController, ReaderDetailView {
/// - Parameter title: a optional String containing the title
func show(title: String?) {
let placeholder = NSLocalizedString("Post", comment: "Placeholder title for ReaderPostDetails.")
self.title = title ?? placeholder
let titleView = UILabel()
titleView.attributedText = NSAttributedString.init(string: title ?? placeholder, attributes: UINavigationBar.appearance().titleTextAttributes)
navigationItem.titleView = titleView
}

deinit {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
private var spotlightView: QuickStartSpotlightView?
private let spotlightViewOffset: CGFloat = -5.0
private var quickStartObserver: NSObject?

extension WPTabBarController {
Expand All @@ -10,17 +9,26 @@ extension WPTabBarController {

guard let userInfo = notification.userInfo,
let element = userInfo[QuickStartTourGuide.notificationElementKey] as? QuickStartTourElement,
[.readerTab].contains(element),
let tabBar = self?.tabBar else {
[.readerTab].contains(element) else {
return
}

let newSpotlight = QuickStartSpotlightView()
tabBar.addSubview(newSpotlight)
self?.view.addSubview(newSpotlight)

let x = tabBar.bounds.size.width / 2.0
guard let tabButton = self?.getTabButton(at: Int(WPTabType.reader.rawValue)) else {
return
}

newSpotlight.translatesAutoresizingMaskIntoConstraints = false

let newSpotlightCenterX = newSpotlight.centerXAnchor.constraint(equalTo: tabButton.centerXAnchor, constant: Constants.spotlightXOffset)
let newSpotlightCenterY = newSpotlight.centerYAnchor.constraint(equalTo: tabButton.centerYAnchor, constant: Constants.spotlightYOffset)
let newSpotlightWidth = newSpotlight.widthAnchor.constraint(equalToConstant: Constants.spotlightDiameter)
let newSpotlightHeight = newSpotlight.heightAnchor.constraint(equalToConstant: Constants.spotlightDiameter)

NSLayoutConstraint.activate([newSpotlightCenterX, newSpotlightCenterY, newSpotlightWidth, newSpotlightHeight])

newSpotlight.frame = CGRect(x: x, y: spotlightViewOffset, width: newSpotlight.frame.width, height: newSpotlight.frame.height)
spotlightView = newSpotlight
}

Expand All @@ -39,4 +47,16 @@ extension WPTabBarController {
NotificationCenter.default.removeObserver(quickStartObserver as Any)
quickStartObserver = nil
}

private func getTabButton(at index: Int) -> UIView? {
var tabs = tabBar.subviews.compactMap { return $0 is UIControl ? $0 : nil }
tabs.sort { $0.frame.origin.x < $1.frame.origin.x }
return tabs[safe: index]
}

private enum Constants {
static let spotlightDiameter: CGFloat = 40
static let spotlightXOffset: CGFloat = 20
static let spotlightYOffset: CGFloat = -10
}
}

0 comments on commit ab6a5fd

Please sign in to comment.