Skip to content

Commit

Permalink
Merge branch 'trunk' into task/23046-subscribers-list-details
Browse files Browse the repository at this point in the history
  • Loading branch information
guarani committed Apr 26, 2024
2 parents f820e05 + 26a669d commit 83df7d6
Show file tree
Hide file tree
Showing 116 changed files with 2,510 additions and 735 deletions.
2 changes: 1 addition & 1 deletion Gutenberg/config.yml
Expand Up @@ -9,6 +9,6 @@
#
# LOCAL_GUTENBERG=../my-gutenberg-fork bundle exec pod install
ref:
tag: v1.117.0
tag: v1.118.0
github_org: wordpress-mobile
repo_name: gutenberg-mobile
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3C",
"green" : "0x3A",
"red" : "0x3A"
"blue" : "0x2E",
"green" : "0x2C",
"red" : "0x2C"
}
},
"idiom" : "universal"
Expand Down
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x2E",
"green" : "0x2C",
"red" : "0x2C"
"blue" : "0x3C",
"green" : "0x3A",
"red" : "0x3A"
}
},
"idiom" : "universal"
Expand Down
1 change: 1 addition & 0 deletions Modules/Sources/DesignSystem/Foundation/IconName.swift
Expand Up @@ -14,6 +14,7 @@ public enum IconName: String, CaseIterable {
case blockShare = "block.share"
case starFill = "star.fill"
case starOutline = "star.outline"
case vector = "vector"
}

// MARK: - Load Image
Expand Down
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "Vector.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Binary file not shown.
2 changes: 1 addition & 1 deletion Podfile
Expand Up @@ -56,7 +56,7 @@ end

def wordpress_kit
# pod 'WordPressKit', '~> 17.0.0'
pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '3291ab9b60e88b1bc78f50422efd3b38c30c0eb3'
pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', commit: '77aee91d607cb8b86d4356c0aebfb3977ff1fcc7'
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', branch: ''
# pod 'WordPressKit', git: 'https://github.com/wordpress-mobile/WordPressKit-iOS.git', tag: ''
# pod 'WordPressKit', path: '../WordPressKit-iOS'
Expand Down
16 changes: 8 additions & 8 deletions Podfile.lock
Expand Up @@ -27,7 +27,7 @@ PODS:
- Gifu (3.3.1)
- Gravatar (1.0.1)
- Gridicons (1.2.0)
- Gutenberg (1.117.0)
- Gutenberg (1.118.0)
- JTAppleCalendar (8.0.5)
- Kanvas (1.4.9):
- CropViewController
Expand Down Expand Up @@ -107,7 +107,7 @@ DEPENDENCIES:
- Gifu (= 3.3.1)
- Gravatar (= 1.0.1)
- Gridicons (~> 1.2)
- Gutenberg (from `https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.117.0.podspec`)
- Gutenberg (from `https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.118.0.podspec`)
- JTAppleCalendar (~> 8.0.5)
- Kanvas (~> 1.4.4)
- MediaEditor (>= 1.2.2, ~> 1.2)
Expand All @@ -121,7 +121,7 @@ DEPENDENCIES:
- SwiftLint (= 0.54.0)
- WordPress-Editor-iOS (~> 1.19.11)
- WordPressAuthenticator (>= 9.0.8, ~> 9.0)
- WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `3291ab9b60e88b1bc78f50422efd3b38c30c0eb3`)
- WordPressKit (from `https://github.com/wordpress-mobile/WordPressKit-iOS.git`, commit `77aee91d607cb8b86d4356c0aebfb3977ff1fcc7`)
- WordPressShared (from `https://github.com/wordpress-mobile/WordPress-iOS-Shared.git`, commit `688ee5e4efddc1fc23626626ef17b7e929bdafb0`)
- WordPressUI (~> 1.16)
- ZendeskSupportSDK (= 5.3.0)
Expand Down Expand Up @@ -175,9 +175,9 @@ EXTERNAL SOURCES:
:git: https://github.com/wordpress-mobile/FSInteractiveMap.git
:tag: 0.2.0
Gutenberg:
:podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.117.0.podspec
:podspec: https://cdn.a8c-ci.services/gutenberg-mobile/Gutenberg-v1.118.0.podspec
WordPressKit:
:commit: 3291ab9b60e88b1bc78f50422efd3b38c30c0eb3
:commit: 77aee91d607cb8b86d4356c0aebfb3977ff1fcc7
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git
WordPressShared:
:commit: 688ee5e4efddc1fc23626626ef17b7e929bdafb0
Expand All @@ -188,7 +188,7 @@ CHECKOUT OPTIONS:
:git: https://github.com/wordpress-mobile/FSInteractiveMap.git
:tag: 0.2.0
WordPressKit:
:commit: 3291ab9b60e88b1bc78f50422efd3b38c30c0eb3
:commit: 77aee91d607cb8b86d4356c0aebfb3977ff1fcc7
:git: https://github.com/wordpress-mobile/WordPressKit-iOS.git
WordPressShared:
:commit: 688ee5e4efddc1fc23626626ef17b7e929bdafb0
Expand All @@ -207,7 +207,7 @@ SPEC CHECKSUMS:
Gifu: 416d4e38c4c2fed012f019e0a1d3ffcb58e5b842
Gravatar: 51437de6811c1d8d6f60c52985f2ca00a85cfc8e
Gridicons: 4455b9f366960121430e45997e32112ae49ffe1d
Gutenberg: 2249ee2bdac042ce129297aee696c7926930bc00
Gutenberg: 3117b6fe578fb7f0bb75377ba96f436ee05c30fe
JTAppleCalendar: 16c6501b22cb27520372c28b0a2e0b12c8d0cd73
Kanvas: cc027f8058de881a4ae2b5aa5f05037b6d054d08
MediaEditor: d08314cfcbfac74361071a306b4bc3a39b3356ae
Expand Down Expand Up @@ -239,6 +239,6 @@ SPEC CHECKSUMS:
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
ZIPFoundation: d170fa8e270b2a32bef9dcdcabff5b8f1a5deced

