Skip to content

Commit

Permalink
Merge branch 'trunk' into gutenberg/add-react-native-fast-image
Browse files Browse the repository at this point in the history
# Conflicts:
#	Podfile
#	Podfile.lock
  • Loading branch information
Gerardo committed Jul 11, 2022
2 parents d671855 + 06df238 commit 2f12a30
Show file tree
Hide file tree
Showing 56 changed files with 1,835 additions and 145 deletions.
49 changes: 23 additions & 26 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,30 +94,27 @@ steps:
context: "UI Tests (iPad)"

#################
# Lint Translations
# Linters
#################
- label: "🧹 Lint Translations"
command: "gplint /workdir/WordPress/Resources/AppStoreStrings.po"
plugins:
- docker#v3.8.0:
image: "public.ecr.aws/automattic/glotpress-validator:1.0.0"
agents:
queue: "default"
notify:
- github_commit_status:
context: "Lint Translations"

#################
# Lint Ruby Tooling
#################
#
# TODO: This ought to be run on a Docker or Ubuntu agent as there's nothing that requires macOS.
# It's currently in the stock setup because... it was faster to build a proof of concept for it this way;
# I don't know how to pass the `DANGER_GITHUB_API_TOKEN` secret that we need to a Docker agent.
#
# This step uses Danger to run RuboCop, but it's "agnostic" about it.
# That is, it outwardly only mentions RuboCop, not Danger
- label: ":rubocop: Lint Ruby Tooling"
command: .buildkite/commands/rubocop-via-danger.sh
env: *common_env
plugins: *common_plugins
- group: "Linters"
steps:
- label: "🧹 Lint Translations"
command: "gplint /workdir/WordPress/Resources/AppStoreStrings.po"
plugins:
- docker#v3.8.0:
image: "public.ecr.aws/automattic/glotpress-validator:1.0.0"
agents:
queue: "default"
notify:
- github_commit_status:
context: "Lint Translations"
# TODO: This ought to be run on a Docker or Ubuntu agent as there's nothing that requires macOS.
# It's currently in the stock setup because... it was faster to build a proof of concept for it this way;
# I don't know how to pass the `DANGER_GITHUB_API_TOKEN` secret that we need to a Docker agent.
#
# This step uses Danger to run RuboCop, but it's "agnostic" about it.
# That is, it outwardly only mentions RuboCop, not Danger
- label: ":rubocop: Lint Ruby Tooling"
command: .buildkite/commands/rubocop-via-danger.sh
env: *common_env
plugins: *common_plugins
6 changes: 6 additions & 0 deletions MIGRATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
This file documents changes in the data model. Please explain any changes to the
data model as well as any custom migrations.

## WordPress 144

@salimbraksa 2022-07-07

- `UserSuggestion`: added `userID` attribute. (optional, no default, `Int 64`)

## WordPress 143

@wargcm 2022-06-01 (@scoutharris 2022-05-24)
Expand Down
2 changes: 1 addition & 1 deletion Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def wordpress_kit
end

def kanvas
pod 'Kanvas', '~> 1.2.7'
pod 'Kanvas', '~> 1.4.3'
# pod 'Kanvas', :git => 'https://github.com/tumblr/Kanvas-iOS.git', :tag => ''
# pod 'Kanvas', :git => 'https://github.com/tumblr/Kanvas-iOS.git', :commit => ''
# pod 'Kanvas', :path => '../Kanvas-iOS'
Expand Down
8 changes: 4 additions & 4 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ PODS:
- React-RCTImage (= 0.66.2)
- RNTAztecView
- JTAppleCalendar (8.0.3)
- Kanvas (1.2.8)
- Kanvas (1.4.3)
- libwebp (1.2.1):
- libwebp/demux (= 1.2.1)
- libwebp/mux (= 1.2.1)
Expand Down Expand Up @@ -553,7 +553,7 @@ DEPENDENCIES:
- Gridicons (~> 1.1.0)
- Gutenberg (from `https://github.com/wordpress-mobile/gutenberg-mobile.git`, tag `v1.80.0-alpha1`)
- JTAppleCalendar (~> 8.0.2)
- Kanvas (~> 1.2.7)
- Kanvas (~> 1.4.3)
- MediaEditor (~> 1.2.1)
- MRProgress (= 0.8.3)
- Nimble (~> 9.0.0)
Expand Down Expand Up @@ -813,7 +813,7 @@ SPEC CHECKSUMS:
GTMSessionFetcher: 43748f93435c2aa068b1cbe39655aaf600652e91
Gutenberg: 67ff454c8bc0de4862502d06363086d60ed65b38
JTAppleCalendar: 932cadea40b1051beab10f67843451d48ba16c99
Kanvas: 9eab00cc89669b38858d42d5f30c810876b31344
Kanvas: 6355398addfc9856c27cc780cbf54df7cd822ab1
libwebp: 98a37e597e40bfdb4c911fc98f2c53d0b12d05fc
MediaEditor: 20cdeb46bdecd040b8bc94467ac85a52b53b193a
MRProgress: 16de7cc9f347e8846797a770db102a323fe7ef09
Expand Down Expand Up @@ -888,6 +888,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
ZIPFoundation: ae5b4b813d216d3bf0a148773267fff14bd51d37

