Skip to content

Commit

Permalink
[Fluent 2 iOS] Merge main (#1513)
Browse files Browse the repository at this point in the history
* SegmentedControl code clean up (#1432)

* fix rotation bug on segmented control (#1411)

* Fix pillMaskedLabelContainerView comment

* Fix update logic

* Make tokenSink and animation duration private

* Update selectionView on token update

Co-authored-by: Harrie Shin <hyshin@microsoft.com>

* Update to checkout v3 (#1459)

* Adding additional leading view to TableViewCell (#1446)

* Merge tokenized Tooltip into main (#1434)

* Bring Tooltip to main

* remove extra space

* Bring changes from theming fix

* [XCUITests] Launch tests for all controls (#1461)

* add launch tests

* remove test template

* update to use base class + resolve comments

* change back to swift + use extension

* change back to base class with overridden control name

* resolve comments

* Add documentation for Avatar (#1469)

* add documentation for avatar

* add swiftui usage example

* Add documentation for Button (#1471)

* Added button documentation

* Fix table in documentation

* Fix table

* Rename table sections + fix path and typo

* Resized documentation images

* Cleanup

* More cleanup

* Added names to documentation

* fix tooltip png filenames (#1473)

* Update Date Picker test to start from `now` to fix test failure (#1477)

* Update Date Picker test to start from today

* Add explicit type interface

* Create a Readme section for demo app controls (#1268)

* Added new readme icon

* Added a vc for the readme

* Created scroll view and labels

* Added a ReadmeStrings class

* Removing title + polishing readme class

* Added a few more readmes

* Revert "Added new readme icon"

This reverts commit c73665f.

* Moving constant values into a struct

* Moved strings to their respective demo controllers

* Change from readme button text to icon

* Added todo to change color to fluent 2 ramp

* Moved constants struct to top of the file

* Use NSLayourConstraint.activate

* Added tvc readme section

* Removed unnecessary function

* Make fields private

* Refactor + added a few readmes

* Added more readmes

* Cleanup

* Move constraints logic to viewDidLoad

* Moved private properties to bottom of file

* Change unavailable to unavailable (#1475)

* Centralize missing readme string (#1479)

* [XCUITests] Add macOS launch tests (#1484)

* add macos launch tests

* try adding to ci

* remove other build commands

* change arch

* change macOS version

* add back build commands

* Resolving height issue (#1485)

* [XCUITests] Add iOS XCUITests to CI (#1480)

* test adding ios tests to ci

* remove -ios

* try changing to Demo.Development

* add new scheme

* add executable to run

* check run

* uncheck run

* change back to Demo.Development

* remove scheme

* change to just test

* add back scheme

* remove other build commands

* add back debug build

* add test retries

* comment out non tokenized tests

* remove retries + turn off parallelism

* add back other tests

* test if all are going to command bar

* change tests back to controlName

* add tear down that deletes app

* remove setup logic

* add timeouts

* change timeout to 1

* add back other build commands

* remove scheme

* whitespace change

* update tearDown to use isFirstLaunch

* fix linting issue

* remove isFirstLaunch from UserDefaults and add #if DEBUG

* try moving navigation back to setUpWithError

* whitespace change

* Skip failing date picker tests (#1495)

* Fix BadgeField space bug (#1497)

* attempt to fix space bug

* add comment

* [XCUITests] Activity Indicator tests (#1493)

* initial activity indicator tests

* add transition to dark mode

* whitespace change

* add dark mode color assert

* add default color to identifier

* update comment

* add dark mode + update to use .*

* add #if DEBUG

* add #if DEBUG to SceneDelegate

* add constants

* add type

* change to hex code

* removing color tests

* Revert "removing color tests"

This reverts commit 79c20c0.

* removing color tests again

* remove SceneDelegate change

* small change

* make code more readable + have SwiftUI inherit from UIKit

* remove super

* [XCUITests] Indeterminate Progress Bar tests (#1503)

* add indeterminate progress bar tests

* update SwiftUI to inherit from UIKit

* remove super

* resolve comments

* Resolving demo conflicts

* Resolving TableViewCell merge conflicts

* Taking tokenized tooltip from main - no fluent2

* Getting TVC building again

* Updating tooltip tokens

* Fixing TVC sample data and demo project

* Fixing token values

Co-authored-by: huwilkes <67026548+huwilkes@users.noreply.github.com>
Co-authored-by: Harrie Shin <hyshin@microsoft.com>
Co-authored-by: Sophia Lee <sophia.lee0416@gmail.com>
Co-authored-by: Jeanie Huynh <31874971+jeaniehuynh@users.noreply.github.com>
Co-authored-by: Joanna Qu <55368679+joannaquu@users.noreply.github.com>
Co-authored-by: Lamine Male <106181067+laminesm@users.noreply.github.com>
  • Loading branch information
7 people committed Jan 25, 2023
1 parent 1d12cfc commit e42fb1c
Show file tree
Hide file tree
Showing 130 changed files with 2,770 additions and 452 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Switch to current version of Xcode
run: scripts/xcode_select_current_version.sh
- name: pod lib lint
Expand All @@ -35,18 +35,20 @@ jobs:
build_command: [
'macos_build FluentUITestApp-macOS Debug build test',
'macos_build FluentUITestApp-macOS Release build test',
'macos_build FluentUITestApp-macOS Debug build test -destination "platform=macOS,arch=x86_64"',
'ios_simulator_build FluentUI-iOS Debug build test -destination "platform=iOS Simulator,name=iPhone 8"', # Provide a destination for the iOS simulator unit tests
'ios_simulator_build FluentUI-iOS Release build',
'ios_device_build FluentUI-iOS Debug build',
'ios_device_build FluentUI-iOS Release build',
'ios_simulator_build Demo.Development Debug build',
'ios_simulator_build Demo.Development Release build',
'ios_simulator_build Demo.Development Debug build test -destination "platform=iOS Simulator,name=iPhone 14 Pro"',
'ios_device_build Demo.Development Debug build',
'ios_device_build Demo.Development Release build',
]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Switch to current version of Xcode
run: scripts/xcode_select_current_version.sh
- name: scripts/xcodebuild_wrapper.sh ${{ matrix.build_command }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/localize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- shell: bash
name: Localize
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/podPublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: macos-12

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Switch to current version of Xcode
run: scripts/xcode_select_current_version.sh
- name: Publish to CocoaPod register
Expand Down
346 changes: 344 additions & 2 deletions ios/FluentUI.Demo/FluentUI.Demo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@
BlueprintName = "FluentUITests"
ReferencedContainer = "container:../FluentUI.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "DatePickerControllerTests/testSelectionManagerEnd()">
</Test>
</SkippedTests>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3A83F7BE295110FF00EF6629"
BuildableName = "FluentUIDemoTests.xctest"
BlueprintName = "FluentUIDemoTests"
ReferencedContainer = "container:FluentUI.Demo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,17 @@
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3A83F7BE295110FF00EF6629"
BuildableName = "FluentUIDemoTests.xctest"
BlueprintName = "FluentUIDemoTests"
ReferencedContainer = "container:FluentUI.Demo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@
ReferencedContainer = "container:../FluentUI.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3A83F7BE295110FF00EF6629"
BuildableName = "FluentUIDemoTests.xctest"
BlueprintName = "FluentUIDemoTests"
ReferencedContainer = "container:FluentUI.Demo.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
Expand Down
27 changes: 20 additions & 7 deletions ios/FluentUI.Demo/FluentUI.Demo/DemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,27 @@ class DemoController: UIViewController {
// disable it for all DemoController subclasses.
self.navigationItem.largeTitleDisplayMode = .never

configureAppearancePopover()
configureAppearanceAndReadmePopovers()
}

// MARK: - Demo Appearance Popover

func configureAppearancePopover() {
// Display the DemoAppearancePopover button
navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "ic_fluent_settings_24_regular"),
style: .plain,
target: self,
action: #selector(showAppearancePopover))
func configureAppearanceAndReadmePopovers() {
let settingsButton = UIBarButtonItem(image: UIImage(named: "ic_fluent_settings_24_regular"),
style: .plain,
target: self,
action: #selector(showAppearancePopover))
let readmeButton = UIBarButtonItem(image: UIImage(systemName: "i.circle.fill"),
style: .plain,
target: self,
action: #selector(showReadmePopover))
navigationItem.rightBarButtonItems = [readmeButton, settingsButton]
}

@objc func showReadmePopover(_ sender: UIBarButtonItem) {
readmeViewController.popoverPresentationController?.barButtonItem = sender
readmeViewController.popoverPresentationController?.delegate = self
self.present(readmeViewController, animated: true, completion: nil)
}

@objc func showAppearancePopover(_ sender: UIBarButtonItem) {
Expand All @@ -180,7 +190,10 @@ class DemoController: UIViewController {
self.present(appearanceController, animated: true, completion: nil)
}

var readmeString: String?

private lazy var appearanceController: DemoAppearanceController = .init(delegate: self as? DemoAppearanceDelegate)
private lazy var readmeViewController: ReadmeViewController = .init(readmeString: readmeString)
}

extension DemoController: UIPopoverPresentationControllerDelegate {
Expand Down
16 changes: 15 additions & 1 deletion ios/FluentUI.Demo/FluentUI.Demo/DemoTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,15 @@ class DemoTableViewController: UITableViewController {

func configureAppearancePopover() {
// Display the DemoAppearancePopover button
navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "ic_fluent_settings_24_regular"),
let settingsButton = UIBarButtonItem(image: UIImage(named: "ic_fluent_settings_24_regular"),
style: .plain,
target: self,
action: #selector(showAppearancePopover))
let readmeButton = UIBarButtonItem(image: UIImage(systemName: "i.circle.fill"),
style: .plain,
target: self,
action: #selector(showReadmePopover))
navigationItem.rightBarButtonItems = [readmeButton, settingsButton]
}

@objc func showAppearancePopover(_ sender: UIBarButtonItem) {
Expand All @@ -62,7 +67,16 @@ class DemoTableViewController: UITableViewController {
self.present(appearanceController, animated: true, completion: nil)
}

@objc func showReadmePopover(_ sender: UIBarButtonItem) {
readmeViewController.popoverPresentationController?.barButtonItem = sender
readmeViewController.popoverPresentationController?.delegate = self
self.present(readmeViewController, animated: true, completion: nil)
}

var readmeString: String?

private lazy var appearanceController: DemoAppearanceController = .init(delegate: self as? DemoAppearanceDelegate)
private lazy var readmeViewController: ReadmeViewController = .init(readmeString: readmeString)
}

extension DemoTableViewController: UIPopoverPresentationControllerDelegate {
Expand Down
6 changes: 3 additions & 3 deletions ios/FluentUI.Demo/FluentUI.Demo/Demos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ struct Demos {
DemoDescriptor("PersonaButtonCarousel", PersonaButtonCarouselDemoController.self),
DemoDescriptor("SegmentedControl", SegmentedControlDemoController.self),
DemoDescriptor("ShimmerView", ShimmerViewDemoController.self),
DemoDescriptor("TableViewCell", TableViewCellDemoController.self)
DemoDescriptor("TableViewCell", TableViewCellDemoController.self),
DemoDescriptor("Tooltip", TooltipDemoController.self)
]

static let fluent2DesignTokens: [DemoDescriptor] = [
Expand Down Expand Up @@ -62,8 +63,7 @@ struct Demos {
DemoDescriptor("TabBarView", TabBarViewDemoController.self),
DemoDescriptor("TableViewCellFileAccessoryView", TableViewCellFileAccessoryViewDemoController.self),
DemoDescriptor("TableViewCellShimmer", TableViewCellShimmerDemoController.self),
DemoDescriptor("TableViewHeaderFooterView", TableViewHeaderFooterViewDemoController.self),
DemoDescriptor("Tooltip", TooltipDemoController.self)
DemoDescriptor("TableViewHeaderFooterView", TableViewHeaderFooterViewDemoController.self)
]

static let debug: [DemoDescriptor] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class ActivityIndicatorDemoController: DemoTableViewController {
override func viewDidLoad() {
super.viewDidLoad()

readmeString = "An activity indicator lets someone know there’s a background task in progress and assures them the system is still working.\n\nUse activity indicators for loading states that take longer than one second but avoid them for long loading processes."

tableView.register(TableViewCell.self, forCellReuseIdentifier: TableViewCell.identifier)
tableView.register(BooleanCell.self, forCellReuseIdentifier: BooleanCell.identifier)
tableView.register(ActionsCell.self, forCellReuseIdentifier: ActionsCell.identifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class AvatarDemoController: DemoTableViewController {

override func viewDidLoad() {
super.viewDidLoad()
readmeString = "An avatar is a graphical representation of a person, group, or entity.\n\nIt can show images or text to represent the person, group, or entity, as well as give additional information like their status and activity. "

tableView.register(TableViewCell.self, forCellReuseIdentifier: TableViewCell.identifier)
tableView.register(BooleanCell.self, forCellReuseIdentifier: BooleanCell.identifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AvatarGroupDemoController: DemoTableViewController {

override func viewDidLoad() {
super.viewDidLoad()

readmeString = "An avatar group shows multiple avatars."
tableView.register(TableViewCell.self, forCellReuseIdentifier: TableViewCell.identifier)
tableView.register(BooleanCell.self, forCellReuseIdentifier: BooleanCell.identifier)
tableView.register(ActionsCell.self, forCellReuseIdentifier: ActionsCell.identifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class BadgeViewDemoController: DemoController {
override func viewDidLoad() {
super.viewDidLoad()

readmeString = "A badge is a compact, interactive, \ntextual representation of a person. It is generally a representation of user-input text that maps to an entry in a database."

addBadgeSection(title: "Default badge", style: .default)
addBadgeSection(title: "Error badge", style: .error)
addBadgeSection(title: "Warning badge", style: .warning)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UIKit
class ButtonDemoController: DemoController {
override func viewDidLoad() {
super.viewDidLoad()
readmeString = "A button triggers a single action or event.\n\nUse buttons for important actions like submitting a response, committing a change, or moving to the next step. If you need to navigate to another place, try a link instead."

container.alignment = .leading

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class CardNudgeDemoController: DemoTableViewController {
override func viewDidLoad() {
super.viewDidLoad()

readmeString = "A card nudge is a short message that helps someone discover what they can do in an app. It appears at the top of a screen, beneath the navigation bar, and pushes all other content below it.\n\nCard nudges are helpful for sending reminders and recommendations, but they don’t necessarily relate to someone’s current task. They should never be used to communicate feedback or status. To tell a user how things are going, try a notification instead."

tableView.register(UITableViewCell.self, forCellReuseIdentifier: CardNudgeDemoController.controlReuseIdentifier)
tableView.register(BooleanCell.self, forCellReuseIdentifier: BooleanCell.identifier)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ class CommandBarDemoController: DemoController {

override func viewDidLoad() {
super.viewDidLoad()

readmeString = "The contextual command bar appears above the keyboard to provide contextual actions relevant to the content within the current view, like text formatting in Word."

container.layoutMargins.right = 0
container.layoutMargins.left = 0
view.backgroundColor = UIColor(dynamicColor: view.fluentTheme.aliasTokens.colors[.background4])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class DateTimePickerDemoController: DemoController {
dateTimePicker.delegate = self
dateLabel.text = "No date selected"
dateLabel.adjustsFontSizeToFitWidth = true
readmeString = "A date and time picker is a specialized interface that lets people choose a single date, a range of dates, or a time.\n\nDate and time pickers provide context that can help people make decisions, like the day of the week a date falls or unavailable dates. Avoid using date and time pickers for dates people know well or that will require a lot of scrolling, like birthdays."

container.addArrangedSubview(dateLabel)
container.addArrangedSubview(createButton(title: "Show date picker", action: #selector(presentDatePicker)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UIKit
class GlobalColorTokensDemoController: DemoTableViewController {
override func viewDidLoad() {
super.viewDidLoad()
readmeString = "All global color tokens within the FluentUI framework."
tableView.register(UITableViewCell.self, forCellReuseIdentifier: Constants.cellID)
}

Expand Down
2 changes: 2 additions & 0 deletions ios/FluentUI.Demo/FluentUI.Demo/Demos/HUDDemoController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class HUDDemoController: DemoTableViewController {
override func viewDidLoad() {
super.viewDidLoad()

readmeString = "The heads-up display, or HUD, is a loading indicator that appears on a backplate and can give additional, textual information about the background task that’s occuring."

tableView.register(TableViewCell.self, forCellReuseIdentifier: TableViewCell.identifier)
tableView.register(ActionsCell.self, forCellReuseIdentifier: ActionsCell.identifier)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class IndeterminateProgressBarDemoController: DemoTableViewController {

override func viewDidLoad() {
super.viewDidLoad()

tableView.register(TableViewCell.self, forCellReuseIdentifier: TableViewCell.identifier)
tableView.register(BooleanCell.self, forCellReuseIdentifier: BooleanCell.identifier)
tableView.register(ActionsCell.self, forCellReuseIdentifier: ActionsCell.identifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class NavigationControllerDemoController: DemoController {
override func viewDidLoad() {
super.viewDidLoad()

readmeString = "The navigation bar provides information and actions relating to the current screen. It often shows the app or page title and allows for navigation relative to the current page, letting someone step forward and back through a flow. The left side of the navigation bar can contain actions that directly relate to that page’s content, like edit or done buttons.\n\nIf you need to show wayfinding for main sections of your app that don’t change as people move through it, try the tab bar."

addTitle(text: "Large Title with Primary style")
container.addArrangedSubview(createButton(title: "Show without accessory", action: #selector(showLargeTitle)))
container.addArrangedSubview(createButton(title: "Show with collapsible search bar", action: #selector(showLargeTitleWithShyAccessory)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class NotificationViewDemoController: DemoController {

override func viewDidLoad() {
super.viewDidLoad()
readmeString = "Notifications deliver helpful messages related to the action someone is taking. They should communicate information people can use right away.\n\nNotifications are great for giving people feedback or communicating a task’s status. If you need to show recommendations or upsell features of your app, try a card nudge instead."
view.backgroundColor = UIColor(dynamicColor: view.fluentTheme.aliasTokens.colors[.background4])

addTitle(text: "SwiftUI Demo")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class PersonaButtonCarouselDemoController: DemoTableViewController {

override func viewDidLoad() {
super.viewDidLoad()

readmeString = "A persona button carousel lets people scroll through a list of persona buttons to view or make a selection."
tableView.register(ActionsCell.self, forCellReuseIdentifier: PersonaButtonCarouselDemoController.controlReuseIdentifier)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: PersonaButtonCarouselDemoController.largeCarouselReuseIdentifier)
tableView.register(UITableViewCell.self, forCellReuseIdentifier: PersonaButtonCarouselDemoController.smallCarouselReuseIdentifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import UIKit
class PillButtonBarDemoController: DemoController {
override func viewDidLoad() {
super.viewDidLoad()

readmeString = "A pill button bar lets someone select one option from a set of two or more pill-shaped buttons aligned horizontally.\n\nPill button bars are ideal for narrowing down the information someone sees on a page, like filtering information. They’re often used in conjunction with search bars. "

container.layoutMargins.right = 0
container.layoutMargins.left = 0
var items: [PillButtonBarItem] = [PillButtonBarItem(title: "All"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ class PopupMenuDemoController: DemoController {

override func viewDidLoad() {
super.viewDidLoad()
readmeString = "A popup menu is a small, temporary window that appears on demand to give non-essential, contextual information.\n\nPopup menus can have structured content and interactive components but limit the functionality that you include in them. Generally, they work best in wider views. If you need to show contextual info in a compact view, try a sheet instead."

navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Show", style: .plain, target: self, action: #selector(topBarButtonTapped))
let showButton = UIBarButtonItem(title: "Show", style: .plain, target: self, action: #selector(topBarButtonTapped))
navigationItem.rightBarButtonItems?.append(showButton)

toolbarItems = [
UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil),
Expand Down
Loading

0 comments on commit e42fb1c

Please sign in to comment.