Skip to content

Commit bddf5db

Browse files
authored
Merge branch 'trunk' into discarded-notification-observers
2 parents 04a9c6b + d061181 commit bddf5db

156 files changed

Lines changed: 1698 additions & 1330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.swiftlint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ remote_timeout: 10.0
44
opt_in_rules:
55
- overridden_super_call
66
- discarded_notification_center_observer
7+
- weak_delegate
78

89
overridden_super_call:
910
severity: error
1011

1112
discarded_notification_center_observer:
1213
severity: error
14+
15+
weak_delegate:
16+
severity: error

Gutenberg/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# LOCAL_GUTENBERG=../my-gutenberg-fork bundle exec pod install
1313
GUTENBERG_CONFIG = {
1414
# commit: ''
15-
tag: 'v1.100.0-alpha1'
15+
tag: 'v1.100.1'
1616
}
1717

1818
GITHUB_ORG = 'wordpress-mobile'

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ abstract_target 'Apps' do
108108
## Third party libraries
109109
## =====================
110110
##
111-
pod 'Gifu', '3.2.0'
111+
pod 'Gifu', '3.3.1'
112112

113113
app_center_version = '~> 4.1'
114114
app_center_configurations = %w[Release-Internal Release-Alpha]

Podfile.lock

Lines changed: 106 additions & 106 deletions
Large diffs are not rendered by default.

RELEASE-NOTES.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
* [*] [internal] Fix multiple memory leaks after logging in and logging out. [#21047, #21092]
44
* [**] Block editor: Move undo/redo buttons to the navigation bar. [#20930]
55
* [*] Fixed an issue that caused the UI to be briefly unresponsive in certain case when opening the app. [#21065]
6+
* [**] Blogging Prompts: Fixed a crash in Reader after tapping on a blogging prompt multiple times. [#21112]
67
* [*] [internal] Update calls to use UserDefaults singleton. [#21088]
8+
* [*] Fix memory leaks in setting up Jetpack connection. [#21052]
79
* [*] Fix a memory leak caused by the theme customization web view. [#21051]
10+
* [*] [Jetpack-only] Made performance improvements for Posting Activity stats. [#21136]
11+
* [*] Fixed a crash that could occur when following sites in Reader. [#21140]
12+
* [*] [Jetpack-only] Fixed a crash that could occur when the user deletes the WordPress app upon a successful migration. [#21167]
13+
* [*] Fixed a crash that occurs in Weekly Roundup Background task due to a Core Data Concurrency violation. [#21076]
14+
* [***] Block editor: Editor UX improvements with new icons, colors and additional design enhancements. [https://github.com/wordpress-mobile/gutenberg-mobile/pull/5985]
815

916
22.8
1017
-----

WordPress/Classes/Extensions/NSURLCache+Helpers.swift

Lines changed: 0 additions & 49 deletions
This file was deleted.

WordPress/Classes/Models/Notifications/NotificationSettings.swift

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,20 @@ open class NotificationSettings {
1515
///
1616
public let streams: [Stream]
1717

18-
/// Maps to the associated blog, if any.
18+
/// The associated blog. This property is not thread-safe.
19+
///
20+
/// If you need to access this property from a thread different from the one it was created on, don't access it directly. Instead, use the `blogManagedObjectID`
21+
/// with `context.existingObject(with: blogManagedObjectID)` to retrieve the corresponding managed object in a thread-safe manner.
1922
///
2023
public let blog: Blog?
2124

25+
/// The managed object identifier for the associated blog. This property serves as a thread-safe version of the `blog` property.
26+
///
27+
/// Rather than directly accessing the `blog` property from a different thread than the one it was created on, use this identifier with
28+
/// `context.existingObject(with: blogManagedObjectID)` to retrieve the corresponding managed object in a thread-safe manner.
29+
///
30+
public let blogManagedObjectID: NSManagedObjectID?
31+
2232
/// The settings that are stored locally
2333
///
2434
static let locallyStoredKeys: [String] = [
@@ -37,6 +47,7 @@ open class NotificationSettings {
3747
self.channel = channel
3848
self.streams = streams
3949
self.blog = blog
50+
self.blogManagedObjectID = blog?.objectID
4051
}
4152

4253

WordPress/Classes/Models/ReaderSiteTopic+Lookup.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,12 @@ extension ReaderSiteTopic {
3434
///
3535
/// - Parameter feedID: The feed id of the topic
3636
@objc(lookupWithFeedID:inContext:)
37-
static func objc_lookup(withFeedID feedID: NSNumber, in context: NSManagedObjectContext) -> ReaderSiteTopic? {
38-
try? lookup(withFeedID: feedID, in: context)
37+
static func objc_lookup(withFeedID feedID: NSNumber?, in context: NSManagedObjectContext) -> ReaderSiteTopic? {
38+
guard let feedID else {
39+
DDLogError("Obj-C lookupWithFeedID called with a nil feedID")
40+
return nil
41+
}
42+
return try? lookup(withFeedID: feedID, in: context)
3943
}
4044

4145
/// Find a site topic by its feed URL

WordPress/Classes/Services/CommentService.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,14 @@ - (void)replyToPost:(ReaderPost *)post
685685
// post and content provided.
686686
BOOL isPrivateSite = post.isPrivate;
687687
[self createHierarchicalCommentWithContent:content withParent:nil postObjectID:post.objectID siteID:post.siteID completion:^(NSManagedObjectID *commentID) {
688+
if (!commentID) {
689+
NSError *error = [NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{NSDebugDescriptionErrorKey: @"Failed to create a comment for a post"}];
690+
if (failure) {
691+
failure(error);
692+
}
693+
[WordPressAppDelegate logError:error];
694+
return;
695+
}
688696
void (^successBlock)(RemoteComment *remoteComment) = ^void(RemoteComment *remoteComment) {
689697
[self.coreDataStack performAndSaveUsingBlock:^(NSManagedObjectContext *context) {
690698
Comment *comment = [context existingObjectWithID:commentID error:nil];
@@ -730,6 +738,14 @@ - (void)replyToHierarchicalCommentWithID:(NSNumber *)commentID
730738
// post and content provided.
731739
BOOL isPrivateSite = post.isPrivate;
732740
[self createHierarchicalCommentWithContent:content withParent:nil postObjectID:post.objectID siteID:post.siteID completion:^(NSManagedObjectID *commentObjectID) {
741+
if (!commentObjectID) {
742+
NSError *error = [NSError errorWithDomain:WKErrorDomain code:WKErrorUnknown userInfo:@{NSDebugDescriptionErrorKey: @"Failed to create a comment for a post"}];
743+
if (failure) {
744+
failure(error);
745+
}
746+
[WordPressAppDelegate logError:error];
747+
return;
748+
}
733749
void (^successBlock)(RemoteComment *remoteComment) = ^void(RemoteComment *remoteComment) {
734750
// Update and save the comment
735751
[self.coreDataStack performAndSaveUsingBlock:^(NSManagedObjectContext *context) {

WordPress/Classes/Services/NotificationSettingsService.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ class NotificationSettingsService {
1515
/// - Parameter managedObjectContext: A Reference to the MOC that should be used to interact with the Core Data Stack.
1616
///
1717
public convenience init(coreDataStack: CoreDataStack) {
18-
var remoteApi: WordPressComRestApi? = nil
19-
20-
if let defaultAccount = try? WPAccount.lookupDefaultWordPressComAccount(in: coreDataStack.mainContext),
21-
defaultAccount.authToken != nil,
22-
let restApi = defaultAccount.wordPressComRestApi,
23-
restApi.hasCredentials() {
24-
remoteApi = restApi
18+
let remoteApi = coreDataStack.performQuery { context -> WordPressComRestApi? in
19+
guard let defaultAccount = try? WPAccount.lookupDefaultWordPressComAccount(in: context),
20+
defaultAccount.authToken != nil,
21+
let restApi = defaultAccount.wordPressComRestApi,
22+
restApi.hasCredentials() else {
23+
return nil
24+
}
25+
return restApi
2526
}
26-
2727
self.init(coreDataStack: coreDataStack, wordPressComRestApi: remoteApi)
2828
}
2929

0 commit comments

Comments
 (0)