Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add HotDog Stand theme to settings #800

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions Tests/VocableUITests/Screens/SettingsScreen.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
//
// SettingsScreen.swift
// VocableUITests
//
// Created by Kevin Stechler on 5/19/20.
// Updated by Canan Arikan and Rudy Salas on 05/27/22.
// Copyright © 2022 WillowTree. All rights reserved.
//

import XCTest

class SettingsScreen: BaseScreen {
Expand All @@ -23,6 +14,7 @@ class SettingsScreen: BaseScreen {
static let selectionModeCell = XCUIApplication().cells[.settings.selectionModeCell]
static let privacyPolicyCell = XCUIApplication().cells[.settings.privacyPolicyCell]
static let contactDevelopersCell = XCUIApplication().cells[.settings.contactDevelopersCell]
static let hotDogStandThemeCell = XCUIApplication().cells[.settings.hotDogStandThemeCell] // Pd3e5

// Categories and Phrases
static let addCategoryButton = XCUIApplication().buttons[.settings.editCategories.addCategoryButton]
Expand Down
15 changes: 6 additions & 9 deletions Tests/VocableUITests/Tests/SettingsScreenTests.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
//
// SettingsScreenTests.swift
// VocableUITests
//
// Created by Sashank Patel on 8/24/20.
// Updated by Canan Arikan and Rudy Salas on 03/28/22.
// Copyright © 2022 WillowTree. All rights reserved.
//

import XCTest

class SettingsScreenTests: BaseTest {
Expand Down Expand Up @@ -68,4 +59,10 @@ class SettingsScreenTests: BaseTest {
// Using the query for the second category (i.e. second most cell in list) confirm the category name matches expectations
XCTAssertEqual(currentSecondCategory.label, originalSecondCategoryName)
}

func testHotDogStandThemeToggle() throws {
try SettingsScreen.navigateToSettingsCategoryScreen()
try SettingsScreen.hotDogStandThemeCell.tapWhenExists()
XCTAssertTrue(SettingsScreen.hotDogStandThemeCell.isSelected)
}
}
12 changes: 4 additions & 8 deletions Vocable/Extensions/UIColor+AppExtensions.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// UIColor+AppExtensions.swift
// Vocable AAC
//
// Created by Kyle Ohanian on 4/16/19.
// Copyright © 2019 WillowTree. All rights reserved.
//

import UIKit

extension UIColor {
Expand Down Expand Up @@ -46,7 +38,7 @@

// MARK: New Branded Colors

// TODO: Switch to compile-time generated symbols

Check warning on line 41 in Vocable/Extensions/UIColor+AppExtensions.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

Todo Violation: TODOs should be resolved (Switch to compile-time generat...) (todo)

Check warning on line 41 in Vocable/Extensions/UIColor+AppExtensions.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

Todo Violation: TODOs should be resolved (Switch to compile-time generat...) (todo)

// Workaround for https://openradar.appspot.com/47113341. Prevent crashing the IBDesignables agent when using a color from the asset catalog.
private convenience init?(safelyNamed name: String) {
Expand All @@ -72,4 +64,8 @@
static let cellBorderHighlightColor = UIColor(safelyNamed: "BorderHighlight")!
static let alertBackgroundColor = UIColor(safelyNamed: "AlertBackground")!
static let alertNormalText = UIColor(safelyNamed: "CategoryBackground")!

// HotDog Stand theme colors
static let hotDogStandBackgroundColor = UIColor(safelyNamed: "HotDogStandBackground")!
static let hotDogStandTextColor = UIColor(safelyNamed: "HotDogStandText")!
}
46 changes: 37 additions & 9 deletions Vocable/Features/Settings/SettingsViewController.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
//
// SettingsViewController.swift
// Vocable AAC
//
// Created by Jesse Morgan on 2/6/20.
// Copyright © 2020 WillowTree. All rights reserved.
//

import UIKit
import MessageUI

Expand Down Expand Up @@ -34,6 +26,7 @@
case pidTuner
case listeningMode
case voiceConfiguration
case hotDogStandTheme // P206b

var title: String {
switch self {
Expand All @@ -55,6 +48,8 @@
return String(localized: "settings.cell.listening_mode.title")
case .voiceConfiguration:
return String(localized: "settings.cell.voice_configuration.title")
case .hotDogStandTheme:
return "HotDog Stand Theme" // P206b
}
}

Expand All @@ -78,6 +73,8 @@
return .settings.voiceSettingsCell
case .pidTuner:
return ""
case .hotDogStandTheme:
return .settings.hotDogStandThemeCell // P206b

Check failure on line 77 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

type 'AccessibilityID.settings' has no member 'hotDogStandThemeCell'
}
}

Expand Down Expand Up @@ -156,6 +153,14 @@
self?.handleItemSelection(item)
}
cell.accessibilityID = item.accessibiltyId
} else if item == .hotDogStandTheme { // Pa7d2
cell.contentConfiguration = VocableListContentConfiguration.toggleCell(
title: item.title,
isOn: AppConfig.isHotDogStandThemeEnabled,

Check failure on line 159 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

type 'AppConfig' has no member 'isHotDogStandThemeEnabled'
accessibilityIdentifier: item.accessibiltyId
) { [weak self] in
self?.handleHotDogStandThemeToggle()
}
} else {
cell.contentConfiguration = VocableListContentConfiguration.disclosureCell(title: item.title) {
self?.handleItemSelection(item)
Expand Down Expand Up @@ -198,7 +203,8 @@
.timingSensitivity,
.listeningMode,
.selectionMode,
.resetAppSettings].filter(\.isFeatureEnabled))
.resetAppSettings,
.hotDogStandTheme].filter(\.isFeatureEnabled)) // Pa8f8
snapshot.appendSections([.externalURL])
snapshot.appendItems([.privacyPolicy,
.contactDevs].filter(\.isFeatureEnabled))
Expand Down Expand Up @@ -295,6 +301,8 @@
presentPidTuner()
case .resetAppSettings:
presentAppResetPrompt()
case .hotDogStandTheme:
handleHotDogStandThemeToggle() // P910c
}
}

