Merge branch 'develop' into performance_experiments
This commit is contained in:
commit
360bfd29f1
44
Gemfile.lock
44
Gemfile.lock
|
@ -1,34 +1,33 @@
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.5)
|
||||
CFPropertyList (3.0.6)
|
||||
rexml
|
||||
activesupport (6.1.7)
|
||||
activesupport (7.0.8)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 1.6, < 2)
|
||||
minitest (>= 5.1)
|
||||
tzinfo (~> 2.0)
|
||||
zeitwerk (~> 2.3)
|
||||
addressable (2.8.1)
|
||||
addressable (2.8.5)
|
||||
public_suffix (>= 2.0.2, < 6.0)
|
||||
algoliasearch (1.27.5)
|
||||
httpclient (~> 2.8, >= 2.8.3)
|
||||
json (>= 1.5.1)
|
||||
arkana (1.3.0)
|
||||
colorize (~> 0.8)
|
||||
arkana (1.5.0)
|
||||
dotenv (~> 2.7)
|
||||
rainbow (~> 3.1.1)
|
||||
yaml (~> 0.2)
|
||||
atomos (0.1.3)
|
||||
claide (1.1.0)
|
||||
cocoapods (1.11.3)
|
||||
cocoapods (1.12.1)
|
||||
addressable (~> 2.8)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
cocoapods-core (= 1.11.3)
|
||||
cocoapods-core (= 1.12.1)
|
||||
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
||||
cocoapods-downloader (>= 1.4.0, < 2.0)
|
||||
cocoapods-downloader (>= 1.6.0, < 2.0)
|
||||
cocoapods-plugins (>= 1.0.0, < 2.0)
|
||||
cocoapods-search (>= 1.0.0, < 2.0)
|
||||
cocoapods-trunk (>= 1.4.0, < 2.0)
|
||||
cocoapods-trunk (>= 1.6.0, < 2.0)
|
||||
cocoapods-try (>= 1.1.0, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
escape (~> 0.0.4)
|
||||
|
@ -36,11 +35,11 @@ GEM
|
|||
gh_inspector (~> 1.0)
|
||||
molinillo (~> 0.8.0)
|
||||
nap (~> 1.0)
|
||||
ruby-macho (>= 1.0, < 3.0)
|
||||
ruby-macho (>= 2.3.0, < 3.0)
|
||||
xcodeproj (>= 1.21.0, < 2.0)
|
||||
cocoapods-clean (0.0.1)
|
||||
cocoapods-core (1.11.3)
|
||||
activesupport (>= 5.0, < 7)
|
||||
cocoapods-core (1.12.1)
|
||||
activesupport (>= 5.0, < 8)
|
||||
addressable (~> 2.8)
|
||||
algoliasearch (~> 1.0)
|
||||
concurrent-ruby (~> 1.1)
|
||||
|
@ -59,8 +58,7 @@ GEM
|
|||
netrc (~> 0.11)
|
||||
cocoapods-try (1.2.0)
|
||||
colored2 (3.1.2)
|
||||
colorize (0.8.1)
|
||||
concurrent-ruby (1.1.10)
|
||||
concurrent-ruby (1.2.2)
|
||||
dotenv (2.8.1)
|
||||
escape (0.0.4)
|
||||
ethon (0.16.0)
|
||||
|
@ -70,21 +68,22 @@ GEM
|
|||
fuzzy_match (2.0.4)
|
||||
gh_inspector (1.1.3)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.12.0)
|
||||
i18n (1.14.1)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.6.2)
|
||||
minitest (5.16.3)
|
||||
json (2.6.3)
|
||||
minitest (5.20.0)
|
||||
molinillo (0.8.0)
|
||||
nanaimo (0.3.0)
|
||||
nap (1.1.0)
|
||||
netrc (0.11.0)
|
||||
public_suffix (4.0.7)
|
||||
rexml (3.2.5)
|
||||
rainbow (3.1.1)
|
||||
rexml (3.2.6)
|
||||
rouge (2.0.7)
|
||||
ruby-macho (2.5.1)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (2.0.5)
|
||||
tzinfo (2.0.6)
|
||||
concurrent-ruby (~> 1.0)
|
||||
xcodeproj (1.22.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
|
@ -95,8 +94,7 @@ GEM
|
|||
rexml (~> 3.2.4)
|
||||
xcpretty (0.3.0)
|
||||
rouge (~> 2.0.7)
|
||||
yaml (0.2.0)
|
||||
zeitwerk (2.6.6)
|
||||
yaml (0.2.1)
|
||||
|
||||
PLATFORMS
|
||||
arm64-darwin-21
|
||||
|
@ -111,4 +109,4 @@ DEPENDENCIES
|
|||
xcpretty
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.26
|
||||
2.4.6
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@
|
|||
2D5981A125E4A593000FB903 /* MastodonConfirmEmailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5981A025E4A593000FB903 /* MastodonConfirmEmailViewModel.swift */; };
|
||||
2D5A3D2825CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5A3D2725CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.swift */; };
|
||||
2D5A3D3825CF8D9F002347D6 /* ScrollViewContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5A3D3725CF8D9F002347D6 /* ScrollViewContainer.swift */; };
|
||||
2D5A3D6225CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5A3D6125CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift */; };
|
||||
2D607AD826242FC500B70763 /* NotificationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D607AD726242FC500B70763 /* NotificationViewModel.swift */; };
|
||||
2D694A7425F9EB4E0038ADDC /* ContentWarningOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D694A7325F9EB4E0038ADDC /* ContentWarningOverlayView.swift */; };
|
||||
2D6DE40026141DF600A63F6A /* SearchViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6DE3FF26141DF600A63F6A /* SearchViewModel.swift */; };
|
||||
|
@ -159,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 */; };
|
||||
|
@ -693,7 +691,6 @@
|
|||
2D5981A025E4A593000FB903 /* MastodonConfirmEmailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonConfirmEmailViewModel.swift; sourceTree = "<group>"; };
|
||||
2D5A3D2725CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HomeTimelineViewModel+Diffable.swift"; sourceTree = "<group>"; };
|
||||
2D5A3D3725CF8D9F002347D6 /* ScrollViewContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollViewContainer.swift; sourceTree = "<group>"; };
|
||||
2D5A3D6125CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "HomeTimelineViewController+DebugAction.swift"; sourceTree = "<group>"; };
|
||||
2D607AD726242FC500B70763 /* NotificationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewModel.swift; sourceTree = "<group>"; };
|
||||
2D694A7325F9EB4E0038ADDC /* ContentWarningOverlayView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentWarningOverlayView.swift; sourceTree = "<group>"; };
|
||||
2D6DE3FF26141DF600A63F6A /* SearchViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewModel.swift; sourceTree = "<group>"; };
|
||||
|
@ -810,7 +807,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>"; };
|
||||
|
@ -1552,7 +1548,6 @@
|
|||
DB1F239626117C360057430E /* View */,
|
||||
2D38F1D425CD465300561493 /* HomeTimelineViewController.swift */,
|
||||
DB697DD8278F4CED004EF2F7 /* HomeTimelineViewController+DataSourceProvider.swift */,
|
||||
2D5A3D6125CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift */,
|
||||
2D38F1E425CD46C100561493 /* HomeTimelineViewModel.swift */,
|
||||
2D5A3D2725CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.swift */,
|
||||
2D38F1EA25CD477000561493 /* HomeTimelineViewModel+LoadLatestState.swift */,
|
||||
|
@ -2525,7 +2520,6 @@
|
|||
2D206B8525F5FB0900143C56 /* Double.swift */,
|
||||
DBB3BA2926A81C020004F2D4 /* FLAnimatedImageView.swift */,
|
||||
DB68586325E619B700F0A850 /* NSKeyValueObservation.swift */,
|
||||
DB0140CE25C42AEE00F9F3CF /* OSLog.swift */,
|
||||
2D939AB425EDD8A90076FA61 /* String.swift */,
|
||||
DB68A06225E905E000CFDF14 /* UIApplication.swift */,
|
||||
DB45FAB525CA5485005A8AC7 /* UIAlertController.swift */,
|
||||
|
@ -3818,7 +3812,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 */,
|
||||
|
@ -3890,7 +3883,6 @@
|
|||
2A82294F29262EE000D2A1F7 /* AppContext+NextAccount.swift in Sources */,
|
||||
DBB525302611EBF3002F1F29 /* ProfilePagingViewModel.swift in Sources */,
|
||||
DB9F58EC26EF435000E7BBE9 /* AccountViewController.swift in Sources */,
|
||||
2D5A3D6225CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift in Sources */,
|
||||
DB3E6FF12806D96900B035AE /* DiscoveryNewsViewModel+Diffable.swift in Sources */,
|
||||
DB3E6FF82807C45300B035AE /* DiscoveryForYouViewModel.swift in Sources */,
|
||||
DB0F9D56283EB46200379AF8 /* ProfileHeaderView+Configuration.swift in Sources */,
|
||||
|
@ -4584,7 +4576,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2023.13;
|
||||
MARKETING_VERSION = 2023.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.joinmastodon.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -4616,7 +4608,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2023.13;
|
||||
MARKETING_VERSION = 2023.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.joinmastodon.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -4803,7 +4795,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2023.13;
|
||||
MARKETING_VERSION = 2023.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.joinmastodon.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
@ -5094,7 +5086,7 @@
|
|||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 2023.13;
|
||||
MARKETING_VERSION = 2023.14;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = org.joinmastodon.app;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
|
|
|
@ -19,15 +19,6 @@
|
|||
"version": "4.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "CommonOSLog",
|
||||
"repositoryURL": "https://github.com/MainasuK/CommonOSLog",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "c121624a30698e9886efe38aebb36ff51c01b6c2",
|
||||
"version": "0.1.1"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "FaviconFinder",
|
||||
"repositoryURL": "https://github.com/will-lumley/FaviconFinder.git",
|
||||
|
@ -46,15 +37,6 @@
|
|||
"version": "1.0.17"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "FPSIndicator",
|
||||
"repositoryURL": "https://github.com/MainasuK/FPSIndicator.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "e4a5067ccd5293b024c767f09e51056afd4a4796",
|
||||
"version": "1.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Fuzi",
|
||||
"repositoryURL": "https://github.com/cezheng/Fuzi.git",
|
||||
|
@ -154,6 +136,15 @@
|
|||
"version": "0.2.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-atomics",
|
||||
"repositoryURL": "https://github.com/apple/swift-atomics.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "6c89474e62719ddcc1e9614989fff2f68208fe10",
|
||||
"version": "1.1.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-collections",
|
||||
"repositoryURL": "https://github.com/apple/swift-collections.git",
|
||||
|
@ -168,17 +159,8 @@
|
|||
"repositoryURL": "https://github.com/apple/swift-nio.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "546610d52b19be3e19935e0880bb06b9c03f5cef",
|
||||
"version": "1.14.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "swift-nio-zlib-support",
|
||||
"repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "37760e9a52030bb9011972c5213c3350fa9d41fd",
|
||||
"version": "1.0.0"
|
||||
"revision": "3db5c4aeee8100d2db6f1eaf3864afdad5dc68fd",
|
||||
"version": "2.59.0"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -190,15 +172,6 @@
|
|||
"version": "2.4.3"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "Introspect",
|
||||
"repositoryURL": "https://github.com/siteline/SwiftUI-Introspect.git",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "f2616860a41f9d9932da412a8978fec79c06fe24",
|
||||
"version": "0.1.4"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "TabBarPager",
|
||||
"repositoryURL": "https://github.com/TwidereProject/TabBarPager.git",
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -11,7 +11,6 @@ import CoreDataStack
|
|||
import Foundation
|
||||
import MastodonSDK
|
||||
import UIKit
|
||||
import os.log
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
|
|
|
@ -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
|
||||
}()
|
||||
|
||||
|
|
|
@ -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?
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}()
|
||||
}
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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] = [
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
// Copyright © 2021 Twidere. All rights reserved.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import CoreDataStack
|
||||
import MastodonSDK
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK Cirno on 2021-5-19.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonLocalization
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK Cirno on 2021-5-21.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonLocalization
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by Cirno MainasuK on 2021-9-13.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import CoreData
|
||||
|
|
|
@ -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) } }
|
||||
|
||||
|
@ -153,12 +150,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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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>()
|
||||
|
||||
|
|
|
@ -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) } }
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-4-29.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import GameplayKit
|
||||
|
|
|
@ -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) } }
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-4-13.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import GameplayKit
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-4-13.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import GameplayKit
|
||||
|
|
|
@ -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) } }
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
@ -24,22 +20,10 @@ extension DiscoveryPostsViewModel {
|
|||
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)
|
||||
}
|
||||
|
||||
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 +72,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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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])
|
||||
|
|
|
@ -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 {
|
||||
|
@ -27,22 +24,10 @@ extension HashtagTimelineViewModel {
|
|||
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)
|
||||
}
|
||||
|
||||
deinit {
|
||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(self.name)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,9 +75,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 +161,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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,451 +0,0 @@
|
|||
//
|
||||
// HomeTimelineViewController+DebugAction.swift
|
||||
// Mastodon
|
||||
//
|
||||
// Created by MainasuK Cirno on 2021-2-5.
|
||||
//
|
||||
|
||||
|
||||
#if DEBUG || SNAPSHOT
|
||||
import os.log
|
||||
import UIKit
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
import FLEX
|
||||
import SwiftUI
|
||||
import MastodonCore
|
||||
import MastodonUI
|
||||
import MastodonSDK
|
||||
import StoreKit
|
||||
|
||||
extension HomeTimelineViewController {
|
||||
var debugMenu: UIMenu {
|
||||
let menu = UIMenu(
|
||||
title: "Debug Tools",
|
||||
image: nil,
|
||||
identifier: nil,
|
||||
options: .displayInline,
|
||||
children: [
|
||||
showMenu,
|
||||
moveMenu,
|
||||
dropMenu,
|
||||
miscMenu,
|
||||
notificationMenu,
|
||||
UIAction(title: "Settings", image: UIImage(systemName: "gear"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showSettings(action)
|
||||
},
|
||||
UIAction(title: "Sign Out", image: UIImage(systemName: "escape"), attributes: .destructive) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.signOutAction(action)
|
||||
}
|
||||
]
|
||||
)
|
||||
return menu
|
||||
}
|
||||
|
||||
var showMenu: UIMenu {
|
||||
return UIMenu(
|
||||
title: "Show…",
|
||||
image: UIImage(systemName: "plus.rectangle.on.rectangle"),
|
||||
identifier: nil,
|
||||
options: [],
|
||||
children: [
|
||||
UIAction(title: "FLEX", image: nil, attributes: [], handler: { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showFLEXAction(action)
|
||||
}),
|
||||
UIAction(title: "Welcome", image: UIImage(systemName: "figure.walk"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showWelcomeAction(action)
|
||||
},
|
||||
UIAction(title: "Register", image: UIImage(systemName: "list.bullet.rectangle.portrait.fill"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showRegisterAction(action)
|
||||
},
|
||||
UIAction(title: "Confirm Email", image: UIImage(systemName: "envelope"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showConfirmEmail(action)
|
||||
},
|
||||
UIAction(title: "Account List", image: UIImage(systemName: "person"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showAccountList(action)
|
||||
},
|
||||
UIAction(title: "Profile", image: UIImage(systemName: "person.crop.circle"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showProfileAction(action)
|
||||
},
|
||||
UIAction(title: "Thread", image: UIImage(systemName: "bubble.left.and.bubble.right"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showThreadAction(action)
|
||||
},
|
||||
UIAction(title: "Account Recommend", image: UIImage(systemName: "human"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
let suggestionAccountViewModel = SuggestionAccountViewModel(
|
||||
context: self.context,
|
||||
authContext: self.viewModel.authContext
|
||||
)
|
||||
_ = self.coordinator.present(
|
||||
scene: .suggestionAccount(viewModel: suggestionAccountViewModel),
|
||||
from: self,
|
||||
transition: .modal(animated: true, completion: nil)
|
||||
)
|
||||
},
|
||||
UIAction(title: "Store Rating", image: UIImage(systemName: "star.fill"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
guard let windowScene = self.view.window?.windowScene else { return }
|
||||
SKStoreReviewController.requestReview(in: windowScene)
|
||||
},
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
var dropMenu: UIMenu {
|
||||
return UIMenu(
|
||||
title: "Drop…",
|
||||
image: UIImage(systemName: "minus.circle"),
|
||||
identifier: nil,
|
||||
options: [],
|
||||
children: [50, 100, 150, 200, 250, 300].map { count in
|
||||
UIAction(title: "Drop Recent \(count) Statuses", image: nil, attributes: [], handler: { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.dropRecentStatusAction(action, count: count)
|
||||
})
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
var miscMenu: UIMenu {
|
||||
return UIMenu(
|
||||
title: "Debug…",
|
||||
image: UIImage(systemName: "switch.2"),
|
||||
identifier: nil,
|
||||
options: [],
|
||||
children: [
|
||||
UIAction(title: "Toggle Visible Touches", image: UIImage(systemName: "hand.tap"), attributes: []) { _ in
|
||||
guard let window = UIApplication.shared.getKeyWindow() as? TouchesVisibleWindow else { return }
|
||||
window.touchesVisible = !window.touchesVisible
|
||||
},
|
||||
UIAction(title: "Toggle EmptyView", image: UIImage(systemName: "clear"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
if self.emptyView.superview != nil {
|
||||
self.emptyView.removeFromSuperview()
|
||||
} else {
|
||||
self.showEmptyView()
|
||||
}
|
||||
},
|
||||
UIAction(
|
||||
title: "Enable account switcher wizard",
|
||||
image: UIImage(systemName: "square.stack.3d.down.forward.fill"),
|
||||
identifier: nil,
|
||||
attributes: [],
|
||||
state: .off,
|
||||
handler: { _ in
|
||||
UserDefaults.shared.didShowMultipleAccountSwitchWizard = false
|
||||
}
|
||||
),
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
var notificationMenu: UIMenu {
|
||||
return UIMenu(
|
||||
title: "Notification…",
|
||||
image: UIImage(systemName: "bell.badge"),
|
||||
identifier: nil,
|
||||
options: [],
|
||||
children: [
|
||||
UIAction(title: "Badge +1", image: UIImage(systemName: "app.badge.fill"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
let accessToken = self.viewModel.authContext.mastodonAuthenticationBox.userAuthorization.accessToken
|
||||
UserDefaults.shared.increaseNotificationCount(accessToken: accessToken)
|
||||
self.context.notificationService.applicationIconBadgeNeedsUpdate.send()
|
||||
},
|
||||
UIAction(title: "Profile", image: UIImage(systemName: "person.badge.plus"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showNotification(action, notificationType: .follow)
|
||||
},
|
||||
UIAction(title: "Status", image: UIImage(systemName: "list.bullet.rectangle"), attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.showNotification(action, notificationType: .mention)
|
||||
},
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension HomeTimelineViewController {
|
||||
|
||||
enum MoveAction: String, CaseIterable {
|
||||
case gap
|
||||
case reply
|
||||
case mention
|
||||
case poll
|
||||
// case quote
|
||||
// case gif
|
||||
// case video
|
||||
// case location
|
||||
// case followsYouAuthor
|
||||
// case blockingAuthor
|
||||
|
||||
var title: String {
|
||||
return rawValue.capitalized
|
||||
}
|
||||
|
||||
func match(item: StatusItem) -> Bool {
|
||||
// let authenticationBox = AppContext.shared.authenticationService.activeMastodonAuthenticationBox.value
|
||||
switch item {
|
||||
case .feed(let record):
|
||||
guard let feed = record.object(in: AppContext.shared.managedObjectContext) else { return false }
|
||||
if let status = feed.status {
|
||||
switch self {
|
||||
case .gap:
|
||||
return false
|
||||
case .reply:
|
||||
return status.inReplyToID != nil
|
||||
case .mention:
|
||||
return !(status.reblog ?? status).mentions.isEmpty
|
||||
case .poll:
|
||||
return (status.reblog ?? status).poll != nil
|
||||
// case .quote:
|
||||
// return status.quote != nil
|
||||
// case .gif:
|
||||
// return status.attachments.contains(where: { attachment in attachment.kind == .animatedGIF })
|
||||
// case .video:
|
||||
// return status.attachments.contains(where: { attachment in attachment.kind == .video })
|
||||
// case .location:
|
||||
// return status.location != nil
|
||||
// case .followsYouAuthor:
|
||||
// guard case let .twitter(authenticationContext) = authenticationContext else { return false }
|
||||
// guard let me = authenticationContext.authenticationRecord.object(in: AppContext.shared.managedObjectContext)?.user else { return false }
|
||||
// return (status.repost ?? status).author.following.contains(me)
|
||||
// case .blockingAuthor:
|
||||
// guard case let .twitter(authenticationContext) = authenticationContext else { return false }
|
||||
// guard let me = authenticationContext.authenticationRecord.object(in: AppContext.shared.managedObjectContext)?.user else { return false }
|
||||
// return (status.repost ?? status).author.blockingBy.contains(me)
|
||||
// default:
|
||||
// return false
|
||||
} // end switch
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case .feedLoader where self == .gap:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func firstMatch(in items: [StatusItem]) -> StatusItem? {
|
||||
return items.first { item in self.match(item: item) }
|
||||
}
|
||||
}
|
||||
|
||||
var moveMenu: UIMenu {
|
||||
return UIMenu(
|
||||
title: "Move to…",
|
||||
image: UIImage(systemName: "arrow.forward.circle"),
|
||||
identifier: nil,
|
||||
options: [],
|
||||
children:
|
||||
MoveAction.allCases.map { moveAction in
|
||||
UIAction(title: "First \(moveAction.title)", image: nil, attributes: []) { [weak self] action in
|
||||
guard let self = self else { return }
|
||||
self.moveToFirst(action, moveAction: moveAction)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
private func moveToFirst(_ sender: UIAction, moveAction: MoveAction) {
|
||||
guard let diffableDataSource = viewModel.diffableDataSource else { return }
|
||||
let snapshot = diffableDataSource.snapshot()
|
||||
let items = snapshot.itemIdentifiers
|
||||
guard let targetItem = moveAction.firstMatch(in: items),
|
||||
let index = snapshot.indexOfItem(targetItem)
|
||||
else { return }
|
||||
let indexPath = IndexPath(row: index, section: 0)
|
||||
tableView.scrollToRow(at: indexPath, at: .middle, animated: true)
|
||||
tableView.blinkRow(at: indexPath)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension HomeTimelineViewController {
|
||||
|
||||
@objc private func showFLEXAction(_ sender: UIAction) {
|
||||
FLEXManager.shared.showExplorer()
|
||||
}
|
||||
|
||||
@objc private func dropRecentStatusAction(_ sender: UIAction, count: Int) {
|
||||
guard let diffableDataSource = viewModel.diffableDataSource else { return }
|
||||
let snapshot = diffableDataSource.snapshot()
|
||||
|
||||
let feedRecords = snapshot.itemIdentifiers.prefix(count).compactMap { item -> ManagedObjectRecord<Feed>? in
|
||||
switch item {
|
||||
case .feed(let record): return record
|
||||
default: return nil
|
||||
}
|
||||
}
|
||||
let managedObjectContext = viewModel.context.backgroundManagedObjectContext
|
||||
Task {
|
||||
try await managedObjectContext.performChanges {
|
||||
for record in feedRecords {
|
||||
guard let feed = record.object(in: managedObjectContext) else { continue }
|
||||
let status = feed.status
|
||||
managedObjectContext.delete(feed)
|
||||
if let status = status {
|
||||
managedObjectContext.delete(status)
|
||||
}
|
||||
} // end for in
|
||||
} // end managedObjectContext.performChanges
|
||||
} // end Task
|
||||
}
|
||||
|
||||
@objc private func showWelcomeAction(_ sender: UIAction) {
|
||||
_ = coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
@objc private func showRegisterAction(_ sender: UIAction) {
|
||||
Task { @MainActor in
|
||||
try await showRegisterController()
|
||||
} // end Task
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func showRegisterController(domain: String = "mstdn.jp") async throws {
|
||||
let viewController = try await MastodonRegisterViewController.create(
|
||||
context: context,
|
||||
coordinator: coordinator,
|
||||
domain: "mstdn.jp"
|
||||
)
|
||||
let navigationController = UINavigationController(rootViewController: viewController)
|
||||
navigationController.modalPresentationStyle = .fullScreen
|
||||
present(navigationController, animated: true) {
|
||||
viewController.navigationItem.leftBarButtonItem = UIBarButtonItem(
|
||||
systemItem: .close,
|
||||
primaryAction: UIAction(handler: { [weak viewController] _ in
|
||||
guard let viewController = viewController else { return }
|
||||
viewController.dismiss(animated: true)
|
||||
}),
|
||||
menu: nil
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func showConfirmEmail(_ sender: UIAction) {
|
||||
let mastodonConfirmEmailViewModel = MastodonConfirmEmailViewModel()
|
||||
_ = coordinator.present(scene: .mastodonConfirmEmail(viewModel: mastodonConfirmEmailViewModel), from: nil, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
@objc private func showAccountList(_ sender: UIAction) {
|
||||
let accountListViewModel = AccountListViewModel(context: context, authContext: viewModel.authContext)
|
||||
_ = coordinator.present(scene: .accountList(viewModel: accountListViewModel), from: self, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
@objc private func showProfileAction(_ sender: UIAction) {
|
||||
let alertController = UIAlertController(title: "Enter User ID", message: nil, preferredStyle: .alert)
|
||||
alertController.addTextField()
|
||||
let showAction = UIAlertAction(title: "Show", style: .default) { [weak self, weak alertController] _ in
|
||||
guard let self = self else { return }
|
||||
guard let textField = alertController?.textFields?.first else { return }
|
||||
let profileViewModel = RemoteProfileViewModel(context: self.context, authContext: self.viewModel.authContext, userID: textField.text ?? "")
|
||||
_ = self.coordinator.present(scene: .profile(viewModel: profileViewModel), from: self, transition: .show)
|
||||
}
|
||||
alertController.addAction(showAction)
|
||||
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
|
||||
alertController.addAction(cancelAction)
|
||||
_ = coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
@objc private func showThreadAction(_ sender: UIAction) {
|
||||
let alertController = UIAlertController(title: "Enter Status ID", message: nil, preferredStyle: .alert)
|
||||
alertController.addTextField()
|
||||
let showAction = UIAlertAction(title: "Show", style: .default) { [weak self, weak alertController] _ in
|
||||
guard let self = self else { return }
|
||||
guard let textField = alertController?.textFields?.first else { return }
|
||||
let threadViewModel = RemoteThreadViewModel(context: self.context, authContext: self.viewModel.authContext, statusID: textField.text ?? "")
|
||||
_ = self.coordinator.present(scene: .thread(viewModel: threadViewModel), from: self, transition: .show)
|
||||
}
|
||||
alertController.addAction(showAction)
|
||||
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
|
||||
alertController.addAction(cancelAction)
|
||||
_ = coordinator.present(scene: .alertController(alertController: alertController), from: self, transition: .alertController(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
private func showNotification(_ sender: UIAction, notificationType: Mastodon.Entity.Notification.NotificationType) {
|
||||
let alertController = UIAlertController(title: "Enter notification ID", message: nil, preferredStyle: .alert)
|
||||
alertController.addTextField()
|
||||
|
||||
let showAction = UIAlertAction(title: "Show", style: .default) { [weak self, weak alertController] _ in
|
||||
guard let self = self else { return }
|
||||
guard let textField = alertController?.textFields?.first,
|
||||
let text = textField.text,
|
||||
let notificationID = Int(text)
|
||||
else { return }
|
||||
|
||||
let pushNotification = MastodonPushNotification(
|
||||
accessToken: self.viewModel.authContext.mastodonAuthenticationBox.userAuthorization.accessToken,
|
||||
notificationID: notificationID,
|
||||
notificationType: notificationType.rawValue,
|
||||
preferredLocale: nil,
|
||||
icon: nil,
|
||||
title: "",
|
||||
body: ""
|
||||
)
|
||||
self.context.notificationService.requestRevealNotificationPublisher.send(pushNotification)
|
||||
}
|
||||
alertController.addAction(showAction)
|
||||
|
||||
// for multiple accounts debug
|
||||
let boxes = self.context.authenticationService.mastodonAuthenticationBoxes // already sorted
|
||||
if boxes.count >= 2 {
|
||||
let accessToken = boxes[1].userAuthorization.accessToken
|
||||
let showForSecondaryAction = UIAlertAction(title: "Show for Secondary", style: .default) { [weak self, weak alertController] _ in
|
||||
guard let self = self else { return }
|
||||
guard let textField = alertController?.textFields?.first,
|
||||
let text = textField.text,
|
||||
let notificationID = Int(text)
|
||||
else { return }
|
||||
|
||||
let pushNotification = MastodonPushNotification(
|
||||
accessToken: accessToken,
|
||||
notificationID: notificationID,
|
||||
notificationType: notificationType.rawValue,
|
||||
preferredLocale: nil,
|
||||
icon: nil,
|
||||
title: "",
|
||||
body: ""
|
||||
)
|
||||
self.context.notificationService.requestRevealNotificationPublisher.send(pushNotification)
|
||||
}
|
||||
alertController.addAction(showForSecondaryAction)
|
||||
}
|
||||
|
||||
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
_ = self.coordinator.present(
|
||||
scene: .alertController(alertController: alertController),
|
||||
from: self,
|
||||
transition: .alertController(animated: true, completion: nil)
|
||||
)
|
||||
}
|
||||
|
||||
@objc private func showSettings(_ sender: UIAction) {
|
||||
guard let currentSetting = context.settingService.currentSetting.value else { return }
|
||||
let settingsViewModel = SettingsViewModel(
|
||||
context: context,
|
||||
authContext: viewModel.authContext,
|
||||
setting: currentSetting
|
||||
)
|
||||
_ = coordinator.present(
|
||||
scene: .settings(viewModel: settingsViewModel),
|
||||
from: self,
|
||||
transition: .modal(animated: true, completion: nil)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
|
@ -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 {
|
||||
|
@ -100,31 +92,13 @@ extension HomeTimelineViewController {
|
|||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] displaySettingBarButtonItem in
|
||||
guard let self = self else { return }
|
||||
#if DEBUG
|
||||
// display debug menu
|
||||
self.navigationItem.rightBarButtonItem = {
|
||||
let barButtonItem = UIBarButtonItem()
|
||||
barButtonItem.image = UIImage(systemName: "ellipsis.circle")
|
||||
barButtonItem.menu = self.debugMenu
|
||||
return barButtonItem
|
||||
}()
|
||||
#else
|
||||
|
||||
self.navigationItem.rightBarButtonItem = displaySettingBarButtonItem ? self.settingBarButtonItem : nil
|
||||
#endif
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
#if DEBUG
|
||||
// long press to trigger debug menu
|
||||
settingBarButtonItem.menu = debugMenu
|
||||
#else
|
||||
|
||||
settingBarButtonItem.target = self
|
||||
settingBarButtonItem.action = #selector(HomeTimelineViewController.settingBarButtonItemPressed(_:))
|
||||
#endif
|
||||
|
||||
#if SNAPSHOT
|
||||
titleView.logoButton.menu = self.debugMenu
|
||||
titleView.button.menu = self.debugMenu
|
||||
#endif
|
||||
|
||||
navigationItem.titleView = titleView
|
||||
titleView.delegate = self
|
||||
|
@ -274,9 +248,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 }
|
||||
|
@ -478,7 +449,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,
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by sxiaojian on 2021/2/7.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import CoreData
|
||||
import CoreDataStack
|
||||
|
|
|
@ -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 {
|
||||
|
@ -32,8 +29,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 +36,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)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -98,13 +89,10 @@ extension HomeTimelineViewModel.LoadLatestState {
|
|||
managedObjectContext.parent = parentManagedObjectContext
|
||||
|
||||
Task {
|
||||
let start = CACurrentMediaTime()
|
||||
let latestStatusIDs: [Status.ID] = latestFeedRecords.compactMap { record in
|
||||
guard let feed = record.object(in: managedObjectContext) else { return nil }
|
||||
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 +107,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 +123,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))
|
||||
|
|
|
@ -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?
|
||||
|
@ -23,22 +20,10 @@ extension HomeTimelineViewModel {
|
|||
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: 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 +82,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))
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK Cirno on 2021-4-28.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import Alamofire
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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?
|
||||
|
|
|
@ -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
|
||||
|
@ -59,10 +56,7 @@ final class MediaPreviewVideoViewModel {
|
|||
// setup player state observer
|
||||
$playbackState
|
||||
.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)")
|
||||
|
||||
.sink { status in
|
||||
switch status {
|
||||
case .unknown, .buffering, .readyToPlay:
|
||||
break
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -52,10 +51,8 @@ extension NotificationTableViewCell {
|
|||
)
|
||||
.dropFirst()
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak tableView, weak self] _, _ in
|
||||
.sink { [weak tableView] _, _ 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()
|
||||
|
|
|
@ -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>()
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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?
|
||||
|
@ -24,22 +21,10 @@ extension NotificationTimelineViewModel {
|
|||
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: 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 +83,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
|
||||
|
|
|
@ -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)")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by sxiaojian on 2021/4/12.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import Pageboy
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import Combine
|
||||
import MastodonSDK
|
||||
import os.log
|
||||
import UIKit
|
||||
import MastodonAsset
|
||||
import MastodonCore
|
||||
|
@ -104,8 +103,8 @@ extension MastodonConfirmEmailViewController {
|
|||
.receive(on: DispatchQueue.main)
|
||||
.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)
|
||||
case .failure(_):
|
||||
break
|
||||
case .finished:
|
||||
// upload avatar and set display name in the background
|
||||
Just(self.viewModel.userToken.accessToken)
|
||||
|
@ -119,10 +118,10 @@ extension MastodonConfirmEmailViewController {
|
|||
.retry(3)
|
||||
.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)
|
||||
case .failure(_):
|
||||
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)
|
||||
}
|
||||
|
|
|
@ -228,15 +228,10 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {
|
|||
@objc func keyboardWillShowNotification(_ notification: Notification) {
|
||||
|
||||
guard let userInfo = notification.userInfo,
|
||||
let keyboardFrameValue = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue,
|
||||
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber
|
||||
else { return }
|
||||
|
||||
// inspired by https://stackoverflow.com/a/30245044
|
||||
let keyboardFrame = keyboardFrameValue.cgRectValue
|
||||
|
||||
let keyboardOrigin = view.convert(keyboardFrame.origin, from: nil)
|
||||
|
||||
UIView.animate(withDuration: duration.doubleValue, delay: 0, options: .curveEaseInOut) {
|
||||
self.view.layoutIfNeeded()
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by BradGao on 2021/2/20.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import GameController
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by BradGao on 2021/2/24.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonSDK
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-1-4.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Tabman
|
||||
import MastodonAsset
|
||||
|
|
|
@ -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>()
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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>()
|
||||
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK Cirno on 2021-5-26.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonAsset
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-1-22.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import MastodonSDK
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-1-22.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import CoreDataStack
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
@ -24,22 +21,11 @@ extension BookmarkViewModel {
|
|||
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)
|
||||
}
|
||||
|
||||
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 +77,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 +149,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
|
||||
|
|
|
@ -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)")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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?
|
||||
|
@ -23,23 +20,11 @@ extension FavoriteViewModel {
|
|||
init(viewModel: FavoriteViewModel) {
|
||||
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)
|
||||
}
|
||||
|
||||
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 +76,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 +148,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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
@ -29,22 +26,10 @@ extension FollowerListViewModel {
|
|||
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)
|
||||
}
|
||||
|
||||
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 +82,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 +137,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 +158,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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
@ -23,22 +20,10 @@ extension FollowingListViewModel {
|
|||
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)
|
||||
}
|
||||
|
||||
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 +76,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 +131,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 +151,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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK Cirno on 2021-4-9.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import CoreDataStack
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-5-26.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import CoreDataStack
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
// Created by MainasuK on 2022-5-26.
|
||||
//
|
||||
|
||||
import os.log
|
||||
import UIKit
|
||||
import Combine
|
||||
import CoreDataStack
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -528,19 +522,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 {
|
||||
|
@ -562,19 +553,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)
|
||||
|
@ -589,15 +577,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)
|
||||
}
|
||||
|
@ -769,11 +753,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,
|
||||
|
@ -800,7 +782,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)
|
||||
|
@ -810,7 +791,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()
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue