More cleanup

This commit is contained in:
Nathan Mattes 2023-09-21 12:52:05 +02:00
parent 8a824e80d6
commit fbde2a5833
242 changed files with 51 additions and 1376 deletions

View File

@ -1,4 +1,3 @@
import os.log
import Foundation
// conver i18n JSON templates to strings files
@ -12,15 +11,13 @@ private func convert(from inputDirectoryURL: URL, to outputDirectory: URL) {
for inputLanguageDirectoryURL in inputLanguageDirectoryURLs {
let language = inputLanguageDirectoryURL.lastPathComponent
guard let mappedLanguage = map(language: language) else { continue }
os_log("%{public}s[%{public}ld], %{public}s: process %s -> %s", ((#file as NSString).lastPathComponent), #line, #function, language, mappedLanguage)
let fileURLs = try FileManager.default.contentsOfDirectory(
at: inputLanguageDirectoryURL,
includingPropertiesForKeys: [.nameKey, .isDirectoryKey],
options: []
)
for jsonURL in fileURLs where jsonURL.pathExtension == "json" {
os_log("%{public}s[%{public}ld], %{public}s: process %s", ((#file as NSString).lastPathComponent), #line, #function, jsonURL.debugDescription)
let filename = jsonURL.deletingPathExtension().lastPathComponent
guard let (mappedFilename, keyStyle) = map(filename: filename) else { continue }
guard let bundle = bundle(filename: filename) else { continue }
@ -40,7 +37,6 @@ private func convert(from inputDirectoryURL: URL, to outputDirectory: URL) {
}
}
} catch {
os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
exit(1)
}
}
@ -103,7 +99,6 @@ private func process(url: URL, keyStyle: Parser.KeyStyle) throws -> String {
let strings = parser.generateStrings(keyStyle: keyStyle)
return strings
} catch {
os_log("%{public}s[%{public}ld], %{public}s: error: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
throw error
}
}
@ -120,15 +115,13 @@ private func move(from inputDirectoryURL: URL, to outputDirectoryURL: URL, pathE
let language = inputLanguageDirectoryURL.lastPathComponent
guard let mappedLanguage = map(language: language) else { continue }
let outputDirectoryURL = outputDirectoryURL.appendingPathComponent(mappedLanguage + ".lproj", isDirectory: true)
os_log("%{public}s[%{public}ld], %{public}s: process %s -> %s", ((#file as NSString).lastPathComponent), #line, #function, language, mappedLanguage)
let fileURLs = try FileManager.default.contentsOfDirectory(
at: inputLanguageDirectoryURL,
includingPropertiesForKeys: [.nameKey, .isDirectoryKey],
options: []
)
for dictURL in fileURLs where dictURL.pathExtension == pathExtension {
os_log("%{public}s[%{public}ld], %{public}s: process %s", ((#file as NSString).lastPathComponent), #line, #function, dictURL.debugDescription)
let filename = dictURL.deletingPathExtension().lastPathComponent
let outputFileURL = outputDirectoryURL.appendingPathComponent(filename).appendingPathExtension(pathExtension)
@ -137,7 +130,6 @@ private func move(from inputDirectoryURL: URL, to outputDirectoryURL: URL, pathE
}
}
} catch {
os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
exit(2)
}
}

View File

@ -158,7 +158,6 @@
D8F8A03C29CA5CB6000195DD /* HashtagWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */; };
DB0009A626AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; settings = {ATTRIBUTES = (codegen, ); }; };
DB0009A726AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; };
DB0140CF25C42AEE00F9F3CF /* OSLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0140CE25C42AEE00F9F3CF /* OSLog.swift */; };
DB023D26279FFB0A005AC798 /* ShareActivityProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D25279FFB0A005AC798 /* ShareActivityProvider.swift */; };
DB023D2827A0FABD005AC798 /* NotificationTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D2727A0FABD005AC798 /* NotificationTableViewCellDelegate.swift */; };
DB023D2A27A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D2927A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift */; };
@ -809,7 +808,6 @@
D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagWidget.swift; sourceTree = "<group>"; };
DB0009A826AEE5DC009B9D2D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intents.intentdefinition; sourceTree = "<group>"; };
DB0009AD26AEE5E4009B9D2D /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Intents.strings; sourceTree = "<group>"; };
DB0140CE25C42AEE00F9F3CF /* OSLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSLog.swift; sourceTree = "<group>"; };
DB023D25279FFB0A005AC798 /* ShareActivityProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareActivityProvider.swift; sourceTree = "<group>"; };
DB023D2727A0FABD005AC798 /* NotificationTableViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTableViewCellDelegate.swift; sourceTree = "<group>"; };
DB023D2927A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataSourceProvider+NotificationTableViewCellDelegate.swift"; sourceTree = "<group>"; };
@ -2525,7 +2523,6 @@
2D206B8525F5FB0900143C56 /* Double.swift */,
DBB3BA2926A81C020004F2D4 /* FLAnimatedImageView.swift */,
DB68586325E619B700F0A850 /* NSKeyValueObservation.swift */,
DB0140CE25C42AEE00F9F3CF /* OSLog.swift */,
2D939AB425EDD8A90076FA61 /* String.swift */,
DB68A06225E905E000CFDF14 /* UIApplication.swift */,
DB45FAB525CA5485005A8AC7 /* UIAlertController.swift */,
@ -3818,7 +3815,6 @@
D87BFC8B291D5C6B00FEE264 /* MastodonLoginView.swift in Sources */,
DB6180F826391D660018D199 /* MediaPreviewingViewController.swift in Sources */,
DBEFCD71282A12B200C0ABEA /* ReportReasonViewController.swift in Sources */,
DB0140CF25C42AEE00F9F3CF /* OSLog.swift in Sources */,
DB98EB5627B0FF1B0082E365 /* ReportViewControllerAppearance.swift in Sources */,
DB3EA8E6281B79E200598866 /* DiscoveryCommunityViewController.swift in Sources */,
2D206B8625F5FB0900143C56 /* Double.swift in Sources */,

View File

@ -181,15 +181,6 @@
"version": "2.4.3"
}
},
{
"package": "swiftui-introspect",
"repositoryURL": "https://github.com/siteline/SwiftUI-Introspect.git",
"state": {
"branch": null,
"revision": "121c146fe591b1320238d054ae35c81ffa45f45a",
"version": "0.12.0"
}
},
{
"package": "TabBarPager",
"repositoryURL": "https://github.com/TwidereProject/TabBarPager.git",

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-13.
//
import os.log
import UIKit
import MastodonCore
import MastodonUI
@ -20,8 +19,6 @@ enum DiscoverySection: CaseIterable {
extension DiscoverySection {
static let logger = Logger(subsystem: "DiscoverySection", category: "logic")
class Configuration {
let authContext: AuthContext
weak var profileCardTableViewCellDelegate: ProfileCardTableViewCellDelegate?

View File

@ -11,7 +11,6 @@ import CoreDataStack
import Foundation
import MastodonSDK
import UIKit
import os.log
import MastodonAsset
import MastodonCore
import MastodonUI

View File

@ -8,7 +8,6 @@
import Combine
import CoreData
import CoreDataStack
import os.log
import UIKit
import AVKit
import AlamofireImage
@ -24,8 +23,6 @@ enum StatusSection: Equatable, Hashable {
extension StatusSection {
static let logger = Logger(subsystem: "StatusSection", category: "logic")
struct Configuration {
let context: AppContext
let authContext: AuthContext
@ -196,7 +193,6 @@ extension StatusSection {
else { return false }
guard !poll.expired else {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): poll expired. Skip update poll \(poll.id)")
return false
}
@ -209,10 +205,9 @@ extension StatusSection {
#endif
guard timeIntervalSinceUpdate > autoRefreshTimeInterval else {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): skip update poll \(poll.id) due to recent updated")
return false
}
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): update poll \(poll.id)")
return true
}()

View File

@ -5,7 +5,6 @@
// Created by Cirno MainasuK on 2021-11-1.
//
import os.log
import UIKit
import CoreData
import CoreDataStack
@ -20,9 +19,6 @@ enum UserSection: Hashable {
}
extension UserSection {
static let logger = Logger(subsystem: "StatusSection", category: "logic")
struct Configuration {
weak var userTableViewCellDelegate: UserTableViewCellDelegate?
}

View File

@ -1,20 +0,0 @@
//
// OSLog.swift
// Mastodon
//
// Created by Cirno MainasuK on 2021/1/29
//
import os
import Foundation
import CommonOSLog
extension OSLog {
static let api: OSLog = {
#if DEBUG
return OSLog(subsystem: OSLog.subsystem + ".api", category: "api")
#else
return OSLog.disabled
#endif
}()
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-26.
//
import os.log
import UIKit
import CoreDataStack
import MastodonUI
@ -154,8 +153,6 @@ extension DataSourceFacade {
user: ManagedObjectRecord<MastodonUser>,
previewContext: ImagePreviewContext
) async throws {
let logger = Logger(subsystem: "DataSourceFacade", category: "Media")
let managedObjectContext = dependency.context.managedObjectContext
var _avatarAssetURL: String?
@ -227,7 +224,6 @@ extension DataSourceFacade {
}()
guard mediaPreviewItem.isAssetURLValid else {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): discard preview due to assetURL invalid")
return
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-2-16.
//
import os.log
import UIKit
import CoreDataStack
import MastodonCore
@ -37,7 +36,6 @@ extension StatusTableViewControllerNavigateableCore where Self: DataSourceProvid
guard let rawValue = sender.propertyList as? String,
let navigation = StatusTableViewNavigation(rawValue: rawValue) else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, navigation.title)
Task {
switch navigation {
case .openAuthorProfile: await openAuthorProfile(target: .status)

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-2-16.
//
import os.log
import UIKit
import MastodonCore
@ -34,7 +33,6 @@ extension TableViewControllerNavigateableCore {
guard let rawValue = sender.propertyList as? String,
let navigation = TableViewNavigation(rawValue: rawValue) else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, navigation.title)
switch navigation {
case .up: navigate(direction: .up)
case .down: navigate(direction: .down)

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-17.
//
import os.log
import UIKit
import CoreDataStack
import MastodonCore
@ -126,7 +125,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV
attributes: [],
state: .off
) { [weak self] _ in
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: save photo", ((#file as NSString).lastPathComponent), #line, #function)
guard let self = self else { return }
Task { @MainActor in
do {
@ -157,7 +155,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV
attributes: [],
state: .off
) { [weak self] _ in
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: copy photo", ((#file as NSString).lastPathComponent), #line, #function)
guard let self = self else { return }
Task {
try await self.context.photoLibraryService.copy(
@ -173,7 +170,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV
attributes: [],
state: .off
) { [weak self] _ in
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: share", ((#file as NSString).lastPathComponent), #line, #function)
guard let self = self else { return }
Task {
let applicationActivities: [UIActivity] = [

View File

@ -6,7 +6,6 @@
// Copyright © 2021 Twidere. All rights reserved.
//
import os.log
import UIKit
import CoreDataStack
import MastodonSDK

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-5-19.
//
import os.log
import UIKit
import MastodonAsset
import MastodonLocalization

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-5-21.
//
import os.log
import UIKit
import MastodonAsset
import MastodonLocalization

View File

@ -5,7 +5,6 @@
// Created by Cirno MainasuK on 2021-9-13.
//
import os.log
import UIKit
import Combine
import CoreData
@ -172,11 +171,6 @@ extension AccountListViewModel {
// MARK: - NSFetchedResultsControllerDelegate
extension AccountListViewModel: NSFetchedResultsControllerDelegate {
public func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
public func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
guard controller === mastodonAuthenticationFetchedResultsController else {
assertionFailure()

View File

@ -5,7 +5,6 @@
// Created by Cirno MainasuK on 2021-9-13.
//
import os.log
import UIKit
import Combine
import CoreDataStack
@ -16,8 +15,6 @@ import MastodonCore
final class AccountListViewController: UIViewController, NeedsDependency {
let logger = Logger(subsystem: "AccountListViewController", category: "UI")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -154,12 +151,10 @@ extension AccountListViewController {
extension AccountListViewController {
@objc private func addBarButtonItem(_ sender: UIBarButtonItem) {
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
_ = coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil))
}
override func accessibilityPerformEscape() -> Bool {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
dismiss(animated: true, completion: nil)
return true
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-17.
//
import os.log
import UIKit
import Combine
import MastodonUI
@ -18,8 +17,6 @@ protocol ComposeStatusAttachmentCollectionViewCellDelegate: AnyObject {
final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell {
let logger = Logger(subsystem: "ComposeStatusAttachmentCollectionViewCell", category: "UI")
var disposeBag = Set<AnyCancellable>()
static let verticalMarginHeight: CGFloat = ComposeStatusAttachmentCollectionViewCell.removeButtonSize.height * 0.5
@ -45,62 +42,21 @@ final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell {
override func prepareForReuse() {
super.prepareForReuse()
// attachmentContainerView.activityIndicatorView.startAnimating()
// attachmentContainerView.previewImageView.af.cancelImageRequest()
// attachmentContainerView.previewImageView.image = .placeholder(color: .systemFill)
// delegate = nil
// disposeBag.removeAll()
}
override init(frame: CGRect) {
super.init(frame: frame)
_init()
}
required init?(coder: NSCoder) {
super.init(coder: coder)
_init()
}
deinit {
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
}
}
extension ComposeStatusAttachmentCollectionViewCell {
private func _init() {
// selectionStyle = .none
// attachmentContainerView.translatesAutoresizingMaskIntoConstraints = false
// contentView.addSubview(attachmentContainerView)
// NSLayoutConstraint.activate([
// attachmentContainerView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: ComposeStatusAttachmentCollectionViewCell.verticalMarginHeight),
// attachmentContainerView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor),
// attachmentContainerView.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor),
// contentView.bottomAnchor.constraint(equalTo: attachmentContainerView.bottomAnchor, constant: ComposeStatusAttachmentCollectionViewCell.verticalMarginHeight),
// attachmentContainerView.heightAnchor.constraint(equalToConstant: 205).priority(.defaultHigh),
// ])
//
// removeButton.translatesAutoresizingMaskIntoConstraints = false
// contentView.addSubview(removeButton)
// NSLayoutConstraint.activate([
// removeButton.centerXAnchor.constraint(equalTo: attachmentContainerView.trailingAnchor),
// removeButton.centerYAnchor.constraint(equalTo: attachmentContainerView.topAnchor),
// removeButton.widthAnchor.constraint(equalToConstant: ComposeStatusAttachmentCollectionViewCell.removeButtonSize.width).priority(.defaultHigh),
// removeButton.heightAnchor.constraint(equalToConstant: ComposeStatusAttachmentCollectionViewCell.removeButtonSize.height).priority(.defaultHigh),
// ])
//
// removeButton.addTarget(self, action: #selector(ComposeStatusAttachmentCollectionViewCell.removeButtonDidPressed(_:)), for: .touchUpInside)
}
}
extension ComposeStatusAttachmentCollectionViewCell {
@objc private func removeButtonDidPressed(_ sender: UIButton) {
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
delegate?.composeStatusAttachmentCollectionViewCell(self, removeButtonDidPressed: sender)
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-23.
//
import os.log
import UIKit
import MastodonAsset
import MastodonCore
@ -111,7 +110,6 @@ extension ComposeStatusPollOptionAppendEntryCollectionViewCell {
extension ComposeStatusPollOptionAppendEntryCollectionViewCell {
@objc private func singleTagGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.composeStatusPollOptionAppendEntryCollectionViewCellDidPressed(self)
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-23.
//
import os.log
import UIKit
import Combine
import MastodonAsset
@ -127,7 +126,6 @@ extension ComposeStatusPollOptionCollectionViewCell {
extension ComposeStatusPollOptionCollectionViewCell {
@objc private func singleTagGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
pollOptionView.optionTextField.becomeFirstResponder()
}
@ -144,12 +142,10 @@ extension ComposeStatusPollOptionCollectionViewCell: DeleteBackwardResponseTextF
extension ComposeStatusPollOptionCollectionViewCell: UITextFieldDelegate {
func textFieldDidBeginEditing(_ textField: UITextField) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.composeStatusPollOptionCollectionViewCell(self, textFieldDidBeginEditing: textField)
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
if textField === pollOptionView.optionTextField {
delegate?.composeStatusPollOptionCollectionViewCell(self, pollOptionTextFieldDidReturn: textField)
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-11.
//
import os.log
import UIKit
import Combine
import PhotosUI
@ -25,9 +24,7 @@ final class ComposeViewController: UIViewController, NeedsDependency {
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
var disposeBag = Set<AnyCancellable>()
var viewModel: ComposeViewModel!
let logger = Logger(subsystem: "ComposeViewController", category: "logic")
var viewModel: ComposeViewModel
init(viewModel: ComposeViewModel) {
self.viewModel = viewModel
@ -114,9 +111,6 @@ final class ComposeViewController: UIViewController, NeedsDependency {
button.setTitleColor(Asset.Colors.Label.primaryReverse.color, for: .normal)
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -202,7 +196,6 @@ extension ComposeViewController {
extension ComposeViewController {
@objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
guard composeContentViewModel.shouldDismiss else {
showDismissConfirmAlertController()
return
@ -282,11 +275,9 @@ extension ComposeViewController {
}
override func paste(_ sender: Any?) {
logger.debug("Paste event received")
// Look for images on the clipboard
if UIPasteboard.general.hasImages, let images = UIPasteboard.general.images {
logger.warning("Got image paste event, however attachments are not yet re-implemented.");
let attachmentViewModels = images.map { image in
return AttachmentViewModel(
api: viewModel.context.apiService,
@ -318,14 +309,8 @@ extension ComposeViewController: UIAdaptivePresentationControllerDelegate {
}
func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
showDismissConfirmAlertController()
}
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
extension ComposeViewController {

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-11.
//
import os.log
import UIKit
import Combine
import CoreData
@ -24,8 +23,6 @@ final class ComposeViewModel {
case composeStatus
case editStatus(status: Status, statusSource: Mastodon.Entity.StatusSource)
}
let logger = Logger(subsystem: "ComposeViewModel", category: "ViewModel")
var disposeBag = Set<AnyCancellable>()

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-29.
//
import os.log
import UIKit
import Combine
import MastodonCore
@ -13,9 +12,6 @@ import MastodonUI
// Local Timeline
final class DiscoveryCommunityViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "DiscoveryCommunityViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-29.
//
import os.log
import UIKit
import Combine
import GameplayKit

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-12.
//
import os.log
import UIKit
import Combine
import Tabman
@ -21,8 +20,6 @@ public class DiscoveryViewController: TabmanViewController, NeedsDependency {
var disposeBag = Set<AnyCancellable>()
let logger = Logger(subsystem: "DiscoveryViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-13.
//
import os.log
import UIKit
import Combine
import MastodonCore
@ -13,8 +12,6 @@ import MastodonUI
final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -34,9 +31,6 @@ final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency,
let refreshControl = RefreshControl()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -100,7 +94,6 @@ extension DiscoveryHashtagsViewController {
extension DiscoveryHashtagsViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(indexPath)")
guard case let .hashtag(tag) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return }
let hashtagTimelineViewModel = HashtagTimelineViewModel(context: context, authContext: viewModel.authContext, hashtag: tag.name)
_ = coordinator.present(

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-13.
//
import os.log
import UIKit
import Combine
import GameplayKit

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-13.
//
import os.log
import UIKit
import Combine
import MastodonCore
@ -13,8 +12,6 @@ import MastodonUI
final class DiscoveryNewsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -33,11 +30,6 @@ final class DiscoveryNewsViewController: UIViewController, NeedsDependency, Medi
}()
let refreshControl = RefreshControl()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
extension DiscoveryNewsViewController {
@ -109,7 +101,6 @@ extension DiscoveryNewsViewController {
extension DiscoveryNewsViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(indexPath)")
guard case let .link(link) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return }
guard let url = URL(string: link.url) else { return }
_ = coordinator.present(

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-13.
//
import os.log
import Foundation
import GameplayKit
import MastodonSDK
@ -13,8 +12,6 @@ import MastodonSDK
extension DiscoveryNewsViewModel {
class State: GKState {
let logger = Logger(subsystem: "DiscoveryNewsViewModel.State", category: "StateMachine")
let id = UUID()
weak var viewModel: DiscoveryNewsViewModel?
@ -23,14 +20,6 @@ extension DiscoveryNewsViewModel {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-13.
//
import os.log
import UIKit
import Combine
import GameplayKit

View File

@ -5,16 +5,12 @@
// Created by MainasuK on 2022-4-12.
//
import os.log
import UIKit
import Combine
import MastodonCore
import MastodonUI
final class DiscoveryPostsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-12.
//
import os.log
import Foundation
import GameplayKit
import MastodonSDK
@ -13,9 +12,6 @@ import MastodonCore
extension DiscoveryPostsViewModel {
class State: GKState {
let logger = Logger(subsystem: "DiscoveryPostsViewModel.State", category: "StateMachine")
let id = UUID()
weak var viewModel: DiscoveryPostsViewModel?
@ -29,17 +25,12 @@ extension DiscoveryPostsViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))")
}
}
}
@ -88,9 +79,7 @@ extension DiscoveryPostsViewModel.State {
super.didEnter(from: previousState)
guard let _ = viewModel, let stateMachine = stateMachine else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function)
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function)
stateMachine.enter(Loading.self)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-4-19.
//
import os.log
import UIKit
import Combine
import MastodonAsset
@ -18,9 +17,6 @@ public protocol DiscoveryIntroBannerViewDelegate: AnyObject {
}
public final class DiscoveryIntroBannerView: UIView {
let logger = Logger(subsystem: "DiscoveryIntroBannerView", category: "View")
var _disposeBag = Set<AnyCancellable>()
public weak var delegate: DiscoveryIntroBannerViewDelegate?
@ -90,7 +86,6 @@ extension DiscoveryIntroBannerView {
extension DiscoveryIntroBannerView {
@objc private func closeButtonDidPressed(_ sender: UIButton) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
delegate?.discoveryIntroBannerView(self, closeButtonDidPressed: sender)
}
}

View File

@ -5,7 +5,6 @@
// Created by BradGao on 2021/3/30.
//
import os.log
import UIKit
import AVKit
import Combine
@ -19,8 +18,6 @@ import MastodonSDK
final class HashtagTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "HashtagTimelineViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -61,10 +58,6 @@ final class HashtagTimelineViewController: UIViewController, NeedsDependency, Me
}()
let refreshControl = RefreshControl()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
}
}
extension HashtagTimelineViewController {
@ -205,7 +198,6 @@ extension HashtagTimelineViewController {
}
@objc private func composeBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
let hashtag = "#" + viewModel.hashtag
UITextChecker.learnWord(hashtag)
let composeViewModel = ComposeViewModel(

View File

@ -5,7 +5,6 @@
// Created by BradGao on 2021/3/30.
//
import os.log
import UIKit
import Combine
import CoreData
@ -40,7 +39,6 @@ extension HashtagTimelineViewModel {
.sink { [weak self] records in
guard let self = self else { return }
guard let diffableDataSource = self.diffableDataSource else { return }
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): incoming \(records.count) objects")
var snapshot = NSDiffableDataSourceSnapshot<StatusSection, StatusItem>()
snapshot.appendSections([.main])

View File

@ -5,7 +5,6 @@
// Created by BradGao on 2021/3/31.
//
import os.log
import Foundation
import GameplayKit
import CoreDataStack
@ -13,8 +12,6 @@ import CoreDataStack
extension HashtagTimelineViewModel {
class State: GKState {
let logger = Logger(subsystem: "HashtagTimelineViewModel.LoadOldestState", category: "StateMachine")
let id = UUID()
var name: String {
@ -32,17 +29,12 @@ extension HashtagTimelineViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(self.name)")
}
}
}
@ -90,9 +82,7 @@ extension HashtagTimelineViewModel.State {
super.didEnter(from: previousState)
guard let _ = viewModel, let stateMachine = stateMachine else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function)
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function)
stateMachine.enter(Loading.self)
}
}
@ -178,7 +168,6 @@ extension HashtagTimelineViewModel.State {
viewModel.fetchedResultsController.append(statusIDs: statusIDs)
viewModel.didLoadLatest.send()
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)")
await enter(state: Fail.self)
}
} // end Task

View File

@ -5,7 +5,6 @@
// Created by BradGao on 2021/3/30.
//
import os.log
import UIKit
import Combine
import CoreData
@ -15,9 +14,7 @@ import MastodonSDK
import MastodonCore
final class HashtagTimelineViewModel {
let logger = Logger(subsystem: "HashtagTimelineViewModel", category: "ViewModel")
let hashtag: String
var disposeBag = Set<AnyCancellable>()
@ -66,10 +63,6 @@ final class HashtagTimelineViewModel {
// end init
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
}
func viewWillAppear() {
let predicate = Tag.predicate(
domain: authContext.mastodonAuthenticationBox.domain,

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/2/5.
//
import os.log
import UIKit
import AVKit
import Combine
@ -21,9 +20,7 @@ import MastodonUI
import MastodonLocalization
final class HomeTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "HomeTimelineViewController", category: "UI")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -75,11 +72,6 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
}()
let refreshControl = RefreshControl()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
}
}
extension HomeTimelineViewController {
@ -255,9 +247,6 @@ extension HomeTimelineViewController {
let viewFrameInWindow = self.view.convert(self.view.frame, to: nil)
guard xPosition >= viewFrameInWindow.minX && xPosition <= viewFrameInWindow.maxX else { return }
// works on iOS 14
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): receive notification \(xPosition)")
// check if scroll to top
guard self.shouldRestoreScrollPosition() else { return }
@ -459,7 +448,6 @@ extension HomeTimelineViewController {
let cellFrameInView = tableView.convert(anchorCell.frame, to: view)
return cellFrameInView.origin.y
}()
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): save position record for \(anchorIndexPath) with offset: \(offset)")
viewModel.scrollPositionRecord = HomeTimelineViewModel.ScrollPositionRecord(
item: anchorItem,
offset: offset,

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/2/7.
//
import os.log
import UIKit
import CoreData
import CoreDataStack

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/2/5.
//
import os.log
import func QuartzCore.CACurrentMediaTime
import Foundation
import CoreData
@ -16,8 +15,6 @@ import MastodonCore
extension HomeTimelineViewModel {
class LoadLatestState: GKState {
let logger = Logger(subsystem: "HomeTimelineViewModel.LoadLatestState", category: "StateMachine")
let id = UUID()
var name: String {
@ -33,7 +30,6 @@ extension HomeTimelineViewModel {
override func didEnter(from previousState: GKState?) {
super.didEnter(from: previousState)
let previousState = previousState as? HomeTimelineViewModel.LoadLatestState
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] enter \(self.name), previous: \(previousState?.name ?? "<nil>")")
viewModel?.loadLatestStateMachinePublisher.send(self)
}
@ -41,10 +37,6 @@ extension HomeTimelineViewModel {
func enter(state: LoadLatestState.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(self.name)")
}
}
}
@ -104,7 +96,6 @@ extension HomeTimelineViewModel.LoadLatestState {
return feed.status?.id
}
let end = CACurrentMediaTime()
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: collect statuses id cost: %.2fs", ((#file as NSString).lastPathComponent), #line, #function, end - start)
do {
let response = try await viewModel.context.apiService.homeTimeline(
@ -119,8 +110,7 @@ extension HomeTimelineViewModel.LoadLatestState {
// stop refresher if no new statuses
let statuses = response.value
let newStatuses = statuses.filter { !latestStatusIDs.contains($0.id) }
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): load \(newStatuses.count) new statuses")
if newStatuses.isEmpty {
viewModel.didLoadLatest.send()
} else {
@ -136,7 +126,6 @@ extension HomeTimelineViewModel.LoadLatestState {
}
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statuses failed: \(error.localizedDescription)")
await enter(state: Idle.self)
viewModel.didLoadLatest.send()
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error))

View File

@ -5,16 +5,13 @@
// Created by sxiaojian on 2021/2/5.
//
import os.log
import Foundation
import GameplayKit
import MastodonSDK
extension HomeTimelineViewModel {
class LoadOldestState: GKState {
let logger = Logger(subsystem: "HomeTimelineViewModel.LoadOldestState", category: "StateMachine")
let id = UUID()
weak var viewModel: HomeTimelineViewModel?
@ -28,17 +25,12 @@ extension HomeTimelineViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: LoadOldestState.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))")
}
}
}
@ -97,7 +89,6 @@ extension HomeTimelineViewModel.LoadOldestState {
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.finished)
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)")
await self.enter(state: Fail.self)
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error))
}

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/2/5.
//
import os.log
import func AVFoundation.AVMakeRect
import UIKit
import AVKit
@ -19,8 +18,6 @@ import MastodonUI
final class HomeTimelineViewModel: NSObject {
let logger = Logger(subsystem: "HomeTimelineViewModel", category: "ViewModel")
var disposeBag = Set<AnyCancellable>()
var observations = Set<NSKeyValueObservation>()
@ -107,11 +104,6 @@ final class HomeTimelineViewModel: NSObject {
}
.store(in: &disposeBag)
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
}
}
extension HomeTimelineViewModel {
@ -176,7 +168,6 @@ extension HomeTimelineViewModel {
} catch {
assertionFailure(error.localizedDescription)
}
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch more failure: \(error.localizedDescription)")
}
// reconfigure item again

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/3/15.
//
import os.log
import UIKit
import MastodonUI
import MastodonAsset
@ -69,12 +68,10 @@ extension HomeTimelineNavigationBarTitleView {
extension HomeTimelineNavigationBarTitleView {
@objc private func logoButtonDidPressed(_ sender: UIButton) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.homeTimelineNavigationBarTitleView(self, logoButtonDidPressed: sender)
}
@objc private func buttonDidPressed(_ sender: UIButton) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.homeTimelineNavigationBarTitleView(self, buttonDidPressed: sender)
}
}
@ -88,7 +85,6 @@ extension HomeTimelineNavigationBarTitleView {
}
func configure(state: HomeTimelineNavigationBarTitleViewModel.State) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: configure title view: %s", ((#file as NSString).lastPathComponent), #line, #function, state.rawValue)
self.state = state
// check state block or not

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-4-28.
//
import os.log
import func AVFoundation.AVMakeRect
import UIKit
import FLAnimatedImage
@ -92,8 +91,6 @@ extension MediaPreviewImageView {
extension MediaPreviewImageView {
@objc private func doubleTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
let middleZoomScale = 0.5 * maximumZoomScale
if zoomScale >= middleZoomScale {
setZoomScale(minimumZoomScale, animated: true)
@ -169,8 +166,6 @@ extension MediaPreviewImageView {
}
}
}
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: setup image for container %s", ((#file as NSString).lastPathComponent), #line, #function, container.frame.debugDescription)
}
}
@ -183,7 +178,6 @@ extension MediaPreviewImageView: UIScrollViewDelegate {
}
func scrollViewDidZoom(_ scrollView: UIScrollView) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
centerScrollViewContents()
// set bounce when zoom in

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-4-28.
//
import os.log
import UIKit
import Combine
import MastodonAsset
@ -32,7 +31,6 @@ final class MediaPreviewImageViewController: UIViewController {
let tapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
deinit {
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
previewImageView.imageView.af.cancelImageRequest()
}
}
@ -85,7 +83,6 @@ extension MediaPreviewImageViewController {
extension MediaPreviewImageViewController {
@objc private func tapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.mediaPreviewImageViewController(self, tapGestureRecognizerDidTrigger: sender)
}
@ -131,7 +128,6 @@ extension MediaPreviewImageViewController: UIGestureRecognizerDelegate {
// MARK: - UIContextMenuInteractionDelegate
extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
if #available(iOS 16.0, *) {
if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) {
@ -147,7 +143,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
let saveAction = UIAction(
title: L10n.Common.Controls.Actions.savePhoto, image: UIImage(systemName: "square.and.arrow.down")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
) { [weak self] _ in
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: save photo", ((#file as NSString).lastPathComponent), #line, #function)
guard let self = self else { return }
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .savePhoto)
}
@ -155,7 +150,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
let copyAction = UIAction(
title: L10n.Common.Controls.Actions.copyPhoto, image: UIImage(systemName: "doc.on.doc")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
) { [weak self] _ in
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: copy photo", ((#file as NSString).lastPathComponent), #line, #function)
guard let self = self else { return }
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .copyPhoto)
}
@ -163,7 +157,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
let shareAction = UIAction(
title: L10n.Common.Controls.Actions.share, image: UIImage(systemName: "square.and.arrow.up")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
) { [weak self] _ in
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: share", ((#file as NSString).lastPathComponent), #line, #function)
guard let self = self else { return }
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .share)
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-4-28.
//
import os.log
import UIKit
import Combine
import Alamofire

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-4-28.
//
import os.log
import UIKit
import Combine
import Pageboy
@ -42,9 +41,6 @@ final class MediaPreviewViewController: UIViewController, NeedsDependency {
button.setTitle("ALT", for: .normal)
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -203,7 +199,6 @@ extension MediaPreviewViewController: MediaPreviewingViewController {
let safeAreaInsets = previewImageView.safeAreaInsets
let statusBarFrameHeight = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
let dismissible = previewImageView.contentOffset.y <= -(safeAreaInsets.top - statusBarFrameHeight) + 3 // add 3pt tolerance
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: dismissible %s", ((#file as NSString).lastPathComponent), #line, #function, dismissible ? "true" : "false")
return dismissible
}
@ -211,7 +206,6 @@ extension MediaPreviewViewController: MediaPreviewingViewController {
return true
}
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: dismissible false", ((#file as NSString).lastPathComponent), #line, #function)
return false
}
@ -309,8 +303,8 @@ extension MediaPreviewViewController: MediaPreviewImageViewControllerDelegate {
context.photoLibraryService.copy(imageSource: .url(assetURL))
.sink { completion in
switch completion {
case .failure(let error):
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: copy photo fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
case .failure(_):
break
case .finished:
break
}

View File

@ -5,16 +5,13 @@
// Created by MainasuK on 2022-2-9.
//
import os.log
import UIKit
import AVKit
import Combine
import func AVFoundation.AVMakeRect
final class MediaPreviewVideoViewController: UIViewController {
let logger = Logger(subsystem: "MediaPreviewVideoViewController", category: "ViewController")
var disposeBag = Set<AnyCancellable>()
var viewModel: MediaPreviewVideoViewModel!
@ -23,7 +20,6 @@ final class MediaPreviewVideoViewController: UIViewController {
let previewImageView = UIImageView()
deinit {
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
playerViewController.player?.pause()
try? AVAudioSession.sharedInstance().setCategory(.ambient)
try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
@ -89,24 +85,6 @@ extension MediaPreviewVideoViewController {
}
// MARK: - ShareActivityProvider
//extension MediaPreviewVideoViewController: ShareActivityProvider {
// var activities: [Any] {
// return []
// }
//
// var applicationActivities: [UIActivity] {
// switch viewModel.item {
// case .gif(let mediaContext):
// guard let url = mediaContext.assetURL else { return [] }
// return [
// SavePhotoActivity(context: viewModel.context, url: url, resourceType: .video)
// ]
// default:
// return []
// }
// }
//}
extension MediaPreviewVideoViewController: MediaPreviewPage {
func setShowingChrome(_ showingChrome: Bool) {
// TODO: does this do anything?

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-2-9.
//
import os.log
import UIKit
import AVKit
import Combine
@ -14,8 +13,6 @@ import MastodonCore
final class MediaPreviewVideoViewModel {
let logger = Logger(subsystem: "MediaPreviewVideoViewModel", category: "ViewModel")
var disposeBag = Set<AnyCancellable>()
// input
@ -61,7 +58,6 @@ final class MediaPreviewVideoViewModel {
.receive(on: DispatchQueue.main)
.sink { [weak self] status in
guard let self = self else { return }
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): player state: \(status.description)")
switch status {
case .unknown, .buffering, .readyToPlay:

View File

@ -33,8 +33,7 @@ extension NotificationTableViewCell {
if notificationView.frame == .zero {
// set status view width
notificationView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): did layout for new cell")
notificationView.statusView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin
notificationView.quoteStatusView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin // the as same width as statusView
}
@ -55,7 +54,6 @@ extension NotificationTableViewCell {
.sink { [weak tableView, weak self] _, _ in
guard let tableView = tableView else { return }
guard let self = self else { return }
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): tableView updates")
UIView.performWithoutAnimation {
tableView.beginUpdates()

View File

@ -5,16 +5,12 @@
// Created by MainasuK on 2022-1-21.
//
import os.log
import UIKit
import Combine
import MastodonCore
import MastodonUI
final class NotificationTableViewCell: UITableViewCell {
let logger = Logger(subsystem: "NotificationTableViewCell", category: "View")
weak var delegate: NotificationTableViewCellDelegate?
var disposeBag = Set<AnyCancellable>()
private var _disposeBag = Set<AnyCancellable>()

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-21.
//
import os.log
import UIKit
import Combine
import CoreDataStack
@ -14,8 +13,6 @@ import MastodonLocalization
final class NotificationTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "NotificationTimelineViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -42,9 +39,6 @@ final class NotificationTimelineViewController: UIViewController, NeedsDependenc
let cellFrameCache = NSCache<NSNumber, NSValue>()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -101,13 +95,10 @@ extension NotificationTimelineViewController {
let now = Date()
if let timestamp = viewModel.lastAutomaticFetchTimestamp {
if now.timeIntervalSince(timestamp) > 60 {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): auto fetch latest timeline…")
Task {
await viewModel.loadLatest()
}
viewModel.lastAutomaticFetchTimestamp = now
} else {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): auto fetch latest timeline skip. Reason: updated in recent 60s")
}
} else {
Task {
@ -133,8 +124,6 @@ extension NotificationTimelineViewController: CellFrameCacheContainer {
extension NotificationTimelineViewController {
@objc private func refreshControlValueChanged(_ sender: RefreshControl) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
Task {
await viewModel.loadLatest()
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-21.
//
import os.log
import UIKit
import CoreData
import CoreDataStack
@ -36,14 +35,8 @@ extension NotificationTimelineViewModel {
.sink { [weak self] records in
guard let self = self else { return }
guard let diffableDataSource = self.diffableDataSource else { return }
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): incoming \(records.count) objects")
Task {
let start = CACurrentMediaTime()
defer {
let end = CACurrentMediaTime()
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): cost \(end - start, format: .fixed(precision: 4))s to process \(records.count) feeds")
}
let oldSnapshot = diffableDataSource.snapshot()
var newSnapshot: NSDiffableDataSourceSnapshot<NotificationSection, NotificationItem> = {
let newItems = records.map { record in
@ -88,16 +81,12 @@ extension NotificationTimelineViewModel {
let hasChanges = newSnapshot.itemIdentifiers != oldSnapshot.itemIdentifiers
if !hasChanges {
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): snapshot not changes")
self.didLoadLatest.send()
return
} else {
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): snapshot has changes")
}
await self.updateSnapshotUsingReloadData(snapshot: newSnapshot)
self.didLoadLatest.send()
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): applied new snapshot")
} // end Task
}
.store(in: &disposeBag)

View File

@ -9,13 +9,10 @@ import CoreDataStack
import Foundation
import GameplayKit
import MastodonSDK
import os.log
extension NotificationTimelineViewModel {
class LoadOldestState: GKState {
let logger = Logger(subsystem: "NotificationTimelineViewModel.LoadOldestState", category: "StateMachine")
let id = UUID()
weak var viewModel: NotificationTimelineViewModel?
@ -29,17 +26,12 @@ extension NotificationTimelineViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: LoadOldestState.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))")
}
}
}
@ -98,7 +90,6 @@ extension NotificationTimelineViewModel.LoadOldestState {
}
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)")
await self.enter(state: Fail.self)
}
} // end Task

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-21.
//
import os.log
import UIKit
import Combine
import CoreDataStack
@ -15,8 +14,6 @@ import MastodonCore
final class NotificationTimelineViewModel {
let logger = Logger(subsystem: "NotificationTimelineViewModel", category: "ViewModel")
var disposeBag = Set<AnyCancellable>()
// input
@ -63,9 +60,6 @@ final class NotificationTimelineViewModel {
)
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -125,7 +119,6 @@ extension NotificationTimelineViewModel {
)
} catch {
didLoadLatest.send()
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(error.localizedDescription)")
}
}
@ -155,7 +148,6 @@ extension NotificationTimelineViewModel {
authenticationBox: authContext.mastodonAuthenticationBox
)
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch more failure: \(error.localizedDescription)")
}
}

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/4/12.
//
import os.log
import UIKit
import Combine
import MastodonAsset
@ -16,8 +15,6 @@ import MastodonCore
final class NotificationViewController: TabmanViewController, NeedsDependency {
let logger = Logger(subsystem: "NotificationViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -44,9 +41,6 @@ final class NotificationViewController: TabmanViewController, NeedsDependency {
viewModel.currentPageIndex = index
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
extension NotificationViewController {
@ -163,8 +157,6 @@ extension NotificationViewController {
extension NotificationViewController {
@objc private func pageSegmentedControlValueChanged(_ sender: UISegmentedControl) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
let index = sender.selectedSegmentIndex
scrollToPage(.at(index: index), animated: true, completion: nil)
}
@ -232,7 +224,6 @@ extension NotificationViewController {
}
@objc private func showCategory(_ sender: UIKeyCommand) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
guard let rawValue = sender.propertyList as? String,
let category = CategorySwitch(rawValue: rawValue)
else { return }

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/4/12.
//
import os.log
import UIKit
import Combine
import Pageboy

View File

@ -7,7 +7,6 @@
import Combine
import MastodonSDK
import os.log
import UIKit
import MastodonAsset
import MastodonCore
@ -105,7 +104,7 @@ extension MastodonConfirmEmailViewController {
.sink { completion in
switch completion {
case .failure(let error):
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: swap user access token swap fail: %s", (#file as NSString).lastPathComponent, #line, #function, error.localizedDescription)
break
case .finished:
// upload avatar and set display name in the background
Just(self.viewModel.userToken.accessToken)
@ -120,9 +119,9 @@ extension MastodonConfirmEmailViewController {
.sink { completion in
switch completion {
case .failure(let error):
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: setup avatar & display name fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
case .finished:
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: setup avatar & display name success", ((#file as NSString).lastPathComponent), #line, #function)
break
case .finished:
break
}
} receiveValue: { _ in
// do nothing
@ -130,7 +129,6 @@ extension MastodonConfirmEmailViewController {
.store(in: &self.context.disposeBag) // execute in the background
} // end switch
} receiveValue: { response in
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: user %s's email confirmed", ((#file as NSString).lastPathComponent), #line, #function, response.value.username)
self.coordinator.setup()
// self.dismiss(animated: true, completion: nil)
}

View File

@ -5,7 +5,6 @@
// Created by BradGao on 2021/2/20.
//
import os.log
import UIKit
import Combine
import GameController

View File

@ -5,7 +5,6 @@
// Created by Cirno MainasuK on 2021/3/5.
//
import os.log
import Foundation
import GameplayKit
import MastodonSDK
@ -17,10 +16,6 @@ extension MastodonPickServerViewModel {
init(viewModel: MastodonPickServerViewModel) {
self.viewModel = viewModel
}
override func didEnter(from previousState: GKState?) {
os_log("%{public}s[%{public}ld], %{public}s: enter %s, previous: %s", ((#file as NSString).lastPathComponent), #line, #function, self.debugDescription, previousState.debugDescription)
}
}
}

View File

@ -5,7 +5,6 @@
// Created by BradGao on 2021/2/23.
//
import os.log
import UIKit
import Combine
import GameplayKit
@ -79,9 +78,6 @@ class MastodonPickServerViewModel: NSObject {
configure()
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,7 +5,6 @@
// Created by BradGao on 2021/2/24.
//
import os.log
import UIKit
import Combine
import MastodonSDK

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-4.
//
import os.log
import UIKit
import Tabman
import MastodonAsset

View File

@ -8,7 +8,6 @@
import AlamofireImage
import Combine
import MastodonSDK
import os.log
import PhotosUI
import UIKit
import SwiftUI
@ -21,8 +20,6 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
static let avatarImageMaxSizeInPixel = CGSize(width: 400, height: 400)
let logger = Logger(subsystem: "MastodonRegisterViewController", category: "ViewController")
var disposeBag = Set<AnyCancellable>()
private var observations = Set<NSKeyValueObservation>()

View File

@ -6,7 +6,6 @@
//
import Combine
import os.log
import UIKit
import WebKit
import MastodonCore
@ -27,8 +26,6 @@ final class MastodonResendEmailViewController: UIViewController, NeedsDependency
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function)
// cleanup cookie
let httpCookieStore = webView.configuration.websiteDataStore.httpCookieStore
httpCookieStore.getAllCookies { cookies in
@ -54,7 +51,6 @@ extension MastodonResendEmailViewController {
let request = URLRequest(url: viewModel.resendEmailURL)
webView.navigationDelegate = self.viewModel.navigationDelegate
webView.load(request)
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: resendEmail via: %s", (#file as NSString).lastPathComponent, #line, #function, viewModel.resendEmailURL.debugDescription)
}
}

View File

@ -7,7 +7,6 @@
import Combine
import Foundation
import os.log
import WebKit
final class MastodonResendEmailViewModel {
@ -22,11 +21,6 @@ final class MastodonResendEmailViewModel {
self.resendEmailURL = resendEmailURL
self.email = email
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function)
}
}
extension MastodonResendEmailViewModel {

View File

@ -5,7 +5,6 @@
// Created by sxiaojian on 2021/2/25.
//
import os.log
import Foundation
import WebKit
@ -17,9 +16,6 @@ final class MastodonResendEmailViewModelNavigationDelegateShim: NSObject {
self.viewModel = viewModel
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-2-22.
//
import os.log
import UIKit
import Combine
import MastodonSDK
@ -16,9 +15,6 @@ import MastodonCore
import MastodonLocalization
final class MastodonServerRulesViewController: UIViewController, NeedsDependency {
let logger = Logger(subsystem: "MastodonServerRulesViewController", category: "ViewController")
var disposeBag = Set<AnyCancellable>()
private var observations = Set<NSKeyValueObservation>()

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021/2/1.
//
import os.log
import UIKit
import CoreData
import CoreDataStack
@ -75,9 +74,7 @@ extension AuthenticationViewModel {
let components = host.components(separatedBy: ".")
guard !components.contains(where: { $0.isEmpty }) else { return nil }
guard components.count >= 2 else { return nil }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: input host: %s", ((#file as NSString).lastPathComponent), #line, #function, host)
return host
}
}
@ -156,7 +153,6 @@ extension AuthenticationViewModel {
)
.flatMap { response -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Account>, Error> in
let token = response.value
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: sign in success. Token: %s", ((#file as NSString).lastPathComponent), #line, #function, token.accessToken)
return AuthenticationViewModel.verifyAndSaveAuthentication(
context: self.context,
info: info,
@ -171,7 +167,6 @@ extension AuthenticationViewModel {
guard let self = self else { return }
switch completion {
case .failure(let error):
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: swap user access token swap fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
self.isAuthenticating.value = false
self.error.value = error
case .finished:
@ -180,7 +175,6 @@ extension AuthenticationViewModel {
} receiveValue: { [weak self] response in
guard let self = self else { return }
let account = response.value
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: user %s sign in success", ((#file as NSString).lastPathComponent), #line, #function, account.username)
self.authenticated.send((domain: info.domain, account: account))
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-6-4.
//
import os.log
import UIKit
import Combine
import AuthenticationServices
@ -44,12 +43,10 @@ extension MastodonAuthenticationController {
callbackURLScheme: APIService.callbackURLScheme
) { [weak self] callback, error in
guard let self = self else { return }
os_log("%{public}s[%{public}ld], %{public}s: callback: %s, error: %s", ((#file as NSString).lastPathComponent), #line, #function, callback?.debugDescription ?? "<nil>", error.debugDescription)
if let error = error {
if let error = error as? ASWebAuthenticationSessionError {
if error.errorCode == ASWebAuthenticationSessionError.canceledLogin.rawValue {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: user cancel authentication", ((#file as NSString).lastPathComponent), #line, #function)
self.isAuthenticating.value = false
return
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-5-26.
//
import os.log
import UIKit
import Combine
import MastodonAsset

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-5-25.
//
import os.log
import UIKit
import Combine
import MetaTextKit
@ -186,7 +185,6 @@ extension ProfileFieldCollectionViewCell {
// MARK: - MetaLabelDelegate
extension ProfileFieldCollectionViewCell: MetaLabelDelegate {
func metaLabel(_ metaLabel: MetaLabel, didSelectMeta meta: Meta) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.profileFieldCollectionViewCell(self, metaLabel: metaLabel, didSelectMeta: meta)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-22.
//
import os.log
import UIKit
import Combine
import MetaTextKit
@ -127,7 +126,6 @@ extension ProfileFieldEditCollectionViewCell {
extension ProfileFieldEditCollectionViewCell {
@objc private func editButtonDidPressed(_ sender: UIButton) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.profileFieldEditCollectionViewCell(self, editButtonDidPressed: sender)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-22.
//
import os.log
import UIKit
import Combine
import MetaTextKit
@ -20,8 +19,6 @@ protocol ProfileAboutViewControllerDelegate: AnyObject {
final class ProfileAboutViewController: UIViewController {
let logger = Logger(subsystem: "ProfileAboutViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -39,9 +36,6 @@ final class ProfileAboutViewController: UIViewController {
return collectionView
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -129,7 +123,6 @@ extension ProfileAboutViewController {
// MARK: - UICollectionViewDelegate
extension ProfileAboutViewController: UICollectionViewDelegate {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): select \(indexPath.debugDescription)")
guard let diffableDataSource = viewModel.diffableDataSource else { return }
guard let item = diffableDataSource.itemIdentifier(for: indexPath) else { return }

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-22.
//
import os.log
import UIKit
import Combine
import MastodonSDK

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-1-22.
//
import os.log
import UIKit
import Combine
import CoreDataStack

View File

@ -5,7 +5,6 @@
// Created by ProtoLimit on 2022-07-19.
//
import os.log
import UIKit
import AVKit
import Combine
@ -17,8 +16,6 @@ import MastodonLocalization
final class BookmarkViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "BookmarkViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -39,9 +36,6 @@ final class BookmarkViewController: UIViewController, NeedsDependency, MediaPrev
return tableView
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,7 +5,6 @@
// Created by ProtoLimit on 2022-07-19.
//
import os.log
import Foundation
import GameplayKit
import MastodonSDK
@ -14,8 +13,6 @@ import MastodonCore
extension BookmarkViewModel {
class State: GKState {
let logger = Logger(subsystem: "BookmarkViewModel.State", category: "StateMachine")
let id = UUID()
weak var viewModel: BookmarkViewModel?
@ -29,7 +26,6 @@ extension BookmarkViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
@ -37,9 +33,6 @@ extension BookmarkViewModel {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))")
}
}
}
@ -91,9 +84,7 @@ extension BookmarkViewModel.State {
super.didEnter(from: previousState)
guard let _ = viewModel, let stateMachine = stateMachine else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function)
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function)
stateMachine.enter(Loading.self)
}
}
@ -165,7 +156,6 @@ extension BookmarkViewModel.State {
}
viewModel.statusFetchedResultsController.statusIDs = statusIDs
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user bookmarks fail: \(error.localizedDescription)")
await enter(state: Fail.self)
}
} // end Task

View File

@ -13,8 +13,5 @@ final class CachedProfileViewModel: ProfileViewModel {
init(context: AppContext, authContext: AuthContext, mastodonUser: MastodonUser) {
super.init(context: context, authContext: authContext, optionalMastodonUser: mastodonUser)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Profile] user[\(mastodonUser.id)] profile: \(mastodonUser.acctWithDomain)")
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-5-17.
//
import os.log
import UIKit
import Combine
import MastodonCore
@ -15,8 +14,6 @@ import CoreDataStack
final class FamiliarFollowersViewController: UIViewController, NeedsDependency {
let logger = Logger(subsystem: "FamiliarFollowersViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -31,9 +28,6 @@ final class FamiliarFollowersViewController: UIViewController, NeedsDependency {
return tableView
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -8,7 +8,6 @@
// Note: Prefer use US favorite then EN favourite in coding
// to following the text checker auto-correct behavior
import os.log
import UIKit
import AVKit
import Combine
@ -20,8 +19,6 @@ import MastodonLocalization
final class FavoriteViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "FavoriteViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -42,9 +39,6 @@ final class FavoriteViewController: UIViewController, NeedsDependency, MediaPrev
return tableView
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-4-7.
//
import os.log
import Foundation
import GameplayKit
import MastodonCore
@ -14,8 +13,6 @@ import MastodonSDK
extension FavoriteViewModel {
class State: GKState {
let logger = Logger(subsystem: "FavoriteViewModel.State", category: "StateMachine")
let id = UUID()
weak var viewModel: FavoriteViewModel?
@ -29,17 +26,12 @@ extension FavoriteViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))")
}
}
}
@ -91,9 +83,7 @@ extension FavoriteViewModel.State {
super.didEnter(from: previousState)
guard let _ = viewModel, let stateMachine = stateMachine else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function)
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function)
stateMachine.enter(Loading.self)
}
}
@ -165,7 +155,6 @@ extension FavoriteViewModel.State {
}
viewModel.statusFetchedResultsController.statusIDs = statusIDs
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user favorites fail: \(error.localizedDescription)")
await enter(state: Fail.self)
}
} // end Task

View File

@ -14,8 +14,6 @@ import MastodonUI
import MastodonLocalization
final class FollowedTagsViewController: UIViewController, NeedsDependency {
let logger = Logger(subsystem: String(describing: FollowedTagsViewController.self), category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -33,9 +31,6 @@ final class FollowedTagsViewController: UIViewController, NeedsDependency {
return tableView
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
extension FollowedTagsViewController {

View File

@ -14,7 +14,6 @@ import MastodonSDK
import MastodonCore
final class FollowedTagsViewModel: NSObject {
let logger = Logger(subsystem: String(describing: FollowedTagsViewModel.self), category: "ViewModel")
var disposeBag = Set<AnyCancellable>()
let fetchedResultsController: FollowedTagsFetchedResultController
@ -93,7 +92,6 @@ extension FollowedTagsViewModel {
extension FollowedTagsViewModel: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(indexPath)")
tableView.deselectRow(at: indexPath, animated: true)
let object = fetchedResultsController.records[indexPath.row]

View File

@ -5,7 +5,6 @@
// Created by Cirno MainasuK on 2021-11-1.
//
import os.log
import UIKit
import GameplayKit
import Combine
@ -16,8 +15,6 @@ import CoreDataStack
final class FollowerListViewController: UIViewController, NeedsDependency {
let logger = Logger(subsystem: "FollowerListViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -35,9 +32,6 @@ final class FollowerListViewController: UIViewController, NeedsDependency {
return tableView
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,7 +5,6 @@
// Created by Cirno MainasuK on 2021-11-1.
//
import os.log
import Foundation
import GameplayKit
import MastodonSDK
@ -15,8 +14,6 @@ import CoreDataStack
extension FollowerListViewModel {
class State: GKState {
let logger = Logger(subsystem: "FollowerListViewModel.State", category: "StateMachine")
let id = UUID()
var name: String {
@ -34,17 +31,12 @@ extension FollowerListViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))")
}
}
}
@ -97,9 +89,7 @@ extension FollowerListViewModel.State {
super.didEnter(from: previousState)
guard let _ = viewModel, let stateMachine = stateMachine else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function)
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function)
stateMachine.enter(Loading.self)
}
}
@ -154,7 +144,6 @@ extension FollowerListViewModel.State {
maxID: maxID,
authenticationBox: viewModel.authContext.mastodonAuthenticationBox
)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch \(response.value.count) followers")
var hasNewAppend = false
var userIDs = viewModel.userFetchedResultsController.userIDs
@ -176,7 +165,6 @@ extension FollowerListViewModel.State {
viewModel.userFetchedResultsController.userIDs = userIDs
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch follower fail: \(error.localizedDescription)")
await enter(state: Fail.self)
}
} // end Task

View File

@ -5,7 +5,6 @@
// Created by Cirno MainasuK on 2021-11-2.
//
import os.log
import UIKit
import GameplayKit
import Combine
@ -15,8 +14,6 @@ import MastodonUI
import CoreDataStack
final class FollowingListViewController: UIViewController, NeedsDependency {
let logger = Logger(subsystem: "FollowingListViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -35,9 +32,6 @@ final class FollowingListViewController: UIViewController, NeedsDependency {
return tableView
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,15 +5,12 @@
// Created by Cirno MainasuK on 2021-11-2.
//
import os.log
import Foundation
import GameplayKit
import MastodonSDK
extension FollowingListViewModel {
class State: GKState {
let logger = Logger(subsystem: "FollowingListViewModel.State", category: "StateMachine")
let id = UUID()
@ -28,17 +25,12 @@ extension FollowingListViewModel {
let from = previousState.flatMap { String(describing: $0) } ?? "nil"
let to = String(describing: self)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)")
}
@MainActor
func enter(state: State.Type) {
stateMachine?.enter(state)
}
deinit {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))")
}
}
}
@ -91,9 +83,7 @@ extension FollowingListViewModel.State {
super.didEnter(from: previousState)
guard let _ = viewModel, let stateMachine = stateMachine else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function)
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function)
stateMachine.enter(Loading.self)
}
}
@ -148,9 +138,7 @@ extension FollowingListViewModel.State {
maxID: maxID,
authenticationBox: viewModel.authContext.mastodonAuthenticationBox
)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch \(response.value.count)")
var hasNewAppend = false
var userIDs = viewModel.userFetchedResultsController.userIDs
for user in response.value {
@ -170,7 +158,6 @@ extension FollowingListViewModel.State {
viewModel.userFetchedResultsController.userIDs = userIDs
} catch {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch following fail: \(error.localizedDescription)")
await enter(state: Fail.self)
}
} // end Task

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-29.
//
import os.log
import UIKit
import Combine
import CoreDataStack
@ -27,8 +26,6 @@ protocol ProfileHeaderViewControllerDelegate: AnyObject {
final class ProfileHeaderViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "ProfileHeaderViewController", category: "ViewController")
static let segmentedControlHeight: CGFloat = 50
static let headerMinHeight: CGFloat = segmentedControlHeight
@ -84,9 +81,6 @@ final class ProfileHeaderViewController: UIViewController, NeedsDependency, Medi
return documentPickerController
}()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -202,7 +196,6 @@ extension ProfileHeaderViewController {
var children: [UIMenuElement] = []
let photoLibraryAction = UIAction(title: L10n.Scene.Compose.MediaSelection.photoLibrary, image: UIImage(systemName: "rectangle.on.rectangle"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] _ in
guard let self = self else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: mediaSelectionType: .photoLibaray", ((#file as NSString).lastPathComponent), #line, #function)
self.currentImageType = type
self.present(self.imagePicker, animated: true, completion: nil)
}
@ -210,7 +203,6 @@ extension ProfileHeaderViewController {
if UIImagePickerController.isSourceTypeAvailable(.camera) {
let cameraAction = UIAction(title: L10n.Scene.Compose.MediaSelection.camera, image: UIImage(systemName: "camera"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off, handler: { [weak self] _ in
guard let self = self else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: mediaSelectionType: .camera", ((#file as NSString).lastPathComponent), #line, #function)
self.currentImageType = type
self.present(self.imagePickerController, animated: true, completion: nil)
})
@ -218,7 +210,6 @@ extension ProfileHeaderViewController {
}
let browseAction = UIAction(title: L10n.Scene.Compose.MediaSelection.browse, image: UIImage(systemName: "ellipsis"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] _ in
guard let self = self else { return }
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: mediaSelectionType: .browse", ((#file as NSString).lastPathComponent), #line, #function)
self.currentImageType = type
self.present(self.documentPickerController, animated: true, completion: nil)
}
@ -384,8 +375,6 @@ extension ProfileHeaderViewController: ProfileHeaderViewDelegate {
// MARK: - MetaTextDelegate
extension ProfileHeaderViewController: MetaTextDelegate {
func metaText(_ metaText: MetaText, processEditing textStorage: MetaTextStorage) -> MetaContent? {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: text: %s", ((#file as NSString).lastPathComponent), #line, #function, metaText.backedString)
switch metaText {
case profileHeaderView.bioMetaText:
guard viewModel.isEditing else { break }
@ -438,7 +427,6 @@ extension ProfileHeaderViewController: UIImagePickerControllerDelegate & UINavig
}
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
picker.dismiss(animated: true, completion: nil)
}
}
@ -455,7 +443,6 @@ extension ProfileHeaderViewController: UIDocumentPickerDelegate {
guard let image = UIImage(data: imageData) else { return }
cropImage(image: image, pickerViewController: controller)
} catch {
os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
}
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-4-9.
//
import os.log
import UIKit
import Combine
import CoreDataStack

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-5-26.
//
import os.log
import UIKit
import Combine
import CoreDataStack

View File

@ -5,7 +5,6 @@
// Created by MainasuK on 2022-5-26.
//
import os.log
import UIKit
import Combine
import CoreDataStack

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-29.
//
import os.log
import UIKit
import Combine
import FLAnimatedImage
@ -511,19 +510,16 @@ extension ProfileHeaderView {
extension ProfileHeaderView {
@objc private func relationshipActionButtonDidPressed(_ sender: UIButton) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
assert(sender === relationshipActionButton)
delegate?.profileHeaderView(self, relationshipButtonDidPressed: relationshipActionButton)
}
@objc private func avatarButtonDidPressed(_ sender: UIButton) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
assert(sender === avatarButton)
delegate?.profileHeaderView(self, avatarButtonDidPressed: avatarButton)
}
@objc private func bannerImageViewDidPressed(_ sender: UITapGestureRecognizer) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.profileHeaderView(self, bannerImageViewDidPressed: bannerImageView)
}
}
@ -544,7 +540,6 @@ extension ProfileHeaderView: UITextViewDelegate {
// MARK: - MetaTextViewDelegate
extension ProfileHeaderView: MetaTextViewDelegate {
func metaTextView(_ metaTextView: MetaTextView, didSelectMeta meta: Meta) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: select entity", ((#file as NSString).lastPathComponent), #line, #function)
delegate?.profileHeaderView(self, metaTextView: metaTextView, metaDidPressed: meta)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-30.
//
import os.log
import UIKit
import Combine
import CoreData
@ -25,8 +24,6 @@ final class MeProfileViewModel: ProfileViewModel {
$me
.sink { [weak self] me in
os_log("%{public}s[%{public}ld], %{public}s: current active mastodon user: %s", ((#file as NSString).lastPathComponent), #line, #function, me?.username ?? "<nil>")
guard let self = self else { return }
self.user = me
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-29.
//
import os.log
import UIKit
import Combine
import XLPagerTabStrip
@ -58,9 +57,6 @@ final class ProfilePagingViewController: ButtonBarPagerTabStripViewController, T
return true
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-29.
//
import os.log
import UIKit
import MastodonAsset
import MastodonLocalization
@ -43,8 +42,5 @@ final class ProfilePagingViewModel: NSObject {
]
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-2-23.
//
import os.log
import UIKit
import Combine
import MastodonMeta
@ -27,8 +26,6 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi
public static let containerViewMarginForRegularHorizontalSizeClass: CGFloat = 64
public static let containerViewMarginForCompactHorizontalSizeClass: CGFloat = 16
let logger = Logger(subsystem: "ProfileViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -153,9 +150,6 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi
profileHeaderViewController.titleView
}
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}
@ -526,19 +520,16 @@ extension ProfileViewController {
extension ProfileViewController {
@objc private func cancelEditingBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
viewModel.isEditing = false
}
@objc private func settingBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
guard let setting = context.settingService.currentSetting.value else { return }
let settingsViewModel = SettingsViewModel(context: context, authContext: viewModel.authContext, setting: setting)
_ = coordinator.present(scene: .settings(viewModel: settingsViewModel), from: self, transition: .modal(animated: true, completion: nil))
}
@objc private func shareBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
guard let user = viewModel.user else { return }
let record: ManagedObjectRecord<MastodonUser> = .init(objectID: user.objectID)
Task {
@ -560,19 +551,16 @@ extension ProfileViewController {
}
@objc private func favoriteBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
let favoriteViewModel = FavoriteViewModel(context: context, authContext: viewModel.authContext)
_ = coordinator.present(scene: .favorite(viewModel: favoriteViewModel), from: self, transition: .show)
}
@objc private func bookmarkBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
let bookmarkViewModel = BookmarkViewModel(context: context, authContext: viewModel.authContext)
_ = coordinator.present(scene: .bookmark(viewModel: bookmarkViewModel), from: self, transition: .show)
}
@objc private func replyBarButtonItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
guard let mastodonUser = viewModel.user else { return }
let mention = "@" + mastodonUser.acct
UITextChecker.learnWord(mention)
@ -587,15 +575,11 @@ extension ProfileViewController {
}
@objc private func followedTagsItemPressed(_ sender: UIBarButtonItem) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
let followedTagsViewModel = FollowedTagsViewModel(context: context, authContext: viewModel.authContext)
_ = coordinator.present(scene: .followedTags(viewModel: followedTagsViewModel), from: self, transition: .show)
}
@objc private func refreshControlValueChanged(_ sender: RefreshControl) {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
if let userTimelineViewController = profilePagingViewController.currentViewController as? UserTimelineViewController {
userTimelineViewController.viewModel.stateMachine.enter(UserTimelineViewModel.State.Reloading.self)
}
@ -767,11 +751,9 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
headerProfileInfo: profileHeaderViewModel.profileInfoEditing,
aboutProfileInfo: profileAboutViewModel.profileInfoEditing
)
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): update profile info success")
self.viewModel.isEditing = false
} catch {
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): update profile info fail: \(error.localizedDescription)")
let alertController = UIAlertController(
for: error,
title: L10n.Common.Alerts.EditProfileFailure.title,
@ -798,7 +780,6 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
}
switch completion {
case .failure(let error):
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch profile info for edit fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
let alertController = UIAlertController(for: error, title: L10n.Common.Alerts.EditProfileFailure.title, preferredStyle: .alert)
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil)
alertController.addAction(okAction)
@ -808,7 +789,6 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
transition: .alertController(animated: true, completion: nil)
)
case .finished:
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch profile info for edit success", ((#file as NSString).lastPathComponent), #line, #function)
// enter editing mode
self.viewModel.isEditing.toggle()
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-29.
//
import os.log
import UIKit
import Combine
import CoreDataStack
@ -19,8 +18,6 @@ import MastodonUI
// please override this base class
class ProfileViewModel: NSObject {
let logger = Logger(subsystem: "ProfileViewModel", category: "ViewModel")
typealias UserID = String
var disposeBag = Set<AnyCancellable>()
@ -151,11 +148,9 @@ class ProfileViewModel: NSObject {
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
guard let _ = self else { return }
pendingRetryPublisher.value = min(2 * delay, 60)
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Relationship] fetch again due to pending", ((#file as NSString).lastPathComponent), #line, #function)
}
}
} catch {
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] update user relationship failure: \(error.localizedDescription)")
}
} // end Task
}
@ -196,12 +191,10 @@ extension ProfileViewModel {
record: ManagedObjectRecord<MastodonUser>,
authenticationBox: MastodonAuthenticationBox
) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Relationship]> {
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] update user relationship...")
let response = try await context.apiService.relationship(
records: [record],
authenticationBox: authenticationBox
)
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] did update MastodonUser relationship")
return response
}

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-4-2.
//
import os.log
import Foundation
import Combine
import CoreDataStack
@ -33,9 +32,9 @@ final class RemoteProfileViewModel: ProfileViewModel {
switch completion {
case .failure(let error):
// TODO: handle error
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetch failed: %s", ((#file as NSString).lastPathComponent), #line, #function, userID, error.localizedDescription)
break
case .finished:
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetched", ((#file as NSString).lastPathComponent), #line, #function, userID)
break
}
} receiveValue: { [weak self] response in
guard let self = self else { return }
@ -109,9 +108,9 @@ final class RemoteProfileViewModel: ProfileViewModel {
switch completion {
case .failure(let error):
// TODO: handle error
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetch failed: %s", ((#file as NSString).lastPathComponent), #line, #function, acct, error.localizedDescription)
break
case .finished:
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetched", ((#file as NSString).lastPathComponent), #line, #function, acct)
break
}
} receiveValue: { [weak self] response in
guard let self = self, let value = response.value else { return }

View File

@ -5,7 +5,6 @@
// Created by MainasuK Cirno on 2021-3-29.
//
import os.log
import UIKit
import AVKit
import Combine
@ -17,8 +16,6 @@ import MastodonCore
final class UserTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
let logger = Logger(subsystem: "UserTimelineViewController", category: "ViewController")
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
@ -38,9 +35,6 @@ final class UserTimelineViewController: UIViewController, NeedsDependency, Media
let cellFrameCache = NSCache<NSNumber, NSValue>()
deinit {
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
}
}

Some files were not shown because too many files have changed in this diff Show More