iOS/Sources/Extensions/NotificationContent/NotificationErrorViewController.swift
Zac West 4d9a530637
Reorganize files in repo, pull out build settings from pbxproj (#1140)
This is somewhat in prep of being able to make the project file generated, but also just organizes things into more concrete directory structures.

This pulls out _all_ of the build settings from the root level, and most from the target level, into xcconfigs.

The new directory structure looks like:

- Sources
  - App
    - (everything from HomeAssistant/)
  - WatchApp
  - Shared
  - MacBridge
  - Extensions
    - Intents
    - NotificationContent
    - NotificationService
    - Share
    - Today
    - Watch
    - Widgets
- Tests
  - App
  - UI
  - Shared

Somewhat intentionally, the file structure under these is not yet standardized/organized.

The project targets are now:

- App
- WatchApp
- Shared-iOS
- Shared-watchOS
- MacBridge
- Tests-App
- Tests-UI
- Tests-Shared
- Extension-Intents
- Extension-NotificationContent
- Extension-NotificationService
- Extension-Share
- Extension-Today
- Extension-Widget
- WatchExtension-Watch

This does not yet clean up resources vs. sources, nor does it handle some of the "it's in Sources/App but it's part of Shared" crossover directory issues.
2020-10-03 00:15:04 -07:00

49 lines
1.5 KiB
Swift

import Foundation
import UIKit
import PromiseKit
import UserNotificationsUI
class NotificationErrorViewController: UIViewController, NotificationCategory {
let label = UILabel()
init(error: Error) {
super.init(nibName: nil, bundle: nil)
label.text = error.localizedDescription
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
label.numberOfLines = 0
label.textAlignment = .center
if #available(iOS 13, *) {
label.textColor = .systemRed
} else {
label.textColor = .red
}
view.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
label.topAnchor.constraint(equalTo: view.topAnchor),
label.leadingAnchor.constraint(equalTo: view.leadingAnchor),
label.trailingAnchor.constraint(equalTo: view.trailingAnchor),
label.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
}
func didReceive(notification: UNNotification, extensionContext: NSExtensionContext?) -> Promise<Void> {
.value(())
}
var mediaPlayPauseButtonType: UNNotificationContentExtensionMediaPlayPauseButtonType { .none }
var mediaPlayPauseButtonFrame: CGRect?
var mediaPlayPauseButtonTintColor: UIColor?
func mediaPlay() {}
func mediaPause() {}
}