2019-01-05 17:59:55 +00:00
|
|
|
//
|
|
|
|
// MyProfileTableViewController.swift
|
|
|
|
// Tusker
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 11/24/18.
|
|
|
|
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
2019-06-14 00:53:17 +00:00
|
|
|
import SwiftUI
|
2019-01-05 17:59:55 +00:00
|
|
|
|
|
|
|
class MyProfileTableViewController: ProfileTableViewController {
|
|
|
|
|
2019-01-19 19:31:31 +00:00
|
|
|
init() {
|
|
|
|
super.init(accountID: nil)
|
2019-01-05 17:59:55 +00:00
|
|
|
|
|
|
|
title = "My Profile"
|
2019-06-11 17:21:22 +00:00
|
|
|
tabBarItem.image = UIImage(systemName: "person.fill")
|
|
|
|
|
2019-01-05 17:59:55 +00:00
|
|
|
|
|
|
|
MastodonController.getOwnAccount { (account) in
|
|
|
|
self.accountID = account.id
|
|
|
|
|
|
|
|
ImageCache.avatars.get(account.avatar, completion: { (data) in
|
2019-12-31 16:40:56 +00:00
|
|
|
guard let data = data, let image = UIImage(data: data) else { return }
|
2019-06-04 17:31:05 +00:00
|
|
|
DispatchQueue.main.async {
|
2019-06-11 17:21:22 +00:00
|
|
|
let size = CGSize(width: 30, height: 30)
|
|
|
|
let tabBarImage = UIGraphicsImageRenderer(size: size).image { (_) in
|
|
|
|
image.draw(in: CGRect(origin: .zero, size: size))
|
|
|
|
}
|
|
|
|
let alwaysOriginalImage = tabBarImage.withRenderingMode(.alwaysOriginal)
|
|
|
|
self.tabBarItem.image = alwaysOriginalImage
|
2019-06-04 17:31:05 +00:00
|
|
|
}
|
2019-01-05 17:59:55 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Preferences", style: .plain, target: self, action: #selector(preferencesPressed))
|
|
|
|
}
|
|
|
|
|
|
|
|
required init?(coder aDecoder: NSCoder) {
|
|
|
|
fatalError("init(coder:) has not been implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override func viewDidLoad() {
|
|
|
|
super.viewDidLoad()
|
|
|
|
}
|
|
|
|
|
2019-06-11 17:21:22 +00:00
|
|
|
override func viewDidAppear(_ animated: Bool) {
|
|
|
|
super.viewDidAppear(animated)
|
|
|
|
}
|
|
|
|
|
2019-01-05 17:59:55 +00:00
|
|
|
@objc func preferencesPressed() {
|
2019-11-17 19:31:07 +00:00
|
|
|
present(PreferencesNavigationController(), animated: true)
|
2019-06-14 00:53:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@objc func closePreferences() {
|
|
|
|
dismiss(animated: true)
|
2019-01-05 17:59:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|