Files
iOS/Sources/App/ClientEvents/ClientEventPayloadViewController.swift
Zac West 77c72785ff Update a few more housekeeping things in the project (#1142)
- Combines all .entitlements into either: App-iOS, App-catalyst, WatchApp, Extension-iOS or Extension-catalyst.
- Cleans up and renames all the schemes to match target names
- Moves around several folders and deletes some old files.
- Converts Podfile to be hierarchical, rather than calling shared methods.
- Always runs MaterialDesignIcons script; aborts early if it's up-to-date.
- Updates all dependencies.
2020-10-03 16:05:19 -07:00

39 lines
1.1 KiB
Swift

//
// ClientEventPayloadViewController.swift
// HomeAssistant
//
// Created by Stephan Vanterpool on 8/25/18.
// Copyright © 2018 Robbie Trencheny. All rights reserved.
//
import Foundation
import UIKit
import Shared
/// View controller responsible for displaying the details of a client event.
class ClientEventPayloadViewController: UIViewController {
@IBOutlet weak var textView: UITextView!
private var jsonString: String?
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.rightBarButtonItems = [
UIBarButtonItem(barButtonSystemItem: .action, target: self, action: #selector(share(_:)))
]
self.textView.text = self.jsonString
}
@objc private func share(_ sender: UIBarButtonItem) {
let controller = UIActivityViewController(activityItems: [jsonString ?? "?"], applicationActivities: nil)
with(controller.popoverPresentationController) {
$0?.barButtonItem = sender
}
present(controller, animated: true, completion: nil)
}
func showEvent(_ event: ClientEvent) {
jsonString = event.jsonPayloadDescription
}
}