Expand Down Expand Up @@ -431,4 +439,24 @@
controller.dismiss(animated: true)
}

// P910c
private func handleHotDogStandThemeToggle() {
AppConfig.isHotDogStandThemeEnabled.toggle()

Check failure on line 444 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

type 'AppConfig' has no member 'isHotDogStandThemeEnabled'
updateTheme()
}

private func updateTheme() {
let theme = AppConfig.isHotDogStandThemeEnabled ? Theme.hotDogStand : Theme.default

Check failure on line 449 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

cannot find 'Theme' in scope

Check failure on line 449 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

cannot find 'Theme' in scope

Check failure on line 449 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

type 'AppConfig' has no member 'isHotDogStandThemeEnabled'
applyTheme(theme)
}

private func applyTheme(_ theme: Theme) {

Check failure on line 453 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

cannot find type 'Theme' in scope

Check failure on line 453 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

cannot find type 'Theme' in scope

Check failure on line 453 in Vocable/Features/Settings/SettingsViewController.swift

View workflow job for this annotation

GitHub Actions / on_pull_request

cannot find type 'Theme' in scope
// Update the colors of the app's windows and views
// This is a placeholder implementation, you should update the actual implementation based on your app's structure
UIApplication.shared.windows.forEach { window in
window.tintColor = theme.tintColor
window.backgroundColor = theme.backgroundColor
window.rootViewController?.view.setNeedsLayout()
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.8",
"alpha" : "1.0",
"blue" : "0.0",
"green" : "0.0"
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
},
"colors" : [
{
"idiom" : "universal",
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "1.0",
"alpha" : "1.0",
"blue" : "0.0",
"green" : "1.0"
}
}
}
]
}
Loading