Skip to content

Commit

Permalink
Merge pull request #68 from IBM/internal-dev
Browse files Browse the repository at this point in the history
Version 2.5.0 Build 76
  • Loading branch information
SMartorelli committed Jan 13, 2022
2 parents 64cc893 + 98f94a7 commit 9c1da38
Show file tree
Hide file tree
Showing 33 changed files with 356 additions and 234 deletions.
Binary file added Images/Popup/checklist_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 10 additions & 4 deletions Notification Agent Core/Controllers/HelpBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public final class HelpBuilder {
"-always_on_top".yellow(),
"-silent".yellow(),
"-miniaturizable".yellow(),
"-position".yellow()]
"-force_light_mode".yellow(),
"-position".yellow(),
"-popup_reminder".yellow()]
static let bannerArguments: [String] = ["-type".green(),
"-title".yellow(),
"-subtitle".yellow(),
Expand All @@ -49,7 +51,8 @@ public final class HelpBuilder {
"-secondary_button_cta_payload".yellow(),
"-tertiary_button_label".yellow(),
"-tertiary_button_cta_type".yellow(),
"-tertiary_button_cta_payload".yellow()]
"-tertiary_button_cta_payload".yellow(),
"-notification_image".yellow()]
static let onboardingArguments: [String] = ["-type".green(),
"-payload".green()]
static let popupDescriptions: [String] = ["[ popup ]".red() + "\n The UI type of the notification.\n Example: -type popup",
Expand Down Expand Up @@ -79,7 +82,9 @@ public final class HelpBuilder {
"\n Flag that tells the agent to keep the pop-up always on top of the window hierarchy.\n Example: -always_on_top",
"\n Flag that tells the agent to not reproduce any sound when the pop-up appear.\n Example: -silent",
"\n Flag that allows the UI to show the \"miniaturize\" button for the pop-up window.\n Example: -miniaturizable",
"[ center | top_right | top_left | bottom_right | bottom_left ]".red() + "\n Tells the app where to place the pop-up window.\n Example: -position center"]
"\n Flag that force the UI in light mode.\n Example: -force_light_mode",
"[ center | top_right | top_left | bottom_right | bottom_left ]".red() + "\n Tells the app where to place the pop-up window.\n Example: -position center",
"\n A text payload to define the behavior of an optional reminder for the pop-up. The reminder is basically a timer at the end of which the pop-up is pushed again on top of the view hierarchy on screen. The payload format is: " + "\"/timeinterval <TIME_IN_SECONDS> /silent /repeat\" ".green() + "\n Example: -popup_reminder \"/timeinterval 300\""]
static let bannerDescriptions: [String] = ["[ banner | alert ]".red() + "\n The UI type of the notification.\n Example: -type banner",
"\n The title of the notification.\n Example: -title \"Title\"",
"\n The subtitle of the notification. It supports MarkDown text.\n Example: -subtitle \"Subtitle\"",
Expand All @@ -91,7 +96,8 @@ public final class HelpBuilder {
"\n An URL if " + "[ link ]".red() + " cta type defined.\n Example: -secondary_button_cta_payload \"URL\"",
"\n The label of the tertiary button.\n Example: -tertiary_button_label \"Tertiary button title\"",
"[ none | link ]".red() + "\n The call to action type for the tertiary button.\n Example: -tertiary_button_cta_type link",
"\n An URL if " + "[ link ]".red() + " cta type defined.\n Example: -tertiary_button_cta_payload \"URL\""]
"\n An URL if " + "[ link ]".red() + " cta type defined.\n Example: -tertiary_button_cta_payload \"URL\"",
"\n The path (local or remote) or the base64 encoded representation of the image attached to this notification.\n Example: -notification_image \"~/Icon/Path.png\""]
static let onboardingDescriptions: [String] = ["[ onboarding ]".red() + "\n The UI type of the notification.\n Example: -type onboarding",
"\n The json payload for the \"onboarding\" UI type.\n Example: -payload \"{ \"pages\": [\n {\n \"title\": \"Some title\",\n \"subtitle\": \"Some subtitle\",\n \"body\": \"Some body\",\n \"mediaType\": \"[ image | video ]\",\n \"mediaPayload\": \"Some URL\"\n }\n ]\n }\"\n Please see more about this feature on the project wiki."]
static let popupSyntacticRules: [String] = ["At least one argument between" + " [ -title | -subtitle | -accessory_view_type + -accessory_view_payload ] ".red() + "must be defined to present a pop-up.",
Expand Down

This file was deleted.

6 changes: 0 additions & 6 deletions Notification Agent Onboarding/Assets.xcassets/Contents.json

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ extension NotificationDispatch {
let onboardingViewController = OnboardingViewController(with: pages)
let window = NSWindow(contentViewController: onboardingViewController)
window.styleMask.remove(.resizable)
if object.forceLightMode ?? false {
window.appearance = NSAppearance(named: .aqua)
}
window.title = ""
window.titlebarAppearsTransparent = true
window.center()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,18 @@ final class OnboardingPageViewController: NSViewController {
case last
case middle
case singlePage
var rightButtonImage: NSImage {
var rightButtonTitle: String {
switch self {
case .first:
return NSImage(named: "arrow.right.circle")!
return "onboarding_page_continue_button".localized
case .middle:
return NSImage(named: "arrow.right.circle")!
return "onboarding_page_continue_button".localized
case .last, .singlePage:
return NSImage(named: "checkmark.circle")!
return "onboarding_page_close_button".localized
}
}
var leftButtonImage: NSImage {
switch self {
case .first, .singlePage:
return NSImage()
case .middle:
return NSImage(named: "arrow.left.circle")!
case .last:
return NSImage(named: "arrow.left.circle")!
}
var leftButtonTitle: String {
return "onboarding_page_back_button".localized
}
var isRightButtonHidden: Bool {
switch self {
Expand All @@ -61,7 +54,7 @@ final class OnboardingPageViewController: NSViewController {
@IBOutlet weak var bodyStackView: NSStackView!
@IBOutlet weak var rightButton: NSButton!
@IBOutlet weak var leftButton: NSButton!
@IBOutlet weak var centerButton: NSButton!
@IBOutlet weak var helpButton: NSButton!

// MARK: - Variables

Expand Down Expand Up @@ -107,21 +100,23 @@ final class OnboardingPageViewController: NSViewController {
var topGravityAreaIndex = 0
if let title = page.title {
titleLabel = NSTextField(wrappingLabelWithString: title)
titleLabel.font = NSFont.systemFont(ofSize: 32)
titleLabel.font = NSFont.boldSystemFont(ofSize: 26)
titleLabel.alignment = .center
bodyStackView.insertView(titleLabel, at: topGravityAreaIndex, in: .top)
topGravityAreaIndex += 1
remainingSpace -= titleLabel.intrinsicContentSize.height+12
}
if let subtitle = page.subtitle {
subtitleLabel = NSTextField(wrappingLabelWithString: subtitle)
subtitleLabel.font = NSFont.systemFont(ofSize: 18)
subtitleLabel.font = NSFont.systemFont(ofSize: 16, weight: .semibold)
subtitleLabel.alignment = .center
bodyStackView.insertView(subtitleLabel, at: topGravityAreaIndex, in: .top)
topGravityAreaIndex += 1
remainingSpace -= subtitleLabel.intrinsicContentSize.height+12
}
if let pageMedia = page.pageMedia {
if let body = page.body {
bodyTextView = MarkdownTextView(withText: body, maxViewHeight: remainingSpace)
bodyTextView = MarkdownTextView(withText: body, maxViewHeight: remainingSpace, alignment: .center)
bodyStackView.insertView(bodyTextView, at: 0, in: .center)
remainingSpace -= bodyTextView.fittingSize.height+12
}
Expand All @@ -137,7 +132,7 @@ final class OnboardingPageViewController: NSViewController {
}
} else {
if let body = page.body {
bodyTextView = MarkdownTextView(withText: body, maxViewHeight: remainingSpace)
bodyTextView = MarkdownTextView(withText: body, maxViewHeight: remainingSpace, alignment: .center)
bodyStackView.insertView(bodyTextView, at: topGravityAreaIndex, in: .top)
}
}
Expand All @@ -147,14 +142,9 @@ final class OnboardingPageViewController: NSViewController {
private func setupButtonsLayout() {
rightButton.isHidden = position.isRightButtonHidden
leftButton.isHidden = position.isLeftButtonHidden
rightButton.image = position.rightButtonImage
leftButton.image = position.leftButtonImage
if page.infoSection != nil {
centerButton.isHidden = false
centerButton.image = NSImage(named: "info.circle")
} else {
centerButton.isHidden = true
}
rightButton.title = position.rightButtonTitle
leftButton.title = position.leftButtonTitle
helpButton.isHidden = !(page.infoSection != nil)
}

/// This method load and set the icon if a custom one was defined.
Expand Down Expand Up @@ -186,7 +176,7 @@ final class OnboardingPageViewController: NSViewController {
private func configureAccessibilityElements() {
self.rightButton.setAccessibilityLabel(position == .last ? "onboarding_accessibility_button_right_close".localized : "onboarding_accessibility_button_right_continue".localized)
self.leftButton.setAccessibilityLabel("onboarding_accessibility_button_left".localized)
self.centerButton.setAccessibilityLabel("onboarding_accessibility_button_center".localized)
self.helpButton.setAccessibilityLabel("onboarding_accessibility_button_center".localized)
self.bodyStackView.setAccessibilityLabel("onboarding_accessibility_stackview_body".localized)
self.topIconImageView.setAccessibilityLabel("onboarding_accessibility_image_top".localized)
}
Expand Down Expand Up @@ -215,7 +205,7 @@ final class OnboardingPageViewController: NSViewController {
}
}

@IBAction func didPressCenterButton(_ sender: NSButton) {
@IBAction func didPressHelpButton(_ sender: NSButton) {
guard let infos = page.infoSection else { return }
let infoPopupViewController = InfoPopOverViewController(with: infos)
self.present(infoPopupViewController,
Expand Down
Loading

0 comments on commit 9c1da38

Please sign in to comment.