iOS/Sources/App/WebView/Views/WebViewAccessoryViews.swift
Bruno Pantaleão Gonçalves bbe33a76b6
Remove custom toast and notify Improv via notification (#2860)
<!-- Thank you for submitting a Pull Request and helping to improve Home
Assistant. Please complete the following sections to help the processing
and review of your changes. Please do not delete anything from this
template. -->

## Summary
<!-- Provide a brief summary of the changes you have made and most
importantly what they aim to achieve -->

## Screenshots
<!-- If this is a user-facing change not in the frontend, please include
screenshots in light and dark mode. -->

## Link to pull request in Documentation repository
<!-- Pull requests that add, change or remove functionality must have a
corresponding pull request in the Companion App Documentation repository
(https://github.com/home-assistant/companion.home-assistant). Please add
the number of this pull request after the "#" -->
Documentation: home-assistant/companion.home-assistant#

## Any other notes
<!-- If there is any other information of note, like if this Pull
Request is part of a bigger change, please include it here. -->
2024-07-22 13:43:01 +02:00

31 lines
1.1 KiB
Swift

import Foundation
import Shared
import UIKit
enum WebViewAccessoryViews {
static let settingsButton: UIButton = {
let button = UIButton()
button.setImage(
MaterialDesignIcons.cogIcon.image(ofSize: CGSize(width: 36, height: 36), color: .white),
for: .normal
)
button.accessibilityLabel = L10n.Settings.NavigationBar.title
button.contentEdgeInsets = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
button.setBackgroundImage(
UIImage(size: CGSize(width: 1, height: 1), color: UIColor(red: 1.00, green: 0.60, blue: 0.00, alpha: 1.0)),
for: .normal
)
// size isn't affected by any trait changes, so we can grab the height once and not worry about it changing
let desiredSize = button.systemLayoutSizeFitting(.zero)
button.layer.cornerRadius = ceil(desiredSize.height / 2.0)
button.layer.masksToBounds = true
button.translatesAutoresizingMaskIntoConstraints = false
if Current.appConfiguration == .fastlaneSnapshot {
button.alpha = 0
}
return button
}()
}