Skip to content

Commit

Permalink
Site Monitoring: Add site monitoring menu item (#22475)
Browse files Browse the repository at this point in the history
  • Loading branch information
momo-ozawa authored Jan 26, 2024
2 parents e153103 + 16afe0e commit 963d9e0
Show file tree
Hide file tree
Showing 9 changed files with 85 additions and 1 deletion.
3 changes: 2 additions & 1 deletion WordPress/Classes/Models/Blog.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ typedef NS_ENUM(NSUInteger, BlogFeature) {
BlogFeatureBlaze,
/// Does the blog support listing and editing Pages?
BlogFeaturePages,

/// Does the blog support Site Monitoring?
BlogFeatureSiteMonitoring,
};

typedef NS_ENUM(NSInteger, SiteVisibility) {
Expand Down
2 changes: 2 additions & 0 deletions WordPress/Classes/Models/Blog.m
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ - (BOOL)supports:(BlogFeature)feature
return [self canBlaze];
case BlogFeaturePages:
return [self isListingPagesAllowed];
case BlogFeatureSiteMonitoring:
return [self isAdmin] && [self isAtomic];
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import UIKit

extension BlogDetailsViewController {

@objc func showSiteMonitoring() {
let controller = SiteMonitoringViewController()
presentationDelegate?.presentBlogDetailsViewController(controller)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ extension BlogDetailsViewController {
value: "Social",
comment: "Title for the social row in the blog details screen"
)
static let siteMonitoringRowTitle = NSLocalizedString(
"my-site.menu.site-monitoring.row.title",
value: "Site Monitoring",
comment: "Title for the site monitoring row in the blog details screen"
)
}
}

Expand All @@ -37,4 +42,5 @@ class objc_BlogDetailsViewController_Strings: NSObject {
@objc class func trafficSectionTitle() -> String { BlogDetailsViewController.Strings.trafficSectionTitle }
@objc class func maintenanceSectionTitle() -> String { BlogDetailsViewController.Strings.maintenanceSectionTitle }
@objc class func socialRowTitle() -> String { BlogDetailsViewController.Strings.socialRowTitle }
@objc class func siteMonitoringRowTitle() -> String { BlogDetailsViewController.Strings.siteMonitoringRowTitle }
}
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,18 @@ - (BlogDetailsRow *)socialRow
return row;
}

- (BlogDetailsRow *)siteMonitoringRow
{
__weak __typeof(self) weakSelf = self;
BlogDetailsRow *row = [[BlogDetailsRow alloc] initWithTitle:[BlogDetailsViewControllerStrings siteMonitoringRowTitle]
accessibilityIdentifier:@"Site Monitoring Row"
image:[UIImage imageNamed:@"tool"]
callback:^{
[weakSelf showSiteMonitoring];
}];
return row;
}

- (BlogDetailsRow *)activityRow
{
__weak __typeof(self) weakSelf = self;
Expand Down Expand Up @@ -1139,6 +1151,9 @@ - (BlogDetailsSection *)trafficSectionViewModel
NSMutableArray *thirdSectionRows = [NSMutableArray array];

// The 1st section
if ([RemoteFeature enabled:RemoteFeatureFlagSiteMonitoring] && [self.blog supports:BlogFeatureSiteMonitoring]) {
[firstSectionRows addObject:[self siteMonitoringRow]];
}
if ([self.blog supports:BlogFeatureActivity] && ![self.blog isWPForTeams]) {
[firstSectionRows addObject:[self activityRow]];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import SwiftUI
import UIKit

struct SiteMonitoringView: View {
var body: some View {
Text("Site Monitoring")
}
}

final class SiteMonitoringViewController: UIHostingController<SiteMonitoringView> {

init() {
super.init(rootView: .init())
}

@MainActor required dynamic init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
12 changes: 12 additions & 0 deletions WordPress/Resources/AppImages.xcassets/tool.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "tool.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
20 changes: 20 additions & 0 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3912,6 +3912,10 @@
FA347AF026EB6E300096604B /* GrowAudienceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA347AEC26EB6E300096604B /* GrowAudienceCell.xib */; };
FA347AF226EB7A420096604B /* StatsGhostGrowAudienceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA347AF126EB7A420096604B /* StatsGhostGrowAudienceCell.xib */; };
FA347AF326EB7A420096604B /* StatsGhostGrowAudienceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = FA347AF126EB7A420096604B /* StatsGhostGrowAudienceCell.xib */; };
FA34AD942B62976100208D65 /* SiteMonitoringView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA34AD932B62976100208D65 /* SiteMonitoringView.swift */; };
FA34AD972B629FCB00208D65 /* SiteMonitoringView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA34AD932B62976100208D65 /* SiteMonitoringView.swift */; };
FA34AD992B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA34AD982B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift */; };
FA34AD9A2B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA34AD982B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift */; };
FA3536F525B01A2C0005A3A0 /* JetpackRestoreCompleteViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA3536F425B01A2C0005A3A0 /* JetpackRestoreCompleteViewController.swift */; };
FA3A28182A38D36900206D74 /* BlazeCampaignTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA3A28172A38D36900206D74 /* BlazeCampaignTableViewCell.swift */; };
FA3A28192A38D36900206D74 /* BlazeCampaignTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = FA3A28172A38D36900206D74 /* BlazeCampaignTableViewCell.swift */; };
Expand Down Expand Up @@ -9212,6 +9216,8 @@
FA347AEB26EB6E300096604B /* GrowAudienceCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GrowAudienceCell.swift; sourceTree = "<group>"; };
FA347AEC26EB6E300096604B /* GrowAudienceCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = GrowAudienceCell.xib; sourceTree = "<group>"; };
FA347AF126EB7A420096604B /* StatsGhostGrowAudienceCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = StatsGhostGrowAudienceCell.xib; sourceTree = "<group>"; };
FA34AD932B62976100208D65 /* SiteMonitoringView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SiteMonitoringView.swift; sourceTree = "<group>"; };
FA34AD982B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BlogDetailsViewController+SiteMonitoring.swift"; sourceTree = "<group>"; };
FA3536F425B01A2C0005A3A0 /* JetpackRestoreCompleteViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JetpackRestoreCompleteViewController.swift; sourceTree = "<group>"; };
FA3A28172A38D36900206D74 /* BlazeCampaignTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlazeCampaignTableViewCell.swift; sourceTree = "<group>"; };
FA3A281A2A39C8FF00206D74 /* BlazeCampaignSingleStatView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlazeCampaignSingleStatView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -11498,6 +11504,7 @@
F53FF3A623EA722F001AD596 /* Detail Header */,
F4D9188529D78C9100974A71 /* BlogDetailsViewController+Strings.swift */,
FADC40AA2A8D093900C19997 /* BlogDetailsViewController+Me.swift */,
FA34AD982B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift */,
);
path = "Blog Details";
sourceTree = "<group>";
Expand Down Expand Up @@ -14921,6 +14928,7 @@
4395A15E210672C900844E8E /* QuickStart */,
E6431DDE1C4E890B00FD8D90 /* Sharing */,
FA5C74091C596E69000B528C /* Site Management */,
FA34AD922B62973E00208D65 /* Site Monitoring */,
FA73D7E72798766300DF24B3 /* Site Picker */,
3F43603823F36A76001DEE70 /* Site Settings */,
0C896DDC2A3A761600D7D4E7 /* Settings */,
Expand Down Expand Up @@ -18036,6 +18044,14 @@
path = "Moved To Jetpack";
sourceTree = "<group>";
};
FA34AD922B62973E00208D65 /* Site Monitoring */ = {
isa = PBXGroup;
children = (
FA34AD932B62976100208D65 /* SiteMonitoringView.swift */,
);
path = "Site Monitoring";
sourceTree = "<group>";
};
FA4F65B52594589C00EAA9F5 /* Jetpack Restore */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -21356,6 +21372,7 @@
C3E2462926277B7700B99EA6 /* PostAuthorSelectorViewController.swift in Sources */,
F5E032E62408D537003AF350 /* ActionSheetViewController.swift in Sources */,
9A4F8F56218B88E000EEDCCC /* PostService+Revisions.swift in Sources */,
FA34AD942B62976100208D65 /* SiteMonitoringView.swift in Sources */,
8332D7452ADF263500EB97EF /* UIConfigurationTextAttributesTransformer+Font.swift in Sources */,
3F73388226C1CE9B0075D1DD /* TimeSelectionButton.swift in Sources */,
5DED0E181B432E0400431FCD /* SourcePostAttribution.m in Sources */,
Expand Down Expand Up @@ -22769,6 +22786,7 @@
738B9A5221B85CF20005062B /* SiteCreationWizardLauncher.swift in Sources */,
46F583AF2624CE790010A723 /* BlockEditorSettingElement+CoreDataProperties.swift in Sources */,
F41D98E42B39CAA5004EC050 /* BlogDashboardDynamicCardCoordinator.swift in Sources */,
FA34AD992B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift in Sources */,
3234B8E7252FA0930068DA40 /* ReaderSitesCardCell.swift in Sources */,
C7234A4E2832C47D0045C63F /* QRLoginVerifyAuthorizationViewController.swift in Sources */,
08CBC77929AE6CC4000026E7 /* SiteCreationEmptySiteTemplate.swift in Sources */,
Expand Down Expand Up @@ -24065,6 +24083,7 @@
FABB21702602FC2C00C8785C /* PeopleCell.swift in Sources */,
FABB21712602FC2C00C8785C /* AbstractPost+Local.swift in Sources */,
FABB21722602FC2C00C8785C /* MeScenePresenter.swift in Sources */,
FA34AD972B629FCB00208D65 /* SiteMonitoringView.swift in Sources */,
FABB21732602FC2C00C8785C /* JetpackScanStatusViewModel.swift in Sources */,
F195C42C26DFBE21000EC884 /* WeeklyRoundupBackgroundTask.swift in Sources */,
FABB21752602FC2C00C8785C /* HeaderContentGroup.swift in Sources */,
Expand Down Expand Up @@ -25095,6 +25114,7 @@
086CCE7E2A7A70F0002A349E /* DashboardGoogleDomainsCardView.swift in Sources */,
FABB24672602FC2C00C8785C /* StatsBarChartView.swift in Sources */,
FABB24682602FC2C00C8785C /* URLQueryItem+Parameters.swift in Sources */,
FA34AD9A2B62A35E00208D65 /* BlogDetailsViewController+SiteMonitoring.swift in Sources */,
FABB24692602FC2C00C8785C /* MenuItemView.m in Sources */,
FA4B203C29AE62C00089FE68 /* BlazeOverlayViewController.swift in Sources */,
C3895DDD28C65435004E7C9B /* SplashPrologueView.swift in Sources */,
Expand Down

0 comments on commit 963d9e0

Please sign in to comment.