Merge pull request #1120 from mastodon/clean-dependencies
Clean dependencies and logging
This commit is contained in:
commit
32564ff871
|
@ -1,4 +1,3 @@
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
// conver i18n JSON templates to strings files
|
// conver i18n JSON templates to strings files
|
||||||
|
@ -12,7 +11,6 @@ private func convert(from inputDirectoryURL: URL, to outputDirectory: URL) {
|
||||||
for inputLanguageDirectoryURL in inputLanguageDirectoryURLs {
|
for inputLanguageDirectoryURL in inputLanguageDirectoryURLs {
|
||||||
let language = inputLanguageDirectoryURL.lastPathComponent
|
let language = inputLanguageDirectoryURL.lastPathComponent
|
||||||
guard let mappedLanguage = map(language: language) else { continue }
|
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(
|
let fileURLs = try FileManager.default.contentsOfDirectory(
|
||||||
at: inputLanguageDirectoryURL,
|
at: inputLanguageDirectoryURL,
|
||||||
|
@ -20,7 +18,6 @@ private func convert(from inputDirectoryURL: URL, to outputDirectory: URL) {
|
||||||
options: []
|
options: []
|
||||||
)
|
)
|
||||||
for jsonURL in fileURLs where jsonURL.pathExtension == "json" {
|
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
|
let filename = jsonURL.deletingPathExtension().lastPathComponent
|
||||||
guard let (mappedFilename, keyStyle) = map(filename: filename) else { continue }
|
guard let (mappedFilename, keyStyle) = map(filename: filename) else { continue }
|
||||||
guard let bundle = bundle(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 {
|
} catch {
|
||||||
os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
|
|
||||||
exit(1)
|
exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -103,7 +99,6 @@ private func process(url: URL, keyStyle: Parser.KeyStyle) throws -> String {
|
||||||
let strings = parser.generateStrings(keyStyle: keyStyle)
|
let strings = parser.generateStrings(keyStyle: keyStyle)
|
||||||
return strings
|
return strings
|
||||||
} catch {
|
} catch {
|
||||||
os_log("%{public}s[%{public}ld], %{public}s: error: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
|
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +115,6 @@ private func move(from inputDirectoryURL: URL, to outputDirectoryURL: URL, pathE
|
||||||
let language = inputLanguageDirectoryURL.lastPathComponent
|
let language = inputLanguageDirectoryURL.lastPathComponent
|
||||||
guard let mappedLanguage = map(language: language) else { continue }
|
guard let mappedLanguage = map(language: language) else { continue }
|
||||||
let outputDirectoryURL = outputDirectoryURL.appendingPathComponent(mappedLanguage + ".lproj", isDirectory: true)
|
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(
|
let fileURLs = try FileManager.default.contentsOfDirectory(
|
||||||
at: inputLanguageDirectoryURL,
|
at: inputLanguageDirectoryURL,
|
||||||
|
@ -128,7 +122,6 @@ private func move(from inputDirectoryURL: URL, to outputDirectoryURL: URL, pathE
|
||||||
options: []
|
options: []
|
||||||
)
|
)
|
||||||
for dictURL in fileURLs where dictURL.pathExtension == pathExtension {
|
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 filename = dictURL.deletingPathExtension().lastPathComponent
|
||||||
|
|
||||||
let outputFileURL = outputDirectoryURL.appendingPathComponent(filename).appendingPathExtension(pathExtension)
|
let outputFileURL = outputDirectoryURL.appendingPathComponent(filename).appendingPathExtension(pathExtension)
|
||||||
|
@ -137,7 +130,6 @@ private func move(from inputDirectoryURL: URL, to outputDirectoryURL: URL, pathE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
|
|
||||||
exit(2)
|
exit(2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@
|
||||||
2D5981A125E4A593000FB903 /* MastodonConfirmEmailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5981A025E4A593000FB903 /* MastodonConfirmEmailViewModel.swift */; };
|
2D5981A125E4A593000FB903 /* MastodonConfirmEmailViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5981A025E4A593000FB903 /* MastodonConfirmEmailViewModel.swift */; };
|
||||||
2D5A3D2825CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D5A3D2725CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.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 */; };
|
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 */; };
|
2D607AD826242FC500B70763 /* NotificationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D607AD726242FC500B70763 /* NotificationViewModel.swift */; };
|
||||||
2D694A7425F9EB4E0038ADDC /* ContentWarningOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D694A7325F9EB4E0038ADDC /* ContentWarningOverlayView.swift */; };
|
2D694A7425F9EB4E0038ADDC /* ContentWarningOverlayView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D694A7325F9EB4E0038ADDC /* ContentWarningOverlayView.swift */; };
|
||||||
2D6DE40026141DF600A63F6A /* SearchViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D6DE3FF26141DF600A63F6A /* SearchViewModel.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 */; };
|
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, ); }; };
|
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 */; };
|
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 */; };
|
DB023D26279FFB0A005AC798 /* ShareActivityProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D25279FFB0A005AC798 /* ShareActivityProvider.swift */; };
|
||||||
DB023D2827A0FABD005AC798 /* NotificationTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D2727A0FABD005AC798 /* NotificationTableViewCellDelegate.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 */; };
|
DB023D2A27A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D2927A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift */; };
|
||||||
|
@ -694,7 +692,6 @@
|
||||||
2D5981A025E4A593000FB903 /* MastodonConfirmEmailViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MastodonConfirmEmailViewModel.swift; sourceTree = "<group>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
2D6DE3FF26141DF600A63F6A /* SearchViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchViewModel.swift; sourceTree = "<group>"; };
|
||||||
|
@ -811,7 +808,6 @@
|
||||||
D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagWidget.swift; sourceTree = "<group>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
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>"; };
|
DB023D2927A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataSourceProvider+NotificationTableViewCellDelegate.swift"; sourceTree = "<group>"; };
|
||||||
|
@ -1554,7 +1550,6 @@
|
||||||
DB1F239626117C360057430E /* View */,
|
DB1F239626117C360057430E /* View */,
|
||||||
2D38F1D425CD465300561493 /* HomeTimelineViewController.swift */,
|
2D38F1D425CD465300561493 /* HomeTimelineViewController.swift */,
|
||||||
DB697DD8278F4CED004EF2F7 /* HomeTimelineViewController+DataSourceProvider.swift */,
|
DB697DD8278F4CED004EF2F7 /* HomeTimelineViewController+DataSourceProvider.swift */,
|
||||||
2D5A3D6125CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift */,
|
|
||||||
2D38F1E425CD46C100561493 /* HomeTimelineViewModel.swift */,
|
2D38F1E425CD46C100561493 /* HomeTimelineViewModel.swift */,
|
||||||
2D5A3D2725CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.swift */,
|
2D5A3D2725CF8BC9002347D6 /* HomeTimelineViewModel+Diffable.swift */,
|
||||||
2D38F1EA25CD477000561493 /* HomeTimelineViewModel+LoadLatestState.swift */,
|
2D38F1EA25CD477000561493 /* HomeTimelineViewModel+LoadLatestState.swift */,
|
||||||
|
@ -2528,7 +2523,6 @@
|
||||||
2D206B8525F5FB0900143C56 /* Double.swift */,
|
2D206B8525F5FB0900143C56 /* Double.swift */,
|
||||||
DBB3BA2926A81C020004F2D4 /* FLAnimatedImageView.swift */,
|
DBB3BA2926A81C020004F2D4 /* FLAnimatedImageView.swift */,
|
||||||
DB68586325E619B700F0A850 /* NSKeyValueObservation.swift */,
|
DB68586325E619B700F0A850 /* NSKeyValueObservation.swift */,
|
||||||
DB0140CE25C42AEE00F9F3CF /* OSLog.swift */,
|
|
||||||
2D939AB425EDD8A90076FA61 /* String.swift */,
|
2D939AB425EDD8A90076FA61 /* String.swift */,
|
||||||
DB68A06225E905E000CFDF14 /* UIApplication.swift */,
|
DB68A06225E905E000CFDF14 /* UIApplication.swift */,
|
||||||
DB45FAB525CA5485005A8AC7 /* UIAlertController.swift */,
|
DB45FAB525CA5485005A8AC7 /* UIAlertController.swift */,
|
||||||
|
@ -3821,7 +3815,6 @@
|
||||||
D87BFC8B291D5C6B00FEE264 /* MastodonLoginView.swift in Sources */,
|
D87BFC8B291D5C6B00FEE264 /* MastodonLoginView.swift in Sources */,
|
||||||
DB6180F826391D660018D199 /* MediaPreviewingViewController.swift in Sources */,
|
DB6180F826391D660018D199 /* MediaPreviewingViewController.swift in Sources */,
|
||||||
DBEFCD71282A12B200C0ABEA /* ReportReasonViewController.swift in Sources */,
|
DBEFCD71282A12B200C0ABEA /* ReportReasonViewController.swift in Sources */,
|
||||||
DB0140CF25C42AEE00F9F3CF /* OSLog.swift in Sources */,
|
|
||||||
DB98EB5627B0FF1B0082E365 /* ReportViewControllerAppearance.swift in Sources */,
|
DB98EB5627B0FF1B0082E365 /* ReportViewControllerAppearance.swift in Sources */,
|
||||||
DB3EA8E6281B79E200598866 /* DiscoveryCommunityViewController.swift in Sources */,
|
DB3EA8E6281B79E200598866 /* DiscoveryCommunityViewController.swift in Sources */,
|
||||||
2D206B8625F5FB0900143C56 /* Double.swift in Sources */,
|
2D206B8625F5FB0900143C56 /* Double.swift in Sources */,
|
||||||
|
@ -3893,7 +3886,6 @@
|
||||||
2A82294F29262EE000D2A1F7 /* AppContext+NextAccount.swift in Sources */,
|
2A82294F29262EE000D2A1F7 /* AppContext+NextAccount.swift in Sources */,
|
||||||
DBB525302611EBF3002F1F29 /* ProfilePagingViewModel.swift in Sources */,
|
DBB525302611EBF3002F1F29 /* ProfilePagingViewModel.swift in Sources */,
|
||||||
DB9F58EC26EF435000E7BBE9 /* AccountViewController.swift in Sources */,
|
DB9F58EC26EF435000E7BBE9 /* AccountViewController.swift in Sources */,
|
||||||
2D5A3D6225CFD9CB002347D6 /* HomeTimelineViewController+DebugAction.swift in Sources */,
|
|
||||||
DB3E6FF12806D96900B035AE /* DiscoveryNewsViewModel+Diffable.swift in Sources */,
|
DB3E6FF12806D96900B035AE /* DiscoveryNewsViewModel+Diffable.swift in Sources */,
|
||||||
DB3E6FF82807C45300B035AE /* DiscoveryForYouViewModel.swift in Sources */,
|
DB3E6FF82807C45300B035AE /* DiscoveryForYouViewModel.swift in Sources */,
|
||||||
DB0F9D56283EB46200379AF8 /* ProfileHeaderView+Configuration.swift in Sources */,
|
DB0F9D56283EB46200379AF8 /* ProfileHeaderView+Configuration.swift in Sources */,
|
||||||
|
|
|
@ -19,15 +19,6 @@
|
||||||
"version": "4.2.0"
|
"version": "4.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"package": "CommonOSLog",
|
|
||||||
"repositoryURL": "https://github.com/MainasuK/CommonOSLog",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "c121624a30698e9886efe38aebb36ff51c01b6c2",
|
|
||||||
"version": "0.1.1"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"package": "FaviconFinder",
|
"package": "FaviconFinder",
|
||||||
"repositoryURL": "https://github.com/will-lumley/FaviconFinder.git",
|
"repositoryURL": "https://github.com/will-lumley/FaviconFinder.git",
|
||||||
|
@ -46,15 +37,6 @@
|
||||||
"version": "1.0.17"
|
"version": "1.0.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"package": "FPSIndicator",
|
|
||||||
"repositoryURL": "https://github.com/MainasuK/FPSIndicator.git",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "e4a5067ccd5293b024c767f09e51056afd4a4796",
|
|
||||||
"version": "1.1.0"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"package": "Fuzi",
|
"package": "Fuzi",
|
||||||
"repositoryURL": "https://github.com/cezheng/Fuzi.git",
|
"repositoryURL": "https://github.com/cezheng/Fuzi.git",
|
||||||
|
@ -154,6 +136,15 @@
|
||||||
"version": "0.2.0"
|
"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",
|
"package": "swift-collections",
|
||||||
"repositoryURL": "https://github.com/apple/swift-collections.git",
|
"repositoryURL": "https://github.com/apple/swift-collections.git",
|
||||||
|
@ -168,17 +159,8 @@
|
||||||
"repositoryURL": "https://github.com/apple/swift-nio.git",
|
"repositoryURL": "https://github.com/apple/swift-nio.git",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": null,
|
||||||
"revision": "546610d52b19be3e19935e0880bb06b9c03f5cef",
|
"revision": "3db5c4aeee8100d2db6f1eaf3864afdad5dc68fd",
|
||||||
"version": "1.14.4"
|
"version": "2.59.0"
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"package": "swift-nio-zlib-support",
|
|
||||||
"repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git",
|
|
||||||
"state": {
|
|
||||||
"branch": null,
|
|
||||||
"revision": "37760e9a52030bb9011972c5213c3350fa9d41fd",
|
|
||||||
"version": "1.0.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -190,15 +172,6 @@
|
||||||
"version": "2.4.3"
|
"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",
|
"package": "TabBarPager",
|
||||||
"repositoryURL": "https://github.com/TwidereProject/TabBarPager.git",
|
"repositoryURL": "https://github.com/TwidereProject/TabBarPager.git",
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-13.
|
// Created by MainasuK on 2022-4-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
|
@ -20,8 +19,6 @@ enum DiscoverySection: CaseIterable {
|
||||||
|
|
||||||
extension DiscoverySection {
|
extension DiscoverySection {
|
||||||
|
|
||||||
static let logger = Logger(subsystem: "DiscoverySection", category: "logic")
|
|
||||||
|
|
||||||
class Configuration {
|
class Configuration {
|
||||||
let authContext: AuthContext
|
let authContext: AuthContext
|
||||||
weak var profileCardTableViewCellDelegate: ProfileCardTableViewCellDelegate?
|
weak var profileCardTableViewCellDelegate: ProfileCardTableViewCellDelegate?
|
||||||
|
|
|
@ -11,7 +11,6 @@ import CoreDataStack
|
||||||
import Foundation
|
import Foundation
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
import UIKit
|
import UIKit
|
||||||
import os.log
|
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
import Combine
|
import Combine
|
||||||
import CoreData
|
import CoreData
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
import AlamofireImage
|
import AlamofireImage
|
||||||
|
@ -24,8 +23,6 @@ enum StatusSection: Equatable, Hashable {
|
||||||
|
|
||||||
extension StatusSection {
|
extension StatusSection {
|
||||||
|
|
||||||
static let logger = Logger(subsystem: "StatusSection", category: "logic")
|
|
||||||
|
|
||||||
struct Configuration {
|
struct Configuration {
|
||||||
let context: AppContext
|
let context: AppContext
|
||||||
let authContext: AuthContext
|
let authContext: AuthContext
|
||||||
|
@ -196,7 +193,6 @@ extension StatusSection {
|
||||||
else { return false }
|
else { return false }
|
||||||
|
|
||||||
guard !poll.expired else {
|
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
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,10 +205,9 @@ extension StatusSection {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
guard timeIntervalSinceUpdate > autoRefreshTimeInterval else {
|
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
|
return false
|
||||||
}
|
}
|
||||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): update poll \(poll.id)…")
|
|
||||||
return true
|
return true
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by Cirno MainasuK on 2021-11-1.
|
// Created by Cirno MainasuK on 2021-11-1.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreData
|
import CoreData
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -20,9 +19,6 @@ enum UserSection: Hashable {
|
||||||
}
|
}
|
||||||
|
|
||||||
extension UserSection {
|
extension UserSection {
|
||||||
|
|
||||||
static let logger = Logger(subsystem: "StatusSection", category: "logic")
|
|
||||||
|
|
||||||
struct Configuration {
|
struct Configuration {
|
||||||
weak var userTableViewCellDelegate: UserTableViewCellDelegate?
|
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.
|
// Created by MainasuK on 2022-1-26.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
|
@ -154,8 +153,6 @@ extension DataSourceFacade {
|
||||||
user: ManagedObjectRecord<MastodonUser>,
|
user: ManagedObjectRecord<MastodonUser>,
|
||||||
previewContext: ImagePreviewContext
|
previewContext: ImagePreviewContext
|
||||||
) async throws {
|
) async throws {
|
||||||
let logger = Logger(subsystem: "DataSourceFacade", category: "Media")
|
|
||||||
|
|
||||||
let managedObjectContext = dependency.context.managedObjectContext
|
let managedObjectContext = dependency.context.managedObjectContext
|
||||||
|
|
||||||
var _avatarAssetURL: String?
|
var _avatarAssetURL: String?
|
||||||
|
@ -227,7 +224,6 @@ extension DataSourceFacade {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
guard mediaPreviewItem.isAssetURLValid else {
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-2-16.
|
// Created by MainasuK on 2022-2-16.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -37,7 +36,6 @@ extension StatusTableViewControllerNavigateableCore where Self: DataSourceProvid
|
||||||
guard let rawValue = sender.propertyList as? String,
|
guard let rawValue = sender.propertyList as? String,
|
||||||
let navigation = StatusTableViewNavigation(rawValue: rawValue) else { return }
|
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 {
|
Task {
|
||||||
switch navigation {
|
switch navigation {
|
||||||
case .openAuthorProfile: await openAuthorProfile(target: .status)
|
case .openAuthorProfile: await openAuthorProfile(target: .status)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-2-16.
|
// Created by MainasuK on 2022-2-16.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
|
||||||
|
@ -34,7 +33,6 @@ extension TableViewControllerNavigateableCore {
|
||||||
guard let rawValue = sender.propertyList as? String,
|
guard let rawValue = sender.propertyList as? String,
|
||||||
let navigation = TableViewNavigation(rawValue: rawValue) else { return }
|
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 {
|
switch navigation {
|
||||||
case .up: navigate(direction: .up)
|
case .up: navigate(direction: .up)
|
||||||
case .down: navigate(direction: .down)
|
case .down: navigate(direction: .down)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-17.
|
// Created by MainasuK on 2022-1-17.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -126,7 +125,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV
|
||||||
attributes: [],
|
attributes: [],
|
||||||
state: .off
|
state: .off
|
||||||
) { [weak self] _ in
|
) { [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 }
|
guard let self = self else { return }
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
do {
|
do {
|
||||||
|
@ -157,7 +155,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV
|
||||||
attributes: [],
|
attributes: [],
|
||||||
state: .off
|
state: .off
|
||||||
) { [weak self] _ in
|
) { [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 }
|
guard let self = self else { return }
|
||||||
Task {
|
Task {
|
||||||
try await self.context.photoLibraryService.copy(
|
try await self.context.photoLibraryService.copy(
|
||||||
|
@ -173,7 +170,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV
|
||||||
attributes: [],
|
attributes: [],
|
||||||
state: .off
|
state: .off
|
||||||
) { [weak self] _ in
|
) { [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 }
|
guard let self = self else { return }
|
||||||
Task {
|
Task {
|
||||||
let applicationActivities: [UIActivity] = [
|
let applicationActivities: [UIActivity] = [
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
// Copyright © 2021 Twidere. All rights reserved.
|
// Copyright © 2021 Twidere. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-5-19.
|
// Created by MainasuK Cirno on 2021-5-19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonLocalization
|
import MastodonLocalization
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-5-21.
|
// Created by MainasuK Cirno on 2021-5-21.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonLocalization
|
import MastodonLocalization
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by Cirno MainasuK on 2021-9-13.
|
// Created by Cirno MainasuK on 2021-9-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreData
|
import CoreData
|
||||||
|
@ -172,11 +171,6 @@ extension AccountListViewModel {
|
||||||
|
|
||||||
// MARK: - NSFetchedResultsControllerDelegate
|
// MARK: - NSFetchedResultsControllerDelegate
|
||||||
extension AccountListViewModel: NSFetchedResultsControllerDelegate {
|
extension AccountListViewModel: NSFetchedResultsControllerDelegate {
|
||||||
|
|
||||||
public func controllerWillChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
|
|
||||||
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
|
public func controllerDidChangeContent(_ controller: NSFetchedResultsController<NSFetchRequestResult>) {
|
||||||
guard controller === mastodonAuthenticationFetchedResultsController else {
|
guard controller === mastodonAuthenticationFetchedResultsController else {
|
||||||
assertionFailure()
|
assertionFailure()
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by Cirno MainasuK on 2021-9-13.
|
// Created by Cirno MainasuK on 2021-9-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -16,8 +15,6 @@ import MastodonCore
|
||||||
|
|
||||||
final class AccountListViewController: UIViewController, NeedsDependency {
|
final class AccountListViewController: UIViewController, NeedsDependency {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "AccountListViewController", category: "UI")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -154,12 +151,10 @@ extension AccountListViewController {
|
||||||
extension AccountListViewController {
|
extension AccountListViewController {
|
||||||
|
|
||||||
@objc private func addBarButtonItem(_ sender: UIBarButtonItem) {
|
@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))
|
_ = coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
override func accessibilityPerformEscape() -> Bool {
|
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)
|
dismiss(animated: true, completion: nil)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-17.
|
// Created by MainasuK Cirno on 2021-3-17.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
|
@ -18,8 +17,6 @@ protocol ComposeStatusAttachmentCollectionViewCellDelegate: AnyObject {
|
||||||
|
|
||||||
final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell {
|
final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "ComposeStatusAttachmentCollectionViewCell", category: "UI")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
static let verticalMarginHeight: CGFloat = ComposeStatusAttachmentCollectionViewCell.removeButtonSize.height * 0.5
|
static let verticalMarginHeight: CGFloat = ComposeStatusAttachmentCollectionViewCell.removeButtonSize.height * 0.5
|
||||||
|
@ -45,54 +42,14 @@ final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell {
|
||||||
override func prepareForReuse() {
|
override func prepareForReuse() {
|
||||||
super.prepareForReuse()
|
super.prepareForReuse()
|
||||||
|
|
||||||
// attachmentContainerView.activityIndicatorView.startAnimating()
|
|
||||||
// attachmentContainerView.previewImageView.af.cancelImageRequest()
|
|
||||||
// attachmentContainerView.previewImageView.image = .placeholder(color: .systemFill)
|
|
||||||
// delegate = nil
|
|
||||||
// disposeBag.removeAll()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
_init()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
required init?(coder: NSCoder) {
|
||||||
super.init(coder: coder)
|
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -100,7 +57,6 @@ extension ComposeStatusAttachmentCollectionViewCell {
|
||||||
extension ComposeStatusAttachmentCollectionViewCell {
|
extension ComposeStatusAttachmentCollectionViewCell {
|
||||||
|
|
||||||
@objc private func removeButtonDidPressed(_ sender: UIButton) {
|
@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)
|
delegate?.composeStatusAttachmentCollectionViewCell(self, removeButtonDidPressed: sender)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-23.
|
// Created by MainasuK Cirno on 2021-3-23.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -111,7 +110,6 @@ extension ComposeStatusPollOptionAppendEntryCollectionViewCell {
|
||||||
extension ComposeStatusPollOptionAppendEntryCollectionViewCell {
|
extension ComposeStatusPollOptionAppendEntryCollectionViewCell {
|
||||||
|
|
||||||
@objc private func singleTagGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
@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)
|
delegate?.composeStatusPollOptionAppendEntryCollectionViewCellDidPressed(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-23.
|
// Created by MainasuK Cirno on 2021-3-23.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
@ -127,7 +126,6 @@ extension ComposeStatusPollOptionCollectionViewCell {
|
||||||
extension ComposeStatusPollOptionCollectionViewCell {
|
extension ComposeStatusPollOptionCollectionViewCell {
|
||||||
|
|
||||||
@objc private func singleTagGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
@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()
|
pollOptionView.optionTextField.becomeFirstResponder()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,12 +142,10 @@ extension ComposeStatusPollOptionCollectionViewCell: DeleteBackwardResponseTextF
|
||||||
extension ComposeStatusPollOptionCollectionViewCell: UITextFieldDelegate {
|
extension ComposeStatusPollOptionCollectionViewCell: UITextFieldDelegate {
|
||||||
|
|
||||||
func textFieldDidBeginEditing(_ textField: UITextField) {
|
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)
|
delegate?.composeStatusPollOptionCollectionViewCell(self, textFieldDidBeginEditing: textField)
|
||||||
}
|
}
|
||||||
|
|
||||||
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
|
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 {
|
if textField === pollOptionView.optionTextField {
|
||||||
delegate?.composeStatusPollOptionCollectionViewCell(self, pollOptionTextFieldDidReturn: textField)
|
delegate?.composeStatusPollOptionCollectionViewCell(self, pollOptionTextFieldDidReturn: textField)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-11.
|
// Created by MainasuK Cirno on 2021-3-11.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import PhotosUI
|
import PhotosUI
|
||||||
|
@ -25,9 +24,7 @@ final class ComposeViewController: UIViewController, NeedsDependency {
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
var viewModel: ComposeViewModel!
|
var viewModel: ComposeViewModel
|
||||||
|
|
||||||
let logger = Logger(subsystem: "ComposeViewController", category: "logic")
|
|
||||||
|
|
||||||
init(viewModel: ComposeViewModel) {
|
init(viewModel: ComposeViewModel) {
|
||||||
self.viewModel = viewModel
|
self.viewModel = viewModel
|
||||||
|
@ -114,9 +111,6 @@ final class ComposeViewController: UIViewController, NeedsDependency {
|
||||||
button.setTitleColor(Asset.Colors.Label.primaryReverse.color, for: .normal)
|
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 {
|
extension ComposeViewController {
|
||||||
|
|
||||||
@objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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 {
|
guard composeContentViewModel.shouldDismiss else {
|
||||||
showDismissConfirmAlertController()
|
showDismissConfirmAlertController()
|
||||||
return
|
return
|
||||||
|
@ -282,11 +275,9 @@ extension ComposeViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
override func paste(_ sender: Any?) {
|
override func paste(_ sender: Any?) {
|
||||||
logger.debug("Paste event received")
|
|
||||||
|
|
||||||
// Look for images on the clipboard
|
// Look for images on the clipboard
|
||||||
if UIPasteboard.general.hasImages, let images = UIPasteboard.general.images {
|
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
|
let attachmentViewModels = images.map { image in
|
||||||
return AttachmentViewModel(
|
return AttachmentViewModel(
|
||||||
api: viewModel.context.apiService,
|
api: viewModel.context.apiService,
|
||||||
|
@ -318,14 +309,8 @@ extension ComposeViewController: UIAdaptivePresentationControllerDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) {
|
func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) {
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
showDismissConfirmAlertController()
|
showDismissConfirmAlertController()
|
||||||
}
|
}
|
||||||
|
|
||||||
func presentationControllerDidDismiss(_ presentationController: UIPresentationController) {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ComposeViewController {
|
extension ComposeViewController {
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-11.
|
// Created by MainasuK Cirno on 2021-3-11.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreData
|
import CoreData
|
||||||
|
@ -25,8 +24,6 @@ final class ComposeViewModel {
|
||||||
case editStatus(status: Status, statusSource: Mastodon.Entity.StatusSource)
|
case editStatus(status: Status, statusSource: Mastodon.Entity.StatusSource)
|
||||||
}
|
}
|
||||||
|
|
||||||
let logger = Logger(subsystem: "ComposeViewModel", category: "ViewModel")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-29.
|
// Created by MainasuK on 2022-4-29.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -13,9 +12,6 @@ import MastodonUI
|
||||||
|
|
||||||
// Local Timeline
|
// Local Timeline
|
||||||
final class DiscoveryCommunityViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class DiscoveryCommunityViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "DiscoveryCommunityViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-29.
|
// Created by MainasuK on 2022-4-29.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-12.
|
// Created by MainasuK on 2022-4-12.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import Tabman
|
import Tabman
|
||||||
|
@ -21,8 +20,6 @@ public class DiscoveryViewController: TabmanViewController, NeedsDependency {
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
let logger = Logger(subsystem: "DiscoveryViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-13.
|
// Created by MainasuK on 2022-4-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -13,8 +12,6 @@ import MastodonUI
|
||||||
|
|
||||||
final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -34,9 +31,6 @@ final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency,
|
||||||
|
|
||||||
let refreshControl = RefreshControl()
|
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 {
|
extension DiscoveryHashtagsViewController: UITableViewDelegate {
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
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 }
|
guard case let .hashtag(tag) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return }
|
||||||
let hashtagTimelineViewModel = HashtagTimelineViewModel(context: context, authContext: viewModel.authContext, hashtag: tag.name)
|
let hashtagTimelineViewModel = HashtagTimelineViewModel(context: context, authContext: viewModel.authContext, hashtag: tag.name)
|
||||||
_ = coordinator.present(
|
_ = coordinator.present(
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-13.
|
// Created by MainasuK on 2022-4-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-13.
|
// Created by MainasuK on 2022-4-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -13,8 +12,6 @@ import MastodonUI
|
||||||
|
|
||||||
final class DiscoveryNewsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class DiscoveryNewsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -33,11 +30,6 @@ final class DiscoveryNewsViewController: UIViewController, NeedsDependency, Medi
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let refreshControl = RefreshControl()
|
let refreshControl = RefreshControl()
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension DiscoveryNewsViewController {
|
extension DiscoveryNewsViewController {
|
||||||
|
@ -109,7 +101,6 @@ extension DiscoveryNewsViewController {
|
||||||
extension DiscoveryNewsViewController: UITableViewDelegate {
|
extension DiscoveryNewsViewController: UITableViewDelegate {
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
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 case let .link(link) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return }
|
||||||
guard let url = URL(string: link.url) else { return }
|
guard let url = URL(string: link.url) else { return }
|
||||||
_ = coordinator.present(
|
_ = coordinator.present(
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-13.
|
// Created by MainasuK on 2022-4-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -13,8 +12,6 @@ import MastodonSDK
|
||||||
extension DiscoveryNewsViewModel {
|
extension DiscoveryNewsViewModel {
|
||||||
class State: GKState {
|
class State: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "DiscoveryNewsViewModel.State", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
weak var viewModel: DiscoveryNewsViewModel?
|
weak var viewModel: DiscoveryNewsViewModel?
|
||||||
|
@ -23,14 +20,6 @@ extension DiscoveryNewsViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: State.Type) {
|
func enter(state: State.Type) {
|
||||||
stateMachine?.enter(state)
|
stateMachine?.enter(state)
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-13.
|
// Created by MainasuK on 2022-4-13.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
|
|
|
@ -5,16 +5,12 @@
|
||||||
// Created by MainasuK on 2022-4-12.
|
// Created by MainasuK on 2022-4-12.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
|
|
||||||
final class DiscoveryPostsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class DiscoveryPostsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-12.
|
// Created by MainasuK on 2022-4-12.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -13,9 +12,6 @@ import MastodonCore
|
||||||
|
|
||||||
extension DiscoveryPostsViewModel {
|
extension DiscoveryPostsViewModel {
|
||||||
class State: GKState {
|
class State: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "DiscoveryPostsViewModel.State", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
weak var viewModel: DiscoveryPostsViewModel?
|
weak var viewModel: DiscoveryPostsViewModel?
|
||||||
|
@ -24,22 +20,10 @@ extension DiscoveryPostsViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: State.Type) {
|
func enter(state: State.Type) {
|
||||||
stateMachine?.enter(state)
|
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)
|
super.didEnter(from: previousState)
|
||||||
guard let _ = viewModel, let stateMachine = stateMachine else { return }
|
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) {
|
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)
|
stateMachine.enter(Loading.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-4-19.
|
// Created by MainasuK on 2022-4-19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
@ -18,9 +17,6 @@ public protocol DiscoveryIntroBannerViewDelegate: AnyObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class DiscoveryIntroBannerView: UIView {
|
public final class DiscoveryIntroBannerView: UIView {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "DiscoveryIntroBannerView", category: "View")
|
|
||||||
|
|
||||||
var _disposeBag = Set<AnyCancellable>()
|
var _disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
public weak var delegate: DiscoveryIntroBannerViewDelegate?
|
public weak var delegate: DiscoveryIntroBannerViewDelegate?
|
||||||
|
@ -90,7 +86,6 @@ extension DiscoveryIntroBannerView {
|
||||||
|
|
||||||
extension DiscoveryIntroBannerView {
|
extension DiscoveryIntroBannerView {
|
||||||
@objc private func closeButtonDidPressed(_ sender: UIButton) {
|
@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)
|
delegate?.discoveryIntroBannerView(self, closeButtonDidPressed: sender)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by BradGao on 2021/3/30.
|
// Created by BradGao on 2021/3/30.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -19,8 +18,6 @@ import MastodonSDK
|
||||||
|
|
||||||
final class HashtagTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class HashtagTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "HashtagTimelineViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -61,10 +58,6 @@ final class HashtagTimelineViewController: UIViewController, NeedsDependency, Me
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let refreshControl = RefreshControl()
|
let refreshControl = RefreshControl()
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension HashtagTimelineViewController {
|
extension HashtagTimelineViewController {
|
||||||
|
@ -205,7 +198,6 @@ extension HashtagTimelineViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func composeBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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
|
let hashtag = "#" + viewModel.hashtag
|
||||||
UITextChecker.learnWord(hashtag)
|
UITextChecker.learnWord(hashtag)
|
||||||
let composeViewModel = ComposeViewModel(
|
let composeViewModel = ComposeViewModel(
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by BradGao on 2021/3/30.
|
// Created by BradGao on 2021/3/30.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreData
|
import CoreData
|
||||||
|
@ -40,7 +39,6 @@ extension HashtagTimelineViewModel {
|
||||||
.sink { [weak self] records in
|
.sink { [weak self] records in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
guard let diffableDataSource = self.diffableDataSource 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>()
|
var snapshot = NSDiffableDataSourceSnapshot<StatusSection, StatusItem>()
|
||||||
snapshot.appendSections([.main])
|
snapshot.appendSections([.main])
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by BradGao on 2021/3/31.
|
// Created by BradGao on 2021/3/31.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -13,8 +12,6 @@ import CoreDataStack
|
||||||
extension HashtagTimelineViewModel {
|
extension HashtagTimelineViewModel {
|
||||||
class State: GKState {
|
class State: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "HashtagTimelineViewModel.LoadOldestState", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
var name: String {
|
var name: String {
|
||||||
|
@ -27,22 +24,10 @@ extension HashtagTimelineViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: State.Type) {
|
func enter(state: State.Type) {
|
||||||
stateMachine?.enter(state)
|
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)
|
super.didEnter(from: previousState)
|
||||||
guard let _ = viewModel, let stateMachine = stateMachine else { return }
|
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) {
|
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)
|
stateMachine.enter(Loading.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +161,6 @@ extension HashtagTimelineViewModel.State {
|
||||||
viewModel.fetchedResultsController.append(statusIDs: statusIDs)
|
viewModel.fetchedResultsController.append(statusIDs: statusIDs)
|
||||||
viewModel.didLoadLatest.send()
|
viewModel.didLoadLatest.send()
|
||||||
} catch {
|
} 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)
|
await enter(state: Fail.self)
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by BradGao on 2021/3/30.
|
// Created by BradGao on 2021/3/30.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreData
|
import CoreData
|
||||||
|
@ -16,8 +15,6 @@ import MastodonCore
|
||||||
|
|
||||||
final class HashtagTimelineViewModel {
|
final class HashtagTimelineViewModel {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "HashtagTimelineViewModel", category: "ViewModel")
|
|
||||||
|
|
||||||
let hashtag: String
|
let hashtag: String
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
@ -66,10 +63,6 @@ final class HashtagTimelineViewModel {
|
||||||
// end init
|
// end init
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
func viewWillAppear() {
|
func viewWillAppear() {
|
||||||
let predicate = Tag.predicate(
|
let predicate = Tag.predicate(
|
||||||
domain: authContext.mastodonAuthenticationBox.domain,
|
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.
|
// Created by sxiaojian on 2021/2/5.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -22,8 +21,6 @@ import MastodonLocalization
|
||||||
|
|
||||||
final class HomeTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class HomeTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "HomeTimelineViewController", category: "UI")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -75,11 +72,6 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media
|
||||||
}()
|
}()
|
||||||
|
|
||||||
let refreshControl = RefreshControl()
|
let refreshControl = RefreshControl()
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension HomeTimelineViewController {
|
extension HomeTimelineViewController {
|
||||||
|
@ -100,31 +92,13 @@ extension HomeTimelineViewController {
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak self] displaySettingBarButtonItem in
|
.sink { [weak self] displaySettingBarButtonItem in
|
||||||
guard let self = self else { return }
|
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
|
self.navigationItem.rightBarButtonItem = displaySettingBarButtonItem ? self.settingBarButtonItem : nil
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
#if DEBUG
|
|
||||||
// long press to trigger debug menu
|
|
||||||
settingBarButtonItem.menu = debugMenu
|
|
||||||
#else
|
|
||||||
settingBarButtonItem.target = self
|
settingBarButtonItem.target = self
|
||||||
settingBarButtonItem.action = #selector(HomeTimelineViewController.settingBarButtonItemPressed(_:))
|
settingBarButtonItem.action = #selector(HomeTimelineViewController.settingBarButtonItemPressed(_:))
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SNAPSHOT
|
|
||||||
titleView.logoButton.menu = self.debugMenu
|
|
||||||
titleView.button.menu = self.debugMenu
|
|
||||||
#endif
|
|
||||||
|
|
||||||
navigationItem.titleView = titleView
|
navigationItem.titleView = titleView
|
||||||
titleView.delegate = self
|
titleView.delegate = self
|
||||||
|
@ -274,9 +248,6 @@ extension HomeTimelineViewController {
|
||||||
let viewFrameInWindow = self.view.convert(self.view.frame, to: nil)
|
let viewFrameInWindow = self.view.convert(self.view.frame, to: nil)
|
||||||
guard xPosition >= viewFrameInWindow.minX && xPosition <= viewFrameInWindow.maxX else { return }
|
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
|
// check if scroll to top
|
||||||
guard self.shouldRestoreScrollPosition() else { return }
|
guard self.shouldRestoreScrollPosition() else { return }
|
||||||
self.restorePositionWhenScrollToTop()
|
self.restorePositionWhenScrollToTop()
|
||||||
|
@ -477,7 +448,6 @@ extension HomeTimelineViewController {
|
||||||
let cellFrameInView = tableView.convert(anchorCell.frame, to: view)
|
let cellFrameInView = tableView.convert(anchorCell.frame, to: view)
|
||||||
return cellFrameInView.origin.y
|
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(
|
viewModel.scrollPositionRecord = HomeTimelineViewModel.ScrollPositionRecord(
|
||||||
item: anchorItem,
|
item: anchorItem,
|
||||||
offset: offset,
|
offset: offset,
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by sxiaojian on 2021/2/7.
|
// Created by sxiaojian on 2021/2/7.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreData
|
import CoreData
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by sxiaojian on 2021/2/5.
|
// Created by sxiaojian on 2021/2/5.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import func QuartzCore.CACurrentMediaTime
|
import func QuartzCore.CACurrentMediaTime
|
||||||
import Foundation
|
import Foundation
|
||||||
import CoreData
|
import CoreData
|
||||||
|
@ -16,8 +15,6 @@ import MastodonCore
|
||||||
extension HomeTimelineViewModel {
|
extension HomeTimelineViewModel {
|
||||||
class LoadLatestState: GKState {
|
class LoadLatestState: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "HomeTimelineViewModel.LoadLatestState", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
var name: String {
|
var name: String {
|
||||||
|
@ -32,8 +29,6 @@ extension HomeTimelineViewModel {
|
||||||
|
|
||||||
override func didEnter(from previousState: GKState?) {
|
override func didEnter(from previousState: GKState?) {
|
||||||
super.didEnter(from: previousState)
|
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)
|
viewModel?.loadLatestStateMachinePublisher.send(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,10 +36,6 @@ extension HomeTimelineViewModel {
|
||||||
func enter(state: LoadLatestState.Type) {
|
func enter(state: LoadLatestState.Type) {
|
||||||
stateMachine?.enter(state)
|
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
|
managedObjectContext.parent = parentManagedObjectContext
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
let start = CACurrentMediaTime()
|
|
||||||
let latestStatusIDs: [Status.ID] = latestFeedRecords.compactMap { record in
|
let latestStatusIDs: [Status.ID] = latestFeedRecords.compactMap { record in
|
||||||
guard let feed = record.object(in: managedObjectContext) else { return nil }
|
guard let feed = record.object(in: managedObjectContext) else { return nil }
|
||||||
return feed.status?.id
|
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 {
|
do {
|
||||||
let response = try await viewModel.context.apiService.homeTimeline(
|
let response = try await viewModel.context.apiService.homeTimeline(
|
||||||
|
@ -119,7 +107,6 @@ extension HomeTimelineViewModel.LoadLatestState {
|
||||||
// stop refresher if no new statuses
|
// stop refresher if no new statuses
|
||||||
let statuses = response.value
|
let statuses = response.value
|
||||||
let newStatuses = statuses.filter { !latestStatusIDs.contains($0.id) }
|
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 {
|
if newStatuses.isEmpty {
|
||||||
viewModel.didLoadLatest.send()
|
viewModel.didLoadLatest.send()
|
||||||
|
@ -136,7 +123,6 @@ extension HomeTimelineViewModel.LoadLatestState {
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch {
|
} 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)
|
await enter(state: Idle.self)
|
||||||
viewModel.didLoadLatest.send()
|
viewModel.didLoadLatest.send()
|
||||||
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error))
|
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error))
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by sxiaojian on 2021/2/5.
|
// Created by sxiaojian on 2021/2/5.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -13,8 +12,6 @@ import MastodonSDK
|
||||||
extension HomeTimelineViewModel {
|
extension HomeTimelineViewModel {
|
||||||
class LoadOldestState: GKState {
|
class LoadOldestState: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "HomeTimelineViewModel.LoadOldestState", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
weak var viewModel: HomeTimelineViewModel?
|
weak var viewModel: HomeTimelineViewModel?
|
||||||
|
@ -23,22 +20,10 @@ extension HomeTimelineViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: LoadOldestState.Type) {
|
func enter(state: LoadOldestState.Type) {
|
||||||
stateMachine?.enter(state)
|
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)
|
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.finished)
|
||||||
|
|
||||||
} catch {
|
} 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)
|
await self.enter(state: Fail.self)
|
||||||
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error))
|
viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error))
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by sxiaojian on 2021/2/5.
|
// Created by sxiaojian on 2021/2/5.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import func AVFoundation.AVMakeRect
|
import func AVFoundation.AVMakeRect
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
|
@ -19,8 +18,6 @@ import MastodonUI
|
||||||
|
|
||||||
final class HomeTimelineViewModel: NSObject {
|
final class HomeTimelineViewModel: NSObject {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "HomeTimelineViewModel", category: "ViewModel")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
var observations = Set<NSKeyValueObservation>()
|
var observations = Set<NSKeyValueObservation>()
|
||||||
|
|
||||||
|
@ -107,11 +104,6 @@ final class HomeTimelineViewModel: NSObject {
|
||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension HomeTimelineViewModel {
|
extension HomeTimelineViewModel {
|
||||||
|
@ -176,7 +168,6 @@ extension HomeTimelineViewModel {
|
||||||
} catch {
|
} catch {
|
||||||
assertionFailure(error.localizedDescription)
|
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
|
// reconfigure item again
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by sxiaojian on 2021/3/15.
|
// Created by sxiaojian on 2021/3/15.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
@ -69,12 +68,10 @@ extension HomeTimelineNavigationBarTitleView {
|
||||||
|
|
||||||
extension HomeTimelineNavigationBarTitleView {
|
extension HomeTimelineNavigationBarTitleView {
|
||||||
@objc private func logoButtonDidPressed(_ sender: UIButton) {
|
@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)
|
delegate?.homeTimelineNavigationBarTitleView(self, logoButtonDidPressed: sender)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func buttonDidPressed(_ sender: UIButton) {
|
@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)
|
delegate?.homeTimelineNavigationBarTitleView(self, buttonDidPressed: sender)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +85,6 @@ extension HomeTimelineNavigationBarTitleView {
|
||||||
}
|
}
|
||||||
|
|
||||||
func configure(state: HomeTimelineNavigationBarTitleViewModel.State) {
|
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
|
self.state = state
|
||||||
|
|
||||||
// check state block or not
|
// check state block or not
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-4-28.
|
// Created by MainasuK Cirno on 2021-4-28.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import func AVFoundation.AVMakeRect
|
import func AVFoundation.AVMakeRect
|
||||||
import UIKit
|
import UIKit
|
||||||
import FLAnimatedImage
|
import FLAnimatedImage
|
||||||
|
@ -92,8 +91,6 @@ extension MediaPreviewImageView {
|
||||||
extension MediaPreviewImageView {
|
extension MediaPreviewImageView {
|
||||||
|
|
||||||
@objc private func doubleTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
@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
|
let middleZoomScale = 0.5 * maximumZoomScale
|
||||||
if zoomScale >= middleZoomScale {
|
if zoomScale >= middleZoomScale {
|
||||||
setZoomScale(minimumZoomScale, animated: true)
|
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) {
|
func scrollViewDidZoom(_ scrollView: UIScrollView) {
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
centerScrollViewContents()
|
centerScrollViewContents()
|
||||||
|
|
||||||
// set bounce when zoom in
|
// set bounce when zoom in
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-4-28.
|
// Created by MainasuK Cirno on 2021-4-28.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
@ -32,7 +31,6 @@ final class MediaPreviewImageViewController: UIViewController {
|
||||||
let tapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
|
let tapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
previewImageView.imageView.af.cancelImageRequest()
|
previewImageView.imageView.af.cancelImageRequest()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +83,6 @@ extension MediaPreviewImageViewController {
|
||||||
extension MediaPreviewImageViewController {
|
extension MediaPreviewImageViewController {
|
||||||
|
|
||||||
@objc private func tapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) {
|
@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)
|
delegate?.mediaPreviewImageViewController(self, tapGestureRecognizerDidTrigger: sender)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +128,6 @@ extension MediaPreviewImageViewController: UIGestureRecognizerDelegate {
|
||||||
// MARK: - UIContextMenuInteractionDelegate
|
// MARK: - UIContextMenuInteractionDelegate
|
||||||
extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
|
extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
|
||||||
func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? {
|
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 #available(iOS 16.0, *) {
|
||||||
if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) {
|
if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) {
|
||||||
|
@ -147,7 +143,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
|
||||||
let saveAction = UIAction(
|
let saveAction = UIAction(
|
||||||
title: L10n.Common.Controls.Actions.savePhoto, image: UIImage(systemName: "square.and.arrow.down")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
|
title: L10n.Common.Controls.Actions.savePhoto, image: UIImage(systemName: "square.and.arrow.down")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
|
||||||
) { [weak self] _ in
|
) { [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 }
|
guard let self = self else { return }
|
||||||
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .savePhoto)
|
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .savePhoto)
|
||||||
}
|
}
|
||||||
|
@ -155,7 +150,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
|
||||||
let copyAction = UIAction(
|
let copyAction = UIAction(
|
||||||
title: L10n.Common.Controls.Actions.copyPhoto, image: UIImage(systemName: "doc.on.doc")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
|
title: L10n.Common.Controls.Actions.copyPhoto, image: UIImage(systemName: "doc.on.doc")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
|
||||||
) { [weak self] _ in
|
) { [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 }
|
guard let self = self else { return }
|
||||||
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .copyPhoto)
|
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .copyPhoto)
|
||||||
}
|
}
|
||||||
|
@ -163,7 +157,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate {
|
||||||
let shareAction = UIAction(
|
let shareAction = UIAction(
|
||||||
title: L10n.Common.Controls.Actions.share, image: UIImage(systemName: "square.and.arrow.up")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
|
title: L10n.Common.Controls.Actions.share, image: UIImage(systemName: "square.and.arrow.up")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off
|
||||||
) { [weak self] _ in
|
) { [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 }
|
guard let self = self else { return }
|
||||||
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .share)
|
self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .share)
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-4-28.
|
// Created by MainasuK Cirno on 2021-4-28.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import Alamofire
|
import Alamofire
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-4-28.
|
// Created by MainasuK Cirno on 2021-4-28.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import Pageboy
|
import Pageboy
|
||||||
|
@ -42,9 +41,6 @@ final class MediaPreviewViewController: UIViewController, NeedsDependency {
|
||||||
button.setTitle("ALT", for: .normal)
|
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 safeAreaInsets = previewImageView.safeAreaInsets
|
||||||
let statusBarFrameHeight = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
|
let statusBarFrameHeight = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0
|
||||||
let dismissible = previewImageView.contentOffset.y <= -(safeAreaInsets.top - statusBarFrameHeight) + 3 // add 3pt tolerance
|
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
|
return dismissible
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,7 +206,6 @@ extension MediaPreviewViewController: MediaPreviewingViewController {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: dismissible false", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,8 +303,8 @@ extension MediaPreviewViewController: MediaPreviewImageViewControllerDelegate {
|
||||||
context.photoLibraryService.copy(imageSource: .url(assetURL))
|
context.photoLibraryService.copy(imageSource: .url(assetURL))
|
||||||
.sink { completion in
|
.sink { completion in
|
||||||
switch completion {
|
switch completion {
|
||||||
case .failure(let error):
|
case .failure(_):
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: copy photo fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription)
|
break
|
||||||
case .finished:
|
case .finished:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-2-9.
|
// Created by MainasuK on 2022-2-9.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -13,8 +12,6 @@ import func AVFoundation.AVMakeRect
|
||||||
|
|
||||||
final class MediaPreviewVideoViewController: UIViewController {
|
final class MediaPreviewVideoViewController: UIViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "MediaPreviewVideoViewController", category: "ViewController")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
var viewModel: MediaPreviewVideoViewModel!
|
var viewModel: MediaPreviewVideoViewModel!
|
||||||
|
|
||||||
|
@ -23,7 +20,6 @@ final class MediaPreviewVideoViewController: UIViewController {
|
||||||
let previewImageView = UIImageView()
|
let previewImageView = UIImageView()
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
playerViewController.player?.pause()
|
playerViewController.player?.pause()
|
||||||
try? AVAudioSession.sharedInstance().setCategory(.ambient)
|
try? AVAudioSession.sharedInstance().setCategory(.ambient)
|
||||||
try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
|
try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
|
||||||
|
@ -89,24 +85,6 @@ extension MediaPreviewVideoViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - ShareActivityProvider
|
// 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 {
|
extension MediaPreviewVideoViewController: MediaPreviewPage {
|
||||||
func setShowingChrome(_ showingChrome: Bool) {
|
func setShowingChrome(_ showingChrome: Bool) {
|
||||||
// TODO: does this do anything?
|
// TODO: does this do anything?
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-2-9.
|
// Created by MainasuK on 2022-2-9.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -14,8 +13,6 @@ import MastodonCore
|
||||||
|
|
||||||
final class MediaPreviewVideoViewModel {
|
final class MediaPreviewVideoViewModel {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "MediaPreviewVideoViewModel", category: "ViewModel")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
// input
|
// input
|
||||||
|
@ -59,10 +56,7 @@ final class MediaPreviewVideoViewModel {
|
||||||
// setup player state observer
|
// setup player state observer
|
||||||
$playbackState
|
$playbackState
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak self] status in
|
.sink { status in
|
||||||
guard let self = self else { return }
|
|
||||||
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): player state: \(status.description)")
|
|
||||||
|
|
||||||
switch status {
|
switch status {
|
||||||
case .unknown, .buffering, .readyToPlay:
|
case .unknown, .buffering, .readyToPlay:
|
||||||
break
|
break
|
||||||
|
|
|
@ -33,7 +33,6 @@ extension NotificationTableViewCell {
|
||||||
if notificationView.frame == .zero {
|
if notificationView.frame == .zero {
|
||||||
// set status view width
|
// set status view width
|
||||||
notificationView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin
|
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.statusView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin
|
||||||
notificationView.quoteStatusView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin // the as same width as statusView
|
notificationView.quoteStatusView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin // the as same width as statusView
|
||||||
|
@ -52,10 +51,8 @@ extension NotificationTableViewCell {
|
||||||
)
|
)
|
||||||
.dropFirst()
|
.dropFirst()
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { [weak tableView, weak self] _, _ in
|
.sink { [weak tableView] _, _ in
|
||||||
guard let tableView = tableView else { return }
|
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 {
|
UIView.performWithoutAnimation {
|
||||||
tableView.beginUpdates()
|
tableView.beginUpdates()
|
||||||
|
|
|
@ -5,16 +5,12 @@
|
||||||
// Created by MainasuK on 2022-1-21.
|
// Created by MainasuK on 2022-1-21.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
import MastodonUI
|
import MastodonUI
|
||||||
|
|
||||||
final class NotificationTableViewCell: UITableViewCell {
|
final class NotificationTableViewCell: UITableViewCell {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "NotificationTableViewCell", category: "View")
|
|
||||||
|
|
||||||
weak var delegate: NotificationTableViewCellDelegate?
|
weak var delegate: NotificationTableViewCellDelegate?
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
private var _disposeBag = Set<AnyCancellable>()
|
private var _disposeBag = Set<AnyCancellable>()
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-21.
|
// Created by MainasuK on 2022-1-21.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -14,8 +13,6 @@ import MastodonLocalization
|
||||||
|
|
||||||
final class NotificationTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class NotificationTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "NotificationTimelineViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -42,9 +39,6 @@ final class NotificationTimelineViewController: UIViewController, NeedsDependenc
|
||||||
|
|
||||||
let cellFrameCache = NSCache<NSNumber, NSValue>()
|
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()
|
let now = Date()
|
||||||
if let timestamp = viewModel.lastAutomaticFetchTimestamp {
|
if let timestamp = viewModel.lastAutomaticFetchTimestamp {
|
||||||
if now.timeIntervalSince(timestamp) > 60 {
|
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 {
|
Task {
|
||||||
await viewModel.loadLatest()
|
await viewModel.loadLatest()
|
||||||
}
|
}
|
||||||
viewModel.lastAutomaticFetchTimestamp = now
|
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 {
|
} else {
|
||||||
Task {
|
Task {
|
||||||
|
@ -133,8 +124,6 @@ extension NotificationTimelineViewController: CellFrameCacheContainer {
|
||||||
extension NotificationTimelineViewController {
|
extension NotificationTimelineViewController {
|
||||||
|
|
||||||
@objc private func refreshControlValueChanged(_ sender: RefreshControl) {
|
@objc private func refreshControlValueChanged(_ sender: RefreshControl) {
|
||||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)")
|
|
||||||
|
|
||||||
Task {
|
Task {
|
||||||
await viewModel.loadLatest()
|
await viewModel.loadLatest()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-21.
|
// Created by MainasuK on 2022-1-21.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreData
|
import CoreData
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -36,14 +35,8 @@ extension NotificationTimelineViewModel {
|
||||||
.sink { [weak self] records in
|
.sink { [weak self] records in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
guard let diffableDataSource = self.diffableDataSource 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 {
|
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()
|
let oldSnapshot = diffableDataSource.snapshot()
|
||||||
var newSnapshot: NSDiffableDataSourceSnapshot<NotificationSection, NotificationItem> = {
|
var newSnapshot: NSDiffableDataSourceSnapshot<NotificationSection, NotificationItem> = {
|
||||||
let newItems = records.map { record in
|
let newItems = records.map { record in
|
||||||
|
@ -88,16 +81,12 @@ extension NotificationTimelineViewModel {
|
||||||
|
|
||||||
let hasChanges = newSnapshot.itemIdentifiers != oldSnapshot.itemIdentifiers
|
let hasChanges = newSnapshot.itemIdentifiers != oldSnapshot.itemIdentifiers
|
||||||
if !hasChanges {
|
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()
|
self.didLoadLatest.send()
|
||||||
return
|
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)
|
await self.updateSnapshotUsingReloadData(snapshot: newSnapshot)
|
||||||
self.didLoadLatest.send()
|
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
|
} // end Task
|
||||||
}
|
}
|
||||||
.store(in: &disposeBag)
|
.store(in: &disposeBag)
|
||||||
|
|
|
@ -9,13 +9,10 @@ import CoreDataStack
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
import os.log
|
|
||||||
|
|
||||||
extension NotificationTimelineViewModel {
|
extension NotificationTimelineViewModel {
|
||||||
class LoadOldestState: GKState {
|
class LoadOldestState: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "NotificationTimelineViewModel.LoadOldestState", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
weak var viewModel: NotificationTimelineViewModel?
|
weak var viewModel: NotificationTimelineViewModel?
|
||||||
|
@ -24,22 +21,10 @@ extension NotificationTimelineViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: LoadOldestState.Type) {
|
func enter(state: LoadOldestState.Type) {
|
||||||
stateMachine?.enter(state)
|
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 {
|
} 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)
|
await self.enter(state: Fail.self)
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-21.
|
// Created by MainasuK on 2022-1-21.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -15,8 +14,6 @@ import MastodonCore
|
||||||
|
|
||||||
final class NotificationTimelineViewModel {
|
final class NotificationTimelineViewModel {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "NotificationTimelineViewModel", category: "ViewModel")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
|
||||||
// input
|
// 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 {
|
} catch {
|
||||||
didLoadLatest.send()
|
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
|
authenticationBox: authContext.mastodonAuthenticationBox
|
||||||
)
|
)
|
||||||
} catch {
|
} 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.
|
// Created by sxiaojian on 2021/4/12.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
@ -16,8 +15,6 @@ import MastodonCore
|
||||||
|
|
||||||
final class NotificationViewController: TabmanViewController, NeedsDependency {
|
final class NotificationViewController: TabmanViewController, NeedsDependency {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "NotificationViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -44,9 +41,6 @@ final class NotificationViewController: TabmanViewController, NeedsDependency {
|
||||||
viewModel.currentPageIndex = index
|
viewModel.currentPageIndex = index
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension NotificationViewController {
|
extension NotificationViewController {
|
||||||
|
@ -163,8 +157,6 @@ extension NotificationViewController {
|
||||||
|
|
||||||
extension NotificationViewController {
|
extension NotificationViewController {
|
||||||
@objc private func pageSegmentedControlValueChanged(_ sender: UISegmentedControl) {
|
@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
|
let index = sender.selectedSegmentIndex
|
||||||
scrollToPage(.at(index: index), animated: true, completion: nil)
|
scrollToPage(.at(index: index), animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
@ -232,7 +224,6 @@ extension NotificationViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func showCategory(_ sender: UIKeyCommand) {
|
@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,
|
guard let rawValue = sender.propertyList as? String,
|
||||||
let category = CategorySwitch(rawValue: rawValue)
|
let category = CategorySwitch(rawValue: rawValue)
|
||||||
else { return }
|
else { return }
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by sxiaojian on 2021/4/12.
|
// Created by sxiaojian on 2021/4/12.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import Pageboy
|
import Pageboy
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -104,8 +103,8 @@ extension MastodonConfirmEmailViewController {
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
.sink { completion in
|
.sink { completion in
|
||||||
switch completion {
|
switch completion {
|
||||||
case .failure(let error):
|
case .failure(_):
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: swap user access token swap fail: %s", (#file as NSString).lastPathComponent, #line, #function, error.localizedDescription)
|
break
|
||||||
case .finished:
|
case .finished:
|
||||||
// upload avatar and set display name in the background
|
// upload avatar and set display name in the background
|
||||||
Just(self.viewModel.userToken.accessToken)
|
Just(self.viewModel.userToken.accessToken)
|
||||||
|
@ -119,10 +118,10 @@ extension MastodonConfirmEmailViewController {
|
||||||
.retry(3)
|
.retry(3)
|
||||||
.sink { completion in
|
.sink { completion in
|
||||||
switch completion {
|
switch completion {
|
||||||
case .failure(let error):
|
case .failure(_):
|
||||||
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)
|
break
|
||||||
case .finished:
|
case .finished:
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: setup avatar & display name success", ((#file as NSString).lastPathComponent), #line, #function)
|
break
|
||||||
}
|
}
|
||||||
} receiveValue: { _ in
|
} receiveValue: { _ in
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -130,7 +129,6 @@ extension MastodonConfirmEmailViewController {
|
||||||
.store(in: &self.context.disposeBag) // execute in the background
|
.store(in: &self.context.disposeBag) // execute in the background
|
||||||
} // end switch
|
} // end switch
|
||||||
} receiveValue: { response in
|
} 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.coordinator.setup()
|
||||||
// self.dismiss(animated: true, completion: nil)
|
// self.dismiss(animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,15 +228,10 @@ class MastodonLoginViewController: UIViewController, NeedsDependency {
|
||||||
@objc func keyboardWillShowNotification(_ notification: Notification) {
|
@objc func keyboardWillShowNotification(_ notification: Notification) {
|
||||||
|
|
||||||
guard let userInfo = notification.userInfo,
|
guard let userInfo = notification.userInfo,
|
||||||
let keyboardFrameValue = userInfo[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue,
|
|
||||||
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber
|
let duration = userInfo[UIResponder.keyboardAnimationDurationUserInfoKey] as? NSNumber
|
||||||
else { return }
|
else { return }
|
||||||
|
|
||||||
// inspired by https://stackoverflow.com/a/30245044
|
// 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) {
|
UIView.animate(withDuration: duration.doubleValue, delay: 0, options: .curveEaseInOut) {
|
||||||
self.view.layoutIfNeeded()
|
self.view.layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by BradGao on 2021/2/20.
|
// Created by BradGao on 2021/2/20.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import GameController
|
import GameController
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by Cirno MainasuK on 2021/3/5.
|
// Created by Cirno MainasuK on 2021/3/5.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -17,10 +16,6 @@ extension MastodonPickServerViewModel {
|
||||||
init(viewModel: MastodonPickServerViewModel) {
|
init(viewModel: MastodonPickServerViewModel) {
|
||||||
self.viewModel = viewModel
|
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.
|
// Created by BradGao on 2021/2/23.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
|
@ -79,9 +78,6 @@ class MastodonPickServerViewModel: NSObject {
|
||||||
configure()
|
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.
|
// Created by BradGao on 2021/2/24.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-4.
|
// Created by MainasuK on 2022-1-4.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Tabman
|
import Tabman
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
import AlamofireImage
|
import AlamofireImage
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
import os.log
|
|
||||||
import PhotosUI
|
import PhotosUI
|
||||||
import UIKit
|
import UIKit
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
@ -21,8 +20,6 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O
|
||||||
|
|
||||||
static let avatarImageMaxSizeInPixel = CGSize(width: 400, height: 400)
|
static let avatarImageMaxSizeInPixel = CGSize(width: 400, height: 400)
|
||||||
|
|
||||||
let logger = Logger(subsystem: "MastodonRegisterViewController", category: "ViewController")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
private var observations = Set<NSKeyValueObservation>()
|
private var observations = Set<NSKeyValueObservation>()
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
import Combine
|
import Combine
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import WebKit
|
import WebKit
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -27,8 +26,6 @@ final class MastodonResendEmailViewController: UIViewController, NeedsDependency
|
||||||
}()
|
}()
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function)
|
|
||||||
|
|
||||||
// cleanup cookie
|
// cleanup cookie
|
||||||
let httpCookieStore = webView.configuration.websiteDataStore.httpCookieStore
|
let httpCookieStore = webView.configuration.websiteDataStore.httpCookieStore
|
||||||
httpCookieStore.getAllCookies { cookies in
|
httpCookieStore.getAllCookies { cookies in
|
||||||
|
@ -54,7 +51,6 @@ extension MastodonResendEmailViewController {
|
||||||
let request = URLRequest(url: viewModel.resendEmailURL)
|
let request = URLRequest(url: viewModel.resendEmailURL)
|
||||||
webView.navigationDelegate = self.viewModel.navigationDelegate
|
webView.navigationDelegate = self.viewModel.navigationDelegate
|
||||||
webView.load(request)
|
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 Combine
|
||||||
import Foundation
|
import Foundation
|
||||||
import os.log
|
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
final class MastodonResendEmailViewModel {
|
final class MastodonResendEmailViewModel {
|
||||||
|
@ -22,11 +21,6 @@ final class MastodonResendEmailViewModel {
|
||||||
self.resendEmailURL = resendEmailURL
|
self.resendEmailURL = resendEmailURL
|
||||||
self.email = email
|
self.email = email
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
extension MastodonResendEmailViewModel {
|
extension MastodonResendEmailViewModel {
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by sxiaojian on 2021/2/25.
|
// Created by sxiaojian on 2021/2/25.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
|
@ -17,9 +16,6 @@ final class MastodonResendEmailViewModelNavigationDelegateShim: NSObject {
|
||||||
self.viewModel = viewModel
|
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.
|
// Created by MainasuK Cirno on 2021-2-22.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -16,9 +15,6 @@ import MastodonCore
|
||||||
import MastodonLocalization
|
import MastodonLocalization
|
||||||
|
|
||||||
final class MastodonServerRulesViewController: UIViewController, NeedsDependency {
|
final class MastodonServerRulesViewController: UIViewController, NeedsDependency {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "MastodonServerRulesViewController", category: "ViewController")
|
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
private var observations = Set<NSKeyValueObservation>()
|
private var observations = Set<NSKeyValueObservation>()
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021/2/1.
|
// Created by MainasuK Cirno on 2021/2/1.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import CoreData
|
import CoreData
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -76,8 +75,6 @@ extension AuthenticationViewModel {
|
||||||
guard !components.contains(where: { $0.isEmpty }) else { return nil }
|
guard !components.contains(where: { $0.isEmpty }) else { return nil }
|
||||||
guard components.count >= 2 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
|
return host
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +153,6 @@ extension AuthenticationViewModel {
|
||||||
)
|
)
|
||||||
.flatMap { response -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Account>, Error> in
|
.flatMap { response -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Account>, Error> in
|
||||||
let token = response.value
|
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(
|
return AuthenticationViewModel.verifyAndSaveAuthentication(
|
||||||
context: self.context,
|
context: self.context,
|
||||||
info: info,
|
info: info,
|
||||||
|
@ -171,7 +167,6 @@ extension AuthenticationViewModel {
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
switch completion {
|
switch completion {
|
||||||
case .failure(let error):
|
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.isAuthenticating.value = false
|
||||||
self.error.value = error
|
self.error.value = error
|
||||||
case .finished:
|
case .finished:
|
||||||
|
@ -180,7 +175,6 @@ extension AuthenticationViewModel {
|
||||||
} receiveValue: { [weak self] response in
|
} receiveValue: { [weak self] response in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
let account = response.value
|
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))
|
self.authenticated.send((domain: info.domain, account: account))
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-6-4.
|
// Created by MainasuK Cirno on 2021-6-4.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import AuthenticationServices
|
import AuthenticationServices
|
||||||
|
@ -44,12 +43,10 @@ extension MastodonAuthenticationController {
|
||||||
callbackURLScheme: APIService.callbackURLScheme
|
callbackURLScheme: APIService.callbackURLScheme
|
||||||
) { [weak self] callback, error in
|
) { [weak self] callback, error in
|
||||||
guard let self = self else { return }
|
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 {
|
||||||
if let error = error as? ASWebAuthenticationSessionError {
|
if let error = error as? ASWebAuthenticationSessionError {
|
||||||
if error.errorCode == ASWebAuthenticationSessionError.canceledLogin.rawValue {
|
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
|
self.isAuthenticating.value = false
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-5-26.
|
// Created by MainasuK Cirno on 2021-5-26.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-5-25.
|
// Created by MainasuK Cirno on 2021-5-25.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MetaTextKit
|
import MetaTextKit
|
||||||
|
@ -186,7 +185,6 @@ extension ProfileFieldCollectionViewCell {
|
||||||
// MARK: - MetaLabelDelegate
|
// MARK: - MetaLabelDelegate
|
||||||
extension ProfileFieldCollectionViewCell: MetaLabelDelegate {
|
extension ProfileFieldCollectionViewCell: MetaLabelDelegate {
|
||||||
func metaLabel(_ metaLabel: MetaLabel, didSelectMeta meta: Meta) {
|
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)
|
delegate?.profileFieldCollectionViewCell(self, metaLabel: metaLabel, didSelectMeta: meta)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-22.
|
// Created by MainasuK on 2022-1-22.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MetaTextKit
|
import MetaTextKit
|
||||||
|
@ -127,7 +126,6 @@ extension ProfileFieldEditCollectionViewCell {
|
||||||
|
|
||||||
extension ProfileFieldEditCollectionViewCell {
|
extension ProfileFieldEditCollectionViewCell {
|
||||||
@objc private func editButtonDidPressed(_ sender: UIButton) {
|
@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)
|
delegate?.profileFieldEditCollectionViewCell(self, editButtonDidPressed: sender)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-22.
|
// Created by MainasuK on 2022-1-22.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MetaTextKit
|
import MetaTextKit
|
||||||
|
@ -20,8 +19,6 @@ protocol ProfileAboutViewControllerDelegate: AnyObject {
|
||||||
|
|
||||||
final class ProfileAboutViewController: UIViewController {
|
final class ProfileAboutViewController: UIViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "ProfileAboutViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -39,9 +36,6 @@ final class ProfileAboutViewController: UIViewController {
|
||||||
return collectionView
|
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
|
// MARK: - UICollectionViewDelegate
|
||||||
extension ProfileAboutViewController: UICollectionViewDelegate {
|
extension ProfileAboutViewController: UICollectionViewDelegate {
|
||||||
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
|
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 diffableDataSource = viewModel.diffableDataSource else { return }
|
||||||
guard let item = diffableDataSource.itemIdentifier(for: indexPath) else { return }
|
guard let item = diffableDataSource.itemIdentifier(for: indexPath) else { return }
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-22.
|
// Created by MainasuK on 2022-1-22.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-1-22.
|
// Created by MainasuK on 2022-1-22.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by ProtoLimit on 2022-07-19.
|
// Created by ProtoLimit on 2022-07-19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -17,8 +16,6 @@ import MastodonLocalization
|
||||||
|
|
||||||
final class BookmarkViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class BookmarkViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "BookmarkViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -39,9 +36,6 @@ final class BookmarkViewController: UIViewController, NeedsDependency, MediaPrev
|
||||||
return tableView
|
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.
|
// Created by ProtoLimit on 2022-07-19.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -14,8 +13,6 @@ import MastodonCore
|
||||||
extension BookmarkViewModel {
|
extension BookmarkViewModel {
|
||||||
class State: GKState {
|
class State: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "BookmarkViewModel.State", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
weak var viewModel: BookmarkViewModel?
|
weak var viewModel: BookmarkViewModel?
|
||||||
|
@ -24,22 +21,11 @@ extension BookmarkViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: State.Type) {
|
func enter(state: State.Type) {
|
||||||
stateMachine?.enter(state)
|
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)
|
super.didEnter(from: previousState)
|
||||||
guard let _ = viewModel, let stateMachine = stateMachine else { return }
|
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) {
|
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)
|
stateMachine.enter(Loading.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +149,6 @@ extension BookmarkViewModel.State {
|
||||||
}
|
}
|
||||||
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
||||||
} catch {
|
} 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)
|
await enter(state: Fail.self)
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
|
|
|
@ -13,8 +13,5 @@ final class CachedProfileViewModel: ProfileViewModel {
|
||||||
|
|
||||||
init(context: AppContext, authContext: AuthContext, mastodonUser: MastodonUser) {
|
init(context: AppContext, authContext: AuthContext, mastodonUser: MastodonUser) {
|
||||||
super.init(context: context, authContext: authContext, optionalMastodonUser: 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.
|
// Created by MainasuK on 2022-5-17.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -15,8 +14,6 @@ import CoreDataStack
|
||||||
|
|
||||||
final class FamiliarFollowersViewController: UIViewController, NeedsDependency {
|
final class FamiliarFollowersViewController: UIViewController, NeedsDependency {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "FamiliarFollowersViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -31,9 +28,6 @@ final class FamiliarFollowersViewController: UIViewController, NeedsDependency {
|
||||||
return tableView
|
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
|
// Note: Prefer use US favorite then EN favourite in coding
|
||||||
// to following the text checker auto-correct behavior
|
// to following the text checker auto-correct behavior
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import AVKit
|
import AVKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -20,8 +19,6 @@ import MastodonLocalization
|
||||||
|
|
||||||
final class FavoriteViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class FavoriteViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "FavoriteViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -42,9 +39,6 @@ final class FavoriteViewController: UIViewController, NeedsDependency, MediaPrev
|
||||||
return tableView
|
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.
|
// Created by MainasuK Cirno on 2021-4-7.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
@ -14,8 +13,6 @@ import MastodonSDK
|
||||||
extension FavoriteViewModel {
|
extension FavoriteViewModel {
|
||||||
class State: GKState {
|
class State: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "FavoriteViewModel.State", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
weak var viewModel: FavoriteViewModel?
|
weak var viewModel: FavoriteViewModel?
|
||||||
|
@ -24,22 +21,10 @@ extension FavoriteViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: State.Type) {
|
func enter(state: State.Type) {
|
||||||
stateMachine?.enter(state)
|
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)
|
super.didEnter(from: previousState)
|
||||||
guard let _ = viewModel, let stateMachine = stateMachine else { return }
|
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) {
|
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)
|
stateMachine.enter(Loading.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +148,6 @@ extension FavoriteViewModel.State {
|
||||||
}
|
}
|
||||||
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
viewModel.statusFetchedResultsController.statusIDs = statusIDs
|
||||||
} catch {
|
} 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)
|
await enter(state: Fail.self)
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
|
|
|
@ -14,8 +14,6 @@ import MastodonUI
|
||||||
import MastodonLocalization
|
import MastodonLocalization
|
||||||
|
|
||||||
final class FollowedTagsViewController: UIViewController, NeedsDependency {
|
final class FollowedTagsViewController: UIViewController, NeedsDependency {
|
||||||
let logger = Logger(subsystem: String(describing: FollowedTagsViewController.self), category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -33,9 +31,6 @@ final class FollowedTagsViewController: UIViewController, NeedsDependency {
|
||||||
return tableView
|
return tableView
|
||||||
}()
|
}()
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension FollowedTagsViewController {
|
extension FollowedTagsViewController {
|
||||||
|
|
|
@ -14,7 +14,6 @@ import MastodonSDK
|
||||||
import MastodonCore
|
import MastodonCore
|
||||||
|
|
||||||
final class FollowedTagsViewModel: NSObject {
|
final class FollowedTagsViewModel: NSObject {
|
||||||
let logger = Logger(subsystem: String(describing: FollowedTagsViewModel.self), category: "ViewModel")
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
let fetchedResultsController: FollowedTagsFetchedResultController
|
let fetchedResultsController: FollowedTagsFetchedResultController
|
||||||
|
|
||||||
|
@ -93,7 +92,6 @@ extension FollowedTagsViewModel {
|
||||||
|
|
||||||
extension FollowedTagsViewModel: UITableViewDelegate {
|
extension FollowedTagsViewModel: UITableViewDelegate {
|
||||||
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
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)
|
tableView.deselectRow(at: indexPath, animated: true)
|
||||||
|
|
||||||
let object = fetchedResultsController.records[indexPath.row]
|
let object = fetchedResultsController.records[indexPath.row]
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by Cirno MainasuK on 2021-11-1.
|
// Created by Cirno MainasuK on 2021-11-1.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -16,8 +15,6 @@ import CoreDataStack
|
||||||
|
|
||||||
final class FollowerListViewController: UIViewController, NeedsDependency {
|
final class FollowerListViewController: UIViewController, NeedsDependency {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "FollowerListViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -35,9 +32,6 @@ final class FollowerListViewController: UIViewController, NeedsDependency {
|
||||||
return tableView
|
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.
|
// Created by Cirno MainasuK on 2021-11-1.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -15,8 +14,6 @@ import CoreDataStack
|
||||||
extension FollowerListViewModel {
|
extension FollowerListViewModel {
|
||||||
class State: GKState {
|
class State: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "FollowerListViewModel.State", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
var name: String {
|
var name: String {
|
||||||
|
@ -29,22 +26,10 @@ extension FollowerListViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: State.Type) {
|
func enter(state: State.Type) {
|
||||||
stateMachine?.enter(state)
|
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)
|
super.didEnter(from: previousState)
|
||||||
guard let _ = viewModel, let stateMachine = stateMachine else { return }
|
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) {
|
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)
|
stateMachine.enter(Loading.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +137,6 @@ extension FollowerListViewModel.State {
|
||||||
maxID: maxID,
|
maxID: maxID,
|
||||||
authenticationBox: viewModel.authContext.mastodonAuthenticationBox
|
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 hasNewAppend = false
|
||||||
var userIDs = viewModel.userFetchedResultsController.userIDs
|
var userIDs = viewModel.userFetchedResultsController.userIDs
|
||||||
|
@ -176,7 +158,6 @@ extension FollowerListViewModel.State {
|
||||||
viewModel.userFetchedResultsController.userIDs = userIDs
|
viewModel.userFetchedResultsController.userIDs = userIDs
|
||||||
|
|
||||||
} catch {
|
} 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)
|
await enter(state: Fail.self)
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by Cirno MainasuK on 2021-11-2.
|
// Created by Cirno MainasuK on 2021-11-2.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import Combine
|
import Combine
|
||||||
|
@ -16,8 +15,6 @@ import CoreDataStack
|
||||||
|
|
||||||
final class FollowingListViewController: UIViewController, NeedsDependency {
|
final class FollowingListViewController: UIViewController, NeedsDependency {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "FollowingListViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -35,9 +32,6 @@ final class FollowingListViewController: UIViewController, NeedsDependency {
|
||||||
return tableView
|
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-2.
|
// Created by Cirno MainasuK on 2021-11-2.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import MastodonSDK
|
import MastodonSDK
|
||||||
|
@ -13,8 +12,6 @@ import MastodonSDK
|
||||||
extension FollowingListViewModel {
|
extension FollowingListViewModel {
|
||||||
class State: GKState {
|
class State: GKState {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "FollowingListViewModel.State", category: "StateMachine")
|
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
|
|
||||||
weak var viewModel: FollowingListViewModel?
|
weak var viewModel: FollowingListViewModel?
|
||||||
|
@ -23,22 +20,10 @@ extension FollowingListViewModel {
|
||||||
self.viewModel = viewModel
|
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
|
@MainActor
|
||||||
func enter(state: State.Type) {
|
func enter(state: State.Type) {
|
||||||
stateMachine?.enter(state)
|
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)
|
super.didEnter(from: previousState)
|
||||||
guard let _ = viewModel, let stateMachine = stateMachine else { return }
|
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) {
|
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)
|
stateMachine.enter(Loading.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,8 +132,6 @@ extension FollowingListViewModel.State {
|
||||||
authenticationBox: viewModel.authContext.mastodonAuthenticationBox
|
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 hasNewAppend = false
|
||||||
var userIDs = viewModel.userFetchedResultsController.userIDs
|
var userIDs = viewModel.userFetchedResultsController.userIDs
|
||||||
for user in response.value {
|
for user in response.value {
|
||||||
|
@ -170,7 +151,6 @@ extension FollowingListViewModel.State {
|
||||||
viewModel.userFetchedResultsController.userIDs = userIDs
|
viewModel.userFetchedResultsController.userIDs = userIDs
|
||||||
|
|
||||||
} catch {
|
} 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)
|
await enter(state: Fail.self)
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-29.
|
// Created by MainasuK Cirno on 2021-3-29.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -27,8 +26,6 @@ protocol ProfileHeaderViewControllerDelegate: AnyObject {
|
||||||
|
|
||||||
final class ProfileHeaderViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
final class ProfileHeaderViewController: UIViewController, NeedsDependency, MediaPreviewableViewController {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "ProfileHeaderViewController", category: "ViewController")
|
|
||||||
|
|
||||||
static let segmentedControlHeight: CGFloat = 50
|
static let segmentedControlHeight: CGFloat = 50
|
||||||
static let headerMinHeight: CGFloat = segmentedControlHeight
|
static let headerMinHeight: CGFloat = segmentedControlHeight
|
||||||
|
|
||||||
|
@ -84,9 +81,6 @@ final class ProfileHeaderViewController: UIViewController, NeedsDependency, Medi
|
||||||
return documentPickerController
|
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] = []
|
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
|
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 }
|
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.currentImageType = type
|
||||||
self.present(self.imagePicker, animated: true, completion: nil)
|
self.present(self.imagePicker, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
@ -210,7 +203,6 @@ extension ProfileHeaderViewController {
|
||||||
if UIImagePickerController.isSourceTypeAvailable(.camera) {
|
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
|
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 }
|
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.currentImageType = type
|
||||||
self.present(self.imagePickerController, animated: true, completion: nil)
|
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
|
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 }
|
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.currentImageType = type
|
||||||
self.present(self.documentPickerController, animated: true, completion: nil)
|
self.present(self.documentPickerController, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
|
@ -384,8 +375,6 @@ extension ProfileHeaderViewController: ProfileHeaderViewDelegate {
|
||||||
// MARK: - MetaTextDelegate
|
// MARK: - MetaTextDelegate
|
||||||
extension ProfileHeaderViewController: MetaTextDelegate {
|
extension ProfileHeaderViewController: MetaTextDelegate {
|
||||||
func metaText(_ metaText: MetaText, processEditing textStorage: MetaTextStorage) -> MetaContent? {
|
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 {
|
switch metaText {
|
||||||
case profileHeaderView.bioMetaText:
|
case profileHeaderView.bioMetaText:
|
||||||
guard viewModel.isEditing else { break }
|
guard viewModel.isEditing else { break }
|
||||||
|
@ -438,7 +427,6 @@ extension ProfileHeaderViewController: UIImagePickerControllerDelegate & UINavig
|
||||||
}
|
}
|
||||||
|
|
||||||
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
|
func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
|
||||||
os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
picker.dismiss(animated: true, completion: nil)
|
picker.dismiss(animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,7 +443,6 @@ extension ProfileHeaderViewController: UIDocumentPickerDelegate {
|
||||||
guard let image = UIImage(data: imageData) else { return }
|
guard let image = UIImage(data: imageData) else { return }
|
||||||
cropImage(image: image, pickerViewController: controller)
|
cropImage(image: image, pickerViewController: controller)
|
||||||
} catch {
|
} 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.
|
// Created by MainasuK Cirno on 2021-4-9.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-5-26.
|
// Created by MainasuK on 2022-5-26.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK on 2022-5-26.
|
// Created by MainasuK on 2022-5-26.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-29.
|
// Created by MainasuK Cirno on 2021-3-29.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import FLAnimatedImage
|
import FLAnimatedImage
|
||||||
|
@ -511,19 +510,16 @@ extension ProfileHeaderView {
|
||||||
|
|
||||||
extension ProfileHeaderView {
|
extension ProfileHeaderView {
|
||||||
@objc private func relationshipActionButtonDidPressed(_ sender: UIButton) {
|
@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)
|
assert(sender === relationshipActionButton)
|
||||||
delegate?.profileHeaderView(self, relationshipButtonDidPressed: relationshipActionButton)
|
delegate?.profileHeaderView(self, relationshipButtonDidPressed: relationshipActionButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func avatarButtonDidPressed(_ sender: UIButton) {
|
@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)
|
assert(sender === avatarButton)
|
||||||
delegate?.profileHeaderView(self, avatarButtonDidPressed: avatarButton)
|
delegate?.profileHeaderView(self, avatarButtonDidPressed: avatarButton)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func bannerImageViewDidPressed(_ sender: UITapGestureRecognizer) {
|
@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)
|
delegate?.profileHeaderView(self, bannerImageViewDidPressed: bannerImageView)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -544,7 +540,6 @@ extension ProfileHeaderView: UITextViewDelegate {
|
||||||
// MARK: - MetaTextViewDelegate
|
// MARK: - MetaTextViewDelegate
|
||||||
extension ProfileHeaderView: MetaTextViewDelegate {
|
extension ProfileHeaderView: MetaTextViewDelegate {
|
||||||
func metaTextView(_ metaTextView: MetaTextView, didSelectMeta meta: Meta) {
|
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)
|
delegate?.profileHeaderView(self, metaTextView: metaTextView, metaDidPressed: meta)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-30.
|
// Created by MainasuK Cirno on 2021-3-30.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreData
|
import CoreData
|
||||||
|
@ -25,8 +24,6 @@ final class MeProfileViewModel: ProfileViewModel {
|
||||||
|
|
||||||
$me
|
$me
|
||||||
.sink { [weak self] me in
|
.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 }
|
guard let self = self else { return }
|
||||||
self.user = me
|
self.user = me
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-29.
|
// Created by MainasuK Cirno on 2021-3-29.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import XLPagerTabStrip
|
import XLPagerTabStrip
|
||||||
|
@ -58,9 +57,6 @@ final class ProfilePagingViewController: ButtonBarPagerTabStripViewController, T
|
||||||
return true
|
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.
|
// Created by MainasuK Cirno on 2021-3-29.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import MastodonAsset
|
import MastodonAsset
|
||||||
import MastodonLocalization
|
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.
|
// Created by MainasuK Cirno on 2021-2-23.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import MastodonMeta
|
import MastodonMeta
|
||||||
|
@ -27,8 +26,6 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi
|
||||||
public static let containerViewMarginForRegularHorizontalSizeClass: CGFloat = 64
|
public static let containerViewMarginForRegularHorizontalSizeClass: CGFloat = 64
|
||||||
public static let containerViewMarginForCompactHorizontalSizeClass: CGFloat = 16
|
public static let containerViewMarginForCompactHorizontalSizeClass: CGFloat = 16
|
||||||
|
|
||||||
let logger = Logger(subsystem: "ProfileViewController", category: "ViewController")
|
|
||||||
|
|
||||||
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
weak var context: AppContext! { willSet { precondition(!isViewLoaded) } }
|
||||||
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } }
|
||||||
|
|
||||||
|
@ -153,9 +150,6 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi
|
||||||
profileHeaderViewController.titleView
|
profileHeaderViewController.titleView
|
||||||
}
|
}
|
||||||
|
|
||||||
deinit {
|
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -526,19 +520,16 @@ extension ProfileViewController {
|
||||||
extension ProfileViewController {
|
extension ProfileViewController {
|
||||||
|
|
||||||
@objc private func cancelEditingBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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
|
viewModel.isEditing = false
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func settingBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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 }
|
guard let setting = context.settingService.currentSetting.value else { return }
|
||||||
let settingsViewModel = SettingsViewModel(context: context, authContext: viewModel.authContext, setting: setting)
|
let settingsViewModel = SettingsViewModel(context: context, authContext: viewModel.authContext, setting: setting)
|
||||||
_ = coordinator.present(scene: .settings(viewModel: settingsViewModel), from: self, transition: .modal(animated: true, completion: nil))
|
_ = coordinator.present(scene: .settings(viewModel: settingsViewModel), from: self, transition: .modal(animated: true, completion: nil))
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func shareBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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 }
|
guard let user = viewModel.user else { return }
|
||||||
let record: ManagedObjectRecord<MastodonUser> = .init(objectID: user.objectID)
|
let record: ManagedObjectRecord<MastodonUser> = .init(objectID: user.objectID)
|
||||||
Task {
|
Task {
|
||||||
|
@ -560,19 +551,16 @@ extension ProfileViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func favoriteBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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)
|
let favoriteViewModel = FavoriteViewModel(context: context, authContext: viewModel.authContext)
|
||||||
_ = coordinator.present(scene: .favorite(viewModel: favoriteViewModel), from: self, transition: .show)
|
_ = coordinator.present(scene: .favorite(viewModel: favoriteViewModel), from: self, transition: .show)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func bookmarkBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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)
|
let bookmarkViewModel = BookmarkViewModel(context: context, authContext: viewModel.authContext)
|
||||||
_ = coordinator.present(scene: .bookmark(viewModel: bookmarkViewModel), from: self, transition: .show)
|
_ = coordinator.present(scene: .bookmark(viewModel: bookmarkViewModel), from: self, transition: .show)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func replyBarButtonItemPressed(_ sender: UIBarButtonItem) {
|
@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 }
|
guard let mastodonUser = viewModel.user else { return }
|
||||||
let mention = "@" + mastodonUser.acct
|
let mention = "@" + mastodonUser.acct
|
||||||
UITextChecker.learnWord(mention)
|
UITextChecker.learnWord(mention)
|
||||||
|
@ -587,15 +575,11 @@ extension ProfileViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func followedTagsItemPressed(_ sender: UIBarButtonItem) {
|
@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)
|
let followedTagsViewModel = FollowedTagsViewModel(context: context, authContext: viewModel.authContext)
|
||||||
_ = coordinator.present(scene: .followedTags(viewModel: followedTagsViewModel), from: self, transition: .show)
|
_ = coordinator.present(scene: .followedTags(viewModel: followedTagsViewModel), from: self, transition: .show)
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc private func refreshControlValueChanged(_ sender: RefreshControl) {
|
@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 {
|
if let userTimelineViewController = profilePagingViewController.currentViewController as? UserTimelineViewController {
|
||||||
userTimelineViewController.viewModel.stateMachine.enter(UserTimelineViewModel.State.Reloading.self)
|
userTimelineViewController.viewModel.stateMachine.enter(UserTimelineViewModel.State.Reloading.self)
|
||||||
}
|
}
|
||||||
|
@ -767,11 +751,9 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
|
||||||
headerProfileInfo: profileHeaderViewModel.profileInfoEditing,
|
headerProfileInfo: profileHeaderViewModel.profileInfoEditing,
|
||||||
aboutProfileInfo: profileAboutViewModel.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
|
self.viewModel.isEditing = false
|
||||||
|
|
||||||
} catch {
|
} 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(
|
let alertController = UIAlertController(
|
||||||
for: error,
|
for: error,
|
||||||
title: L10n.Common.Alerts.EditProfileFailure.title,
|
title: L10n.Common.Alerts.EditProfileFailure.title,
|
||||||
|
@ -798,7 +780,6 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
|
||||||
}
|
}
|
||||||
switch completion {
|
switch completion {
|
||||||
case .failure(let error):
|
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 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)
|
let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil)
|
||||||
alertController.addAction(okAction)
|
alertController.addAction(okAction)
|
||||||
|
@ -808,7 +789,6 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate {
|
||||||
transition: .alertController(animated: true, completion: nil)
|
transition: .alertController(animated: true, completion: nil)
|
||||||
)
|
)
|
||||||
case .finished:
|
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
|
// enter editing mode
|
||||||
self.viewModel.isEditing.toggle()
|
self.viewModel.isEditing.toggle()
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
// Created by MainasuK Cirno on 2021-3-29.
|
// Created by MainasuK Cirno on 2021-3-29.
|
||||||
//
|
//
|
||||||
|
|
||||||
import os.log
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Combine
|
import Combine
|
||||||
import CoreDataStack
|
import CoreDataStack
|
||||||
|
@ -19,8 +18,6 @@ import MastodonUI
|
||||||
// please override this base class
|
// please override this base class
|
||||||
class ProfileViewModel: NSObject {
|
class ProfileViewModel: NSObject {
|
||||||
|
|
||||||
let logger = Logger(subsystem: "ProfileViewModel", category: "ViewModel")
|
|
||||||
|
|
||||||
typealias UserID = String
|
typealias UserID = String
|
||||||
|
|
||||||
var disposeBag = Set<AnyCancellable>()
|
var disposeBag = Set<AnyCancellable>()
|
||||||
|
@ -151,11 +148,9 @@ class ProfileViewModel: NSObject {
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
|
DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in
|
||||||
guard let _ = self else { return }
|
guard let _ = self else { return }
|
||||||
pendingRetryPublisher.value = min(2 * delay, 60)
|
pendingRetryPublisher.value = min(2 * delay, 60)
|
||||||
os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Relationship] fetch again due to pending", ((#file as NSString).lastPathComponent), #line, #function)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] update user relationship failure: \(error.localizedDescription)")
|
|
||||||
}
|
}
|
||||||
} // end Task
|
} // end Task
|
||||||
}
|
}
|
||||||
|
@ -196,12 +191,10 @@ extension ProfileViewModel {
|
||||||
record: ManagedObjectRecord<MastodonUser>,
|
record: ManagedObjectRecord<MastodonUser>,
|
||||||
authenticationBox: MastodonAuthenticationBox
|
authenticationBox: MastodonAuthenticationBox
|
||||||
) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Relationship]> {
|
) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Relationship]> {
|
||||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] update user relationship...")
|
|
||||||
let response = try await context.apiService.relationship(
|
let response = try await context.apiService.relationship(
|
||||||
records: [record],
|
records: [record],
|
||||||
authenticationBox: authenticationBox
|
authenticationBox: authenticationBox
|
||||||
)
|
)
|
||||||
logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] did update MastodonUser relationship")
|
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue