Skip to content

Commit 6cf8bea

Browse files
committed
Sync branch with trunk
2 parents b489bf1 + adbb17e commit 6cf8bea

71 files changed

Lines changed: 1405 additions & 155 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.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash -eu
2+
3+
echo "--- :rubygems: Setting up Gems"
4+
install_gems
5+
6+
echo "--- :cocoapods: Setting up Pods"
7+
install_cocoapods
8+
9+
echo "--- :writing_hand: Copy Files"
10+
mkdir -pv ~/.configure/wordpress-ios/secrets
11+
cp -v fastlane/env/project.env-example ~/.configure/wordpress-ios/secrets/project.env
12+
13+
echo "--- Lint Localized Strings Format"
14+
LOGS=logs.txt
15+
set +e
16+
set -o pipefail
17+
bundle exec fastlane generate_strings_file_for_glotpress skip_commit:true | tee $LOGS
18+
EXIT_CODE=$?
19+
set -e
20+
21+
echo $EXIT_CODE
22+
23+
if [[ $EXIT_CODE -ne 0 ]]; then
24+
# Strings generation finished with errors, extract the errors in an easy-to-find section
25+
echo "--- Report genstrings errors"
26+
ERRORS=errors.txt
27+
echo "Found errors when trying to run \`genstrings\` to generate the \`.strings\` files from \`*LocalizedStrings\` calls:" | tee $ERRORS
28+
echo '' >> $ERRORS
29+
# Print the errors inline.
30+
#
31+
# Notice the second `sed` call that removes the ANSI escape sequences that
32+
# Fastlane uses to color the output.
33+
grep -e "\[.*\].*genstrings:" $LOGS \
34+
| sed -e 's/\[.*\].*genstrings: error: /- /' \
35+
| sed -e $'s/\x1b\[[0-9;]*m//g' \
36+
| sort \
37+
| uniq \
38+
| tee -a $ERRORS
39+
# Annotate the build with the errors
40+
cat $ERRORS | buildkite-agent annotate --style error --context genstrings
41+
fi
42+
43+
exit $EXIT_CODE

.buildkite/pipeline.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,10 @@ steps:
123123
plugins: *common_plugins
124124
agents:
125125
queue: "android"
126+
# Runs the `.strings` generation automation to ensure all the
127+
# `LocalizedString` calls in the code can be correctly parsed by Apple's
128+
# `genstrings`.
129+
- label: "Lint Localized Strings Format"
130+
command: .buildkite/commands/lint-localized-strings-format.sh
131+
plugins: *common_plugins
132+
env: *common_env

Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ abstract_target 'Apps' do
218218

219219
pod 'NSURL+IDN', '~> 0.4'
220220

221-
pod 'WPMediaPicker', '~> 1.8.7-beta.1'
221+
pod 'WPMediaPicker', '~> 1.8.7'
222222
# pod 'WPMediaPicker', :git => 'https://github.com/wordpress-mobile/MediaPicker-iOS.git', :tag => '1.7.0'
223223
## while PR is in review:
224224
# pod 'WPMediaPicker', :git => 'https://github.com/wordpress-mobile/MediaPicker-iOS.git', :branch => ''

Podfile.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ PODS:
6464
- RNTAztecView
6565
- JTAppleCalendar (8.0.3)
6666
- Kanvas (1.4.4)
67-
- libwebp (1.2.3):
68-
- libwebp/demux (= 1.2.3)
69-
- libwebp/mux (= 1.2.3)
70-
- libwebp/webp (= 1.2.3)
71-
- libwebp/demux (1.2.3):
67+
- libwebp (1.2.4):
68+
- libwebp/demux (= 1.2.4)
69+
- libwebp/mux (= 1.2.4)
70+
- libwebp/webp (= 1.2.4)
71+
- libwebp/demux (1.2.4):
7272
- libwebp/webp
73-
- libwebp/mux (1.2.3):
73+
- libwebp/mux (1.2.4):
7474
- libwebp/demux
75-
- libwebp/webp (1.2.3)
75+
- libwebp/webp (1.2.4)
7676
- MediaEditor (1.2.1):
7777
- CropViewController (~> 2.5.3)
7878
- MRProgress (0.8.3):
@@ -512,7 +512,7 @@ PODS:
512512
- CocoaLumberjack (~> 3.4)
513513
- FormatterKit/TimeIntervalFormatter (~> 1.8)
514514
- WordPressUI (1.12.5)
515-
- WPMediaPicker (1.8.7-beta.1)
515+
- WPMediaPicker (1.8.7)
516516
- wpxmlrpc (0.9.0)
517517
- Yoga (1.14.0)
518518
- ZendeskCommonUISDK (6.1.2)
@@ -605,7 +605,7 @@ DEPENDENCIES:
605605
- WordPressKit (>= 4.58.2, ~> 4.58)
606606
- WordPressShared (~> 1.18.0)
607607
- WordPressUI (~> 1.12.5)
608-
- WPMediaPicker (~> 1.8.7-beta.1)
608+
- WPMediaPicker (~> 1.8.7)
609609
- Yoga (from `https://raw.githubusercontent.com/wordpress-mobile/gutenberg-mobile/v1.85.0/third-party-podspecs/Yoga.podspec.json`)
610610
- ZendeskSupportSDK (= 5.3.0)
611611
- ZIPFoundation (~> 0.9.8)
@@ -807,7 +807,7 @@ SPEC CHECKSUMS:
807807
Gutenberg: 387b010e396588027538e351899bf1cc730a7009
808808
JTAppleCalendar: 932cadea40b1051beab10f67843451d48ba16c99
809809
Kanvas: f932eaed3d3f47aae8aafb6c2d27c968bdd49030
810-
libwebp: 60305b2e989864154bd9be3d772730f08fc6a59c
810+
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
811811
MediaEditor: 20cdeb46bdecd040b8bc94467ac85a52b53b193a
812812
MRProgress: 16de7cc9f347e8846797a770db102a323fe7ef09
813813
NSObject-SafeExpectations: ab8fe623d36b25aa1f150affa324e40a2f3c0374
@@ -868,7 +868,7 @@ SPEC CHECKSUMS:
868868
WordPressKit: d8bc00bce09273fc241cf171b0e61ef8f4f29479
869869
WordPressShared: e5a479220643f46dc4d7726ef8dd45f18bf0c53b
870870
WordPressUI: c5be816f6c7b3392224ac21de9e521e89fa108ac
871-
WPMediaPicker: 59135aebb058a95a507045f93e478516729e5c0f
871+
WPMediaPicker: 0d45dfd7b3c5651c5236ffd48c1b0b2f60a2d5d2
872872
wpxmlrpc: bf55a43a7e710bd2a4fb8c02dfe83b1246f14f13
873873
Yoga: 2ca978c40e0fd6d7f54bcb1602bc0cbbc79454a7
874874
ZendeskCommonUISDK: 5f0a83f412e07ae23701f18c412fe783b3249ef5
@@ -880,6 +880,6 @@ SPEC CHECKSUMS:
880880
ZendeskSupportSDK: 3a8e508ab1d9dd22dc038df6c694466414e037ba
881881
ZIPFoundation: ae5b4b813d216d3bf0a148773267fff14bd51d37
882882

883-
PODFILE CHECKSUM: 936784ec2e9d8246acccd6b123c0ba5b1b6e13b9
883+
PODFILE CHECKSUM: e4762593ef0d1097286d309c828f611976c1e771
884884

885885
COCOAPODS: 1.11.2

RELEASE-NOTES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
21.3
2+
-----
3+
* [*] [internal] Blogging Reminders notifications and scheduling can be turned off for WordPress as part of Jetpack focus behind a feature flag. [#19611]
4+
* [*] [internal] Weekly Roundup notifications and scheduling can be turned off for WordPress as part of Jetpack focus behind a feature flag. [#19590]
5+
* [*] Fixed a minor UI issue where the segmented control under My SIte was being clipped when "Home" is selected. [#19595]
6+
17
21.2
28
-----
39
* [*] [internal] Refactored fetching posts in the Reader tab. [#19539]

WordPress/Classes/Models/Notifications/NotificationSettings.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ open class NotificationSettings {
139139
}
140140

141141
// MARK: - Private Properties
142-
fileprivate let blogPreferenceKeys: [String] = {
142+
fileprivate var blogPreferenceKeys: [String] {
143143
var keys = [Keys.commentAdded, Keys.commentLiked, Keys.postLiked, Keys.follower, Keys.achievement, Keys.mention]
144144

145145
if Feature.enabled(.weeklyRoundup) {
146146
keys.append(Keys.weeklyRoundup)
147147
}
148148

149149
return keys
150-
}()
150+
}
151151
fileprivate let blogEmailPreferenceKeys = [Keys.commentAdded, Keys.commentLiked, Keys.postLiked, Keys.follower, Keys.mention]
152152
fileprivate let otherPreferenceKeys = [Keys.commentLiked, Keys.commentReplied]
153153
fileprivate let wpcomPreferenceKeys = [Keys.marketing, Keys.research, Keys.community]

WordPress/Classes/Services/NotificationFilteringService.swift

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ final class NotificationFilteringService {
2424

2525
set {
2626
userDefaults?.set(newValue, forKey: WPNotificationsEnabledKey)
27+
28+
if isWordPress && !newValue {
29+
cancelAllPendingWordPressLocalNotifications()
30+
}
2731
}
2832
}
2933

@@ -50,9 +54,21 @@ final class NotificationFilteringService {
5054
}
5155

5256
func shouldFilterWordPressNotifications() -> Bool {
53-
return allowDisablingWPNotifications
57+
let shouldFilter = allowDisablingWPNotifications
5458
&& isWordPress
5559
&& !wordPressNotificationsEnabled
60+
61+
if shouldFilter {
62+
cancelAllPendingWordPressLocalNotifications()
63+
}
64+
65+
return shouldFilter
66+
}
67+
68+
private func cancelAllPendingWordPressLocalNotifications(notificationCenter: UNUserNotificationCenter = UNUserNotificationCenter.current()) {
69+
if isWordPress {
70+
notificationCenter.removeAllPendingNotificationRequests()
71+
}
5672
}
5773
}
5874

WordPress/Classes/Utility/Analytics/WPAnalyticsEvent.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,10 @@ import Foundation
407407
case jetpackPoweredBadgeTapped
408408
case jetpackPoweredBannerTapped
409409
case jetpackPoweredBottomSheetButtonTapped
410+
case jetpackFullscreenOverlayDisplayed
411+
case jetpackFullscreenOverlayLinkTapped
412+
case jetpackFullscreenOverlayButtonTapped
413+
case jetpackFullscreenOverlayDismissed
410414

411415
/// A String that represents the event
412416
var value: String {
@@ -1102,6 +1106,14 @@ import Foundation
11021106
return "jetpack_powered_banner_tapped"
11031107
case .jetpackPoweredBottomSheetButtonTapped:
11041108
return "jetpack_powered_bottom_sheet_button_tapped"
1109+
case .jetpackFullscreenOverlayDisplayed:
1110+
return "remove_feature_overlay_displayed"
1111+
case .jetpackFullscreenOverlayLinkTapped:
1112+
return "remove_feature_overlay_link_tapped"
1113+
case .jetpackFullscreenOverlayButtonTapped:
1114+
return "remove_feature_overlay_button_tapped"
1115+
case .jetpackFullscreenOverlayDismissed:
1116+
return "remove_feature_overlay_dismissed"
11051117
} // END OF SWITCH
11061118
}
11071119

WordPress/Classes/Utility/BackgroundTasks/WeeklyRoundupBackgroundTask.swift

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ class WeeklyRoundupBackgroundTask: BackgroundTask {
252252
private let eventTracker: NotificationEventTracker
253253
let runDateComponents: DateComponents
254254
let notificationScheduler: WeeklyRoundupNotificationScheduler
255+
private let notificationFilteringService = NotificationFilteringService()
255256

256257
init(
257258
eventTracker: NotificationEventTracker = NotificationEventTracker(),
@@ -260,7 +261,8 @@ class WeeklyRoundupBackgroundTask: BackgroundTask {
260261
store: Store = Store()) {
261262

262263
self.eventTracker = eventTracker
263-
notificationScheduler = WeeklyRoundupNotificationScheduler(staticNotificationDateComponents: staticNotificationDateComponents)
264+
notificationScheduler = WeeklyRoundupNotificationScheduler(staticNotificationDateComponents: staticNotificationDateComponents,
265+
notificationFilteringService: notificationFilteringService)
264266
self.store = store
265267

266268
self.runDateComponents = runDateComponents ?? {
@@ -357,6 +359,14 @@ class WeeklyRoundupBackgroundTask: BackgroundTask {
357359

358360
func run(onError: @escaping (Error) -> Void, completion: @escaping (Bool) -> Void) {
359361

362+
// This will no longer run for WordPress as part of JetPack migration.
363+
// This can be removed once JetPack migration is complete.
364+
if notificationFilteringService.shouldFilterWordPressNotifications() {
365+
notificationScheduler.cancellAll()
366+
notificationScheduler.cancelStaticNotification()
367+
return
368+
}
369+
360370
// We use multiple operations in series so that if the expiration handler is
361371
// called, the operation queue will cancell any pending operations, ensuring
362372
// that the task will exit as soon as possible.
@@ -485,9 +495,11 @@ class WeeklyRoundupNotificationScheduler {
485495

486496
init(
487497
staticNotificationDateComponents: DateComponents? = nil,
498+
notificationFilteringService: NotificationFilteringService,
488499
userNotificationCenter: UNUserNotificationCenter = UNUserNotificationCenter.current()) {
489500

490501
self.userNotificationCenter = userNotificationCenter
502+
self.notificationFilteringService = notificationFilteringService
491503

492504
self.staticNotificationDateComponents = staticNotificationDateComponents ?? {
493505
var dateComponents = DateComponents()
@@ -506,6 +518,7 @@ class WeeklyRoundupNotificationScheduler {
506518

507519
let staticNotificationDateComponents: DateComponents
508520
let userNotificationCenter: UNUserNotificationCenter
521+
let notificationFilteringService: NotificationFilteringService
509522

510523
enum NotificationSchedulingError: Error {
511524
case staticNotificationSchedulingError(error: Error)
@@ -611,6 +624,10 @@ class WeeklyRoundupNotificationScheduler {
611624
dateComponents: DateComponents,
612625
completion: @escaping (Result<Void, Error>) -> Void) {
613626

627+
if notificationFilteringService.shouldFilterWordPressNotifications() {
628+
return
629+
}
630+
614631
let content = UNMutableNotificationContent()
615632
content.title = title
616633
content.body = body
@@ -649,7 +666,7 @@ class WeeklyRoundupNotificationScheduler {
649666
}
650667
}
651668

652-
func cancelStaticNotification(completion: @escaping (Bool) -> Void) {
669+
func cancelStaticNotification(completion: @escaping (Bool) -> Void = { _ in }) {
653670
userNotificationCenter.getPendingNotificationRequests { requests in
654671
if Feature.enabled(.weeklyRoundupStaticNotification) {
655672
guard requests.contains( where: { $0.identifier == self.staticNotificationIdentifier }) else {

WordPress/Classes/Utility/BuildInformation/FeatureFlag.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ enum FeatureFlag: Int, CaseIterable, OverrideableFlag {
6868
case .milestoneNotifications:
6969
return true
7070
case .bloggingReminders:
71-
return true
71+
return !NotificationFilteringService().shouldFilterWordPressNotifications()
7272
case .siteIconCreator:
7373
return BuildConfiguration.current != .appStore
7474
case .weeklyRoundup:
75-
return true
75+
return !NotificationFilteringService().shouldFilterWordPressNotifications()
7676
case .weeklyRoundupStaticNotification:
7777
// This may be removed, but we're feature flagging it for now until we know for sure we won't need it.
7878
return false

0 commit comments

Comments
 (0)