PODFILE CHECKSUM: d5e8587901ad6400bb90366661ff541a6f27f08a
PODFILE CHECKSUM: 4bbf2ae7c80a5f39db237e7c3514872e9f7eb3ca

COCOAPODS: 1.15.2
@@ -1,15 +1,11 @@
import Foundation

extension AbstractPost {
/// If a post is in the failed state it can contain references to local files.
/// When updating the app through the App Store the local paths can change.
/// This will fix any outdated local path with the correct one.
///
/// When updating the app through the App Store or installing a new version
/// of the app from Xcode, the local paths can change. This will fix any
/// outdated local path with the correct one.
func fixLocalMediaURLs() {
guard isFailed,
var content = self.content else {
return
}
guard var content = self.content else { return }

media.forEach { media in
guard !media.hasRemote else {
Expand Down
Expand Up @@ -54,11 +54,20 @@ extension UINavigationController {

extension UIViewController {
func configureDefaultNavigationBarAppearance() {
var textAttributes: [NSAttributedString.Key: Any] = [.foregroundColor: UIColor.appBarText]
let largeTitleTextAttributes: [NSAttributedString.Key: Any] = [.font: WPStyleGuide.navigationBarLargeFont]

textAttributes[.font] = WPStyleGuide.navigationBarStandardFont

let standardAppearance = UINavigationBarAppearance()
standardAppearance.configureWithDefaultBackground()
standardAppearance.titleTextAttributes = textAttributes
standardAppearance.largeTitleTextAttributes = largeTitleTextAttributes

let scrollEdgeAppearance = UINavigationBarAppearance()
scrollEdgeAppearance.configureWithTransparentBackground()
scrollEdgeAppearance.titleTextAttributes = textAttributes
scrollEdgeAppearance.largeTitleTextAttributes = largeTitleTextAttributes

navigationItem.standardAppearance = standardAppearance
navigationItem.compactAppearance = standardAppearance
Expand Down
4 changes: 4 additions & 0 deletions WordPress/Classes/Models/Blog.h
Expand Up @@ -173,6 +173,10 @@ typedef NS_ENUM(NSInteger, SiteVisibility) {
@property (nonatomic, strong, readwrite, nullable) NSDictionary *capabilities;
@property (nonatomic, strong, readwrite, nullable) NSSet<QuickStartTourState *> *quickStartTours;
@property (nonatomic, strong, readwrite, nullable) NSNumber *quickStartTypeValue;

// Site Switcher Convenience Properties
@property (nonatomic, strong, readwrite, nullable) NSDate *pinnedDate;
@property (nonatomic, strong, readwrite, nullable) NSDate *lastUsed;
/// The blog's user ID for the current user
@property (nonatomic, strong, readwrite, nullable) NSNumber *userID;
/// Disk quota for site, this is only available for WP.com sites
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Classes/Models/Blog.m
Expand Up @@ -93,6 +93,8 @@ @implementation Blog
@dynamic quotaSpaceUsed;
@dynamic pageTemplateCategories;
@dynamic publicizeInfo;
@dynamic pinnedDate;
@dynamic lastUsed;

@synthesize isSyncingPosts;
@synthesize isSyncingPages;
Expand Down
20 changes: 20 additions & 0 deletions WordPress/Classes/Services/MediaCoordinator.swift
Expand Up @@ -798,6 +798,26 @@ extension MediaCoordinator {

}, for: nil)
}

/// Returns `true` if the error can't be resolved by simply retrying and
/// requires user interventions, for example, making more room in the
/// Media library.
static func isTerminalError(_ error: Error) -> Bool {
let nsError = error as NSError
switch nsError.domain {
case MediaServiceErrorDomain:
switch nsError.code {
case MediaServiceError.fileDoesNotExist.rawValue,
MediaServiceError.fileLargerThanMaxFileSize.rawValue,
MediaServiceError.fileLargerThanDiskQuotaAvailable.rawValue:
return true
default:
return false
}
default:
return false
}
}
}

extension Media {
Expand Down
17 changes: 9 additions & 8 deletions WordPress/Classes/Services/PostCoordinator+Notices.swift
@@ -1,7 +1,7 @@
import UIKit

extension PostCoordinator {
static func makeUploadSuccessNotice(for post: AbstractPost, isExistingPost: Bool = false) -> Notice {
static func makeUploadSuccessNotice(for post: AbstractPost, previousStatus: AbstractPost.Status? = nil) -> Notice {
var message: String {
let title = post.titleForDisplay() ?? ""
if !title.isEmpty {
Expand All @@ -10,18 +10,19 @@ extension PostCoordinator {
return post.blog.displayURL as String? ?? ""
}
let isPublished = post.status == .publish
return Notice(title: Strings.publishSuccessTitle(for: post, isExistingPost: isExistingPost),
let isUpdated = post.status == previousStatus
return Notice(title: Strings.publishSuccessTitle(for: post, isUpdated: isUpdated),
message: message,
feedbackType: .success,
notificationInfo: makeUploadSuccessNotificationInfo(for: post, isExistingPost: isExistingPost),
notificationInfo: makeUploadSuccessNotificationInfo(for: post, isUpdated: isUpdated),
actionTitle: isPublished ? Strings.view : nil,
actionHandler: { _ in
PostNoticeNavigationCoordinator.presentPostEpilogue(for: post)
})
}

private static func makeUploadSuccessNotificationInfo(for post: AbstractPost, isExistingPost: Bool) -> NoticeNotificationInfo {
let status = Strings.publishSuccessTitle(for: post, isExistingPost: isExistingPost)
private static func makeUploadSuccessNotificationInfo(for post: AbstractPost, isUpdated: Bool) -> NoticeNotificationInfo {
let status = Strings.publishSuccessTitle(for: post, isUpdated: isUpdated)
var title: String {
let title = post.titleForDisplay() ?? ""
guard !title.isEmpty else {
Expand All @@ -46,10 +47,10 @@ extension PostCoordinator {
private enum Strings {
static let view = NSLocalizedString("postNotice.view", value: "View", comment: "Button title. Displays a summary / sharing screen for a specific post.")

static func publishSuccessTitle(for post: AbstractPost, isExistingPost: Bool = false) -> String {
static func publishSuccessTitle(for post: AbstractPost, isUpdated: Bool = false) -> String {
switch post {
case let post as Post:
guard !isExistingPost else {
guard !isUpdated else {
return NSLocalizedString("postNotice.postUpdated", value: "Post updated", comment: "Title of notification displayed when a post has been successfully updated.")
}
switch post.status {
Expand All @@ -63,7 +64,7 @@ private enum Strings {
return NSLocalizedString("postNotice.postPublished", value: "Post published", comment: "Title of notification displayed when a post has been successfully published.")
}
case let page as Page:
guard !isExistingPost else {
guard !isUpdated else {
return NSLocalizedString("postNotice.pageUpdated", value: "Page updated", comment: "Title of notification displayed when a page has been successfully updated.")
}
switch page.status {
Expand Down
21 changes: 12 additions & 9 deletions WordPress/Classes/Services/PostCoordinator.swift
Expand Up @@ -228,9 +228,9 @@ class PostCoordinator: NSObject {
defer { resumeSyncing(for: post) }

do {
let isExistingPost = post.hasRemote()
let previousStatus = post.status
try await PostRepository()._save(post, changes: changes)
show(PostCoordinator.makeUploadSuccessNotice(for: post, isExistingPost: isExistingPost))
show(PostCoordinator.makeUploadSuccessNotice(for: post, previousStatus: previousStatus))
return post
} catch {
trackError(error, operation: "post-save")
Expand Down Expand Up @@ -600,7 +600,7 @@ class PostCoordinator: NSObject {
worker.error = error
postDidUpdateNotification(for: operation.post)

if shouldScheduleRetry(for: error) {
if !PostCoordinator.isTerminalError(error) {
let delay = worker.nextRetryDelay
worker.retryTimer = Timer.scheduledTimer(withTimeInterval: delay, repeats: false) { [weak self, weak worker] _ in
guard let self, let worker else { return }
Expand All @@ -617,16 +617,19 @@ class PostCoordinator: NSObject {
}
}

private func shouldScheduleRetry(for error: Error) -> Bool {
/// Returns `true` if the error can't be resolved by simply retrying and
/// requires user interventions, for example, resolving a conflict.
static func isTerminalError(_ error: Error) -> Bool {
if let saveError = error as? PostRepository.PostSaveError {
switch saveError {
case .deleted:
return false
case .conflict:
return false
case .deleted, .conflict:
return true
}
}
return true
if let error = error as? SavingError, case .mediaFailure(_, let error) = error {
return MediaCoordinator.isTerminalError(error)
}
return false
}

private func didRetryTimerFire(for worker: SyncWorker) {
Expand Down
10 changes: 10 additions & 0 deletions WordPress/Classes/System/UITestConfigurator.swift
Expand Up @@ -22,10 +22,20 @@ struct UITestConfigurator {

private static func logoutAtLaunch() {
if CommandLine.arguments.contains("-logout-at-launch") {
removeSelfHostedSites()
AccountHelper.logOutDefaultWordPressComAccount()
}
}

private static func removeSelfHostedSites() {
let context = ContextManager.shared.mainContext
let service = BlogService(coreDataStack: ContextManager.shared)
let blogs = try? BlogQuery().hostedByWPCom(false).blogs(in: context)
for blog in blogs ?? [] {
service.remove(blog)
}
}

private static func disableCompliancePopover() {
if CommandLine.arguments.contains("-ui-testing") {
UserDefaults.standard.didShowCompliancePopup = true
Expand Down
12 changes: 12 additions & 0 deletions WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift
Expand Up @@ -26,6 +26,7 @@ import Foundation
case editorPostPublishTap
case editorPostPublishDismissed
case editorPostScheduledChanged
case editorPostPendingReviewChanged
case editorPostTitleChanged
case editorPostVisibilityChanged
case editorPostTagsChanged
Expand Down Expand Up @@ -284,6 +285,9 @@ import Foundation
case siteSwitcherAddSiteTapped
case siteSwitcherSearchPerformed
case siteSwitcherToggleBlogVisible
case siteSwitcherToggledPinTapped
case siteSwitcherPinUpdated
case siteSwitcherSiteTapped

// Post List
case postListItemSelected
Expand Down Expand Up @@ -627,6 +631,8 @@ import Foundation
return "editor_post_publish_dismissed"
case .editorPostScheduledChanged:
return "editor_post_scheduled_changed"
case .editorPostPendingReviewChanged:
return "editor_post_pending_review_changed"
case .editorPostTitleChanged:
return "editor_post_title_changed"
case .editorPostVisibilityChanged:
Expand Down Expand Up @@ -1087,6 +1093,12 @@ import Foundation
return "site_switcher_search_performed"
case .siteSwitcherToggleBlogVisible:
return "site_switcher_toggle_blog_visible"
case .siteSwitcherToggledPinTapped:
return "site_switcher_toggled_pin_tapped"
case .siteSwitcherPinUpdated:
return "site_switcher_pin_updated"
case .siteSwitcherSiteTapped:
return "site_switcher_site_tapped"

// Post List
case .postListItemSelected:
Expand Down

0 comments on commit 83df7d6

Please sign in to comment.