PODFILE CHECKSUM: d636557b9eb713540b619055ff3450c6be2ba92d
PODFILE CHECKSUM: 6a91f74e1de7e0971a8892cb184d236f887a74c8

COCOAPODS: 1.11.2
9 changes: 9 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
20.4
-----


20.3
-----
* [*] Stories: Fixed a crash that could occur when adding multiple items to a Story post. [#18967]
* [*] User Mention: When replying to a post or a comment, the post author or comment author shows up at the top of the suggestions list. [#18979]
* [*] Block Editor: Fixed an issue where the media picker search query was being retained after dismissing the picker and opening it again. [#18980]
* [*] Block Editor: Add 'Insert from URL' option to Video block [https://github.com/WordPress/gutenberg/pull/41493]
* [*] Block Editor: Image block copies the alt text from the media library when selecting an item [https://github.com/WordPress/gutenberg/pull/41839]
* [*] Block Editor: Introduce "block recovery" option for invalid blocks [https://github.com/WordPress/gutenberg/pull/41988]

20.2
-----
Expand Down
9 changes: 9 additions & 0 deletions WordPress.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@
"version": "1.0.2"
}
},
{
"package": "BuildkiteTestCollector",
"repositoryURL": "https://github.com/buildkite/test-collector-swift",
"state": {
"branch": null,
"revision": "87afcecfb58dd017d6e835ec8e88e9eaa18095ba",
"version": "0.1.1"
}
},
{
"package": "XCUITestHelpers",
"repositoryURL": "https://github.com/Automattic/XCUITestHelpers",
Expand Down
7 changes: 7 additions & 0 deletions WordPress/Classes/Models/Notifications/Notification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,12 @@ extension Notification {
return metaIds?[MetaKeys.Comment] as? NSNumber
}

/// Comment Author ID, if any.
///
@objc var metaCommentAuthorID: NSNumber? {
return metaIds?[MetaKeys.User] as? NSNumber
}

/// Comment Parent ID, if any.
///
@objc var metaParentID: NSNumber? {
Expand Down Expand Up @@ -392,6 +398,7 @@ extension Notification {
static let Site = "site"
static let Post = "post"
static let Comment = "comment"
static let User = "user"
static let Parent = "parent_comment"
static let Reply = "reply_comment"
static let Home = "home"
Expand Down
9 changes: 5 additions & 4 deletions WordPress/Classes/Models/UserSuggestion+CoreDataClass.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public class UserSuggestion: NSManagedObject {
let userLoginValue = dictionary["user_login"] as? String
let displayNameValue = dictionary["display_name"] as? String

// A user suggestion is only valid when at least one of these is present.
guard userLoginValue != nil || displayNameValue != nil else {
// A user suggestion is only valid when it has an ID and at least user_login or display_name is present.
guard let id = dictionary["ID"] as? UInt, userLoginValue != nil || displayNameValue != nil else {
return nil
}

Expand All @@ -18,8 +18,9 @@ public class UserSuggestion: NSManagedObject {
}
self.init(entity: entityDescription, insertInto: context)

username = userLoginValue
displayName = displayNameValue
self.userID = NSNumber(value: id)
self.username = userLoginValue
self.displayName = displayNameValue

if let imageURLString = dictionary["image_URL"] as? String {
imageURL = URL(string: imageURLString)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ extension UserSuggestion {
return NSFetchRequest<UserSuggestion>(entityName: "UserSuggestion")
}

@NSManaged public var userID: NSNumber?
@NSManaged public var displayName: String?
@NSManaged public var imageURL: URL?
@NSManaged public var username: String?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class KanvasCustomUI {
trashColor: Self.brightRed,
tooltipBackgroundColor: .systemRed,
closeButtonColor: black25,
cameraConfirmationColor: firstPrimary,
primaryButtonBackgroundColor: Self.brightRed,
permissionsButtonColor: Self.brightBlue,
permissionsButtonAcceptedBackgroundColor: UIColor.muriel(color: MurielColor(name: .green, shade: .shade20)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct SiteIconPickerView: View {
var onDismiss: (() -> Void)? = nil

@SwiftUI.State private var currentIcon: String? = nil
@SwiftUI.State private var currentBackgroundColor = UIColor(hex: "#969CA1")
@SwiftUI.State private var currentBackgroundColor: UIColor = .init(hexString: "#969CA1") ?? .gray
@SwiftUI.State private var scrollOffsetColumn: Int? = nil

private var hasMadeSelection: Bool {
Expand Down Expand Up @@ -314,17 +314,17 @@ struct SiteIconPickerView: View {
}

private static let backgroundColors = [
UIColor(hex: "#d1e4dd"),
UIColor(hex: "#d1dfe4"),
UIColor(hex: "#d1d1e4"),
UIColor(hex: "#e4d1d1"),
UIColor(hex: "#e4dad1"),
UIColor(hex: "#eeeadd"),
UIColor(hex: "#ffffff"),
UIColor(hex: "#39414d"),
UIColor(hex: "#28303d"),
UIColor(hexString: "#d1e4dd"),
UIColor(hexString: "#d1dfe4"),
UIColor(hexString: "#d1d1e4"),
UIColor(hexString: "#e4d1d1"),
UIColor(hexString: "#e4dad1"),
UIColor(hexString: "#eeeadd"),
UIColor(hexString: "#ffffff"),
UIColor(hexString: "#39414d"),
UIColor(hexString: "#28303d"),
UIColor.black
]
].compactMap { $0 }
}

private struct EmojiColumnView: View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class CommentDetailViewController: UIViewController, NoResultsViewHost {

// MARK: Properties

private let accountService: AccountService

private let containerStackView = UIStackView()
private let tableView = UITableView(frame: .zero, style: .plain)

Expand Down Expand Up @@ -190,6 +192,7 @@ class CommentDetailViewController: UIViewController, NoResultsViewHost {
self.comment = comment
self.isLastInList = isLastInList
self.managedObjectContext = managedObjectContext
self.accountService = AccountService(managedObjectContext: managedObjectContext)
super.init(nibName: nil, bundle: nil)
}

Expand All @@ -201,6 +204,7 @@ class CommentDetailViewController: UIViewController, NoResultsViewHost {
self.notification = notification
self.notificationDelegate = notificationDelegate
self.managedObjectContext = managedObjectContext
self.accountService = AccountService(managedObjectContext: managedObjectContext)
super.init(nibName: nil, bundle: nil)
}

Expand Down Expand Up @@ -1070,6 +1074,11 @@ private extension CommentDetailViewController {

let suggestionsView = SuggestionsTableView(siteID: siteID, suggestionType: .mention, delegate: self)
suggestionsView.translatesAutoresizingMaskIntoConstraints = false
suggestionsView.prominentSuggestionsIds = SuggestionsTableView.prominentSuggestions(
fromPostAuthorId: comment.post?.authorID,
commentAuthorId: NSNumber(value: comment.authorID),
defaultAccountId: accountService.defaultWordPressComAccount()?.userID
)
view.addSubview(suggestionsView)

NSLayoutConstraint.activate([
Expand Down Expand Up @@ -1110,7 +1119,7 @@ extension CommentDetailViewController: ReplyTextViewDelegate {
suggestionsTableView?.hideSuggestions()

if let siteID = siteID {
controller.enableSuggestions(with: siteID)
controller.enableSuggestions(with: siteID, prominentSuggestionsIds: suggestionsTableView?.prominentSuggestionsIds)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class FullScreenCommentReplyViewController: EditCommentViewController, Su
/// Reply Suggestions
///
private var siteID: NSNumber?
private var prominentSuggestionsIds: [NSNumber]?
private var suggestionsTableView: SuggestionsTableView?

// Static margin between the suggestions view and the text cursor position
Expand Down Expand Up @@ -58,8 +59,10 @@ public class FullScreenCommentReplyViewController: EditCommentViewController, Su

/// Enables the @ mention suggestions while editing
/// - Parameter siteID: The ID of the site to determine if suggestions are enabled or not
@objc func enableSuggestions(with siteID: NSNumber) {
/// - Parameter prominentSuggestionsIds: The suggestions ids to display at the top of the suggestions list.
@objc func enableSuggestions(with siteID: NSNumber, prominentSuggestionsIds: [NSNumber]?) {
self.siteID = siteID
self.prominentSuggestionsIds = prominentSuggestionsIds
}

/// Description
Expand All @@ -72,7 +75,7 @@ public class FullScreenCommentReplyViewController: EditCommentViewController, Su
let tableView = SuggestionsTableView(siteID: siteID, suggestionType: .mention, delegate: self)
tableView.useTransparentHeader = true
tableView.translatesAutoresizingMaskIntoConstraints = false

tableView.prominentSuggestionsIds = prominentSuggestionsIds
suggestionsTableView = tableView

attachSuggestionsViewIfNeeded()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GutenbergMediaInserterHelper: NSObject {

func insertFromSiteMediaLibrary(media: [Media], callback: @escaping MediaPickerDidPickMediaCallback) {
let formattedMedia = media.map { item in
return MediaInfo(id: item.mediaID?.int32Value, url: item.remoteURL, type: item.mediaTypeString, caption: item.caption, title: item.filename)
return MediaInfo(id: item.mediaID?.int32Value, url: item.remoteURL, type: item.mediaTypeString, caption: item.caption, title: item.filename, alt: item.alt)
}
callback(formattedMedia)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ class NotificationDetailsViewController: UIViewController, NoResultsViewHost {
return DefaultContentCoordinator(controller: self, context: mainContext)
}()

/// Service to access the currently authenticated user
///
lazy var accountService: AccountService = {
return AccountService(managedObjectContext: mainContext)
}()

lazy var router: NotificationContentRouter = {
return makeRouter()
}()
Expand Down Expand Up @@ -480,6 +486,12 @@ extension NotificationDetailsViewController {
}

suggestionsTableView = SuggestionsTableView(siteID: siteID, suggestionType: .mention, delegate: self)
suggestionsTableView?.prominentSuggestionsIds = SuggestionsTableView.prominentSuggestions(
fromPostAuthorId: nil,
commentAuthorId: note.metaCommentAuthorID,
defaultAccountId: accountService.defaultWordPressComAccount()?.userID
)

suggestionsTableView?.translatesAutoresizingMaskIntoConstraints = false
}

Expand Down Expand Up @@ -1290,7 +1302,7 @@ extension NotificationDetailsViewController: ReplyTextViewDelegate {
}

suggestionsTableView.hideSuggestions()
controller.enableSuggestions(with: siteID)
controller.enableSuggestions(with: siteID, prominentSuggestionsIds: suggestionsTableView.prominentSuggestionsIds)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ extension QRLoginScanningViewController {
override func viewDidLoad() {
super.viewDidLoad()

navigationController?.delegate = self

errorLabel.isHidden = true
coordinator?.start()
}
Expand Down Expand Up @@ -66,6 +68,17 @@ extension QRLoginScanningViewController {
}
}

// MARK: - UINavigation Controller Delegate
extension QRLoginScanningViewController: UINavigationControllerDelegate {
func navigationControllerSupportedInterfaceOrientations(_ navigationController: UINavigationController) -> UIInterfaceOrientationMask {
return supportedInterfaceOrientations
}

func navigationControllerPreferredInterfaceOrientationForPresentation(_ navigationController: UINavigationController) -> UIInterfaceOrientation {
return .portrait
}
}

// MARK: - Animations
private extension QRLoginScanningViewController {
func startAnimations() {
Expand Down
Loading

0 comments on commit 2f12a30

Please sign in to comment.