From fbde2a58339de24375dc4673286dd737a9133d6e Mon Sep 17 00:00:00 2001 From: Nathan Mattes Date: Thu, 21 Sep 2023 12:52:05 +0200 Subject: [PATCH] More cleanup --- .../Sources/StringsConvertor/main.swift | 12 +---- Mastodon.xcodeproj/project.pbxproj | 4 -- .../xcshareddata/swiftpm/Package.resolved | 9 ---- .../Diffable/Discovery/DiscoverySection.swift | 3 -- Mastodon/Diffable/Report/ReportSection.swift | 1 - Mastodon/Diffable/Status/StatusSection.swift | 7 +-- Mastodon/Diffable/User/UserSection.swift | 4 -- Mastodon/Extension/OSLog.swift | 20 -------- .../Provider/DataSourceFacade+Media.swift | 4 -- ...tatusTableViewControllerNavigateable.swift | 2 - ...ider+TableViewControllerNavigateable.swift | 2 - ...taSourceProvider+UITableViewDelegate.swift | 4 -- .../Provider/DataSourceProvider.swift | 1 - ...tatusTableViewControllerNavigateable.swift | 1 - .../TableViewControllerNavigateable.swift | 1 - .../Scene/Account/AccountListViewModel.swift | 6 --- .../Scene/Account/AccountViewController.swift | 5 -- ...seStatusAttachmentCollectionViewCell.swift | 44 ---------------- ...lOptionAppendEntryCollectionViewCell.swift | 2 - ...seStatusPollOptionCollectionViewCell.swift | 4 -- .../Scene/Compose/ComposeViewController.swift | 17 +------ Mastodon/Scene/Compose/ComposeViewModel.swift | 3 -- .../DiscoveryCommunityViewController.swift | 4 -- .../DiscoveryCommunityViewModel.swift | 1 - .../Discovery/DiscoveryViewController.swift | 3 -- .../DiscoveryHashtagsViewController.swift | 7 --- .../Hashtags/DiscoveryHashtagsViewModel.swift | 1 - .../News/DiscoveryNewsViewController.swift | 9 ---- .../News/DiscoveryNewsViewModel+State.swift | 11 ---- .../News/DiscoveryNewsViewModel.swift | 1 - .../Posts/DiscoveryPostsViewController.swift | 4 -- .../Posts/DiscoveryPostsViewModel+State.swift | 11 ---- .../View/DiscoveryIntroBannerView.swift | 5 -- .../HashtagTimelineViewController.swift | 8 --- .../HashtagTimelineViewModel+Diffable.swift | 2 - .../HashtagTimelineViewModel+State.swift | 11 ---- .../HashtagTimelineViewModel.swift | 9 +--- .../HomeTimelineViewController.swift | 14 +---- .../HomeTimelineViewModel+Diffable.swift | 1 - ...omeTimelineViewModel+LoadLatestState.swift | 13 +---- ...omeTimelineViewModel+LoadOldestState.swift | 11 +--- .../HomeTimeline/HomeTimelineViewModel.swift | 9 ---- .../HomeTimelineNavigationBarTitleView.swift | 4 -- .../Image/MediaPreviewImageView.swift | 6 --- .../MediaPreviewImageViewController.swift | 7 --- .../Image/MediaPreviewImageViewModel.swift | 1 - .../MediaPreviewViewController.swift | 10 +--- .../MediaPreviewVideoViewController.swift | 24 +-------- .../Video/MediaPreviewVideoViewModel.swift | 4 -- .../NotificationTableViewCell+ViewModel.swift | 4 +- .../Cell/NotificationTableViewCell.swift | 4 -- .../NotificationTimelineViewController.swift | 11 ---- ...tificationTimelineViewModel+Diffable.swift | 11 ---- ...ionTimelineViewModel+LoadOldestState.swift | 9 ---- .../NotificationTimelineViewModel.swift | 8 --- .../NotificationViewController.swift | 9 ---- .../Notification/NotificationViewModel.swift | 1 - .../MastodonConfirmEmailViewController.swift | 10 ++-- .../MastodonPickServerViewController.swift | 1 - ...rverViewModel+LoadIndexedServerState.swift | 5 -- .../MastodonPickServerViewModel.swift | 4 -- .../TableViewCell/PickServerCell.swift | 1 - ...ckServerServerSectionTableHeaderView.swift | 1 - .../MastodonRegisterViewController.swift | 3 -- .../MastodonResendEmailViewController.swift | 4 -- .../MastodonResendEmailViewModel.swift | 6 --- ...EmailViewModelNavigationDelegateShim.swift | 4 -- .../MastodonServerRulesViewController.swift | 4 -- .../Share/AuthenticationViewModel.swift | 8 +-- .../MastodonAuthenticationController.swift | 5 +- ...ofileFieldAddEntryCollectionViewCell.swift | 1 - .../Cell/ProfileFieldCollectionViewCell.swift | 2 - .../ProfileFieldEditCollectionViewCell.swift | 2 - .../About/ProfileAboutViewController.swift | 7 --- .../ProfileAboutViewModel+Diffable.swift | 1 - .../Profile/About/ProfileAboutViewModel.swift | 1 - .../Bookmark/BookmarkViewController.swift | 6 --- .../Bookmark/BookmarkViewModel+State.swift | 10 ---- .../Profile/CachedProfileViewModel.swift | 3 -- .../FamiliarFollowersViewController.swift | 6 --- .../Favorite/FavoriteViewController.swift | 6 --- .../Favorite/FavoriteViewModel+State.swift | 11 ---- .../FollowedTagsViewController.swift | 5 -- .../FollowedTags/FollowedTagsViewModel.swift | 2 - .../Follower/FollowerListViewController.swift | 6 --- .../FollowerListViewModel+State.swift | 12 ----- .../FollowingListViewController.swift | 6 --- .../FollowingListViewModel+State.swift | 15 +----- .../Header/ProfileHeaderViewController.swift | 13 ----- .../Header/ProfileHeaderViewModel.swift | 1 - .../ProfileHeaderView+Configuration.swift | 1 - .../View/ProfileHeaderView+ViewModel.swift | 1 - .../Header/View/ProfileHeaderView.swift | 5 -- .../Scene/Profile/MeProfileViewModel.swift | 3 -- .../Paging/ProfilePagingViewController.swift | 4 -- .../Paging/ProfilePagingViewModel.swift | 4 -- .../Scene/Profile/ProfileViewController.swift | 20 -------- Mastodon/Scene/Profile/ProfileViewModel.swift | 7 --- .../Profile/RemoteProfileViewModel.swift | 9 ++-- .../Timeline/UserTimelineViewController.swift | 6 --- .../UserTimelineViewModel+State.swift | 11 ---- .../Timeline/UserTimelineViewModel.swift | 6 --- .../FavoritedByViewController.swift | 14 ----- .../RebloggedByViewController.swift | 8 --- .../UserLIst/UserListViewModel+State.swift | 13 ----- .../Profile/UserLIst/UserListViewModel.swift | 2 - .../Report/Report/ReportViewController.swift | 7 --- .../Scene/Report/Report/ReportViewModel.swift | 1 - .../ReportReasonViewController.swift | 8 --- .../ReportResultViewController.swift | 4 -- .../ReportResult/ReportResultViewModel.swift | 1 - .../ReportServerRulesViewController.swift | 8 --- .../ReportStatusViewController.swift | 11 ---- .../ReportStatusViewModel+State.swift | 9 ---- .../ReportStatus/ReportStatusViewModel.swift | 1 - .../ReportSupplementaryViewController.swift | 10 ---- .../ReportStatusTableViewCell+ViewModel.swift | 1 - .../Cell/ReportStatusTableViewCell.swift | 3 -- .../Root/ContentSplitViewController.swift | 4 -- .../Root/MainTab/MainTabBarController.swift | 10 +--- .../Scene/Root/RootSplitViewController.swift | 4 -- .../Root/Sidebar/SidebarViewController.swift | 9 +--- .../Sidebar/View/SidebarListContentView.swift | 11 +--- .../Search/Search/SearchViewController.swift | 1 - .../SearchDetailViewController.swift | 1 - ...ySectionHeaderCollectionReusableView.swift | 1 - .../SearchHistoryViewController.swift | 1 - .../SearchResult/SearchResultSection.swift | 1 - .../SearchResultViewController.swift | 1 - .../Settings/SettingsViewController.swift | 26 ---------- .../Scene/Settings/SettingsViewModel.swift | 12 +---- .../Content/ContentWarningOverlayView.swift | 2 - .../TableviewCell/StatusTableViewCell.swift | 1 - ...tusThreadRootTableViewCell+ViewModel.swift | 1 - .../StatusThreadRootTableViewCell.swift | 6 --- .../ThreadReplyLoaderTableViewCell.swift | 2 - .../Share/Webview/WebViewController.swift | 3 -- .../MastodonStatusThreadViewModel.swift | 6 --- .../Scene/Thread/RemoteThreadViewModel.swift | 1 - .../Scene/Thread/ThreadViewController.swift | 9 ---- .../Thread/ThreadViewModel+Diffable.swift | 8 --- .../ThreadViewModel+LoadThreadState.swift | 20 +------- Mastodon/Scene/Thread/ThreadViewModel.swift | 6 --- ...wViewControllerAnimatedTransitioning.swift | 3 -- .../MediaPreviewTransitionController.swift | 4 -- ...lViewControllerAnimatedTransitioning.swift | 6 --- .../ViewControllerAnimatedTransitioning.swift | 6 --- Mastodon/Supporting Files/AppDelegate.swift | 9 +--- Mastodon/Supporting Files/SceneDelegate.swift | 10 ---- MastodonSDK/Package.swift | 2 - .../Sources/CoreDataStack/CoreDataStack.swift | 9 +--- .../Extension/NSManagedObjectContext.swift | 1 - .../Sources/MastodonCore/AppContext.swift | 5 -- .../Sources/MastodonCore/AuthContext.swift | 7 +-- .../MastodonCore/Extension/FileManager.swift | 6 +-- .../Extension/NSItemProvider.swift | 4 -- .../FeedFetchedResultsController.swift | 3 -- .../FollowedTagsFetchedResultController.swift | 2 - ...SearchHistoryFetchedResultController.swift | 2 - .../SettingFetchedResultController.swift | 2 - .../StatusFetchedResultsController.swift | 1 - .../UserFetchedResultsController.swift | 1 - .../Persistence/Persistence+Card.swift | 10 ---- .../Persistence+MastodonUser.swift | 3 -- .../Persistence+Notification.swift | 2 - .../Persistence/Persistence+Poll.swift | 10 ---- .../Persistence/Persistence+PollOption.swift | 2 - .../Persistence+SearchHistory.swift | 2 - .../Persistence/Persistence+Status.swift | 12 ----- .../Persistence/Persistence+Tag.swift | 2 - .../Service/API/APIService+Account.swift | 6 --- .../Service/API/APIService+Filter.swift | 1 - .../API/APIService+Status+Publish.swift | 1 - .../API/APIService+Subscriptions.swift | 5 -- .../Service/API/APIService+Tags.swift | 1 - .../Service/API/APIService+Thread.swift | 1 - .../MastodonCore/Service/API/APIService.swift | 1 - .../APIService+CoreData+Instance.swift | 4 +- .../APIService+CoreData+InstanceV2.swift | 8 +-- ...vice+CoreData+MastodonAuthentication.swift | 1 - .../APIService+CoreData+Setting.swift | 1 - .../APIService+CoreData+Subscriptions.swift | 1 - .../Service/AuthenticationService.swift | 5 -- ...rvice+CustomEmojiViewModel+LoadState.swift | 9 +--- .../Service/Emoji/EmojiService.swift | 1 - .../Service/InstanceService.swift | 17 ++----- ...astodonAttachmentService+UploadState.swift | 9 ---- .../MastodonAttachmentService.swift | 6 --- .../Notification/NotificationService.swift | 15 ------ .../Service/PhotoLibraryService.swift | 1 - .../PublisherService/PublisherService.swift | 8 --- .../MastodonCore/Service/SettingService.swift | 19 +------ .../Service/StatusFilterService.swift | 4 -- .../Service/StatusPublishService.swift | 51 ------------------- .../Vendor/ItemProviderLoader.swift | 7 --- .../MastodonSDK/API/Mastodon+API.swift | 1 - .../MastodonSDK/Query/SerialStream.swift | 19 +------ .../Attachment/AttachmentView.swift | 3 -- .../AttachmentViewModel+Compress.swift | 7 --- .../AttachmentViewModel+DragAndDrop.swift | 1 - .../Attachment/AttachmentViewModel+Load.swift | 2 - .../AttachmentViewModel+Upload.swift | 13 ----- .../Attachment/AttachmentViewModel.swift | 7 --- .../AutoCompleteViewController.swift | 2 - .../AutoCompleteViewModel+State.swift | 11 ---- .../ComposeContentViewController.swift | 11 ---- ...oseContentViewModel+MetaTextDelegate.swift | 1 - ...eContentViewModel+UITextViewDelegate.swift | 2 - .../ComposeContentViewModel.swift | 9 ---- .../Poll/PollOptionTextField.swift | 3 -- .../Publisher/MastodonStatusPublisher.swift | 5 -- .../ComposeContentTableViewCell.swift | 3 -- .../Toolbar/ComposeContentToolbarView.swift | 1 - .../View/ComposeContentView.swift | 6 --- .../View/Container/AudioContainerView.swift | 1 - .../Container/MediaGridContainerView.swift | 5 -- ...liarFollowersDashboardView+ViewModel.swift | 3 -- .../Content/NotificationView+ViewModel.swift | 3 -- .../View/Content/NotificationView.swift | 8 --- .../Content/ProfileCardView+ViewModel.swift | 2 - .../View/Content/ProfileCardView.swift | 5 -- .../View/Content/StatusAuthorView.swift | 2 - .../View/Content/StatusView+ViewModel.swift | 3 -- .../MastodonUI/View/Content/StatusView.swift | 9 ---- .../View/Control/ActionToolbarContainer.swift | 7 +-- .../Control/ContentWarningOverlayView.swift | 3 -- .../Control/ProfileStatusDashboardView.swift | 2 - .../View/Control/StripProgressView.swift | 3 -- ...ofileCardTableViewCell+Configuration.swift | 1 - .../ProfileCardTableViewCell.swift | 3 -- .../TimelineMiddleLoaderTableViewCell.swift | 2 - .../View/Utility/ViewLayoutFrame.swift | 3 -- .../API/MastodonSDK+API+AccountTests.swift | 1 - .../API/MastodonSDK+API+AppTests.swift | 3 -- .../API/MastodonSDK+API+Instance.swift | 1 - .../API/MastodonSDK+API+OAuthTests.swift | 2 - .../API/MastodonSDK+API+OnboardingTests.swift | 5 +- .../API/MastodonSDK+API+TimelineTests.swift | 1 - .../NotificationService+Decrypt.swift | 5 -- Podfile.lock | 6 +-- .../Scene/ShareViewController.swift | 18 ------- .../Scene/ShareViewModel.swift | 3 -- 242 files changed, 51 insertions(+), 1376 deletions(-) delete mode 100644 Mastodon/Extension/OSLog.swift diff --git a/Localization/StringsConvertor/Sources/StringsConvertor/main.swift b/Localization/StringsConvertor/Sources/StringsConvertor/main.swift index 65d2bb457..061448826 100644 --- a/Localization/StringsConvertor/Sources/StringsConvertor/main.swift +++ b/Localization/StringsConvertor/Sources/StringsConvertor/main.swift @@ -1,4 +1,3 @@ -import os.log import Foundation // conver i18n JSON templates to strings files @@ -12,15 +11,13 @@ private func convert(from inputDirectoryURL: URL, to outputDirectory: URL) { for inputLanguageDirectoryURL in inputLanguageDirectoryURLs { let language = inputLanguageDirectoryURL.lastPathComponent guard let mappedLanguage = map(language: language) else { continue } - os_log("%{public}s[%{public}ld], %{public}s: process %s -> %s", ((#file as NSString).lastPathComponent), #line, #function, language, mappedLanguage) - + let fileURLs = try FileManager.default.contentsOfDirectory( at: inputLanguageDirectoryURL, includingPropertiesForKeys: [.nameKey, .isDirectoryKey], options: [] ) for jsonURL in fileURLs where jsonURL.pathExtension == "json" { - os_log("%{public}s[%{public}ld], %{public}s: process %s", ((#file as NSString).lastPathComponent), #line, #function, jsonURL.debugDescription) let filename = jsonURL.deletingPathExtension().lastPathComponent guard let (mappedFilename, keyStyle) = map(filename: filename) else { continue } guard let bundle = bundle(filename: filename) else { continue } @@ -40,7 +37,6 @@ private func convert(from inputDirectoryURL: URL, to outputDirectory: URL) { } } } catch { - os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) exit(1) } } @@ -103,7 +99,6 @@ private func process(url: URL, keyStyle: Parser.KeyStyle) throws -> String { let strings = parser.generateStrings(keyStyle: keyStyle) return strings } catch { - os_log("%{public}s[%{public}ld], %{public}s: error: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) throw error } } @@ -120,15 +115,13 @@ private func move(from inputDirectoryURL: URL, to outputDirectoryURL: URL, pathE let language = inputLanguageDirectoryURL.lastPathComponent guard let mappedLanguage = map(language: language) else { continue } let outputDirectoryURL = outputDirectoryURL.appendingPathComponent(mappedLanguage + ".lproj", isDirectory: true) - os_log("%{public}s[%{public}ld], %{public}s: process %s -> %s", ((#file as NSString).lastPathComponent), #line, #function, language, mappedLanguage) - + let fileURLs = try FileManager.default.contentsOfDirectory( at: inputLanguageDirectoryURL, includingPropertiesForKeys: [.nameKey, .isDirectoryKey], options: [] ) for dictURL in fileURLs where dictURL.pathExtension == pathExtension { - os_log("%{public}s[%{public}ld], %{public}s: process %s", ((#file as NSString).lastPathComponent), #line, #function, dictURL.debugDescription) let filename = dictURL.deletingPathExtension().lastPathComponent let outputFileURL = outputDirectoryURL.appendingPathComponent(filename).appendingPathExtension(pathExtension) @@ -137,7 +130,6 @@ private func move(from inputDirectoryURL: URL, to outputDirectoryURL: URL, pathE } } } catch { - os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) exit(2) } } diff --git a/Mastodon.xcodeproj/project.pbxproj b/Mastodon.xcodeproj/project.pbxproj index baacb4630..2eb48b787 100644 --- a/Mastodon.xcodeproj/project.pbxproj +++ b/Mastodon.xcodeproj/project.pbxproj @@ -158,7 +158,6 @@ D8F8A03C29CA5CB6000195DD /* HashtagWidget.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */; }; DB0009A626AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; settings = {ATTRIBUTES = (codegen, ); }; }; DB0009A726AEE5DC009B9D2D /* Intents.intentdefinition in Sources */ = {isa = PBXBuildFile; fileRef = DB0009A926AEE5DC009B9D2D /* Intents.intentdefinition */; }; - DB0140CF25C42AEE00F9F3CF /* OSLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB0140CE25C42AEE00F9F3CF /* OSLog.swift */; }; DB023D26279FFB0A005AC798 /* ShareActivityProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D25279FFB0A005AC798 /* ShareActivityProvider.swift */; }; DB023D2827A0FABD005AC798 /* NotificationTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D2727A0FABD005AC798 /* NotificationTableViewCellDelegate.swift */; }; DB023D2A27A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB023D2927A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift */; }; @@ -809,7 +808,6 @@ D8F8A03B29CA5CB6000195DD /* HashtagWidget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashtagWidget.swift; sourceTree = ""; }; DB0009A826AEE5DC009B9D2D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.intentdefinition; name = Base; path = Base.lproj/Intents.intentdefinition; sourceTree = ""; }; DB0009AD26AEE5E4009B9D2D /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Intents.strings; sourceTree = ""; }; - DB0140CE25C42AEE00F9F3CF /* OSLog.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OSLog.swift; sourceTree = ""; }; DB023D25279FFB0A005AC798 /* ShareActivityProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareActivityProvider.swift; sourceTree = ""; }; DB023D2727A0FABD005AC798 /* NotificationTableViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationTableViewCellDelegate.swift; sourceTree = ""; }; DB023D2927A0FE5C005AC798 /* DataSourceProvider+NotificationTableViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DataSourceProvider+NotificationTableViewCellDelegate.swift"; sourceTree = ""; }; @@ -2525,7 +2523,6 @@ 2D206B8525F5FB0900143C56 /* Double.swift */, DBB3BA2926A81C020004F2D4 /* FLAnimatedImageView.swift */, DB68586325E619B700F0A850 /* NSKeyValueObservation.swift */, - DB0140CE25C42AEE00F9F3CF /* OSLog.swift */, 2D939AB425EDD8A90076FA61 /* String.swift */, DB68A06225E905E000CFDF14 /* UIApplication.swift */, DB45FAB525CA5485005A8AC7 /* UIAlertController.swift */, @@ -3818,7 +3815,6 @@ D87BFC8B291D5C6B00FEE264 /* MastodonLoginView.swift in Sources */, DB6180F826391D660018D199 /* MediaPreviewingViewController.swift in Sources */, DBEFCD71282A12B200C0ABEA /* ReportReasonViewController.swift in Sources */, - DB0140CF25C42AEE00F9F3CF /* OSLog.swift in Sources */, DB98EB5627B0FF1B0082E365 /* ReportViewControllerAppearance.swift in Sources */, DB3EA8E6281B79E200598866 /* DiscoveryCommunityViewController.swift in Sources */, 2D206B8625F5FB0900143C56 /* Double.swift in Sources */, diff --git a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved index e89928123..1588649b2 100644 --- a/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Mastodon.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -181,15 +181,6 @@ "version": "2.4.3" } }, - { - "package": "swiftui-introspect", - "repositoryURL": "https://github.com/siteline/SwiftUI-Introspect.git", - "state": { - "branch": null, - "revision": "121c146fe591b1320238d054ae35c81ffa45f45a", - "version": "0.12.0" - } - }, { "package": "TabBarPager", "repositoryURL": "https://github.com/TwidereProject/TabBarPager.git", diff --git a/Mastodon/Diffable/Discovery/DiscoverySection.swift b/Mastodon/Diffable/Discovery/DiscoverySection.swift index 225b6f46a..d15d60f86 100644 --- a/Mastodon/Diffable/Discovery/DiscoverySection.swift +++ b/Mastodon/Diffable/Discovery/DiscoverySection.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-13. // -import os.log import UIKit import MastodonCore import MastodonUI @@ -20,8 +19,6 @@ enum DiscoverySection: CaseIterable { extension DiscoverySection { - static let logger = Logger(subsystem: "DiscoverySection", category: "logic") - class Configuration { let authContext: AuthContext weak var profileCardTableViewCellDelegate: ProfileCardTableViewCellDelegate? diff --git a/Mastodon/Diffable/Report/ReportSection.swift b/Mastodon/Diffable/Report/ReportSection.swift index 4c8fd4345..99e04ea1f 100644 --- a/Mastodon/Diffable/Report/ReportSection.swift +++ b/Mastodon/Diffable/Report/ReportSection.swift @@ -11,7 +11,6 @@ import CoreDataStack import Foundation import MastodonSDK import UIKit -import os.log import MastodonAsset import MastodonCore import MastodonUI diff --git a/Mastodon/Diffable/Status/StatusSection.swift b/Mastodon/Diffable/Status/StatusSection.swift index e134a17cb..586764f42 100644 --- a/Mastodon/Diffable/Status/StatusSection.swift +++ b/Mastodon/Diffable/Status/StatusSection.swift @@ -8,7 +8,6 @@ import Combine import CoreData import CoreDataStack -import os.log import UIKit import AVKit import AlamofireImage @@ -24,8 +23,6 @@ enum StatusSection: Equatable, Hashable { extension StatusSection { - static let logger = Logger(subsystem: "StatusSection", category: "logic") - struct Configuration { let context: AppContext let authContext: AuthContext @@ -196,7 +193,6 @@ extension StatusSection { else { return false } guard !poll.expired else { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): poll expired. Skip update poll \(poll.id)") return false } @@ -209,10 +205,9 @@ extension StatusSection { #endif guard timeIntervalSinceUpdate > autoRefreshTimeInterval else { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): skip update poll \(poll.id) due to recent updated") return false } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): update poll \(poll.id)…") + return true }() diff --git a/Mastodon/Diffable/User/UserSection.swift b/Mastodon/Diffable/User/UserSection.swift index 24f13ddc6..0c4a47b46 100644 --- a/Mastodon/Diffable/User/UserSection.swift +++ b/Mastodon/Diffable/User/UserSection.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-11-1. // -import os.log import UIKit import CoreData import CoreDataStack @@ -20,9 +19,6 @@ enum UserSection: Hashable { } extension UserSection { - - static let logger = Logger(subsystem: "StatusSection", category: "logic") - struct Configuration { weak var userTableViewCellDelegate: UserTableViewCellDelegate? } diff --git a/Mastodon/Extension/OSLog.swift b/Mastodon/Extension/OSLog.swift deleted file mode 100644 index 0121200d9..000000000 --- a/Mastodon/Extension/OSLog.swift +++ /dev/null @@ -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 - }() -} diff --git a/Mastodon/Protocol/Provider/DataSourceFacade+Media.swift b/Mastodon/Protocol/Provider/DataSourceFacade+Media.swift index 9dd97f38a..8379f08e9 100644 --- a/Mastodon/Protocol/Provider/DataSourceFacade+Media.swift +++ b/Mastodon/Protocol/Provider/DataSourceFacade+Media.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-26. // -import os.log import UIKit import CoreDataStack import MastodonUI @@ -154,8 +153,6 @@ extension DataSourceFacade { user: ManagedObjectRecord, previewContext: ImagePreviewContext ) async throws { - let logger = Logger(subsystem: "DataSourceFacade", category: "Media") - let managedObjectContext = dependency.context.managedObjectContext var _avatarAssetURL: String? @@ -227,7 +224,6 @@ extension DataSourceFacade { }() guard mediaPreviewItem.isAssetURLValid else { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): discard preview due to assetURL invalid") return } diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewControllerNavigateable.swift b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewControllerNavigateable.swift index b8cf026d4..f90827863 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewControllerNavigateable.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+StatusTableViewControllerNavigateable.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-2-16. // -import os.log import UIKit import CoreDataStack import MastodonCore @@ -37,7 +36,6 @@ extension StatusTableViewControllerNavigateableCore where Self: DataSourceProvid guard let rawValue = sender.propertyList as? String, let navigation = StatusTableViewNavigation(rawValue: rawValue) else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, navigation.title) Task { switch navigation { case .openAuthorProfile: await openAuthorProfile(target: .status) diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift b/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift index 35ef7761e..6292d4b22 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+TableViewControllerNavigateable.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-2-16. // -import os.log import UIKit import MastodonCore @@ -34,7 +33,6 @@ extension TableViewControllerNavigateableCore { guard let rawValue = sender.propertyList as? String, let navigation = TableViewNavigation(rawValue: rawValue) else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, navigation.title) switch navigation { case .up: navigate(direction: .up) case .down: navigate(direction: .down) diff --git a/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift b/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift index 299951ce2..611223df8 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider+UITableViewDelegate.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-17. // -import os.log import UIKit import CoreDataStack import MastodonCore @@ -126,7 +125,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV attributes: [], state: .off ) { [weak self] _ in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: save photo", ((#file as NSString).lastPathComponent), #line, #function) guard let self = self else { return } Task { @MainActor in do { @@ -157,7 +155,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV attributes: [], state: .off ) { [weak self] _ in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: copy photo", ((#file as NSString).lastPathComponent), #line, #function) guard let self = self else { return } Task { try await self.context.photoLibraryService.copy( @@ -173,7 +170,6 @@ extension UITableViewDelegate where Self: DataSourceProvider & MediaPreviewableV attributes: [], state: .off ) { [weak self] _ in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: share", ((#file as NSString).lastPathComponent), #line, #function) guard let self = self else { return } Task { let applicationActivities: [UIActivity] = [ diff --git a/Mastodon/Protocol/Provider/DataSourceProvider.swift b/Mastodon/Protocol/Provider/DataSourceProvider.swift index e4287b6b9..6df47ccae 100644 --- a/Mastodon/Protocol/Provider/DataSourceProvider.swift +++ b/Mastodon/Protocol/Provider/DataSourceProvider.swift @@ -6,7 +6,6 @@ // Copyright © 2021 Twidere. All rights reserved. // -import os.log import UIKit import CoreDataStack import MastodonSDK diff --git a/Mastodon/Protocol/StatusTableViewControllerNavigateable.swift b/Mastodon/Protocol/StatusTableViewControllerNavigateable.swift index a35fae7b7..6539137a5 100644 --- a/Mastodon/Protocol/StatusTableViewControllerNavigateable.swift +++ b/Mastodon/Protocol/StatusTableViewControllerNavigateable.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-5-19. // -import os.log import UIKit import MastodonAsset import MastodonLocalization diff --git a/Mastodon/Protocol/TableViewControllerNavigateable.swift b/Mastodon/Protocol/TableViewControllerNavigateable.swift index 4189d0cfc..5a96e74ff 100644 --- a/Mastodon/Protocol/TableViewControllerNavigateable.swift +++ b/Mastodon/Protocol/TableViewControllerNavigateable.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-5-21. // -import os.log import UIKit import MastodonAsset import MastodonLocalization diff --git a/Mastodon/Scene/Account/AccountListViewModel.swift b/Mastodon/Scene/Account/AccountListViewModel.swift index 2b8c75b8d..1aa50f2ea 100644 --- a/Mastodon/Scene/Account/AccountListViewModel.swift +++ b/Mastodon/Scene/Account/AccountListViewModel.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-9-13. // -import os.log import UIKit import Combine import CoreData @@ -172,11 +171,6 @@ extension AccountListViewModel { // MARK: - NSFetchedResultsControllerDelegate extension AccountListViewModel: NSFetchedResultsControllerDelegate { - - public func controllerWillChangeContent(_ controller: NSFetchedResultsController) { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - public func controllerDidChangeContent(_ controller: NSFetchedResultsController) { guard controller === mastodonAuthenticationFetchedResultsController else { assertionFailure() diff --git a/Mastodon/Scene/Account/AccountViewController.swift b/Mastodon/Scene/Account/AccountViewController.swift index 75ea91fd6..475badab8 100644 --- a/Mastodon/Scene/Account/AccountViewController.swift +++ b/Mastodon/Scene/Account/AccountViewController.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-9-13. // -import os.log import UIKit import Combine import CoreDataStack @@ -16,8 +15,6 @@ import MastodonCore final class AccountListViewController: UIViewController, NeedsDependency { - let logger = Logger(subsystem: "AccountListViewController", category: "UI") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -154,12 +151,10 @@ extension AccountListViewController { extension AccountListViewController { @objc private func addBarButtonItem(_ sender: UIBarButtonItem) { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") _ = coordinator.present(scene: .welcome, from: self, transition: .modal(animated: true, completion: nil)) } override func accessibilityPerformEscape() -> Bool { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") dismiss(animated: true, completion: nil) return true } diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusAttachmentCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusAttachmentCollectionViewCell.swift index 046247507..d7bfe9928 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusAttachmentCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusAttachmentCollectionViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-17. // -import os.log import UIKit import Combine import MastodonUI @@ -18,8 +17,6 @@ protocol ComposeStatusAttachmentCollectionViewCellDelegate: AnyObject { final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell { - let logger = Logger(subsystem: "ComposeStatusAttachmentCollectionViewCell", category: "UI") - var disposeBag = Set() static let verticalMarginHeight: CGFloat = ComposeStatusAttachmentCollectionViewCell.removeButtonSize.height * 0.5 @@ -45,62 +42,21 @@ final class ComposeStatusAttachmentCollectionViewCell: UICollectionViewCell { override func prepareForReuse() { super.prepareForReuse() -// attachmentContainerView.activityIndicatorView.startAnimating() -// attachmentContainerView.previewImageView.af.cancelImageRequest() -// attachmentContainerView.previewImageView.image = .placeholder(color: .systemFill) -// delegate = nil -// disposeBag.removeAll() } override init(frame: CGRect) { super.init(frame: frame) - _init() } required init?(coder: NSCoder) { super.init(coder: coder) - _init() } - deinit { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - } - -} - -extension ComposeStatusAttachmentCollectionViewCell { - - private func _init() { - // selectionStyle = .none - -// attachmentContainerView.translatesAutoresizingMaskIntoConstraints = false -// contentView.addSubview(attachmentContainerView) -// NSLayoutConstraint.activate([ -// attachmentContainerView.topAnchor.constraint(equalTo: contentView.topAnchor, constant: ComposeStatusAttachmentCollectionViewCell.verticalMarginHeight), -// attachmentContainerView.leadingAnchor.constraint(equalTo: contentView.readableContentGuide.leadingAnchor), -// attachmentContainerView.trailingAnchor.constraint(equalTo: contentView.readableContentGuide.trailingAnchor), -// contentView.bottomAnchor.constraint(equalTo: attachmentContainerView.bottomAnchor, constant: ComposeStatusAttachmentCollectionViewCell.verticalMarginHeight), -// attachmentContainerView.heightAnchor.constraint(equalToConstant: 205).priority(.defaultHigh), -// ]) -// -// removeButton.translatesAutoresizingMaskIntoConstraints = false -// contentView.addSubview(removeButton) -// NSLayoutConstraint.activate([ -// removeButton.centerXAnchor.constraint(equalTo: attachmentContainerView.trailingAnchor), -// removeButton.centerYAnchor.constraint(equalTo: attachmentContainerView.topAnchor), -// removeButton.widthAnchor.constraint(equalToConstant: ComposeStatusAttachmentCollectionViewCell.removeButtonSize.width).priority(.defaultHigh), -// removeButton.heightAnchor.constraint(equalToConstant: ComposeStatusAttachmentCollectionViewCell.removeButtonSize.height).priority(.defaultHigh), -// ]) -// -// removeButton.addTarget(self, action: #selector(ComposeStatusAttachmentCollectionViewCell.removeButtonDidPressed(_:)), for: .touchUpInside) - } - } extension ComposeStatusAttachmentCollectionViewCell { @objc private func removeButtonDidPressed(_ sender: UIButton) { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.composeStatusAttachmentCollectionViewCell(self, removeButtonDidPressed: sender) } diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift index d160ef7f5..e597fca45 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionAppendEntryCollectionViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-23. // -import os.log import UIKit import MastodonAsset import MastodonCore @@ -111,7 +110,6 @@ extension ComposeStatusPollOptionAppendEntryCollectionViewCell { extension ComposeStatusPollOptionAppendEntryCollectionViewCell { @objc private func singleTagGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.composeStatusPollOptionAppendEntryCollectionViewCellDidPressed(self) } diff --git a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift index 96ba4ce59..2bdf49707 100644 --- a/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift +++ b/Mastodon/Scene/Compose/CollectionViewCell/ComposeStatusPollOptionCollectionViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-23. // -import os.log import UIKit import Combine import MastodonAsset @@ -127,7 +126,6 @@ extension ComposeStatusPollOptionCollectionViewCell { extension ComposeStatusPollOptionCollectionViewCell { @objc private func singleTagGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) pollOptionView.optionTextField.becomeFirstResponder() } @@ -144,12 +142,10 @@ extension ComposeStatusPollOptionCollectionViewCell: DeleteBackwardResponseTextF extension ComposeStatusPollOptionCollectionViewCell: UITextFieldDelegate { func textFieldDidBeginEditing(_ textField: UITextField) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.composeStatusPollOptionCollectionViewCell(self, textFieldDidBeginEditing: textField) } func textFieldShouldReturn(_ textField: UITextField) -> Bool { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) if textField === pollOptionView.optionTextField { delegate?.composeStatusPollOptionCollectionViewCell(self, pollOptionTextFieldDidReturn: textField) } diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 23cf1768b..71c797a9c 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-11. // -import os.log import UIKit import Combine import PhotosUI @@ -25,9 +24,7 @@ final class ComposeViewController: UIViewController, NeedsDependency { weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } var disposeBag = Set() - var viewModel: ComposeViewModel! - - let logger = Logger(subsystem: "ComposeViewController", category: "logic") + var viewModel: ComposeViewModel init(viewModel: ComposeViewModel) { self.viewModel = viewModel @@ -114,9 +111,6 @@ final class ComposeViewController: UIViewController, NeedsDependency { button.setTitleColor(Asset.Colors.Label.primaryReverse.color, for: .normal) } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -202,7 +196,6 @@ extension ComposeViewController { extension ComposeViewController { @objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") guard composeContentViewModel.shouldDismiss else { showDismissConfirmAlertController() return @@ -282,11 +275,9 @@ extension ComposeViewController { } override func paste(_ sender: Any?) { - logger.debug("Paste event received") // Look for images on the clipboard if UIPasteboard.general.hasImages, let images = UIPasteboard.general.images { - logger.warning("Got image paste event, however attachments are not yet re-implemented."); let attachmentViewModels = images.map { image in return AttachmentViewModel( api: viewModel.context.apiService, @@ -318,14 +309,8 @@ extension ComposeViewController: UIAdaptivePresentationControllerDelegate { } func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) showDismissConfirmAlertController() } - - func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension ComposeViewController { diff --git a/Mastodon/Scene/Compose/ComposeViewModel.swift b/Mastodon/Scene/Compose/ComposeViewModel.swift index 8992ac7a6..442a47de4 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-11. // -import os.log import UIKit import Combine import CoreData @@ -24,8 +23,6 @@ final class ComposeViewModel { case composeStatus case editStatus(status: Status, statusSource: Mastodon.Entity.StatusSource) } - - let logger = Logger(subsystem: "ComposeViewModel", category: "ViewModel") var disposeBag = Set() diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift index 0ef14b4ca..6e28bbd18 100644 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift +++ b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-29. // -import os.log import UIKit import Combine import MastodonCore @@ -13,9 +12,6 @@ import MastodonUI // Local Timeline final class DiscoveryCommunityViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - - let logger = Logger(subsystem: "DiscoveryCommunityViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } diff --git a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift index 5e98a1ba2..6169e0830 100644 --- a/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift +++ b/Mastodon/Scene/Discovery/Community/DiscoveryCommunityViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-29. // -import os.log import UIKit import Combine import GameplayKit diff --git a/Mastodon/Scene/Discovery/DiscoveryViewController.swift b/Mastodon/Scene/Discovery/DiscoveryViewController.swift index 969ba5534..027f1c216 100644 --- a/Mastodon/Scene/Discovery/DiscoveryViewController.swift +++ b/Mastodon/Scene/Discovery/DiscoveryViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-12. // -import os.log import UIKit import Combine import Tabman @@ -21,8 +20,6 @@ public class DiscoveryViewController: TabmanViewController, NeedsDependency { var disposeBag = Set() - let logger = Logger(subsystem: "DiscoveryViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } diff --git a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift index 64d1231fe..304ea0e1c 100644 --- a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift +++ b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-13. // -import os.log import UIKit import Combine import MastodonCore @@ -13,8 +12,6 @@ import MastodonUI final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -34,9 +31,6 @@ final class DiscoveryHashtagsViewController: UIViewController, NeedsDependency, let refreshControl = RefreshControl() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -100,7 +94,6 @@ extension DiscoveryHashtagsViewController { extension DiscoveryHashtagsViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(indexPath)") guard case let .hashtag(tag) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return } let hashtagTimelineViewModel = HashtagTimelineViewModel(context: context, authContext: viewModel.authContext, hashtag: tag.name) _ = coordinator.present( diff --git a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift index a4c4d7814..d45b711e9 100644 --- a/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift +++ b/Mastodon/Scene/Discovery/Hashtags/DiscoveryHashtagsViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-13. // -import os.log import UIKit import Combine import GameplayKit diff --git a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift index 4884aafac..0d4331ddc 100644 --- a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift +++ b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-13. // -import os.log import UIKit import Combine import MastodonCore @@ -13,8 +12,6 @@ import MastodonUI final class DiscoveryNewsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -33,11 +30,6 @@ final class DiscoveryNewsViewController: UIViewController, NeedsDependency, Medi }() let refreshControl = RefreshControl() - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension DiscoveryNewsViewController { @@ -109,7 +101,6 @@ extension DiscoveryNewsViewController { extension DiscoveryNewsViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(indexPath)") guard case let .link(link) = viewModel.diffableDataSource?.itemIdentifier(for: indexPath) else { return } guard let url = URL(string: link.url) else { return } _ = coordinator.present( diff --git a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift index adc8a786e..86f450781 100644 --- a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift +++ b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel+State.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-13. // -import os.log import Foundation import GameplayKit import MastodonSDK @@ -13,8 +12,6 @@ import MastodonSDK extension DiscoveryNewsViewModel { class State: GKState { - let logger = Logger(subsystem: "DiscoveryNewsViewModel.State", category: "StateMachine") - let id = UUID() weak var viewModel: DiscoveryNewsViewModel? @@ -23,14 +20,6 @@ extension DiscoveryNewsViewModel { self.viewModel = viewModel } - override func didEnter(from previousState: GKState?) { - super.didEnter(from: previousState) - - let from = previousState.flatMap { String(describing: $0) } ?? "nil" - let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") - } - @MainActor func enter(state: State.Type) { stateMachine?.enter(state) diff --git a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift index 7e6bcbde5..52061d5ae 100644 --- a/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift +++ b/Mastodon/Scene/Discovery/News/DiscoveryNewsViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-13. // -import os.log import UIKit import Combine import GameplayKit diff --git a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift index 01b4f7ba8..6e1aa124d 100644 --- a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift +++ b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewController.swift @@ -5,16 +5,12 @@ // Created by MainasuK on 2022-4-12. // -import os.log import UIKit import Combine import MastodonCore import MastodonUI final class DiscoveryPostsViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - - let logger = Logger(subsystem: "TrendPostsViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } diff --git a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift index 7585e5387..7169b8347 100644 --- a/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift +++ b/Mastodon/Scene/Discovery/Posts/DiscoveryPostsViewModel+State.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-12. // -import os.log import Foundation import GameplayKit import MastodonSDK @@ -13,9 +12,6 @@ import MastodonCore extension DiscoveryPostsViewModel { class State: GKState { - - let logger = Logger(subsystem: "DiscoveryPostsViewModel.State", category: "StateMachine") - let id = UUID() weak var viewModel: DiscoveryPostsViewModel? @@ -29,17 +25,12 @@ extension DiscoveryPostsViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -88,9 +79,7 @@ extension DiscoveryPostsViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } diff --git a/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift b/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift index 492541062..65943d7d3 100644 --- a/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift +++ b/Mastodon/Scene/Discovery/View/DiscoveryIntroBannerView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-19. // -import os.log import UIKit import Combine import MastodonAsset @@ -18,9 +17,6 @@ public protocol DiscoveryIntroBannerViewDelegate: AnyObject { } public final class DiscoveryIntroBannerView: UIView { - - let logger = Logger(subsystem: "DiscoveryIntroBannerView", category: "View") - var _disposeBag = Set() public weak var delegate: DiscoveryIntroBannerViewDelegate? @@ -90,7 +86,6 @@ extension DiscoveryIntroBannerView { extension DiscoveryIntroBannerView { @objc private func closeButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.discoveryIntroBannerView(self, closeButtonDidPressed: sender) } } diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift index c41b7b5f4..a387b99ea 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewController.swift @@ -5,7 +5,6 @@ // Created by BradGao on 2021/3/30. // -import os.log import UIKit import AVKit import Combine @@ -19,8 +18,6 @@ import MastodonSDK final class HashtagTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "HashtagTimelineViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -61,10 +58,6 @@ final class HashtagTimelineViewController: UIViewController, NeedsDependency, Me }() let refreshControl = RefreshControl() - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function) - } } extension HashtagTimelineViewController { @@ -205,7 +198,6 @@ extension HashtagTimelineViewController { } @objc private func composeBarButtonItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let hashtag = "#" + viewModel.hashtag UITextChecker.learnWord(hashtag) let composeViewModel = ComposeViewModel( diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+Diffable.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+Diffable.swift index c7c0a3bd7..8cc185382 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+Diffable.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+Diffable.swift @@ -5,7 +5,6 @@ // Created by BradGao on 2021/3/30. // -import os.log import UIKit import Combine import CoreData @@ -40,7 +39,6 @@ extension HashtagTimelineViewModel { .sink { [weak self] records in guard let self = self else { return } guard let diffableDataSource = self.diffableDataSource else { return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): incoming \(records.count) objects") var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.main]) diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift index c35715f1e..5913871f2 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel+State.swift @@ -5,7 +5,6 @@ // Created by BradGao on 2021/3/31. // -import os.log import Foundation import GameplayKit import CoreDataStack @@ -13,8 +12,6 @@ import CoreDataStack extension HashtagTimelineViewModel { class State: GKState { - let logger = Logger(subsystem: "HashtagTimelineViewModel.LoadOldestState", category: "StateMachine") - let id = UUID() var name: String { @@ -32,17 +29,12 @@ extension HashtagTimelineViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(self.name)") - } } } @@ -90,9 +82,7 @@ extension HashtagTimelineViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } @@ -178,7 +168,6 @@ extension HashtagTimelineViewModel.State { viewModel.fetchedResultsController.append(statusIDs: statusIDs) viewModel.didLoadLatest.send() } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift index 888bc720c..fbdc42a1c 100644 --- a/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift +++ b/Mastodon/Scene/HashtagTimeline/HashtagTimelineViewModel.swift @@ -5,7 +5,6 @@ // Created by BradGao on 2021/3/30. // -import os.log import UIKit import Combine import CoreData @@ -15,9 +14,7 @@ import MastodonSDK import MastodonCore final class HashtagTimelineViewModel { - - let logger = Logger(subsystem: "HashtagTimelineViewModel", category: "ViewModel") - + let hashtag: String var disposeBag = Set() @@ -66,10 +63,6 @@ final class HashtagTimelineViewModel { // end init } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function) - } - func viewWillAppear() { let predicate = Tag.predicate( domain: authContext.mastodonAuthenticationBox.domain, diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift index 768af282e..4673f0b9f 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/2/5. // -import os.log import UIKit import AVKit import Combine @@ -21,9 +20,7 @@ import MastodonUI import MastodonLocalization final class HomeTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - - let logger = Logger(subsystem: "HomeTimelineViewController", category: "UI") - + weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -75,11 +72,6 @@ final class HomeTimelineViewController: UIViewController, NeedsDependency, Media }() let refreshControl = RefreshControl() - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension HomeTimelineViewController { @@ -255,9 +247,6 @@ extension HomeTimelineViewController { let viewFrameInWindow = self.view.convert(self.view.frame, to: nil) guard xPosition >= viewFrameInWindow.minX && xPosition <= viewFrameInWindow.maxX else { return } - - // works on iOS 14 - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): receive notification \(xPosition)") // check if scroll to top guard self.shouldRestoreScrollPosition() else { return } @@ -459,7 +448,6 @@ extension HomeTimelineViewController { let cellFrameInView = tableView.convert(anchorCell.frame, to: view) return cellFrameInView.origin.y }() - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): save position record for \(anchorIndexPath) with offset: \(offset)") viewModel.scrollPositionRecord = HomeTimelineViewModel.ScrollPositionRecord( item: anchorItem, offset: offset, diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift index 6da6a60fa..18cbf18d2 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+Diffable.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/2/7. // -import os.log import UIKit import CoreData import CoreDataStack diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift index 71dd4ec0e..5cce90694 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadLatestState.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/2/5. // -import os.log import func QuartzCore.CACurrentMediaTime import Foundation import CoreData @@ -16,8 +15,6 @@ import MastodonCore extension HomeTimelineViewModel { class LoadLatestState: GKState { - let logger = Logger(subsystem: "HomeTimelineViewModel.LoadLatestState", category: "StateMachine") - let id = UUID() var name: String { @@ -33,7 +30,6 @@ extension HomeTimelineViewModel { override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) let previousState = previousState as? HomeTimelineViewModel.LoadLatestState - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] enter \(self.name), previous: \(previousState?.name ?? "")") viewModel?.loadLatestStateMachinePublisher.send(self) } @@ -41,10 +37,6 @@ extension HomeTimelineViewModel { func enter(state: LoadLatestState.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(self.name)") - } } } @@ -104,7 +96,6 @@ extension HomeTimelineViewModel.LoadLatestState { return feed.status?.id } let end = CACurrentMediaTime() - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: collect statuses id cost: %.2fs", ((#file as NSString).lastPathComponent), #line, #function, end - start) do { let response = try await viewModel.context.apiService.homeTimeline( @@ -119,8 +110,7 @@ extension HomeTimelineViewModel.LoadLatestState { // stop refresher if no new statuses let statuses = response.value let newStatuses = statuses.filter { !latestStatusIDs.contains($0.id) } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): load \(newStatuses.count) new statuses") - + if newStatuses.isEmpty { viewModel.didLoadLatest.send() } else { @@ -136,7 +126,6 @@ extension HomeTimelineViewModel.LoadLatestState { } } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statuses failed: \(error.localizedDescription)") await enter(state: Idle.self) viewModel.didLoadLatest.send() viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error)) diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadOldestState.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadOldestState.swift index 2b02f0360..cf58f06ba 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadOldestState.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel+LoadOldestState.swift @@ -5,16 +5,13 @@ // Created by sxiaojian on 2021/2/5. // -import os.log import Foundation import GameplayKit import MastodonSDK extension HomeTimelineViewModel { class LoadOldestState: GKState { - - let logger = Logger(subsystem: "HomeTimelineViewModel.LoadOldestState", category: "StateMachine") - + let id = UUID() weak var viewModel: HomeTimelineViewModel? @@ -28,17 +25,12 @@ extension HomeTimelineViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: LoadOldestState.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -97,7 +89,6 @@ extension HomeTimelineViewModel.LoadOldestState { viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.finished) } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)") await self.enter(state: Fail.self) viewModel.homeTimelineNavigationBarTitleViewModel.receiveLoadingStateCompletion(.failure(error)) } diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift index 663a38724..040fe45b5 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/2/5. // -import os.log import func AVFoundation.AVMakeRect import UIKit import AVKit @@ -19,8 +18,6 @@ import MastodonUI final class HomeTimelineViewModel: NSObject { - let logger = Logger(subsystem: "HomeTimelineViewModel", category: "ViewModel") - var disposeBag = Set() var observations = Set() @@ -107,11 +104,6 @@ final class HomeTimelineViewModel: NSObject { } .store(in: &disposeBag) } - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension HomeTimelineViewModel { @@ -176,7 +168,6 @@ extension HomeTimelineViewModel { } catch { assertionFailure(error.localizedDescription) } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch more failure: \(error.localizedDescription)") } // reconfigure item again diff --git a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift index 2c201e12b..28475c2d7 100644 --- a/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift +++ b/Mastodon/Scene/HomeTimeline/View/HomeTimelineNavigationBarTitleView.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/3/15. // -import os.log import UIKit import MastodonUI import MastodonAsset @@ -69,12 +68,10 @@ extension HomeTimelineNavigationBarTitleView { extension HomeTimelineNavigationBarTitleView { @objc private func logoButtonDidPressed(_ sender: UIButton) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.homeTimelineNavigationBarTitleView(self, logoButtonDidPressed: sender) } @objc private func buttonDidPressed(_ sender: UIButton) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.homeTimelineNavigationBarTitleView(self, buttonDidPressed: sender) } } @@ -88,7 +85,6 @@ extension HomeTimelineNavigationBarTitleView { } func configure(state: HomeTimelineNavigationBarTitleViewModel.State) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: configure title view: %s", ((#file as NSString).lastPathComponent), #line, #function, state.rawValue) self.state = state // check state block or not diff --git a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift index defb02fde..10840c35f 100644 --- a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift +++ b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageView.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-28. // -import os.log import func AVFoundation.AVMakeRect import UIKit import FLAnimatedImage @@ -92,8 +91,6 @@ extension MediaPreviewImageView { extension MediaPreviewImageView { @objc private func doubleTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - let middleZoomScale = 0.5 * maximumZoomScale if zoomScale >= middleZoomScale { setZoomScale(minimumZoomScale, animated: true) @@ -169,8 +166,6 @@ extension MediaPreviewImageView { } } } - - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: setup image for container %s", ((#file as NSString).lastPathComponent), #line, #function, container.frame.debugDescription) } } @@ -183,7 +178,6 @@ extension MediaPreviewImageView: UIScrollViewDelegate { } func scrollViewDidZoom(_ scrollView: UIScrollView) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) centerScrollViewContents() // set bounce when zoom in diff --git a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift index a431d4dda..2fd2231a1 100644 --- a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift +++ b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-28. // -import os.log import UIKit import Combine import MastodonAsset @@ -32,7 +31,6 @@ final class MediaPreviewImageViewController: UIViewController { let tapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer deinit { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) previewImageView.imageView.af.cancelImageRequest() } } @@ -85,7 +83,6 @@ extension MediaPreviewImageViewController { extension MediaPreviewImageViewController { @objc private func tapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.mediaPreviewImageViewController(self, tapGestureRecognizerDidTrigger: sender) } @@ -131,7 +128,6 @@ extension MediaPreviewImageViewController: UIGestureRecognizerDelegate { // MARK: - UIContextMenuInteractionDelegate extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate { func contextMenuInteraction(_ interaction: UIContextMenuInteraction, configurationForMenuAtLocation location: CGPoint) -> UIContextMenuConfiguration? { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) if #available(iOS 16.0, *) { if previewImageView.liveTextInteraction.hasInteractiveItem(at: previewImageView.imageView.convert(location, from: previewImageView)) { @@ -147,7 +143,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate { let saveAction = UIAction( title: L10n.Common.Controls.Actions.savePhoto, image: UIImage(systemName: "square.and.arrow.down")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off ) { [weak self] _ in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: save photo", ((#file as NSString).lastPathComponent), #line, #function) guard let self = self else { return } self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .savePhoto) } @@ -155,7 +150,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate { let copyAction = UIAction( title: L10n.Common.Controls.Actions.copyPhoto, image: UIImage(systemName: "doc.on.doc")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off ) { [weak self] _ in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: copy photo", ((#file as NSString).lastPathComponent), #line, #function) guard let self = self else { return } self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .copyPhoto) } @@ -163,7 +157,6 @@ extension MediaPreviewImageViewController: UIContextMenuInteractionDelegate { let shareAction = UIAction( title: L10n.Common.Controls.Actions.share, image: UIImage(systemName: "square.and.arrow.up")!, identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off ) { [weak self] _ in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: share", ((#file as NSString).lastPathComponent), #line, #function) guard let self = self else { return } self.delegate?.mediaPreviewImageViewController(self, contextMenuActionPerform: .share) } diff --git a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift index 3a4d9edd2..f54f768ee 100644 --- a/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift +++ b/Mastodon/Scene/MediaPreview/Image/MediaPreviewImageViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-28. // -import os.log import UIKit import Combine import Alamofire diff --git a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift index cd94a7f8d..6eaf104e1 100644 --- a/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift +++ b/Mastodon/Scene/MediaPreview/MediaPreviewViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-28. // -import os.log import UIKit import Combine import Pageboy @@ -42,9 +41,6 @@ final class MediaPreviewViewController: UIViewController, NeedsDependency { button.setTitle("ALT", for: .normal) } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -203,7 +199,6 @@ extension MediaPreviewViewController: MediaPreviewingViewController { let safeAreaInsets = previewImageView.safeAreaInsets let statusBarFrameHeight = view.window?.windowScene?.statusBarManager?.statusBarFrame.height ?? 0 let dismissible = previewImageView.contentOffset.y <= -(safeAreaInsets.top - statusBarFrameHeight) + 3 // add 3pt tolerance - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: dismissible %s", ((#file as NSString).lastPathComponent), #line, #function, dismissible ? "true" : "false") return dismissible } @@ -211,7 +206,6 @@ extension MediaPreviewViewController: MediaPreviewingViewController { return true } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: dismissible false", ((#file as NSString).lastPathComponent), #line, #function) return false } @@ -309,8 +303,8 @@ extension MediaPreviewViewController: MediaPreviewImageViewControllerDelegate { context.photoLibraryService.copy(imageSource: .url(assetURL)) .sink { completion in switch completion { - case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: copy photo fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) + case .failure(_): + break case .finished: break } diff --git a/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewController.swift b/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewController.swift index e924f38d4..022e68e2a 100644 --- a/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewController.swift +++ b/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewController.swift @@ -5,16 +5,13 @@ // Created by MainasuK on 2022-2-9. // -import os.log import UIKit import AVKit import Combine import func AVFoundation.AVMakeRect final class MediaPreviewVideoViewController: UIViewController { - - let logger = Logger(subsystem: "MediaPreviewVideoViewController", category: "ViewController") - + var disposeBag = Set() var viewModel: MediaPreviewVideoViewModel! @@ -23,7 +20,6 @@ final class MediaPreviewVideoViewController: UIViewController { let previewImageView = UIImageView() deinit { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) playerViewController.player?.pause() try? AVAudioSession.sharedInstance().setCategory(.ambient) try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation) @@ -89,24 +85,6 @@ extension MediaPreviewVideoViewController { } // MARK: - ShareActivityProvider -//extension MediaPreviewVideoViewController: ShareActivityProvider { -// var activities: [Any] { -// return [] -// } -// -// var applicationActivities: [UIActivity] { -// switch viewModel.item { -// case .gif(let mediaContext): -// guard let url = mediaContext.assetURL else { return [] } -// return [ -// SavePhotoActivity(context: viewModel.context, url: url, resourceType: .video) -// ] -// default: -// return [] -// } -// } -//} - extension MediaPreviewVideoViewController: MediaPreviewPage { func setShowingChrome(_ showingChrome: Bool) { // TODO: does this do anything? diff --git a/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift b/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift index a6542d464..7d4e42e85 100644 --- a/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift +++ b/Mastodon/Scene/MediaPreview/Video/MediaPreviewVideoViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-2-9. // -import os.log import UIKit import AVKit import Combine @@ -14,8 +13,6 @@ import MastodonCore final class MediaPreviewVideoViewModel { - let logger = Logger(subsystem: "MediaPreviewVideoViewModel", category: "ViewModel") - var disposeBag = Set() // input @@ -61,7 +58,6 @@ final class MediaPreviewVideoViewModel { .receive(on: DispatchQueue.main) .sink { [weak self] status in guard let self = self else { return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): player state: \(status.description)") switch status { case .unknown, .buffering, .readyToPlay: diff --git a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift index 7b994076a..b11b4bf3c 100644 --- a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift +++ b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell+ViewModel.swift @@ -33,8 +33,7 @@ extension NotificationTableViewCell { if notificationView.frame == .zero { // set status view width notificationView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): did layout for new cell") - + notificationView.statusView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin notificationView.quoteStatusView.frame.size.width = tableView.frame.width - containerViewHorizontalMargin // the as same width as statusView } @@ -55,7 +54,6 @@ extension NotificationTableViewCell { .sink { [weak tableView, weak self] _, _ in guard let tableView = tableView else { return } guard let self = self else { return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): tableView updates") UIView.performWithoutAnimation { tableView.beginUpdates() diff --git a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift index d8949e391..bce1ccf7a 100644 --- a/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift +++ b/Mastodon/Scene/Notification/Cell/NotificationTableViewCell.swift @@ -5,16 +5,12 @@ // Created by MainasuK on 2022-1-21. // -import os.log import UIKit import Combine import MastodonCore import MastodonUI final class NotificationTableViewCell: UITableViewCell { - - let logger = Logger(subsystem: "NotificationTableViewCell", category: "View") - weak var delegate: NotificationTableViewCellDelegate? var disposeBag = Set() private var _disposeBag = Set() diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift index 9b7416afc..d081327d3 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-21. // -import os.log import UIKit import Combine import CoreDataStack @@ -14,8 +13,6 @@ import MastodonLocalization final class NotificationTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "NotificationTimelineViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -42,9 +39,6 @@ final class NotificationTimelineViewController: UIViewController, NeedsDependenc let cellFrameCache = NSCache() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -101,13 +95,10 @@ extension NotificationTimelineViewController { let now = Date() if let timestamp = viewModel.lastAutomaticFetchTimestamp { if now.timeIntervalSince(timestamp) > 60 { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): auto fetch latest timeline…") Task { await viewModel.loadLatest() } viewModel.lastAutomaticFetchTimestamp = now - } else { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): auto fetch latest timeline skip. Reason: updated in recent 60s") } } else { Task { @@ -133,8 +124,6 @@ extension NotificationTimelineViewController: CellFrameCacheContainer { extension NotificationTimelineViewController { @objc private func refreshControlValueChanged(_ sender: RefreshControl) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - Task { await viewModel.loadLatest() } diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift index 0331f401e..c412c39a4 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+Diffable.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-21. // -import os.log import UIKit import CoreData import CoreDataStack @@ -36,14 +35,8 @@ extension NotificationTimelineViewModel { .sink { [weak self] records in guard let self = self else { return } guard let diffableDataSource = self.diffableDataSource else { return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): incoming \(records.count) objects") Task { - let start = CACurrentMediaTime() - defer { - let end = CACurrentMediaTime() - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): cost \(end - start, format: .fixed(precision: 4))s to process \(records.count) feeds") - } let oldSnapshot = diffableDataSource.snapshot() var newSnapshot: NSDiffableDataSourceSnapshot = { let newItems = records.map { record in @@ -88,16 +81,12 @@ extension NotificationTimelineViewModel { let hasChanges = newSnapshot.itemIdentifiers != oldSnapshot.itemIdentifiers if !hasChanges { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): snapshot not changes") self.didLoadLatest.send() return - } else { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): snapshot has changes") } await self.updateSnapshotUsingReloadData(snapshot: newSnapshot) self.didLoadLatest.send() - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): applied new snapshot") } // end Task } .store(in: &disposeBag) diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift index ff23d8d6e..fe72df772 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel+LoadOldestState.swift @@ -9,13 +9,10 @@ import CoreDataStack import Foundation import GameplayKit import MastodonSDK -import os.log extension NotificationTimelineViewModel { class LoadOldestState: GKState { - let logger = Logger(subsystem: "NotificationTimelineViewModel.LoadOldestState", category: "StateMachine") - let id = UUID() weak var viewModel: NotificationTimelineViewModel? @@ -29,17 +26,12 @@ extension NotificationTimelineViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: LoadOldestState.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -98,7 +90,6 @@ extension NotificationTimelineViewModel.LoadOldestState { } } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch statues failed: \(error.localizedDescription)") await self.enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift index f4ce7c2d7..a6412d365 100644 --- a/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift +++ b/Mastodon/Scene/Notification/NotificationTimeline/NotificationTimelineViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-21. // -import os.log import UIKit import Combine import CoreDataStack @@ -15,8 +14,6 @@ import MastodonCore final class NotificationTimelineViewModel { - let logger = Logger(subsystem: "NotificationTimelineViewModel", category: "ViewModel") - var disposeBag = Set() // input @@ -63,9 +60,6 @@ final class NotificationTimelineViewModel { ) } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -125,7 +119,6 @@ extension NotificationTimelineViewModel { ) } catch { didLoadLatest.send() - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(error.localizedDescription)") } } @@ -155,7 +148,6 @@ extension NotificationTimelineViewModel { authenticationBox: authContext.mastodonAuthenticationBox ) } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch more failure: \(error.localizedDescription)") } } diff --git a/Mastodon/Scene/Notification/NotificationViewController.swift b/Mastodon/Scene/Notification/NotificationViewController.swift index 79232c072..502e04b7c 100644 --- a/Mastodon/Scene/Notification/NotificationViewController.swift +++ b/Mastodon/Scene/Notification/NotificationViewController.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/4/12. // -import os.log import UIKit import Combine import MastodonAsset @@ -16,8 +15,6 @@ import MastodonCore final class NotificationViewController: TabmanViewController, NeedsDependency { - let logger = Logger(subsystem: "NotificationViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -44,9 +41,6 @@ final class NotificationViewController: TabmanViewController, NeedsDependency { viewModel.currentPageIndex = index } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } extension NotificationViewController { @@ -163,8 +157,6 @@ extension NotificationViewController { extension NotificationViewController { @objc private func pageSegmentedControlValueChanged(_ sender: UISegmentedControl) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - let index = sender.selectedSegmentIndex scrollToPage(.at(index: index), animated: true, completion: nil) } @@ -232,7 +224,6 @@ extension NotificationViewController { } @objc private func showCategory(_ sender: UIKeyCommand) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let rawValue = sender.propertyList as? String, let category = CategorySwitch(rawValue: rawValue) else { return } diff --git a/Mastodon/Scene/Notification/NotificationViewModel.swift b/Mastodon/Scene/Notification/NotificationViewModel.swift index 039653ee5..39c1b9ca5 100644 --- a/Mastodon/Scene/Notification/NotificationViewModel.swift +++ b/Mastodon/Scene/Notification/NotificationViewModel.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/4/12. // -import os.log import UIKit import Combine import Pageboy diff --git a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift index e2eddc16c..64a1f2d5e 100644 --- a/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ConfirmEmail/MastodonConfirmEmailViewController.swift @@ -7,7 +7,6 @@ import Combine import MastodonSDK -import os.log import UIKit import MastodonAsset import MastodonCore @@ -105,7 +104,7 @@ extension MastodonConfirmEmailViewController { .sink { completion in switch completion { case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: swap user access token swap fail: %s", (#file as NSString).lastPathComponent, #line, #function, error.localizedDescription) + break case .finished: // upload avatar and set display name in the background Just(self.viewModel.userToken.accessToken) @@ -120,9 +119,9 @@ extension MastodonConfirmEmailViewController { .sink { completion in switch completion { case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: setup avatar & display name fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) - case .finished: - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: setup avatar & display name success", ((#file as NSString).lastPathComponent), #line, #function) + break + case .finished: + break } } receiveValue: { _ in // do nothing @@ -130,7 +129,6 @@ extension MastodonConfirmEmailViewController { .store(in: &self.context.disposeBag) // execute in the background } // end switch } receiveValue: { response in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: user %s's email confirmed", ((#file as NSString).lastPathComponent), #line, #function, response.value.username) self.coordinator.setup() // self.dismiss(animated: true, completion: nil) } diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift index 5618f2790..886b138b1 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewController.swift @@ -5,7 +5,6 @@ // Created by BradGao on 2021/2/20. // -import os.log import UIKit import Combine import GameController diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+LoadIndexedServerState.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+LoadIndexedServerState.swift index 0c4910d17..f7ccebd84 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+LoadIndexedServerState.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel+LoadIndexedServerState.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021/3/5. // -import os.log import Foundation import GameplayKit import MastodonSDK @@ -17,10 +16,6 @@ extension MastodonPickServerViewModel { init(viewModel: MastodonPickServerViewModel) { self.viewModel = viewModel } - - override func didEnter(from previousState: GKState?) { - os_log("%{public}s[%{public}ld], %{public}s: enter %s, previous: %s", ((#file as NSString).lastPathComponent), #line, #function, self.debugDescription, previousState.debugDescription) - } } } diff --git a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift index 19e9bab3c..00a287b22 100644 --- a/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift +++ b/Mastodon/Scene/Onboarding/PickServer/MastodonPickServerViewModel.swift @@ -5,7 +5,6 @@ // Created by BradGao on 2021/2/23. // -import os.log import UIKit import Combine import GameplayKit @@ -79,9 +78,6 @@ class MastodonPickServerViewModel: NSObject { configure() } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift index 694418c32..9d9f43f59 100644 --- a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift +++ b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift @@ -5,7 +5,6 @@ // Created by BradGao on 2021/2/24. // -import os.log import UIKit import Combine import MastodonSDK diff --git a/Mastodon/Scene/Onboarding/PickServer/View/PickServerServerSectionTableHeaderView.swift b/Mastodon/Scene/Onboarding/PickServer/View/PickServerServerSectionTableHeaderView.swift index 7c686cfb2..a29a4ca74 100644 --- a/Mastodon/Scene/Onboarding/PickServer/View/PickServerServerSectionTableHeaderView.swift +++ b/Mastodon/Scene/Onboarding/PickServer/View/PickServerServerSectionTableHeaderView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-4. // -import os.log import UIKit import Tabman import MastodonAsset diff --git a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift index 588e3a175..c327357bc 100644 --- a/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift +++ b/Mastodon/Scene/Onboarding/Register/MastodonRegisterViewController.swift @@ -8,7 +8,6 @@ import AlamofireImage import Combine import MastodonSDK -import os.log import PhotosUI import UIKit import SwiftUI @@ -21,8 +20,6 @@ final class MastodonRegisterViewController: UIViewController, NeedsDependency, O static let avatarImageMaxSizeInPixel = CGSize(width: 400, height: 400) - let logger = Logger(subsystem: "MastodonRegisterViewController", category: "ViewController") - var disposeBag = Set() private var observations = Set() diff --git a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift index d6870785c..da43547f2 100644 --- a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift +++ b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewController.swift @@ -6,7 +6,6 @@ // import Combine -import os.log import UIKit import WebKit import MastodonCore @@ -27,8 +26,6 @@ final class MastodonResendEmailViewController: UIViewController, NeedsDependency }() deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function) - // cleanup cookie let httpCookieStore = webView.configuration.websiteDataStore.httpCookieStore httpCookieStore.getAllCookies { cookies in @@ -54,7 +51,6 @@ extension MastodonResendEmailViewController { let request = URLRequest(url: viewModel.resendEmailURL) webView.navigationDelegate = self.viewModel.navigationDelegate webView.load(request) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: resendEmail via: %s", (#file as NSString).lastPathComponent, #line, #function, viewModel.resendEmailURL.debugDescription) } } diff --git a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModel.swift b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModel.swift index dc907cc6c..c552c0b8a 100644 --- a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModel.swift +++ b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModel.swift @@ -7,7 +7,6 @@ import Combine import Foundation -import os.log import WebKit final class MastodonResendEmailViewModel { @@ -22,11 +21,6 @@ final class MastodonResendEmailViewModel { self.resendEmailURL = resendEmailURL self.email = email } - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function) - } - } extension MastodonResendEmailViewModel { diff --git a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift index 4a27de96d..79ea5550d 100644 --- a/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift +++ b/Mastodon/Scene/Onboarding/ResendEmail/MastodonResendEmailViewModelNavigationDelegateShim.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/2/25. // -import os.log import Foundation import WebKit @@ -17,9 +16,6 @@ final class MastodonResendEmailViewModelNavigationDelegateShim: NSObject { self.viewModel = viewModel } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift index 871f115ff..49b85106c 100644 --- a/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift +++ b/Mastodon/Scene/Onboarding/ServerRules/MastodonServerRulesViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-2-22. // -import os.log import UIKit import Combine import MastodonSDK @@ -16,9 +15,6 @@ import MastodonCore import MastodonLocalization final class MastodonServerRulesViewController: UIViewController, NeedsDependency { - - let logger = Logger(subsystem: "MastodonServerRulesViewController", category: "ViewController") - var disposeBag = Set() private var observations = Set() diff --git a/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift b/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift index 920164bce..41b4d2355 100644 --- a/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift +++ b/Mastodon/Scene/Onboarding/Share/AuthenticationViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/2/1. // -import os.log import UIKit import CoreData import CoreDataStack @@ -75,9 +74,7 @@ extension AuthenticationViewModel { let components = host.components(separatedBy: ".") guard !components.contains(where: { $0.isEmpty }) else { return nil } guard components.count >= 2 else { return nil } - - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: input host: %s", ((#file as NSString).lastPathComponent), #line, #function, host) - + return host } } @@ -156,7 +153,6 @@ extension AuthenticationViewModel { ) .flatMap { response -> AnyPublisher, Error> in let token = response.value - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: sign in success. Token: %s", ((#file as NSString).lastPathComponent), #line, #function, token.accessToken) return AuthenticationViewModel.verifyAndSaveAuthentication( context: self.context, info: info, @@ -171,7 +167,6 @@ extension AuthenticationViewModel { guard let self = self else { return } switch completion { case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: swap user access token swap fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) self.isAuthenticating.value = false self.error.value = error case .finished: @@ -180,7 +175,6 @@ extension AuthenticationViewModel { } receiveValue: { [weak self] response in guard let self = self else { return } let account = response.value - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: user %s sign in success", ((#file as NSString).lastPathComponent), #line, #function, account.username) self.authenticated.send((domain: info.domain, account: account)) } diff --git a/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift b/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift index e56c7f126..32e76ea5d 100644 --- a/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift +++ b/Mastodon/Scene/Onboarding/Share/MastodonAuthenticationController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-6-4. // -import os.log import UIKit import Combine import AuthenticationServices @@ -44,12 +43,10 @@ extension MastodonAuthenticationController { callbackURLScheme: APIService.callbackURLScheme ) { [weak self] callback, error in guard let self = self else { return } - os_log("%{public}s[%{public}ld], %{public}s: callback: %s, error: %s", ((#file as NSString).lastPathComponent), #line, #function, callback?.debugDescription ?? "", error.debugDescription) - + if let error = error { if let error = error as? ASWebAuthenticationSessionError { if error.errorCode == ASWebAuthenticationSessionError.canceledLogin.rawValue { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: user cancel authentication", ((#file as NSString).lastPathComponent), #line, #function) self.isAuthenticating.value = false return } diff --git a/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift b/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift index f630ec696..e71e3fad7 100644 --- a/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift +++ b/Mastodon/Scene/Profile/About/Cell/ProfileFieldAddEntryCollectionViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-5-26. // -import os.log import UIKit import Combine import MastodonAsset diff --git a/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift b/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift index 00fd21b22..df0719ff1 100644 --- a/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift +++ b/Mastodon/Scene/Profile/About/Cell/ProfileFieldCollectionViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-5-25. // -import os.log import UIKit import Combine import MetaTextKit @@ -186,7 +185,6 @@ extension ProfileFieldCollectionViewCell { // MARK: - MetaLabelDelegate extension ProfileFieldCollectionViewCell: MetaLabelDelegate { func metaLabel(_ metaLabel: MetaLabel, didSelectMeta meta: Meta) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.profileFieldCollectionViewCell(self, metaLabel: metaLabel, didSelectMeta: meta) } } diff --git a/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift b/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift index c7005867c..7cc00ec5c 100644 --- a/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift +++ b/Mastodon/Scene/Profile/About/Cell/ProfileFieldEditCollectionViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-22. // -import os.log import UIKit import Combine import MetaTextKit @@ -127,7 +126,6 @@ extension ProfileFieldEditCollectionViewCell { extension ProfileFieldEditCollectionViewCell { @objc private func editButtonDidPressed(_ sender: UIButton) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.profileFieldEditCollectionViewCell(self, editButtonDidPressed: sender) } } diff --git a/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift b/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift index 2a96a86ab..1a1a1ac6c 100644 --- a/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift +++ b/Mastodon/Scene/Profile/About/ProfileAboutViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-22. // -import os.log import UIKit import Combine import MetaTextKit @@ -20,8 +19,6 @@ protocol ProfileAboutViewControllerDelegate: AnyObject { final class ProfileAboutViewController: UIViewController { - let logger = Logger(subsystem: "ProfileAboutViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -39,9 +36,6 @@ final class ProfileAboutViewController: UIViewController { return collectionView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -129,7 +123,6 @@ extension ProfileAboutViewController { // MARK: - UICollectionViewDelegate extension ProfileAboutViewController: UICollectionViewDelegate { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): select \(indexPath.debugDescription)") guard let diffableDataSource = viewModel.diffableDataSource else { return } guard let item = diffableDataSource.itemIdentifier(for: indexPath) else { return } diff --git a/Mastodon/Scene/Profile/About/ProfileAboutViewModel+Diffable.swift b/Mastodon/Scene/Profile/About/ProfileAboutViewModel+Diffable.swift index eb7a6aaae..5f37f90c1 100644 --- a/Mastodon/Scene/Profile/About/ProfileAboutViewModel+Diffable.swift +++ b/Mastodon/Scene/Profile/About/ProfileAboutViewModel+Diffable.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-22. // -import os.log import UIKit import Combine import MastodonSDK diff --git a/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift b/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift index 8ab427c39..f9a0b1c9d 100644 --- a/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift +++ b/Mastodon/Scene/Profile/About/ProfileAboutViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-22. // -import os.log import UIKit import Combine import CoreDataStack diff --git a/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift b/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift index 458c47335..e4666ad28 100644 --- a/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift +++ b/Mastodon/Scene/Profile/Bookmark/BookmarkViewController.swift @@ -5,7 +5,6 @@ // Created by ProtoLimit on 2022-07-19. // -import os.log import UIKit import AVKit import Combine @@ -17,8 +16,6 @@ import MastodonLocalization final class BookmarkViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "BookmarkViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -39,9 +36,6 @@ final class BookmarkViewController: UIViewController, NeedsDependency, MediaPrev return tableView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift index e86ee92cc..5ec4761cd 100644 --- a/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift +++ b/Mastodon/Scene/Profile/Bookmark/BookmarkViewModel+State.swift @@ -5,7 +5,6 @@ // Created by ProtoLimit on 2022-07-19. // -import os.log import Foundation import GameplayKit import MastodonSDK @@ -14,8 +13,6 @@ import MastodonCore extension BookmarkViewModel { class State: GKState { - let logger = Logger(subsystem: "BookmarkViewModel.State", category: "StateMachine") - let id = UUID() weak var viewModel: BookmarkViewModel? @@ -29,7 +26,6 @@ extension BookmarkViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor @@ -37,9 +33,6 @@ extension BookmarkViewModel { stateMachine?.enter(state) } - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -91,9 +84,7 @@ extension BookmarkViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } @@ -165,7 +156,6 @@ extension BookmarkViewModel.State { } viewModel.statusFetchedResultsController.statusIDs = statusIDs } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user bookmarks fail: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Profile/CachedProfileViewModel.swift b/Mastodon/Scene/Profile/CachedProfileViewModel.swift index cdd572fc4..a769f2a9f 100644 --- a/Mastodon/Scene/Profile/CachedProfileViewModel.swift +++ b/Mastodon/Scene/Profile/CachedProfileViewModel.swift @@ -13,8 +13,5 @@ final class CachedProfileViewModel: ProfileViewModel { init(context: AppContext, authContext: AuthContext, mastodonUser: MastodonUser) { super.init(context: context, authContext: authContext, optionalMastodonUser: mastodonUser) - - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Profile] user[\(mastodonUser.id)] profile: \(mastodonUser.acctWithDomain)") } - } diff --git a/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift b/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift index 56bebaad7..c181f4e95 100644 --- a/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift +++ b/Mastodon/Scene/Profile/FamiliarFollowers/FamiliarFollowersViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-17. // -import os.log import UIKit import Combine import MastodonCore @@ -15,8 +14,6 @@ import CoreDataStack final class FamiliarFollowersViewController: UIViewController, NeedsDependency { - let logger = Logger(subsystem: "FamiliarFollowersViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -31,9 +28,6 @@ final class FamiliarFollowersViewController: UIViewController, NeedsDependency { return tableView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift b/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift index 19f25f3ad..9c55f988f 100644 --- a/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift +++ b/Mastodon/Scene/Profile/Favorite/FavoriteViewController.swift @@ -8,7 +8,6 @@ // Note: Prefer use US favorite then EN favourite in coding // to following the text checker auto-correct behavior -import os.log import UIKit import AVKit import Combine @@ -20,8 +19,6 @@ import MastodonLocalization final class FavoriteViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "FavoriteViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -42,9 +39,6 @@ final class FavoriteViewController: UIViewController, NeedsDependency, MediaPrev return tableView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift index c2dc27201..c4fad013f 100644 --- a/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift +++ b/Mastodon/Scene/Profile/Favorite/FavoriteViewModel+State.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-7. // -import os.log import Foundation import GameplayKit import MastodonCore @@ -14,8 +13,6 @@ import MastodonSDK extension FavoriteViewModel { class State: GKState { - let logger = Logger(subsystem: "FavoriteViewModel.State", category: "StateMachine") - let id = UUID() weak var viewModel: FavoriteViewModel? @@ -29,17 +26,12 @@ extension FavoriteViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -91,9 +83,7 @@ extension FavoriteViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } @@ -165,7 +155,6 @@ extension FavoriteViewModel.State { } viewModel.statusFetchedResultsController.statusIDs = statusIDs } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user favorites fail: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewController.swift b/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewController.swift index 9a31fe0c3..7839832bf 100644 --- a/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewController.swift +++ b/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewController.swift @@ -14,8 +14,6 @@ import MastodonUI import MastodonLocalization final class FollowedTagsViewController: UIViewController, NeedsDependency { - let logger = Logger(subsystem: String(describing: FollowedTagsViewController.self), category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -33,9 +31,6 @@ final class FollowedTagsViewController: UIViewController, NeedsDependency { return tableView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } extension FollowedTagsViewController { diff --git a/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift b/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift index dbcf4d756..c2b8ca77d 100644 --- a/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift +++ b/Mastodon/Scene/Profile/FollowedTags/FollowedTagsViewModel.swift @@ -14,7 +14,6 @@ import MastodonSDK import MastodonCore final class FollowedTagsViewModel: NSObject { - let logger = Logger(subsystem: String(describing: FollowedTagsViewModel.self), category: "ViewModel") var disposeBag = Set() let fetchedResultsController: FollowedTagsFetchedResultController @@ -93,7 +92,6 @@ extension FollowedTagsViewModel { extension FollowedTagsViewModel: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(indexPath)") tableView.deselectRow(at: indexPath, animated: true) let object = fetchedResultsController.records[indexPath.row] diff --git a/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift b/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift index 8094a77d7..501267813 100644 --- a/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift +++ b/Mastodon/Scene/Profile/Follower/FollowerListViewController.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-11-1. // -import os.log import UIKit import GameplayKit import Combine @@ -16,8 +15,6 @@ import CoreDataStack final class FollowerListViewController: UIViewController, NeedsDependency { - let logger = Logger(subsystem: "FollowerListViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -35,9 +32,6 @@ final class FollowerListViewController: UIViewController, NeedsDependency { return tableView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift b/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift index 531c2c380..f8a47aab6 100644 --- a/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift +++ b/Mastodon/Scene/Profile/Follower/FollowerListViewModel+State.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-11-1. // -import os.log import Foundation import GameplayKit import MastodonSDK @@ -15,8 +14,6 @@ import CoreDataStack extension FollowerListViewModel { class State: GKState { - let logger = Logger(subsystem: "FollowerListViewModel.State", category: "StateMachine") - let id = UUID() var name: String { @@ -34,17 +31,12 @@ extension FollowerListViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -97,9 +89,7 @@ extension FollowerListViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } @@ -154,7 +144,6 @@ extension FollowerListViewModel.State { maxID: maxID, authenticationBox: viewModel.authContext.mastodonAuthenticationBox ) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch \(response.value.count) followers") var hasNewAppend = false var userIDs = viewModel.userFetchedResultsController.userIDs @@ -176,7 +165,6 @@ extension FollowerListViewModel.State { viewModel.userFetchedResultsController.userIDs = userIDs } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch follower fail: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Profile/Following/FollowingListViewController.swift b/Mastodon/Scene/Profile/Following/FollowingListViewController.swift index 336eb333e..c80b3169b 100644 --- a/Mastodon/Scene/Profile/Following/FollowingListViewController.swift +++ b/Mastodon/Scene/Profile/Following/FollowingListViewController.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-11-2. // -import os.log import UIKit import GameplayKit import Combine @@ -15,8 +14,6 @@ import MastodonUI import CoreDataStack final class FollowingListViewController: UIViewController, NeedsDependency { - - let logger = Logger(subsystem: "FollowingListViewController", category: "ViewController") weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -35,9 +32,6 @@ final class FollowingListViewController: UIViewController, NeedsDependency { return tableView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/Following/FollowingListViewModel+State.swift b/Mastodon/Scene/Profile/Following/FollowingListViewModel+State.swift index 723e66c8e..b21de6be3 100644 --- a/Mastodon/Scene/Profile/Following/FollowingListViewModel+State.swift +++ b/Mastodon/Scene/Profile/Following/FollowingListViewModel+State.swift @@ -5,15 +5,12 @@ // Created by Cirno MainasuK on 2021-11-2. // -import os.log import Foundation import GameplayKit import MastodonSDK extension FollowingListViewModel { class State: GKState { - - let logger = Logger(subsystem: "FollowingListViewModel.State", category: "StateMachine") let id = UUID() @@ -28,17 +25,12 @@ extension FollowingListViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -91,9 +83,7 @@ extension FollowingListViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } @@ -148,9 +138,7 @@ extension FollowingListViewModel.State { maxID: maxID, authenticationBox: viewModel.authContext.mastodonAuthenticationBox ) - - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch \(response.value.count)") - + var hasNewAppend = false var userIDs = viewModel.userFetchedResultsController.userIDs for user in response.value { @@ -170,7 +158,6 @@ extension FollowingListViewModel.State { viewModel.userFetchedResultsController.userIDs = userIDs } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch following fail: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift b/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift index 934d7d4c4..d912173be 100644 --- a/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift +++ b/Mastodon/Scene/Profile/Header/ProfileHeaderViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-29. // -import os.log import UIKit import Combine import CoreDataStack @@ -27,8 +26,6 @@ protocol ProfileHeaderViewControllerDelegate: AnyObject { final class ProfileHeaderViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "ProfileHeaderViewController", category: "ViewController") - static let segmentedControlHeight: CGFloat = 50 static let headerMinHeight: CGFloat = segmentedControlHeight @@ -84,9 +81,6 @@ final class ProfileHeaderViewController: UIViewController, NeedsDependency, Medi return documentPickerController }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -202,7 +196,6 @@ extension ProfileHeaderViewController { var children: [UIMenuElement] = [] let photoLibraryAction = UIAction(title: L10n.Scene.Compose.MediaSelection.photoLibrary, image: UIImage(systemName: "rectangle.on.rectangle"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] _ in guard let self = self else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: mediaSelectionType: .photoLibaray", ((#file as NSString).lastPathComponent), #line, #function) self.currentImageType = type self.present(self.imagePicker, animated: true, completion: nil) } @@ -210,7 +203,6 @@ extension ProfileHeaderViewController { if UIImagePickerController.isSourceTypeAvailable(.camera) { let cameraAction = UIAction(title: L10n.Scene.Compose.MediaSelection.camera, image: UIImage(systemName: "camera"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off, handler: { [weak self] _ in guard let self = self else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: mediaSelectionType: .camera", ((#file as NSString).lastPathComponent), #line, #function) self.currentImageType = type self.present(self.imagePickerController, animated: true, completion: nil) }) @@ -218,7 +210,6 @@ extension ProfileHeaderViewController { } let browseAction = UIAction(title: L10n.Scene.Compose.MediaSelection.browse, image: UIImage(systemName: "ellipsis"), identifier: nil, discoverabilityTitle: nil, attributes: [], state: .off) { [weak self] _ in guard let self = self else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: mediaSelectionType: .browse", ((#file as NSString).lastPathComponent), #line, #function) self.currentImageType = type self.present(self.documentPickerController, animated: true, completion: nil) } @@ -384,8 +375,6 @@ extension ProfileHeaderViewController: ProfileHeaderViewDelegate { // MARK: - MetaTextDelegate extension ProfileHeaderViewController: MetaTextDelegate { func metaText(_ metaText: MetaText, processEditing textStorage: MetaTextStorage) -> MetaContent? { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: text: %s", ((#file as NSString).lastPathComponent), #line, #function, metaText.backedString) - switch metaText { case profileHeaderView.bioMetaText: guard viewModel.isEditing else { break } @@ -438,7 +427,6 @@ extension ProfileHeaderViewController: UIImagePickerControllerDelegate & UINavig } func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) picker.dismiss(animated: true, completion: nil) } } @@ -455,7 +443,6 @@ extension ProfileHeaderViewController: UIDocumentPickerDelegate { guard let image = UIImage(data: imageData) else { return } cropImage(image: image, pickerViewController: controller) } catch { - os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) } } } diff --git a/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift b/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift index 3025907e0..9301aea50 100644 --- a/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift +++ b/Mastodon/Scene/Profile/Header/ProfileHeaderViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-9. // -import os.log import UIKit import Combine import CoreDataStack diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+Configuration.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+Configuration.swift index ac33227cc..8e1693142 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+Configuration.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+Configuration.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-26. // -import os.log import UIKit import Combine import CoreDataStack diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift index 961a8269a..270f86b64 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView+ViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-26. // -import os.log import UIKit import Combine import CoreDataStack diff --git a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift index e5032b5bd..7a906c05c 100644 --- a/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift +++ b/Mastodon/Scene/Profile/Header/View/ProfileHeaderView.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-29. // -import os.log import UIKit import Combine import FLAnimatedImage @@ -511,19 +510,16 @@ extension ProfileHeaderView { extension ProfileHeaderView { @objc private func relationshipActionButtonDidPressed(_ sender: UIButton) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) assert(sender === relationshipActionButton) delegate?.profileHeaderView(self, relationshipButtonDidPressed: relationshipActionButton) } @objc private func avatarButtonDidPressed(_ sender: UIButton) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) assert(sender === avatarButton) delegate?.profileHeaderView(self, avatarButtonDidPressed: avatarButton) } @objc private func bannerImageViewDidPressed(_ sender: UITapGestureRecognizer) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.profileHeaderView(self, bannerImageViewDidPressed: bannerImageView) } } @@ -544,7 +540,6 @@ extension ProfileHeaderView: UITextViewDelegate { // MARK: - MetaTextViewDelegate extension ProfileHeaderView: MetaTextViewDelegate { func metaTextView(_ metaTextView: MetaTextView, didSelectMeta meta: Meta) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: select entity", ((#file as NSString).lastPathComponent), #line, #function) delegate?.profileHeaderView(self, metaTextView: metaTextView, metaDidPressed: meta) } } diff --git a/Mastodon/Scene/Profile/MeProfileViewModel.swift b/Mastodon/Scene/Profile/MeProfileViewModel.swift index 995e32002..3deefd4d5 100644 --- a/Mastodon/Scene/Profile/MeProfileViewModel.swift +++ b/Mastodon/Scene/Profile/MeProfileViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-30. // -import os.log import UIKit import Combine import CoreData @@ -25,8 +24,6 @@ final class MeProfileViewModel: ProfileViewModel { $me .sink { [weak self] me in - os_log("%{public}s[%{public}ld], %{public}s: current active mastodon user: %s", ((#file as NSString).lastPathComponent), #line, #function, me?.username ?? "") - guard let self = self else { return } self.user = me } diff --git a/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift b/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift index 27c539d18..b01b69a1c 100644 --- a/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift +++ b/Mastodon/Scene/Profile/Paging/ProfilePagingViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-29. // -import os.log import UIKit import Combine import XLPagerTabStrip @@ -58,9 +57,6 @@ final class ProfilePagingViewController: ButtonBarPagerTabStripViewController, T return true } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/Paging/ProfilePagingViewModel.swift b/Mastodon/Scene/Profile/Paging/ProfilePagingViewModel.swift index 9b9e78d98..1bf3df83d 100644 --- a/Mastodon/Scene/Profile/Paging/ProfilePagingViewModel.swift +++ b/Mastodon/Scene/Profile/Paging/ProfilePagingViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-29. // -import os.log import UIKit import MastodonAsset import MastodonLocalization @@ -43,8 +42,5 @@ final class ProfilePagingViewModel: NSObject { ] } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/ProfileViewController.swift b/Mastodon/Scene/Profile/ProfileViewController.swift index 9dce85225..15ef88033 100644 --- a/Mastodon/Scene/Profile/ProfileViewController.swift +++ b/Mastodon/Scene/Profile/ProfileViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-2-23. // -import os.log import UIKit import Combine import MastodonMeta @@ -27,8 +26,6 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi public static let containerViewMarginForRegularHorizontalSizeClass: CGFloat = 64 public static let containerViewMarginForCompactHorizontalSizeClass: CGFloat = 16 - let logger = Logger(subsystem: "ProfileViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -153,9 +150,6 @@ final class ProfileViewController: UIViewController, NeedsDependency, MediaPrevi profileHeaderViewController.titleView } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -526,19 +520,16 @@ extension ProfileViewController { extension ProfileViewController { @objc private func cancelEditingBarButtonItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) viewModel.isEditing = false } @objc private func settingBarButtonItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let setting = context.settingService.currentSetting.value else { return } let settingsViewModel = SettingsViewModel(context: context, authContext: viewModel.authContext, setting: setting) _ = coordinator.present(scene: .settings(viewModel: settingsViewModel), from: self, transition: .modal(animated: true, completion: nil)) } @objc private func shareBarButtonItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let user = viewModel.user else { return } let record: ManagedObjectRecord = .init(objectID: user.objectID) Task { @@ -560,19 +551,16 @@ extension ProfileViewController { } @objc private func favoriteBarButtonItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let favoriteViewModel = FavoriteViewModel(context: context, authContext: viewModel.authContext) _ = coordinator.present(scene: .favorite(viewModel: favoriteViewModel), from: self, transition: .show) } @objc private func bookmarkBarButtonItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let bookmarkViewModel = BookmarkViewModel(context: context, authContext: viewModel.authContext) _ = coordinator.present(scene: .bookmark(viewModel: bookmarkViewModel), from: self, transition: .show) } @objc private func replyBarButtonItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let mastodonUser = viewModel.user else { return } let mention = "@" + mastodonUser.acct UITextChecker.learnWord(mention) @@ -587,15 +575,11 @@ extension ProfileViewController { } @objc private func followedTagsItemPressed(_ sender: UIBarButtonItem) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - let followedTagsViewModel = FollowedTagsViewModel(context: context, authContext: viewModel.authContext) _ = coordinator.present(scene: .followedTags(viewModel: followedTagsViewModel), from: self, transition: .show) } @objc private func refreshControlValueChanged(_ sender: RefreshControl) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - if let userTimelineViewController = profilePagingViewController.currentViewController as? UserTimelineViewController { userTimelineViewController.viewModel.stateMachine.enter(UserTimelineViewModel.State.Reloading.self) } @@ -767,11 +751,9 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate { headerProfileInfo: profileHeaderViewModel.profileInfoEditing, aboutProfileInfo: profileAboutViewModel.profileInfoEditing ) - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): update profile info success") self.viewModel.isEditing = false } catch { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): update profile info fail: \(error.localizedDescription)") let alertController = UIAlertController( for: error, title: L10n.Common.Alerts.EditProfileFailure.title, @@ -798,7 +780,6 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate { } switch completion { case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch profile info for edit fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) let alertController = UIAlertController(for: error, title: L10n.Common.Alerts.EditProfileFailure.title, preferredStyle: .alert) let okAction = UIAlertAction(title: L10n.Common.Controls.Actions.ok, style: .default, handler: nil) alertController.addAction(okAction) @@ -808,7 +789,6 @@ extension ProfileViewController: ProfileHeaderViewControllerDelegate { transition: .alertController(animated: true, completion: nil) ) case .finished: - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch profile info for edit success", ((#file as NSString).lastPathComponent), #line, #function) // enter editing mode self.viewModel.isEditing.toggle() } diff --git a/Mastodon/Scene/Profile/ProfileViewModel.swift b/Mastodon/Scene/Profile/ProfileViewModel.swift index 5c81c7920..9445b8a26 100644 --- a/Mastodon/Scene/Profile/ProfileViewModel.swift +++ b/Mastodon/Scene/Profile/ProfileViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-29. // -import os.log import UIKit import Combine import CoreDataStack @@ -19,8 +18,6 @@ import MastodonUI // please override this base class class ProfileViewModel: NSObject { - let logger = Logger(subsystem: "ProfileViewModel", category: "ViewModel") - typealias UserID = String var disposeBag = Set() @@ -151,11 +148,9 @@ class ProfileViewModel: NSObject { DispatchQueue.main.asyncAfter(deadline: .now() + delay) { [weak self] in guard let _ = self else { return } pendingRetryPublisher.value = min(2 * delay, 60) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Relationship] fetch again due to pending", ((#file as NSString).lastPathComponent), #line, #function) } } } catch { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] update user relationship failure: \(error.localizedDescription)") } } // end Task } @@ -196,12 +191,10 @@ extension ProfileViewModel { record: ManagedObjectRecord, authenticationBox: MastodonAuthenticationBox ) async throws -> Mastodon.Response.Content<[Mastodon.Entity.Relationship]> { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] update user relationship...") let response = try await context.apiService.relationship( records: [record], authenticationBox: authenticationBox ) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Relationship] did update MastodonUser relationship") return response } diff --git a/Mastodon/Scene/Profile/RemoteProfileViewModel.swift b/Mastodon/Scene/Profile/RemoteProfileViewModel.swift index 705d2806f..bc35a218c 100644 --- a/Mastodon/Scene/Profile/RemoteProfileViewModel.swift +++ b/Mastodon/Scene/Profile/RemoteProfileViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-2. // -import os.log import Foundation import Combine import CoreDataStack @@ -33,9 +32,9 @@ final class RemoteProfileViewModel: ProfileViewModel { switch completion { case .failure(let error): // TODO: handle error - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetch failed: %s", ((#file as NSString).lastPathComponent), #line, #function, userID, error.localizedDescription) + break case .finished: - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetched", ((#file as NSString).lastPathComponent), #line, #function, userID) + break } } receiveValue: { [weak self] response in guard let self = self else { return } @@ -109,9 +108,9 @@ final class RemoteProfileViewModel: ProfileViewModel { switch completion { case .failure(let error): // TODO: handle error - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetch failed: %s", ((#file as NSString).lastPathComponent), #line, #function, acct, error.localizedDescription) + break case .finished: - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: remote user %s fetched", ((#file as NSString).lastPathComponent), #line, #function, acct) + break } } receiveValue: { [weak self] response in guard let self = self, let value = response.value else { return } diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift index 6cdd6a594..fdb964b30 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-29. // -import os.log import UIKit import AVKit import Combine @@ -17,8 +16,6 @@ import MastodonCore final class UserTimelineViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "UserTimelineViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -38,9 +35,6 @@ final class UserTimelineViewController: UIViewController, NeedsDependency, Media let cellFrameCache = NSCache() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift index 4ed266c2e..4d5af3cdf 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel+State.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-30. // -import os.log import Foundation import GameplayKit import MastodonCore @@ -13,9 +12,6 @@ import MastodonSDK extension UserTimelineViewModel { class State: GKState { - - let logger = Logger(subsystem: "UserTimelineViewModel.State", category: "StateMachine") - let id = UUID() weak var viewModel: UserTimelineViewModel? @@ -29,7 +25,6 @@ extension UserTimelineViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor @@ -37,9 +32,6 @@ extension UserTimelineViewModel { 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))") - } } } @@ -92,9 +84,7 @@ extension UserTimelineViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } @@ -167,7 +157,6 @@ extension UserTimelineViewModel.State { viewModel.statusFetchedResultsController.statusIDs = statusIDs } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user timeline fail: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift index 0d85b6807..0c8d634e5 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-29. // -import os.log import UIKit import GameplayKit import Combine @@ -65,11 +64,6 @@ final class UserTimelineViewModel { ) self.queryFilter = queryFilter } - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension UserTimelineViewModel { diff --git a/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift b/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift index c7f828efa..c9e88484c 100644 --- a/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift +++ b/Mastodon/Scene/Profile/UserLIst/FavoritedBy/FavoritedByViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-17. // -import os.log import UIKit import GameplayKit import Combine @@ -15,9 +14,6 @@ import MastodonUI import CoreDataStack final class FavoritedByViewController: UIViewController, NeedsDependency { - - let logger = Logger(subsystem: "FavoritedByViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -32,9 +28,6 @@ final class FavoritedByViewController: UIViewController, NeedsDependency { return tableView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -43,13 +36,6 @@ extension FavoritedByViewController { override func viewDidLoad() { super.viewDidLoad() - #if DEBUG - switch viewModel.kind { - case .favoritedBy: break - default: assertionFailure() - } - #endif - title = L10n.Scene.FavoritedBy.title view.backgroundColor = ThemeService.shared.currentTheme.value.secondarySystemBackgroundColor diff --git a/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift b/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift index e4605a02a..369128f3c 100644 --- a/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift +++ b/Mastodon/Scene/Profile/UserLIst/RebloggedBy/RebloggedByViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-17. // -import os.log import UIKit import GameplayKit import Combine @@ -16,8 +15,6 @@ import CoreDataStack final class RebloggedByViewController: UIViewController, NeedsDependency { - let logger = Logger(subsystem: "RebloggedByViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -31,11 +28,6 @@ final class RebloggedByViewController: UIViewController, NeedsDependency { tableView.backgroundColor = .clear return tableView }() - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension RebloggedByViewController { diff --git a/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift b/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift index c6666c6f5..6f0c394b0 100644 --- a/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift +++ b/Mastodon/Scene/Profile/UserLIst/UserListViewModel+State.swift @@ -5,15 +5,12 @@ // Created by MainasuK on 2022-5-17. // -import os.log import Foundation import GameplayKit import MastodonSDK extension UserListViewModel { class State: GKState { - - let logger = Logger(subsystem: "UserListViewModel.State", category: "StateMachine") let id = UUID() @@ -28,17 +25,12 @@ extension UserListViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -91,9 +83,7 @@ extension UserListViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } @@ -156,8 +146,6 @@ extension UserListViewModel.State { ) } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch \(response.value.count) accounts") - var hasNewAppend = false var userIDs = viewModel.userFetchedResultsController.userIDs for user in response.value { @@ -177,7 +165,6 @@ extension UserListViewModel.State { viewModel.userFetchedResultsController.userIDs = userIDs } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch following fail: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift b/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift index 481ac8ea0..d27562b94 100644 --- a/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift +++ b/Mastodon/Scene/Profile/UserLIst/UserListViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-17. // -import os.log import UIKit import Combine import CoreDataStack @@ -13,7 +12,6 @@ import GameplayKit import MastodonCore final class UserListViewModel { - let logger = Logger(subsystem: "UserListViewModel", category: "ViewModel") var disposeBag = Set() // input diff --git a/Mastodon/Scene/Report/Report/ReportViewController.swift b/Mastodon/Scene/Report/Report/ReportViewController.swift index fb0417a7f..468fa5ae6 100644 --- a/Mastodon/Scene/Report/Report/ReportViewController.swift +++ b/Mastodon/Scene/Report/Report/ReportViewController.swift @@ -5,7 +5,6 @@ // Created by ihugo on 2021/4/20. // -import os.log import UIKit import Combine import CoreDataStack @@ -15,8 +14,6 @@ import MastodonLocalization class ReportViewController: UIViewController, NeedsDependency, ReportViewControllerAppearance { - let logger = Logger(subsystem: "ReportViewController", category: "ViewController") - var disposeBag = Set() private var observations = Set() @@ -31,9 +28,6 @@ class ReportViewController: UIViewController, NeedsDependency, ReportViewControl action: #selector(ReportViewController.cancelBarButtonItemDidPressed(_:)) ) - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -162,7 +156,6 @@ extension ReportViewController: ReportSupplementaryViewControllerDelegate { Task { @MainActor in do { let _ = try await viewModel.report() - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): report success") let reportResultViewModel = ReportResultViewModel( context: context, diff --git a/Mastodon/Scene/Report/Report/ReportViewModel.swift b/Mastodon/Scene/Report/Report/ReportViewModel.swift index 05f1cfef8..cb840d213 100644 --- a/Mastodon/Scene/Report/Report/ReportViewModel.swift +++ b/Mastodon/Scene/Report/Report/ReportViewModel.swift @@ -12,7 +12,6 @@ import Foundation import GameplayKit import MastodonSDK import OrderedCollections -import os.log import UIKit import MastodonCore import MastodonLocalization diff --git a/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift b/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift index 517873abe..2bfb689d0 100644 --- a/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift +++ b/Mastodon/Scene/Report/ReportReason/ReportReasonViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-10. // -import os.log import UIKit import SwiftUI import Combine @@ -20,8 +19,6 @@ protocol ReportReasonViewControllerDelegate: AnyObject { final class ReportReasonViewController: UIViewController, NeedsDependency, ReportViewControllerAppearance { - let logger = Logger(subsystem: "ReportReasonViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -38,9 +35,6 @@ final class ReportReasonViewController: UIViewController, NeedsDependency, Repor return navigationActionView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -91,8 +85,6 @@ extension ReportReasonViewController { extension ReportReasonViewController { @objc private func nextButtonPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - assert(viewModel.delegate != nil) viewModel.delegate?.reportReasonViewController(self, nextButtonPressed: sender) } diff --git a/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift b/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift index 1d67ad6c3..d66eadfd7 100644 --- a/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift +++ b/Mastodon/Scene/Report/ReportResult/ReportResultViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-2-8. // -import os.log import UIKit import SwiftUI import Combine @@ -38,9 +37,6 @@ final class ReportResultViewController: UIViewController, NeedsDependency, Repor return navigationActionView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift b/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift index 8123a8773..8caf7d1f1 100644 --- a/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift +++ b/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift @@ -10,7 +10,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log import UIKit import MastodonAsset import MastodonCore diff --git a/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift b/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift index 00be4d800..5d9f8ede8 100644 --- a/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift +++ b/Mastodon/Scene/Report/ReportServerRules/ReportServerRulesViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-10. // -import os.log import UIKit import SwiftUI import Combine @@ -19,8 +18,6 @@ protocol ReportServerRulesViewControllerDelegate: AnyObject { } final class ReportServerRulesViewController: UIViewController, NeedsDependency, ReportViewControllerAppearance { - - let logger = Logger(subsystem: "ReportReasonViewController", category: "ViewController") weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -44,9 +41,6 @@ final class ReportServerRulesViewController: UIViewController, NeedsDependency, return navigationActionView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -101,8 +95,6 @@ extension ReportServerRulesViewController { } @objc private func nextButtonPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - assert(viewModel.delegate != nil) viewModel.delegate?.reportServerRulesViewController(self, nextButtonPressed: sender) } diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift index 3385a12ef..65e7046d0 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-10. // -import os.log import UIKit import Combine import CoreDataStack @@ -20,9 +19,6 @@ protocol ReportStatusViewControllerDelegate: AnyObject { } class ReportStatusViewController: UIViewController, NeedsDependency, ReportViewControllerAppearance { - - let logger = Logger(subsystem: "ReportStatusViewController", category: "ViewController") - var disposeBag = Set() private var observations = Set() @@ -58,9 +54,6 @@ class ReportStatusViewController: UIViewController, NeedsDependency, ReportViewC return navigationActionView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -136,16 +129,12 @@ extension ReportStatusViewController { } @objc private func skipButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - assert(viewModel.delegate != nil) viewModel.isSkip = true viewModel.delegate?.reportStatusViewController(self, skipButtonDidPressed: sender) } @objc private func nextButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - assert(viewModel.delegate != nil) viewModel.isSkip = false viewModel.delegate?.reportStatusViewController(self, nextButtonDidPressed: sender) diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift index 79807cf0f..07a5e222c 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel+State.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-2-7. // -import os.log import func QuartzCore.CACurrentMediaTime import Foundation import CoreData @@ -15,8 +14,6 @@ import GameplayKit extension ReportStatusViewModel { class State: GKState { - let logger = Logger(subsystem: "ReportViewModel.State", category: "StateMachine") - let id = UUID() var name: String { @@ -32,17 +29,12 @@ extension ReportStatusViewModel { override func didEnter(from previousState: GKState?) { super.didEnter(from: previousState) let previousState = previousState as? ReportStatusViewModel.State - 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 ?? "")") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(self.name)") - } } } @@ -117,7 +109,6 @@ extension ReportStatusViewModel.State { viewModel.statusFetchedResultsController.statusIDs = statusIDs } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch user timeline fail: \(error.localizedDescription)") await enter(state: Fail.self) } } diff --git a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift index c1c79af48..8c41e1ce0 100644 --- a/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift +++ b/Mastodon/Scene/Report/ReportStatus/ReportStatusViewModel.swift @@ -12,7 +12,6 @@ import Foundation import GameplayKit import MastodonSDK import OrderedCollections -import os.log import UIKit import MastodonCore diff --git a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift index a84a3a650..8292d69cf 100644 --- a/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift +++ b/Mastodon/Scene/Report/ReportSupplementary/ReportSupplementaryViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-2-7. // -import os.log import UIKit import Combine import MastodonAsset @@ -20,8 +19,6 @@ protocol ReportSupplementaryViewControllerDelegate: AnyObject { final class ReportSupplementaryViewController: UIViewController, NeedsDependency, ReportViewControllerAppearance { - let logger = Logger(subsystem: "ReportSupplementaryViewController", category: "ViewController") - var disposeBag = Set() private var observations = Set() @@ -63,9 +60,6 @@ final class ReportSupplementaryViewController: UIViewController, NeedsDependency return navigationActionView }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -134,16 +128,12 @@ extension ReportSupplementaryViewController { } @objc func skipButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - assert(viewModel.delegate != nil) viewModel.isSkip = true viewModel.delegate?.reportSupplementaryViewController(self, skipButtonDidPressed: sender) } @objc func nextButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - assert(viewModel.delegate != nil) viewModel.isSkip = false viewModel.delegate?.reportSupplementaryViewController(self, nextButtonDidPressed: sender) diff --git a/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift b/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift index 9ce759a2a..00d079cfa 100644 --- a/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift +++ b/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell+ViewModel.swift @@ -27,7 +27,6 @@ extension ReportStatusTableViewCell { if statusView.frame == .zero { // set status view width statusView.frame.size.width = tableView.frame.width - ReportStatusTableViewCell.checkboxLeadingMargin - ReportStatusTableViewCell.checkboxSize.width - ReportStatusTableViewCell.statusViewLeadingSpacing - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): did layout for new cell") } statusView.configure(status: viewModel.value) diff --git a/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell.swift b/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell.swift index 6a2cf7fb2..76c7cbfc8 100644 --- a/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell.swift +++ b/Mastodon/Scene/Report/Share/Cell/ReportStatusTableViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-2-7. // -import os.log import UIKit import Combine import MastodonUI @@ -19,8 +18,6 @@ final class ReportStatusTableViewCell: UITableViewCell { var disposeBag = Set() - let logger = Logger(subsystem: "ReportStatusTableViewCell", category: "View") - let checkbox: UIImageView = { let imageView = UIImageView() imageView.preferredSymbolConfiguration = UIImage.SymbolConfiguration(textStyle: .body) diff --git a/Mastodon/Scene/Root/ContentSplitViewController.swift b/Mastodon/Scene/Root/ContentSplitViewController.swift index a10f0ed9b..877bd48d8 100644 --- a/Mastodon/Scene/Root/ContentSplitViewController.swift +++ b/Mastodon/Scene/Root/ContentSplitViewController.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-10-28. // -import os.log import UIKit import Combine import CoreDataStack @@ -46,9 +45,6 @@ final class ContentSplitViewController: UIViewController, NeedsDependency { return mainTabBarController }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift index 13ae74103..c41d2c19d 100644 --- a/Mastodon/Scene/Root/MainTab/MainTabBarController.swift +++ b/Mastodon/Scene/Root/MainTab/MainTabBarController.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-1-27. // -import os.log import UIKit import Combine import CoreDataStack @@ -17,8 +16,6 @@ import MastodonUI class MainTabBarController: UITabBarController { - let logger = Logger(subsystem: "MainTabBarController", category: "UI") - public var disposeBag = Set() weak var context: AppContext! @@ -406,7 +403,6 @@ extension MainTabBarController { @objc private func tabBarLongPressGestureRecognizerHandler(_ sender: UILongPressGestureRecognizer) { guard sender.state == .began else { return } guard let tab = touchedTab(by: sender) else { return } - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): long press \(tab.title) tab") switch tab { case .me: @@ -656,8 +652,7 @@ extension MainTabBarController { @objc private func switchToTabKeyCommandHandler(_ sender: UIKeyCommand) { guard let rawValue = sender.propertyList as? Int, let tab = Tab(rawValue: rawValue) else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, tab.title) - + guard let index = Tab.allCases.firstIndex(of: tab) else { return } let previousTab = Tab(rawValue: selectedIndex) selectedIndex = index @@ -683,14 +678,12 @@ extension MainTabBarController { } @objc private func showFavoritesKeyCommandHandler(_ sender: UIKeyCommand) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let authContext = self.authContext else { return } let favoriteViewModel = FavoriteViewModel(context: context, authContext: authContext) _ = coordinator.present(scene: .favorite(viewModel: favoriteViewModel), from: nil, transition: .show) } @objc private func openSettingsKeyCommandHandler(_ sender: UIKeyCommand) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let authContext = self.authContext else { return } guard let setting = context.settingService.currentSetting.value else { return } let settingsViewModel = SettingsViewModel(context: context, authContext: authContext, setting: setting) @@ -698,7 +691,6 @@ extension MainTabBarController { } @objc private func composeNewPostKeyCommandHandler(_ sender: UIKeyCommand) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let authContext = self.authContext else { return } let composeViewModel = ComposeViewModel( context: context, diff --git a/Mastodon/Scene/Root/RootSplitViewController.swift b/Mastodon/Scene/Root/RootSplitViewController.swift index a06e055db..dd8dd3a74 100644 --- a/Mastodon/Scene/Root/RootSplitViewController.swift +++ b/Mastodon/Scene/Root/RootSplitViewController.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-9-22. // -import os.log import UIKit import Combine import CoreDataStack @@ -78,9 +77,6 @@ final class RootSplitViewController: UISplitViewController, NeedsDependency { fatalError("init(coder:) has not been implemented") } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift b/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift index 2d5a80200..dab9f1af4 100644 --- a/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift +++ b/Mastodon/Scene/Root/Sidebar/SidebarViewController.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-9-22. // -import os.log import UIKit import Combine import CoreDataStack @@ -19,9 +18,6 @@ protocol SidebarViewControllerDelegate: AnyObject { } final class SidebarViewController: UIViewController, NeedsDependency { - - let logger = Logger(subsystem: "SidebarViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -126,8 +122,7 @@ extension SidebarViewController { let contentHeight = secondaryCollectionView.contentSize.height guard contentHeight > 0 else { return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): secondaryCollectionView contentSize: \(secondaryCollectionView.contentSize.debugDescription)") - + let currentFrameHeight = secondaryCollectionView.frame.height guard currentFrameHeight < contentHeight else { return } @@ -171,7 +166,6 @@ extension SidebarViewController { @objc private func sidebarLongPressGestureRecognizerHandler(_ sender: UILongPressGestureRecognizer) { guard sender.state == .began else { return } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") assert(sender.view === collectionView) let position = sender.location(in: collectionView) @@ -185,7 +179,6 @@ extension SidebarViewController { @objc private func sidebarDoubleTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { guard sender.state == .ended else { return } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") assert(sender.view === collectionView) let position = sender.location(in: collectionView) diff --git a/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift b/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift index 7182a443e..fcd6f817c 100644 --- a/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift +++ b/Mastodon/Scene/Root/Sidebar/View/SidebarListContentView.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-9-24. // -import os.log import UIKit import MetaTextKit import FLAnimatedImage @@ -15,8 +14,6 @@ import MastodonAsset final class SidebarListContentView: UIView, UIContentView { - let logger = Logger(subsystem: "SidebarListContentView", category: "UI") - let imageView = UIImageView() let avatarButton: CircleAvatarButton = { let button = CircleAvatarButton() @@ -89,8 +86,6 @@ extension SidebarListContentView { } private func apply(configuration: ContentConfiguration) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - guard currentConfiguration != configuration else { return } currentConfiguration = configuration @@ -157,17 +152,13 @@ extension SidebarListContentView { } struct ContentConfiguration: UIContentConfiguration, Hashable { - let logger = Logger(subsystem: "SidebarListContentView.ContentConfiguration", category: "ContentConfiguration") - var item: Item? func makeContentView() -> UIView & UIContentView { SidebarListContentView(configuration: self) } - func updated(for state: UIConfigurationState) -> ContentConfiguration { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - + func updated(for state: UIConfigurationState) -> ContentConfiguration { var updatedConfiguration = self if let state = state as? UICellConfigurationState { diff --git a/Mastodon/Scene/Search/Search/SearchViewController.swift b/Mastodon/Scene/Search/Search/SearchViewController.swift index 093976e63..9f755cf15 100644 --- a/Mastodon/Scene/Search/Search/SearchViewController.swift +++ b/Mastodon/Scene/Search/Search/SearchViewController.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/3/31. // -import os.log import Combine import GameplayKit import MastodonSDK diff --git a/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift b/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift index f61b47265..da9771327 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchDetailViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-13. // -import os.log import UIKit import Combine import MastodonAsset diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistorySectionHeaderCollectionReusableView.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistorySectionHeaderCollectionReusableView.swift index 6375f5d29..8a68308ae 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistorySectionHeaderCollectionReusableView.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/Cell/SearchHistorySectionHeaderCollectionReusableView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-20. // -import os.log import UIKit import MastodonAsset import MastodonLocalization diff --git a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift index 8645da5ac..9dbbe986e 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchHistory/SearchHistoryViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-13. // -import os.log import UIKit import Combine import CoreDataStack diff --git a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultSection.swift b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultSection.swift index dbede1795..fada6734e 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultSection.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultSection.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/4/6. // -import os.log import Foundation import MastodonSDK import UIKit diff --git a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift index fa8b844a6..0fa2cd4bb 100644 --- a/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift +++ b/Mastodon/Scene/Search/SearchDetail/SearchResult/SearchResultViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-14. // -import os.log import UIKit import Combine import CoreDataStack diff --git a/Mastodon/Scene/Settings/SettingsViewController.swift b/Mastodon/Scene/Settings/SettingsViewController.swift index cf113cf27..910317b9f 100644 --- a/Mastodon/Scene/Settings/SettingsViewController.swift +++ b/Mastodon/Scene/Settings/SettingsViewController.swift @@ -5,7 +5,6 @@ // Created by ihugo on 2021/4/7. // -import os.log import UIKit import Combine import CoreData @@ -128,12 +127,6 @@ class SettingsViewController: UIViewController, NeedsDependency { view.addArrangedSubview(tableFooterLabel) return view }() - - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension SettingsViewController { @@ -570,26 +563,7 @@ extension SettingsViewController { } @objc private func closeSettingsWindowKeyCommandHandler(_ sender: UIKeyCommand) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) dismiss(animated: true, completion: nil) } } - -#if canImport(SwiftUI) && DEBUG -import SwiftUI - -struct SettingsViewController_Previews: PreviewProvider { - - static var previews: some View { - Group { - UIViewControllerPreview { () -> UIViewController in - return SettingsViewController() - } - .previewLayout(.fixed(width: 390, height: 844)) - } - } - -} - -#endif diff --git a/Mastodon/Scene/Settings/SettingsViewModel.swift b/Mastodon/Scene/Settings/SettingsViewModel.swift index bcf637b4c..945d67f56 100644 --- a/Mastodon/Scene/Settings/SettingsViewModel.swift +++ b/Mastodon/Scene/Settings/SettingsViewModel.swift @@ -11,7 +11,6 @@ import CoreDataStack import Foundation import MastodonSDK import UIKit -import os.log import AuthenticationServices import MastodonCore @@ -63,12 +62,10 @@ class SettingsViewModel { .sink { [weak self] completion in guard let self = self else { return } switch completion { - case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch instance fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) + case .failure(_): self.currentInstance.value = nil case .finished: - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch instance success", ((#file as NSString).lastPathComponent), #line, #function) - + break } } receiveValue: { [weak self] response in guard let self = self else { return } @@ -76,11 +73,6 @@ class SettingsViewModel { } .store(in: &disposeBag) } - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension SettingsViewModel { diff --git a/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift b/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift index eb55dc575..34d5b3622 100644 --- a/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift +++ b/Mastodon/Scene/Share/View/Content/ContentWarningOverlayView.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/3/11. // -import os.log import Foundation import Combine import UIKit @@ -200,7 +199,6 @@ extension ContentWarningOverlayView { extension ContentWarningOverlayView { @objc private func tapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.contentWarningOverlayViewDidPressed(self) } } diff --git a/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift index 6c8c82527..f0b86dd54 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/StatusTableViewCell.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/1/27. // -import os.log import UIKit import Combine import MastodonAsset diff --git a/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell+ViewModel.swift b/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell+ViewModel.swift index 9568aa80e..568552c16 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell+ViewModel.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell+ViewModel.swift @@ -32,7 +32,6 @@ extension StatusThreadRootTableViewCell { if statusView.frame == .zero { // set status view width statusView.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") } switch viewModel.value { diff --git a/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift index ac86e6aa1..54a38308b 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/StatusThreadRootTableViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-17. // -import os.log import UIKit import Combine import MastodonAsset @@ -16,8 +15,6 @@ final class StatusThreadRootTableViewCell: UITableViewCell { static let marginForRegularHorizontalSizeClass: CGFloat = 64 - let logger = Logger(subsystem: "StatusThreadRootTableViewCell", category: "View") - weak var delegate: StatusTableViewCellDelegate? var disposeBag = Set() @@ -44,9 +41,6 @@ final class StatusThreadRootTableViewCell: UITableViewCell { _init() } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift b/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift index d3abb9e79..13030122c 100644 --- a/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift +++ b/Mastodon/Scene/Share/View/TableviewCell/ThreadReplyLoaderTableViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-13. // -import os.log import UIKit import Combine import MastodonAsset @@ -134,7 +133,6 @@ extension ThreadReplyLoaderTableViewCell { extension ThreadReplyLoaderTableViewCell { @objc private func loadMoreButtonDidPressed(_ sender: UIButton) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) delegate?.threadReplyLoaderTableViewCell(self, loadMoreButtonDidPressed: sender) } } diff --git a/Mastodon/Scene/Share/Webview/WebViewController.swift b/Mastodon/Scene/Share/Webview/WebViewController.swift index 209ee483d..b4f45c436 100644 --- a/Mastodon/Scene/Share/Webview/WebViewController.swift +++ b/Mastodon/Scene/Share/Webview/WebViewController.swift @@ -7,7 +7,6 @@ import Foundation import Combine -import os.log import UIKit import WebKit import MastodonCore @@ -28,8 +27,6 @@ final class WebViewController: UIViewController, NeedsDependency { }() deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function) - // cleanup cookie let httpCookieStore = webView.configuration.websiteDataStore.httpCookieStore httpCookieStore.getAllCookies { cookies in diff --git a/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift b/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift index 97998fd73..ad69791b2 100644 --- a/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift +++ b/Mastodon/Scene/Thread/MastodonStatusThreadViewModel.swift @@ -6,7 +6,6 @@ // Copyright © 2021 Twidere. All rights reserved. // -import os.log import Foundation import Combine import CoreData @@ -72,9 +71,6 @@ final class MastodonStatusThreadViewModel { .store(in: &disposeBag) } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -94,7 +90,6 @@ extension MastodonStatusThreadViewModel { dictionary[status.id] = status } } catch { - os_log("%{public}s[%{public}ld], %{public}s: fetch conversation fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) return } @@ -133,7 +128,6 @@ extension MastodonStatusThreadViewModel { dictionary[status.id] = status } } catch { - os_log("%{public}s[%{public}ld], %{public}s: fetch conversation fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) return } diff --git a/Mastodon/Scene/Thread/RemoteThreadViewModel.swift b/Mastodon/Scene/Thread/RemoteThreadViewModel.swift index e22b11961..696e10492 100644 --- a/Mastodon/Scene/Thread/RemoteThreadViewModel.swift +++ b/Mastodon/Scene/Thread/RemoteThreadViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-12. // -import os.log import UIKit import CoreDataStack import MastodonCore diff --git a/Mastodon/Scene/Thread/ThreadViewController.swift b/Mastodon/Scene/Thread/ThreadViewController.swift index c18e41bca..f8abc4c1f 100644 --- a/Mastodon/Scene/Thread/ThreadViewController.swift +++ b/Mastodon/Scene/Thread/ThreadViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-12. // -import os.log import UIKit import Combine import CoreData @@ -18,8 +17,6 @@ import MastodonLocalization final class ThreadViewController: UIViewController, NeedsDependency, MediaPreviewableViewController { - let logger = Logger(subsystem: "ThreadViewController", category: "ViewController") - weak var context: AppContext! { willSet { precondition(!isViewLoaded) } } weak var coordinator: SceneCoordinator! { willSet { precondition(!isViewLoaded) } } @@ -47,11 +44,6 @@ final class ThreadViewController: UIViewController, NeedsDependency, MediaPrevie return tableView }() - - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s:", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension ThreadViewController { @@ -112,7 +104,6 @@ extension ThreadViewController { extension ThreadViewController { @objc private func replyBarButtonItemPressed(_ sender: UIBarButtonItem) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") guard case let .root(threadContext) = viewModel.root else { return } let composeViewModel = ComposeViewModel( context: context, diff --git a/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift b/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift index d1814436f..aa5f33cec 100644 --- a/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift +++ b/Mastodon/Scene/Thread/ThreadViewModel+Diffable.swift @@ -116,10 +116,7 @@ extension ThreadViewModel { let hasChanges = newSnapshot.itemIdentifiers != oldSnapshot.itemIdentifiers if !hasChanges && !self.hasPendingStatusEditReload { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): snapshot not changes") return - } else { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): snapshot has changes") } guard let difference = self.calculateReloadSnapshotDifference( @@ -128,12 +125,9 @@ extension ThreadViewModel { newSnapshot: newSnapshot ) else { await self.updateDataSource(snapshot: newSnapshot, animatingDifferences: false) - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): applied new snapshot without tweak") return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Snapshot] oldSnapshot: \(oldSnapshot.itemIdentifiers.debugDescription)") - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Snapshot] newSnapshot: \(newSnapshot.itemIdentifiers.debugDescription)") await self.updateSnapshotUsingReloadData( tableView: tableView, oldSnapshot: oldSnapshot, @@ -206,7 +200,6 @@ extension ThreadViewModel { let additionalInset = round(tableView.contentSize.height - cell.frame.maxY) tableView.contentInset.bottom = max(0, bottomSpacing - additionalInset) - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): content inset bottom: \(tableView.contentInset.bottom)") } // set scroll position @@ -219,7 +212,6 @@ extension ThreadViewModel { } return offset }() - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): applied new snapshot") } } diff --git a/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift b/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift index 6d26b9fa4..9ef713bcc 100644 --- a/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift +++ b/Mastodon/Scene/Thread/ThreadViewModel+LoadThreadState.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-12. // -import os.log import Foundation import Combine import GameplayKit @@ -15,8 +14,6 @@ import MastodonSDK extension ThreadViewModel { class LoadThreadState: GKState { - let logger = Logger(subsystem: "ThreadViewModel.LoadThreadState", category: "StateMachine") - let id = UUID() weak var viewModel: ThreadViewModel? @@ -30,17 +27,12 @@ extension ThreadViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: LoadThreadState.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -95,16 +87,7 @@ extension ThreadViewModel.LoadThreadState { from: response.value.ancestors ) ) - // deprecated: Tree mode replies - // viewModel.mastodonStatusThreadViewModel.appendDescendant( - // domain: threadContext.domain, - // nodes: MastodonStatusThreadViewModel.Node.children( - // of: threadContext.statusID, - // from: response.value.descendants - // ) - // ) - - // new: the same order from API + viewModel.mastodonStatusThreadViewModel.appendDescendant( domain: threadContext.domain, nodes: response.value.descendants.map { status in @@ -112,7 +95,6 @@ extension ThreadViewModel.LoadThreadState { } ) } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fetch status context for \(threadContext.statusID) fail: \(error.localizedDescription)") await enter(state: Fail.self) } } // end Task diff --git a/Mastodon/Scene/Thread/ThreadViewModel.swift b/Mastodon/Scene/Thread/ThreadViewModel.swift index 74afa44dd..69dc73e48 100644 --- a/Mastodon/Scene/Thread/ThreadViewModel.swift +++ b/Mastodon/Scene/Thread/ThreadViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-12. // -import os.log import UIKit import Combine import CoreData @@ -19,8 +18,6 @@ import MastodonLocalization class ThreadViewModel { - let logger = Logger(subsystem: "ThreadViewModel", category: "ViewModel") - var disposeBag = Set() var rootItemObserver: AnyCancellable? @@ -107,9 +104,6 @@ class ThreadViewModel { .store(in: &disposeBag) } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } diff --git a/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift b/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift index ce9cfca96..032034a1f 100644 --- a/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift +++ b/Mastodon/Scene/Transition/MediaPreview/MediaHostToMediaPreviewViewControllerAnimatedTransitioning.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-28. // -import os.log import UIKit import func AVFoundation.AVMakeRect @@ -307,7 +306,6 @@ extension MediaHostToMediaPreviewViewControllerAnimatedTransitioning { // finish or cancel current transitioning let targetPosition = completionPosition() - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: target position: %s", ((#file as NSString).lastPathComponent), #line, #function, targetPosition == .end ? "end" : "start") isTransitionContextFinish = true animate(targetPosition) @@ -330,7 +328,6 @@ extension MediaHostToMediaPreviewViewControllerAnimatedTransitioning { updateTransitionItemPosition(of: translation) case .ended, .cancelled: let targetPosition = completionPosition() - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: target position: %s", ((#file as NSString).lastPathComponent), #line, #function, targetPosition == .end ? "end" : "start") isTransitionContextFinish = true animate(targetPosition) diff --git a/Mastodon/Scene/Transition/MediaPreview/MediaPreviewTransitionController.swift b/Mastodon/Scene/Transition/MediaPreview/MediaPreviewTransitionController.swift index d8d822bc5..b418f084c 100644 --- a/Mastodon/Scene/Transition/MediaPreview/MediaPreviewTransitionController.swift +++ b/Mastodon/Scene/Transition/MediaPreview/MediaPreviewTransitionController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-28. // -import os.log import UIKit final class MediaPreviewTransitionController: NSObject { @@ -37,7 +36,6 @@ extension MediaPreviewTransitionController { guard let mediaPreviewViewController = self.mediaPreviewViewController else { return } wantsInteractiveStart = true mediaPreviewViewController.dismiss(animated: true, completion: nil) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: start interactive dismiss", ((#file as NSString).lastPathComponent), #line, #function) } } @@ -116,8 +114,6 @@ extension MediaPreviewTransitionController: UIViewControllerTransitioningDelegat extension MediaPreviewTransitionController: ViewControllerAnimatedTransitioningDelegate { func animationEnded(_ transitionCompleted: Bool) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: completed: %s", ((#file as NSString).lastPathComponent), #line, #function, transitionCompleted.description) - dismissInteractiveTransitioning = nil wantsInteractiveStart = false } diff --git a/Mastodon/Scene/Transition/Search/SearchToSearchDetailViewControllerAnimatedTransitioning.swift b/Mastodon/Scene/Transition/Search/SearchToSearchDetailViewControllerAnimatedTransitioning.swift index e060acc83..683ba6336 100644 --- a/Mastodon/Scene/Transition/Search/SearchToSearchDetailViewControllerAnimatedTransitioning.swift +++ b/Mastodon/Scene/Transition/Search/SearchToSearchDetailViewControllerAnimatedTransitioning.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-13. // -import os.log import UIKit final class SearchToSearchDetailViewControllerAnimatedTransitioning: ViewControllerAnimatedTransitioning { @@ -17,11 +16,6 @@ final class SearchToSearchDetailViewControllerAnimatedTransitioning: ViewControl self.transitionDuration = 0.2 } - - deinit { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } // MARK: - UIViewControllerAnimatedTransitioning diff --git a/Mastodon/Scene/Transition/ViewControllerAnimatedTransitioning.swift b/Mastodon/Scene/Transition/ViewControllerAnimatedTransitioning.swift index 71fd199f4..7089f17eb 100644 --- a/Mastodon/Scene/Transition/ViewControllerAnimatedTransitioning.swift +++ b/Mastodon/Scene/Transition/ViewControllerAnimatedTransitioning.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-28. // -import os.log import UIKit protocol ViewControllerAnimatedTransitioningDelegate: AnyObject { @@ -29,11 +28,6 @@ class ViewControllerAnimatedTransitioning: NSObject { self.transitionDuration = 0.3 super.init() } - - deinit { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } // MARK: - UIViewControllerAnimatedTransitioning diff --git a/Mastodon/Supporting Files/AppDelegate.swift b/Mastodon/Supporting Files/AppDelegate.swift index 85fed2b28..2269f9c54 100644 --- a/Mastodon/Supporting Files/AppDelegate.swift +++ b/Mastodon/Supporting Files/AppDelegate.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/1/22. // -import os.log import UIKit import UserNotifications import AVFoundation @@ -78,15 +77,13 @@ extension AppDelegate: UNUserNotificationCenterDelegate { willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void ) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Push Notification]", ((#file as NSString).lastPathComponent), #line, #function) guard let pushNotification = AppDelegate.mastodonPushNotification(from: notification) else { completionHandler([]) return } let notificationID = String(pushNotification.notificationID) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Push Notification] notification %s", ((#file as NSString).lastPathComponent), #line, #function, notificationID) - + let accessToken = pushNotification.accessToken UserDefaults.shared.increaseNotificationCount(accessToken: accessToken) appContext.notificationService.applicationIconBadgeNeedsUpdate.send() @@ -109,15 +106,13 @@ extension AppDelegate: UNUserNotificationCenterDelegate { didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void ) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Push Notification]", ((#file as NSString).lastPathComponent), #line, #function) - + guard let pushNotification = AppDelegate.mastodonPushNotification(from: response.notification) else { completionHandler() return } let notificationID = String(pushNotification.notificationID) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Push Notification] notification %s", ((#file as NSString).lastPathComponent), #line, #function, notificationID) appContext.notificationService.handle(pushNotification: pushNotification) appContext.notificationService.requestRevealNotificationPublisher.send(pushNotification) completionHandler() diff --git a/Mastodon/Supporting Files/SceneDelegate.swift b/Mastodon/Supporting Files/SceneDelegate.swift index a5c3a9caa..a603f5250 100644 --- a/Mastodon/Supporting Files/SceneDelegate.swift +++ b/Mastodon/Supporting Files/SceneDelegate.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/1/22. // -import os.log import UIKit import Combine import CoreDataStack @@ -32,8 +31,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { var savedShortCutItem: UIApplicationShortcutItem? - let logger = Logger(subsystem: "SceneDelegate", category: "logic") - func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let windowScene = scene as? UIWindowScene else { return } @@ -204,7 +201,6 @@ extension SceneDelegate { @MainActor private func handler(shortcutItem: UIApplicationShortcutItem) async -> Bool { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(shortcutItem.type)") switch shortcutItem.type { case NotificationService.unreadShortcutItemIdentifier: @@ -239,11 +235,9 @@ extension SceneDelegate { case "org.joinmastodon.app.search": coordinator?.switchToTabBar(tab: .search) - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): select search tab") if let searchViewController = coordinator?.tabBarController.topMost as? SearchViewController { searchViewController.searchBarTapPublisher.send("") - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): trigger search") } default: @@ -263,7 +257,6 @@ extension SceneDelegate { private func showComposeViewController() { if coordinator?.tabBarController.topMost is ComposeViewController { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): composing…") } else { if let authContext = coordinator?.authContext { let composeViewModel = ComposeViewModel( @@ -273,9 +266,6 @@ extension SceneDelegate { destination: .topLevel ) _ = coordinator?.present(scene: .compose(viewModel: composeViewModel), from: nil, transition: .modal(animated: true, completion: nil)) - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): present compose scene") - } else { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): not authenticated") } } } diff --git a/MastodonSDK/Package.swift b/MastodonSDK/Package.swift index 75990451c..a7f4a77ac 100644 --- a/MastodonSDK/Package.swift +++ b/MastodonSDK/Package.swift @@ -36,7 +36,6 @@ let package = Package( dependencies: [ .package(name: "ArkanaKeys", path: "../dependencies/ArkanaKeys"), .package(url: "https://github.com/will-lumley/FaviconFinder.git", from: "3.2.2"), - .package(url: "https://github.com/siteline/SwiftUI-Introspect.git", from: "0.1.3"), .package(url: "https://github.com/MainasuK/UITextView-Placeholder.git", from: "1.4.1"), .package(url: "https://github.com/Alamofire/Alamofire.git", from: "5.4.0"), .package(url: "https://github.com/Alamofire/AlamofireImage.git", from: "4.1.0"), @@ -118,7 +117,6 @@ let package = Package( .product(name: "FLAnimatedImage", package: "FLAnimatedImage"), .product(name: "FaviconFinder", package: "FaviconFinder"), .product(name: "Nuke", package: "Nuke"), - .product(name: "Introspect", package: "SwiftUI-Introspect"), .product(name: "UITextView+Placeholder", package: "UITextView-Placeholder"), .product(name: "UIHostingConfigurationBackport", package: "UIHostingConfigurationBackport"), .product(name: "TabBarPager", package: "TabBarPager"), diff --git a/MastodonSDK/Sources/CoreDataStack/CoreDataStack.swift b/MastodonSDK/Sources/CoreDataStack/CoreDataStack.swift index e8ac87548..0fdf55fec 100644 --- a/MastodonSDK/Sources/CoreDataStack/CoreDataStack.swift +++ b/MastodonSDK/Sources/CoreDataStack/CoreDataStack.swift @@ -13,8 +13,6 @@ import MastodonCommon public final class CoreDataStack { - static let logger = Logger(subsystem: "CoreDataStack", category: "DB") - private(set) var storeDescriptions: [NSPersistentStoreDescription] public let didFinishLoad = CurrentValueSubject(false) @@ -77,7 +75,6 @@ public final class CoreDataStack { (reason == "Can't find mapping model for migration" || reason == "Persistent store migration failed, missing mapping model.") { if let storeDescription = container.persistentStoreDescriptions.first, let url = storeDescription.url { try? container.persistentStoreCoordinator.destroyPersistentStore(at: url, ofType: NSSQLiteStoreType, options: nil) - os_log("%{public}s[%{public}ld], %{public}s: cannot migrate model. rebuild database…", ((#file as NSString).lastPathComponent), #line, #function) } else { assertionFailure() } @@ -90,9 +87,7 @@ public final class CoreDataStack { // it's looks like the remote notification only trigger when app enter and leave background container.viewContext.automaticallyMergesChangesFromParent = true - - os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, storeDescription.debugDescription) - + callback() #if DEBUG @@ -103,9 +98,7 @@ public final class CoreDataStack { formatter.allowedUnits = [.useMB] formatter.countStyle = .file let size = formatter.string(fromByteCount: Int64(data.count)) - CoreDataStack.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): Database size: \(size)") } catch { - CoreDataStack.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): Cannot get database size") } #endif }) diff --git a/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift b/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift index 3b4818992..97604a735 100644 --- a/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift +++ b/MastodonSDK/Sources/CoreDataStack/Extension/NSManagedObjectContext.swift @@ -28,7 +28,6 @@ extension NSManagedObjectContext { } catch { rollback() - os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) throw error } } diff --git a/MastodonSDK/Sources/MastodonCore/AppContext.swift b/MastodonSDK/Sources/MastodonCore/AppContext.swift index d8aa06fae..35ad3247d 100644 --- a/MastodonSDK/Sources/MastodonCore/AppContext.swift +++ b/MastodonSDK/Sources/MastodonCore/AppContext.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 22/9/30. // -import os.log import UIKit import SwiftUI import Combine @@ -115,9 +114,6 @@ public class AppContext: ObservableObject { .store(in: &disposeBag) } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -149,7 +145,6 @@ extension AppContext { ImageDownloader.defaultURLCache().removeAllCachedResponses() let currentDiskBytes = ImageDownloader.defaultURLCache().currentDiskUsage let purgedDiskBytes = max(0, diskBytes - currentDiskBytes) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: purge AlamofireImage cache bytes: %ld -> %ld (%ld)", ((#file as NSString).lastPathComponent), #line, #function, diskBytes, currentDiskBytes, purgedDiskBytes) promise(.success(purgedDiskBytes)) } } diff --git a/MastodonSDK/Sources/MastodonCore/AuthContext.swift b/MastodonSDK/Sources/MastodonCore/AuthContext.swift index b93a2e03a..adb98d88f 100644 --- a/MastodonSDK/Sources/MastodonCore/AuthContext.swift +++ b/MastodonSDK/Sources/MastodonCore/AuthContext.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 22/10/8. // -import os.log import Foundation import Combine import CoreDataStack @@ -19,8 +18,6 @@ public class AuthContext { var disposeBag = Set() - let logger = Logger(subsystem: "AuthContext", category: "AuthContext") - // Mastodon public private(set) var mastodonAuthenticationBox: MastodonAuthenticationBox @@ -41,9 +38,9 @@ extension AuthContext { guard let self = self else { return } switch completion { case .failure(let error): - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(error.localizedDescription)") + break case .finished: - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): observer finished") + break } } receiveValue: { [weak self] change in guard let self = self else { return } diff --git a/MastodonSDK/Sources/MastodonCore/Extension/FileManager.swift b/MastodonSDK/Sources/MastodonCore/Extension/FileManager.swift index 9a7ee6601..02942a6a2 100644 --- a/MastodonSDK/Sources/MastodonCore/Extension/FileManager.swift +++ b/MastodonSDK/Sources/MastodonCore/Extension/FileManager.swift @@ -5,12 +5,10 @@ // Created by MainasuK on 2022-1-15. // -import os.log import Foundation extension FileManager { - static let logger = Logger(subsystem: "FileManager", category: "File") - + public func createTemporaryFileURL( filename: String, pathExtension: String @@ -20,8 +18,6 @@ extension FileManager { .appendingPathComponent(filename) .appendingPathExtension(pathExtension) try FileManager.default.createDirectory(at: tempDirectoryURL, withIntermediateDirectories: true, attributes: nil) - - Self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): create temporary file at: \(fileURL.debugDescription)") return fileURL } diff --git a/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift b/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift index c5b8d513c..62e3edbf2 100644 --- a/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift +++ b/MastodonSDK/Sources/MastodonCore/Extension/NSItemProvider.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2021/11/19. // -import os.log import Foundation import UniformTypeIdentifiers import MobileCoreServices @@ -16,8 +15,6 @@ import PhotosUI extension NSItemProvider { - static let logger = Logger(subsystem: "NSItemProvider", category: "Logic") - public struct ImageLoadResult { public let data: Data public let type: UTType? @@ -85,7 +82,6 @@ extension NSItemProvider { CGImageDestinationFinalize(imageDestination) let dataSize = ByteCountFormatter.string(fromByteCount: Int64(data.length), countStyle: .memory) - NSItemProvider.logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): load image \(dataSize)") let result = ImageLoadResult( data: data as Data, diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FeedFetchedResultsController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FeedFetchedResultsController.swift index 2ba2ec5cb..682c83815 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FeedFetchedResultsController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FeedFetchedResultsController.swift @@ -6,7 +6,6 @@ // Copyright © 2021 Twidere. All rights reserved. // -import os.log import Foundation import UIKit import Combine @@ -20,8 +19,6 @@ final public class FeedFetchedResultsController: NSObject { static let defaultFetchLimit = 100 } - public let logger = Logger(subsystem: "FeedFetchedResultsController", category: "DB") - var disposeBag = Set() private let fetchedResultsController: NSFetchedResultsController diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FollowedTagsFetchedResultController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FollowedTagsFetchedResultController.swift index 8c5c64b58..4c3670283 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FollowedTagsFetchedResultController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/FollowedTagsFetchedResultController.swift @@ -5,7 +5,6 @@ // Created by Marcus Kida on 23.11.22. // -import os.log import UIKit import Combine import CoreData @@ -69,7 +68,6 @@ public final class FollowedTagsFetchedResultController: NSObject { // MARK: - NSFetchedResultsControllerDelegate extension FollowedTagsFetchedResultController: NSFetchedResultsControllerDelegate { public func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let objects = fetchedResultsController.fetchedObjects ?? [] self.records = objects diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift index 196c9b8f5..f8376a9c0 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SearchHistoryFetchedResultController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-15. // -import os.log import UIKit import Combine import CoreData @@ -71,7 +70,6 @@ public final class SearchHistoryFetchedResultController: NSObject { // MARK: - NSFetchedResultsControllerDelegate extension SearchHistoryFetchedResultController: NSFetchedResultsControllerDelegate { public func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let objects = fetchedResultsController.fetchedObjects ?? [] self._objectIDs.value = objects.map { $0.objectID } diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SettingFetchedResultController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SettingFetchedResultController.swift index cd8845386..a51d9501b 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SettingFetchedResultController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/SettingFetchedResultController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-25. // -import os.log import UIKit import Combine import CoreData @@ -56,7 +55,6 @@ public final class SettingFetchedResultController: NSObject { // MARK: - NSFetchedResultsControllerDelegate extension SettingFetchedResultController: NSFetchedResultsControllerDelegate { public func controller(_ controller: NSFetchedResultsController, didChangeContentWith snapshot: NSDiffableDataSourceSnapshotReference) { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) let objects = fetchedResultsController.fetchedObjects ?? [] self.settings.value = objects diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift index bb4184bfc..1bc5426c6 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/StatusFetchedResultsController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-30. // -import os.log import UIKit import Combine import CoreData diff --git a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift index cf4f1fc07..452fa2914 100644 --- a/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift +++ b/MastodonSDK/Sources/MastodonCore/FetchedResultsController/UserFetchedResultsController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-7. // -import os.log import UIKit import Combine import CoreData diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Card.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Card.swift index 9ab8a817c..e390d8e35 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Card.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Card.swift @@ -9,7 +9,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log extension Persistence.Card { @@ -17,7 +16,6 @@ extension Persistence.Card { public let domain: String public let entity: Mastodon.Entity.Card public let me: MastodonUser? - public let log = Logger(subsystem: "Card", category: "Persistence") public init( domain: String, entity: Mastodon.Entity.Card, @@ -40,14 +38,6 @@ extension Persistence.Card { self.card = card self.isNewInsertion = isNewInsertion } - - #if DEBUG - public let logger = Logger(subsystem: "Persistence.MastodonCard.PersistResult", category: "Persist") - public func log() { - let pollInsertionFlag = isNewInsertion ? "+" : "-" - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(pollInsertionFlag)](\(card.title)):") - } - #endif } public static func create( diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+MastodonUser.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+MastodonUser.swift index 8571a11cf..b8b5f3089 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+MastodonUser.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+MastodonUser.swift @@ -10,7 +10,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log extension Persistence.MastodonUser { @@ -19,7 +18,6 @@ extension Persistence.MastodonUser { public let entity: Mastodon.Entity.Account public let cache: Persistence.PersistCache? public let networkDate: Date - public let log = Logger(subsystem: "MastodonUser", category: "Persistence") public init( domain: String, @@ -127,7 +125,6 @@ extension Persistence.MastodonUser { public let entity: Mastodon.Entity.Relationship public let me: MastodonUser public let networkDate: Date - public let log = Logger(subsystem: "MastodonUser", category: "Persistence") public init( entity: Mastodon.Entity.Relationship, diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Notification.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Notification.swift index 5273d2bbf..cfe715503 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Notification.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Notification.swift @@ -9,7 +9,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log import class CoreDataStack.Notification extension Persistence.Notification { @@ -19,7 +18,6 @@ extension Persistence.Notification { public let entity: Mastodon.Entity.Notification public let me: MastodonUser public let networkDate: Date - public let log = Logger(subsystem: "Notification", category: "Persistence") public init( domain: String, diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Poll.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Poll.swift index 6e9d5a436..c0d6c813c 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Poll.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Poll.swift @@ -9,7 +9,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log extension Persistence.Poll { @@ -18,7 +17,6 @@ extension Persistence.Poll { public let entity: Mastodon.Entity.Poll public let me: MastodonUser? public let networkDate: Date - public let log = Logger(subsystem: "Poll", category: "Persistence") public init( domain: String, entity: Mastodon.Entity.Poll, @@ -43,14 +41,6 @@ extension Persistence.Poll { self.poll = poll self.isNewInsertion = isNewInsertion } - - #if DEBUG - public let logger = Logger(subsystem: "Persistence.MastodonPoll.PersistResult", category: "Persist") - public func log() { - let pollInsertionFlag = isNewInsertion ? "+" : "-" - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(pollInsertionFlag)](\(poll.id)):") - } - #endif } public static func createOrMerge( diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+PollOption.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+PollOption.swift index d26447276..322fd254f 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+PollOption.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+PollOption.swift @@ -9,7 +9,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log extension Persistence.PollOption { @@ -19,7 +18,6 @@ extension Persistence.PollOption { public let entity: Mastodon.Entity.Poll.Option public let me: MastodonUser? public let networkDate: Date - public let log = Logger(subsystem: "PollOption", category: "Persistence") public init( index: Int, diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+SearchHistory.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+SearchHistory.swift index 84a7bd15f..ef47448cc 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+SearchHistory.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+SearchHistory.swift @@ -9,7 +9,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log extension Persistence.SearchHistory { @@ -17,7 +16,6 @@ extension Persistence.SearchHistory { public let entity: Entity public let me: MastodonUser public let now: Date - public let log = Logger(subsystem: "SearchHistory", category: "Persistence") public init( entity: Entity, me: MastodonUser, diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Status.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Status.swift index dbdfd26c0..c7548db82 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Status.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Status.swift @@ -10,7 +10,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log extension Persistence.Status { @@ -21,7 +20,6 @@ extension Persistence.Status { public let statusCache: Persistence.PersistCache? public let userCache: Persistence.PersistCache? public let networkDate: Date - public let log = Logger(subsystem: "Status", category: "Persistence") public init( domain: String, @@ -54,16 +52,6 @@ extension Persistence.Status { self.isNewInsertion = isNewInsertion self.isNewInsertionAuthor = isNewInsertionAuthor } - - #if DEBUG - public let logger = Logger(subsystem: "Persistence.Status.PersistResult", category: "Persist") - public func log() { - let statusInsertionFlag = isNewInsertion ? "+" : "-" - let authorInsertionFlag = isNewInsertionAuthor ? "+" : "-" - let contentPreview = status.content.prefix(32).replacingOccurrences(of: "\n", with: " ") - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(statusInsertionFlag)](\(status.id))[\(authorInsertionFlag)](\(status.author.id))@\(status.author.username): \(contentPreview)") - } - #endif } public static func createOrMerge( diff --git a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Tag.swift b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Tag.swift index 3071fed0d..163019505 100644 --- a/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Tag.swift +++ b/MastodonSDK/Sources/MastodonCore/Persistence/Persistence+Tag.swift @@ -9,7 +9,6 @@ import CoreData import CoreDataStack import Foundation import MastodonSDK -import os.log extension Persistence.Tag { @@ -18,7 +17,6 @@ extension Persistence.Tag { public let entity: Mastodon.Entity.Tag public let me: MastodonUser? public let networkDate: Date - public let log = Logger(subsystem: "Tag", category: "Persistence") public init( domain: String, diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift index c1642218c..74285c8ec 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Account.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/2/2. // -import os.log import CoreDataStack import Foundation import Combine @@ -67,7 +66,6 @@ extension APIService { authorization: authorization ) .flatMap { response -> AnyPublisher, Error> in - let logger = Logger(subsystem: "Account", category: "API") let account = response.value let managedObjectContext = self.backgroundManagedObjectContext @@ -82,7 +80,6 @@ extension APIService { ) ) let flag = result.isNewInsertion ? "+" : "-" - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): mastodon user [\(flag)](\(result.user.id))\(result.user.username) verifed") } .setFailureType(to: Error.self) .tryMap { result -> Mastodon.Response.Content in @@ -103,8 +100,6 @@ extension APIService { query: Mastodon.API.Account.UpdateCredentialQuery, authorization: Mastodon.API.OAuth.Authorization ) async throws -> Mastodon.Response.Content { - let logger = Logger(subsystem: "Account", category: "API") - let response = try await Mastodon.API.Account.updateCredentials( session: session, domain: domain, @@ -126,7 +121,6 @@ extension APIService { let flag = result.isNewInsertion ? "+" : "-" let userID = response.value.id let username = response.value.username - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): mastodon user [\(flag)](\(userID)\(username) verifed") } return response diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Filter.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Filter.swift index 01f8087a2..28806363b 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Filter.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Filter.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-9. // -import os.log import Combine import CoreData import CoreDataStack diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status+Publish.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status+Publish.swift index d2cbd3f5c..27900d493 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status+Publish.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Status+Publish.swift @@ -9,7 +9,6 @@ import Foundation import Combine import CoreData import CoreDataStack -import CommonOSLog import MastodonSDK extension APIService { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Subscriptions.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Subscriptions.swift index 825bdcd4c..c29505785 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Subscriptions.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Subscriptions.swift @@ -5,7 +5,6 @@ // Created by ihugo on 2021/4/9. // -import os.log import Combine import CoreData import CoreDataStack @@ -29,8 +28,6 @@ extension APIService { query: query ) .flatMap { response -> AnyPublisher, Error> in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: create subscription successful %s", ((#file as NSString).lastPathComponent), #line, #function, response.value.endpoint) - let managedObjectContext = self.backgroundManagedObjectContext return managedObjectContext.performChanges { guard let subscription = managedObjectContext.object(with: subscriptionObjectID) as? NotificationSubscription else { @@ -59,8 +56,6 @@ extension APIService { authorization: authorization ).singleOutput() - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: cancel subscription successful", ((#file as NSString).lastPathComponent), #line, #function) - return response } diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Tags.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Tags.swift index 0b0320078..79a391fe7 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Tags.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Tags.swift @@ -5,7 +5,6 @@ // Created by Marcus Kida on 23.11.22. // -import os.log import Foundation import Combine import CoreData diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift index f1b94376e..afa41b3e9 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService+Thread.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-12. // -import os.log import Foundation import Combine import CoreData diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift b/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift index 44eb9938e..0b7b16ea4 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/APIService.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/1/27. // -import os.log import UIKit import Combine import CoreData diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Instance.swift b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Instance.swift index d9566f6d4..1a76fe4d5 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Instance.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Instance.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-10-9. // -import os.log import Foundation import CoreData import CoreDataStack @@ -17,8 +16,7 @@ extension APIService.CoreData { into managedObjectContext: NSManagedObjectContext, domain: String, entity: Mastodon.Entity.Instance, - networkDate: Date, - log: Logger + networkDate: Date ) -> (instance: Instance, isCreated: Bool) { // fetch old mastodon user let old: Instance? = { diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+InstanceV2.swift b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+InstanceV2.swift index 19e188133..675ee9b46 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+InstanceV2.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+InstanceV2.swift @@ -1,4 +1,3 @@ -import os.log import Foundation import CoreData import CoreDataStack @@ -10,18 +9,15 @@ extension APIService.CoreData { public let domain: String public let entity: Mastodon.Entity.V2.Instance public let networkDate: Date - public let log: Logger - + public init( domain: String, entity: Mastodon.Entity.V2.Instance, - networkDate: Date, - log: Logger + networkDate: Date ) { self.domain = domain self.entity = entity self.networkDate = networkDate - self.log = log } } diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift index 1acb52a77..551ec97de 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+MastodonAuthentication.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/2/3. // -import os.log import Foundation import CoreData import CoreDataStack diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Setting.swift b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Setting.swift index 0c23eab6e..7e8883c75 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Setting.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Setting.swift @@ -6,7 +6,6 @@ // -import os.log import Foundation import CoreData import CoreDataStack diff --git a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift index ec8eec8b2..ea3f4c5f8 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/API/CoreData/APIService+CoreData+Subscriptions.swift @@ -5,7 +5,6 @@ // Created by ihugo on 2021/4/11. // -import os.log import Foundation import CoreData import CoreDataStack diff --git a/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift b/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift index 8faac74d9..2b05a98cd 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/AuthenticationService.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/2/3. // -import os.log import Foundation import Combine import CoreData @@ -207,10 +206,6 @@ extension AuthenticationService { // MARK: - NSFetchedResultsControllerDelegate extension AuthenticationService: NSFetchedResultsControllerDelegate { - public func controllerWillChangeContent(_ controller: NSFetchedResultsController) { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - public func controllerDidChangeContent(_ controller: NSFetchedResultsController) { guard controller === mastodonAuthenticationFetchedResultsController else { assertionFailure() diff --git a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel+LoadState.swift b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel+LoadState.swift index a03af9bd1..e8f76eb84 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel+LoadState.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService+CustomEmojiViewModel+LoadState.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-15. // -import os.log import Foundation import GameplayKit @@ -16,10 +15,6 @@ extension EmojiService.CustomEmojiViewModel { init(viewModel: EmojiService.CustomEmojiViewModel) { 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) - } } } @@ -44,14 +39,12 @@ extension EmojiService.CustomEmojiViewModel.LoadState { // .receive(on: DispatchQueue.main) .sink { completion in switch completion { - case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: failed to load custom emojis for %s: %s. Retry 10s later", ((#file as NSString).lastPathComponent), #line, #function, viewModel.domain, error.localizedDescription) + case .failure(_): stateMachine.enter(Fail.self) case .finished: break } } receiveValue: { response in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: load %ld custom emojis for %s", ((#file as NSString).lastPathComponent), #line, #function, response.value.count, viewModel.domain) stateMachine.enter(Finish.self) viewModel.emojis.value = response.value } diff --git a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift index f912217d4..2da15c3ef 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Emoji/EmojiService.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-15. // -import os.log import Foundation import Combine import MastodonSDK diff --git a/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift b/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift index 0745e2f37..e9ca2df9e 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/InstanceService.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-10-9. // -import os.log import Foundation import Combine import CoreData @@ -15,9 +14,7 @@ import MastodonSDK public final class InstanceService { var disposeBag = Set() - - let logger = Logger(subsystem: "InstanceService", category: "Logic") - + // input let backgroundManagedObjectContext: NSManagedObjectContext weak var apiService: APIService? @@ -66,9 +63,9 @@ extension InstanceService { guard let self = self else { return } switch completion { case .failure(let error): - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Instance] update instance failure: \(error.localizedDescription)") + break case .finished: - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Instance] update instance for domain: \(domain)") + break } } receiveValue: { [weak self] response in guard let _ = self else { return } @@ -85,8 +82,7 @@ extension InstanceService { into: managedObjectContext, domain: domain, entity: response.value, - networkDate: response.networkDate, - log: Logger(subsystem: "Update", category: "InstanceService") + networkDate: response.networkDate ) // update relationship @@ -123,8 +119,7 @@ extension InstanceService { context: .init( domain: domain, entity: response.value, - networkDate: response.networkDate, - log: Logger(subsystem: "Update", category: "InstanceService") + networkDate: response.networkDate ) ) @@ -167,9 +162,7 @@ public extension InstanceService { authenticationBox: authBox ) - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Instance] update mutes and blocks succeeded") } catch { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Instance] update mutes and blocks failure: \(error.localizedDescription)") } } } diff --git a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift index c4a403fc9..cb12a3b36 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService+UploadState.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-18. // -import os.log import Foundation import Combine import GameplayKit @@ -20,7 +19,6 @@ extension MastodonAttachmentService { } public 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) service?.uploadStateMachineSubject.send(self) } } @@ -86,18 +84,14 @@ extension MastodonAttachmentService.UploadState { { self.needsFallback = true stateMachine.enter(Uploading.self) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: upload attachment fallback to V1", ((#file as NSString).lastPathComponent), #line, #function) } else { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: upload attachment fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) service.error.send(error) stateMachine.enter(Fail.self) } case .finished: - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: upload attachment success", ((#file as NSString).lastPathComponent), #line, #function) break } } receiveValue: { response in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: upload attachment %s success: %s", ((#file as NSString).lastPathComponent), #line, #function, response.value.id, response.value.url ?? "") service.attachment.value = response.value if response.statusCode == 202 { // check if still processing @@ -142,18 +136,15 @@ extension MastodonAttachmentService.UploadState { guard let _ = self else { return } switch completion { case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: get attachment fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) service.error.send(error) stateMachine.enter(Fail.self) case .finished: - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: get attachment success", ((#file as NSString).lastPathComponent), #line, #function) break } } receiveValue: { [weak self] response in guard let self = self else { return } guard let _ = response.value.url else { DispatchQueue.main.asyncAfter(deadline: .now() + 2) { [weak self] in - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: processing, retry in 2s", ((#file as NSString).lastPathComponent), #line, #function) self?.stateMachine?.enter(Processing.self) } return diff --git a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift index 1af18efbe..7433e0f8d 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/MastodonAttachment/MastodonAttachmentService.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-17. // -import os.log import UIKit import Combine import PhotosUI @@ -167,7 +166,6 @@ public final class MastodonAttachmentService { let image = UIImage(cgImage: cgImage) return image } catch { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: thumbnail generate fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) return nil } } @@ -176,9 +174,6 @@ public final class MastodonAttachmentService { .store(in: &disposeBag) } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -238,7 +233,6 @@ extension MastodonAttachmentService { let imageData = try Data(contentsOf: url) promise(.success(.jpeg(imageData))) } catch { - os_log("%{public}s[%{public}ld], %{public}s: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) promise(.failure(error)) } } diff --git a/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift b/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift index adabd8962..0ed4004e3 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/Notification/NotificationService.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-22. // -import os.log import UIKit import Combine import CoreData @@ -52,17 +51,6 @@ public final class NotificationService { }) .store(in: &disposeBag) - deviceToken - .receive(on: DispatchQueue.main) - .sink { [weak self] deviceToken in - guard let _ = self else { return } - guard let deviceToken = deviceToken else { return } - let token = [UInt8](deviceToken).toHexString() - let logger = Logger(subsystem: "DeviceToken", category: "NotificationService") - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): deviceToken: \(token)") - } - .store(in: &disposeBag) - Publishers.CombineLatest( authenticationService.$mastodonAuthenticationBoxes, applicationIconBadgeNeedsUpdate @@ -94,7 +82,6 @@ extension NotificationService { let center = UNUserNotificationCenter.current() center.requestAuthorization(options: [.alert, .sound, .badge]) { [weak self] granted, error in guard let self = self else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: request notification permission: %s", ((#file as NSString).lastPathComponent), #line, #function, granted ? "granted" : "fail") self.isNotificationPermissionGranted.value = granted @@ -230,9 +217,7 @@ extension NotificationService { domain: domain, authorization: .init(accessToken: userAccessToken) ) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Push Notification] cancel sign-out user subscription", ((#file as NSString).lastPathComponent), #line, #function) } catch { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: [Push Notification] failed to cancel sign-out user subscription: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) } } diff --git a/MastodonSDK/Sources/MastodonCore/Service/PhotoLibraryService.swift b/MastodonSDK/Sources/MastodonCore/Service/PhotoLibraryService.swift index 053ab3586..a6a2f721c 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/PhotoLibraryService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/PhotoLibraryService.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-29. // -import os.log import UIKit import Combine import Photos diff --git a/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift b/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift index 1c62a38d2..bd14f4b6e 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/PublisherService/PublisherService.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2021-12-2. // -import os.log import UIKit import Combine @@ -13,8 +12,6 @@ public final class PublisherService { var disposeBag = Set() - let logger = Logger(subsystem: "PublisherService", category: "Service") - // input let apiService: APIService @@ -43,7 +40,6 @@ public final class PublisherService { self.currentPublishProgressObservation = last.progress .observe(\.fractionCompleted, options: [.initial, .new]) { [weak self] progress, _ in guard let self = self else { return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): publish progress \(progress.fractionCompleted)") self.currentPublishProgress = progress.fractionCompleted } } @@ -88,19 +84,15 @@ extension PublisherService { Task { do { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): publish status…") let result = try await publisher.publish(api: apiService, authContext: authContext) - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): publish status success") self.statusPublishResult.send(.success(result)) self.statusPublishers.removeAll(where: { $0 === publisher }) } catch is CancellationError { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): publish cancelled") self.statusPublishers.removeAll(where: { $0 === publisher }) } catch { - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): publish failure: \(error.localizedDescription)") self.statusPublishResult.send(.failure(error)) self.currentPublishProgress = 0 } diff --git a/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift b/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift index e86e9e044..3c74045d3 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/SettingService.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-25. // -import os.log import UIKit import Combine import CoreDataStack @@ -109,8 +108,6 @@ public final class SettingService { } .store(in: &disposeBag) - let logger = Logger(subsystem: "Notification", category: "SettingService") - Publishers.CombineLatest3( notificationService.deviceToken, currentSetting.eraseToAnyPublisher(), @@ -154,20 +151,7 @@ public final class SettingService { ) } .debounce(for: .seconds(3), scheduler: DispatchQueue.main) // limit subscribe request emit time interval - .sink(receiveValue: { [weak self] publisher in - guard let self = self else { return } - publisher - .sink { completion in - switch completion { - case .failure(let error): - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Push Notification] subscribe failure: \(error.localizedDescription)") - case .finished: - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [Push Notification] subscribe success") - } - } receiveValue: { response in - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): subscribe response: \(response.value.endpoint)") - } - .store(in: &self.disposeBag) + .sink(receiveValue: { _ in }) .store(in: &disposeBag) } @@ -197,7 +181,6 @@ extension SettingService { let themeName: ThemeName = .system if UserDefaults.shared.currentThemeNameRawValue != themeName.rawValue { ThemeService.shared.set(themeName: themeName) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: update theme style", ((#file as NSString).lastPathComponent), #line, #function) } // set avatar mode diff --git a/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift b/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift index e752a022e..16d4be05e 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/StatusFilterService.swift @@ -5,7 +5,6 @@ // Created by Cirno MainasuK on 2021-7-14. // -import os.log import Foundation import Combine import CoreData @@ -75,11 +74,8 @@ public final class StatusFilterService { .sink { result in switch result { case .success(let response): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch account filters success. %ld items", ((#file as NSString).lastPathComponent), #line, #function, response.value.count) self.activeFilters = response.value case .failure(let error): - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: fetch account filters fail: %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) - break } } diff --git a/MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift b/MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift index a411f30c2..b92eb291f 100644 --- a/MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift +++ b/MastodonSDK/Sources/MastodonCore/Service/StatusPublishService.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-26. // -import os.log import Foundation import Intents import Combine @@ -26,54 +25,4 @@ public final class StatusPublishService { // output let composeViewModelDidUpdatePublisher = PassthroughSubject() // let latestPublishingComposeViewModel = CurrentValueSubject(nil) - - init() { -// Publishers.CombineLatest( -// viewModels.eraseToAnyPublisher(), -// composeViewModelDidUpdatePublisher.eraseToAnyPublisher() -// ) -// .map { viewModels, _ in viewModels.last } -// .assign(to: \.value, on: latestPublishingComposeViewModel) -// .store(in: &disposeBag) - } - -} - -extension StatusPublishService { - -// func publish(composeViewModel: ComposeViewModel) { -// workingQueue.sync { -// guard !self.viewModels.value.contains(where: { $0 === composeViewModel }) else { return } -// self.viewModels.value = self.viewModels.value + [composeViewModel] -// -// composeViewModel.publishStateMachinePublisher -// .receive(on: DispatchQueue.main) -// .sink { [weak self, weak composeViewModel] state in -// guard let self = self else { return } -// guard let composeViewModel = composeViewModel else { return } -// -// os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: composeViewModelDidUpdate", ((#file as NSString).lastPathComponent), #line, #function) -// self.composeViewModelDidUpdatePublisher.send() -// -// switch state { -// case is ComposeViewModel.PublishState.Finish: -// self.remove(composeViewModel: composeViewModel) -// default: -// break -// } -// } -// .store(in: &composeViewModel.disposeBag) // cancel subscription when viewModel dealloc -// } -// } -// -// func remove(composeViewModel: ComposeViewModel) { -// workingQueue.async { -// var viewModels = self.viewModels.value -// viewModels.removeAll(where: { $0 === composeViewModel }) -// self.viewModels.value = viewModels -// -// os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: composeViewModel removed", ((#file as NSString).lastPathComponent), #line, #function) -// } -// } - } diff --git a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift index ad26e0ceb..ff9e6b979 100644 --- a/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift +++ b/MastodonSDK/Sources/MastodonCore/Vendor/ItemProviderLoader.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-18. // -import os.log import Foundation import Combine import MobileCoreServices @@ -15,11 +14,6 @@ import MastodonSDK // load image with low memory usage // Refs: https://christianselig.com/2020/09/phpickerviewcontroller-efficiently/ public enum ItemProviderLoader { - static let logger = Logger(subsystem: "ItemProviderLoader", category: "logic") -} - -extension ItemProviderLoader { - public static func loadImageData(from result: PHPickerResult) -> Future { loadImageData(from: result.itemProvider) } @@ -95,7 +89,6 @@ extension ItemProviderLoader { CGImageDestinationFinalize(imageDestination) let dataSize = ByteCountFormatter.string(fromByteCount: Int64(data.length), countStyle: .memory) - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): load image \(dataSize)") let file = Mastodon.Query.MediaAttachment.jpeg(data as Data) promise(.success(file)) diff --git a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API.swift b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API.swift index 57d99dc41..cba9e91b6 100644 --- a/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API.swift +++ b/MastodonSDK/Sources/MastodonSDK/API/Mastodon+API.swift @@ -5,7 +5,6 @@ // Created by xiaojian sun on 2021/1/25. // -import os.log import Foundation import enum NIOHTTP1.HTTPResponseStatus diff --git a/MastodonSDK/Sources/MastodonSDK/Query/SerialStream.swift b/MastodonSDK/Sources/MastodonSDK/Query/SerialStream.swift index 5808b9f6d..b8df4f7b9 100644 --- a/MastodonSDK/Sources/MastodonSDK/Query/SerialStream.swift +++ b/MastodonSDK/Sources/MastodonSDK/Query/SerialStream.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-5-28. // -import os.log import Foundation import Combine @@ -16,8 +15,6 @@ import Combine final class SerialStream: NSObject { - let logger = Logger(subsystem: "SerialStream", category: "Stream") - public let progress = Progress() var writingTimerSubscriber: AnyCancellable? @@ -61,8 +58,7 @@ final class SerialStream: NSObject { .sink { [weak self] timer in guard let self = self else { return } guard self.canWrite else { return } - os_log(.debug, "%{public}s[%{public}ld], %{public}s: writing…", ((#file as NSString).lastPathComponent), #line, #function) - + guard self.currentStreamIndex < self.streams.count else { self.boundStreams.output.close() self.writingTimerSubscriber = nil // cancel timer after task completed @@ -78,11 +74,8 @@ final class SerialStream: NSObject { baseAddress += writeResult remainsBytes -= writeResult - os_log(.debug, "%{public}s[%{public}ld], %{public}s: write %ld/%ld bytes. write result: %ld", ((#file as NSString).lastPathComponent), #line, #function, baseAddress, readBytesCount, writeResult) - self.progress.completedUnitCount += Int64(writeResult) - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): estimate progress: \(self.progress.completedUnitCount)/\(self.progress.totalUnitCount)") - + if writeResult == -1 { break } @@ -108,7 +101,6 @@ final class SerialStream: NSObject { let reaminsCount = SerialStream.bufferSize - readBytesCount let readCount = inputStream.read(&self.buffer[readBytesCount], maxLength: reaminsCount) - os_log(.debug, "%{public}s[%{public}ld], %{public}s: read source %ld bytes", ((#file as NSString).lastPathComponent), #line, #function, readCount) switch readCount { case 0: @@ -124,11 +116,6 @@ final class SerialStream: NSObject { } } } - - deinit { - os_log(.debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension SerialStream { @@ -141,8 +128,6 @@ extension SerialStream { // MARK: - StreamDelegate extension SerialStream: StreamDelegate { func stream(_ aStream: Stream, handle eventCode: Stream.Event) { - os_log(.debug, "%{public}s[%{public}ld], %{public}s: eventCode %s", ((#file as NSString).lastPathComponent), #line, #function, String(eventCode.rawValue)) - guard aStream == boundStreams.output else { return } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentView.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentView.swift index b44ba1bff..ee3487a4f 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentView.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentView.swift @@ -5,14 +5,11 @@ // Created by MainasuK on 2022-5-20. // -import os.log import UIKit import SwiftUI -import Introspect import AVKit import MastodonAsset import MastodonLocalization -import Introspect public struct AttachmentView: View { diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Compress.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Compress.swift index 0f16bdc1d..efcedbc3f 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Compress.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Compress.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022/11/11. // -import os.log import UIKit import AVKit import MastodonCore @@ -92,7 +91,6 @@ extension AttachmentViewModel { DispatchQueue.main.async { [weak self] in guard let self = self else { return } self.videoCompressProgress = Double(progress) - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: export progress: %.2f", ((#file as NSString).lastPathComponent), #line, #function, progress) } }, completionHandler: { result in switch result { @@ -104,7 +102,6 @@ extension AttachmentViewModel { default: if Task.isCancelled { exporter.cancelExport() - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: cancel export", ((#file as NSString).lastPathComponent), #line, #function) } print("NextLevelSessionExporter, did not complete") } @@ -138,10 +135,8 @@ extension AttachmentViewModel { guard let compressedJpegData = image.jpegData(compressionQuality: 0.8) else { throw AttachmentError.invalidAttachmentType } - os_log("%{public}s[%{public}ld], %{public}s: compress png %.2fMiB -> jpeg %.2fMiB", ((#file as NSString).lastPathComponent), #line, #function, Double(imageData.count) / 1024 / 1024, Double(compressedJpegData.count) / 1024 / 1024) imageData = compressedJpegData } else { - os_log("%{public}s[%{public}ld], %{public}s: png %.2fMiB", ((#file as NSString).lastPathComponent), #line, #function, Double(imageData.count) / 1024 / 1024) break } } else { @@ -152,10 +147,8 @@ extension AttachmentViewModel { guard let compressedJpegData = scaledImage.jpegData(compressionQuality: 0.8) else { throw AttachmentError.invalidAttachmentType } - os_log("%{public}s[%{public}ld], %{public}s: compress jpeg %.2fMiB -> jpeg %.2fMiB", ((#file as NSString).lastPathComponent), #line, #function, Double(imageData.count) / 1024 / 1024, Double(compressedJpegData.count) / 1024 / 1024) imageData = compressedJpegData } else { - os_log("%{public}s[%{public}ld], %{public}s: jpeg %.2fMiB", ((#file as NSString).lastPathComponent), #line, #function, Double(imageData.count) / 1024 / 1024) break } } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+DragAndDrop.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+DragAndDrop.swift index a319aec95..3efef5111 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+DragAndDrop.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+DragAndDrop.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022/11/8. // -import os.log import UIKit import Combine import UniformTypeIdentifiers diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Load.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Load.swift index 31c4a59d9..1cdc53cdc 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Load.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Load.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022/11/8. // -import os.log import UIKit import AVKit import UniformTypeIdentifiers @@ -137,7 +136,6 @@ extension AttachmentViewModel { let image = UIImage(cgImage: cgImage) return image } catch { - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): thumbnail generate fail: \(error.localizedDescription)") return nil } } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift index aeedb6b51..6fe331139 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel+Upload.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2021-11-26. // -import os.log import UIKit import UniformTypeIdentifiers import MastodonCore @@ -143,8 +142,6 @@ extension AttachmentViewModel { let attachmentUploadResponse: Mastodon.Response.Content = try await { do { - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [V2] upload attachment...") - progress.addChild(query.progress, withPendingUnitCount: uploadTaskCount) return try await context.apiService.uploadMedia( domain: context.authContext.mastodonAuthenticationBox.domain, @@ -158,8 +155,6 @@ extension AttachmentViewModel { apiError.httpResponseStatus == .notFound else { throw error } - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [V1] upload attachment...") - progress.addChild(query.progress, withPendingUnitCount: uploadTaskCount) return try await context.apiService.uploadMedia( domain: context.authContext.mastodonAuthenticationBox.domain, @@ -183,8 +178,6 @@ extension AttachmentViewModel { // make sure always count + 1 waitProcessRetryCount += checkUploadTaskCount } - - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): check attachment process status") let attachmentStatusResponse = try await context.apiService.getMedia( attachmentID: attachmentUploadResponse.value.id, @@ -193,23 +186,17 @@ extension AttachmentViewModel { progress.completedUnitCount += checkUploadTaskCount if let url = attachmentStatusResponse.value.url { - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): attachment process finish: \(url)") - // escape here progress.completedUnitCount = progress.totalUnitCount return .uploadedMastodonAttachment(attachmentStatusResponse.value) } else { - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): attachment processing. Retry \(waitProcessRetryCount)/\(waitProcessRetryLimit)") try await Task.sleep(nanoseconds: 1_000_000_000 * 3) // 3s } } while waitProcessRetryCount < waitProcessRetryLimit - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): attachment processing result discard due to exceed retry limit") throw AppError.badRequest } else { - AttachmentViewModel.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): upload attachment success: \(attachmentUploadResponse.value.url ?? "")") - return .uploadedMastodonAttachment(attachmentUploadResponse.value) } } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel.swift index 64441303d..714db2a03 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Attachment/AttachmentViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2021/11/19. // -import os.log import UIKit import Combine import PhotosUI @@ -21,9 +20,6 @@ public protocol AttachmentViewModelDelegate: AnyObject { final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable { - static let logger = Logger(subsystem: "AttachmentViewModel", category: "ViewModel") - let logger = Logger(subsystem: "AttachmentViewModel", category: "ViewModel") - public let id = UUID() var disposeBag = Set() @@ -102,7 +98,6 @@ final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable progress .observe(\.fractionCompleted, options: [.initial, .new]) { [weak self] progress, _ in guard let self = self else { return } - self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): publish progress \(progress.fractionCompleted)") DispatchQueue.main.async { self.fractionCompleted = progress.fractionCompleted } @@ -113,7 +108,6 @@ final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable // progress // .observe(\.isFinished, options: [.initial, .new]) { [weak self] progress, _ in // guard let self = self else { return } - // self.logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): publish progress \(progress.fractionCompleted)") // DispatchQueue.main.async { // self.objectWillChange.send() // } @@ -182,7 +176,6 @@ final public class AttachmentViewModel: NSObject, ObservableObject, Identifiable } deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) uploadTask?.cancel() diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewController.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewController.swift index ccb483f35..bfc1760fe 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewController.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-5-14. // -import os.log import UIKit import Combine import MastodonCore @@ -103,7 +102,6 @@ extension AutoCompleteViewController { extension AutoCompleteViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: indexPath: %s", ((#file as NSString).lastPathComponent), #line, #function, indexPath.debugDescription) tableView.deselectRow(at: indexPath, animated: true) guard let diffableDataSource = viewModel.diffableDataSource else { return } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewModel+State.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewModel+State.swift index 7f93c4ba7..bb315a6e8 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewModel+State.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/AutoComplete/AutoCompleteViewModel+State.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-5-17. // -import os.log import Foundation import GameplayKit import MastodonSDK @@ -14,8 +13,6 @@ import MastodonCore extension AutoCompleteViewModel { class State: GKState { - let logger = Logger(subsystem: "AutoCompleteViewModel.State", category: "StateMachine") - let id = UUID() weak var viewModel: AutoCompleteViewModel? @@ -29,17 +26,12 @@ extension AutoCompleteViewModel { let from = previousState.flatMap { String(describing: $0) } ?? "nil" let to = String(describing: self) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(from) -> \(to)") } @MainActor func enter(state: State.Type) { stateMachine?.enter(state) } - - deinit { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): [\(self.id.uuidString)] \(String(describing: self))") - } } } @@ -161,7 +153,6 @@ extension AutoCompleteViewModel.State { viewModel.autoCompleteItems.value = items } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): auto-complete fail: \(error.localizedDescription)") await enter(state: Fail.self) } } @@ -204,9 +195,7 @@ extension AutoCompleteViewModel.State { super.didEnter(from: previousState) guard let _ = viewModel, let stateMachine = stateMachine else { return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading 3s later…", ((#file as NSString).lastPathComponent), #line, #function) DispatchQueue.main.asyncAfter(deadline: .now() + 3) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: retry loading", ((#file as NSString).lastPathComponent), #line, #function) stateMachine.enter(Loading.self) } } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewController.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewController.swift index 9187f746e..c373a7a6f 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewController.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 22/9/30. // -import os.log import UIKit import SwiftUI import Combine @@ -17,8 +16,6 @@ public final class ComposeContentViewController: UIViewController { static let minAutoCompleteVisibleHeight: CGFloat = 100 - let logger = Logger(subsystem: "ComposeContentViewController", category: "ViewController") - var disposeBag = Set() public var viewModel: ComposeContentViewModel! private(set) lazy var composeContentToolbarViewModel = ComposeContentToolbarView.ViewModel(delegate: self) @@ -233,7 +230,6 @@ extension ComposeContentViewController { switch scrollViewState { case .fold: self.tableView.contentInset.top = -replyToCellFrame.height - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: set contentInset.top: -%s", ((#file as NSString).lastPathComponent), #line, #function, replyToCellFrame.height.description) case .expand: self.tableView.contentInset.top = 0 } @@ -441,7 +437,6 @@ extension ComposeContentViewController { switch viewModel.scrollViewState { case .fold: - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): fold") guard velocity.y < 0 else { return } let offsetY = scrollView.contentOffset.y + scrollView.adjustedContentInset.top if offsetY < -44 { @@ -451,7 +446,6 @@ extension ComposeContentViewController { } case .expand: - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): expand") guard velocity.y > 0 else { return } // check if top across let topOffset = (scrollView.contentOffset.y + scrollView.adjustedContentInset.top) - replyToCellFrame.height @@ -511,7 +505,6 @@ extension ComposeContentViewController: UIImagePickerControllerDelegate & UINavi } public func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - os_log("%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) picker.dismiss(animated: true, completion: nil) } } @@ -594,8 +587,6 @@ extension ComposeContentViewController: AutoCompleteViewControllerDelegate { _ viewController: AutoCompleteViewController, didSelectItem item: AutoCompleteItem ) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): did select item: \(String(describing: item))") - guard let info = viewModel.autoCompleteInfo else { return } guard let metaText = viewModel.contentMetaText else { return } @@ -638,8 +629,6 @@ extension ComposeContentViewController: AutoCompleteViewControllerDelegate { extension ComposeContentViewController: UICollectionViewDelegate { public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: select %s", ((#file as NSString).lastPathComponent), #line, #function, indexPath.debugDescription) - switch collectionView { case customEmojiPickerInputView.collectionView: guard let diffableDataSource = viewModel.customEmojiPickerDiffableDataSource else { return } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+MetaTextDelegate.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+MetaTextDelegate.swift index 8a189739d..9f8330c8e 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+MetaTextDelegate.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+MetaTextDelegate.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022/10/28. // -import os.log import UIKit import MetaTextKit import TwitterMeta diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift index 7813aa63a..feabef283 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel+UITextViewDelegate.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022/11/13. // -import os.log import UIKit // MARK: - UITextViewDelegate @@ -120,7 +119,6 @@ extension ComposeContentViewModel { self.autoCompleteInfo = nil return } - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: auto complete %s (%s)", ((#file as NSString).lastPathComponent), #line, #function, String(autoCompletion.toHighlightEndString), String(autoCompletion.toCursorString)) // get layout text bounding rect var glyphRange = NSRange() diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift index 835740b21..515e3d243 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/ComposeContentViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 22/9/30. // -import os.log import UIKit import Combine import CoreDataStack @@ -27,8 +26,6 @@ public final class ComposeContentViewModel: NSObject, ObservableObject { case editStatus(status: Status, statusSource: Mastodon.Entity.StatusSource) } - let logger = Logger(subsystem: "ComposeContentViewModel", category: "ViewModel") - var disposeBag = Set() // tableViewCell @@ -313,9 +310,6 @@ public final class ComposeContentViewModel: NSObject, ObservableObject { bind() } - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -538,8 +532,6 @@ extension ComposeContentViewModel { extension ComposeContentViewModel { func createNewPollOptionIfCould() { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - guard pollOptions.count < maxPollOptionLimit else { return } let option = PollComposeItem.Option() option.shouldBecomeFirstResponder = true @@ -798,7 +790,6 @@ extension ComposeContentViewModel: AttachmentViewModelDelegate { return case .ready: let count = self.attachmentViewModels.count - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): upload \(i)/\(count) attachment") try await attachmentViewModel.upload() return case .uploading: diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionTextField.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionTextField.swift index fa409c114..7768ac148 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionTextField.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Poll/PollOptionTextField.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-27. // -import os.log import UIKit import SwiftUI import Combine @@ -64,8 +63,6 @@ protocol DeleteBackwardResponseTextFieldRelayDelegate: AnyObject { extension PollOptionTextField { public class Coordinator: NSObject { - let logger = Logger(subsystem: "DeleteBackwardResponseTextFieldRepresentable.Coordinator", category: "Coordinator") - var disposeBag = Set() weak var delegate: DeleteBackwardResponseTextFieldRelayDelegate? diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusPublisher.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusPublisher.swift index 8cb32075b..dfa7d3ef7 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusPublisher.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Publisher/MastodonStatusPublisher.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2021-12-1. // -import os.log import Foundation import Combine import CoreData @@ -15,8 +14,6 @@ import MastodonSDK public final class MastodonStatusPublisher: NSObject, ProgressReporting { - let logger = Logger(subsystem: "MastodonStatusPublisher", category: "Publisher") - // Input // author @@ -149,7 +146,6 @@ extension MastodonStatusPublisher: StatusPublisher { // attachmentIDs.append(attachmentID) } } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): upload attachment fail: \(error.localizedDescription)") _state = .failure(error) throw error } @@ -190,7 +186,6 @@ extension MastodonStatusPublisher: StatusPublisher { ) progress.completedUnitCount += publishStatusTaskCount _state = .success - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): status published: \(publishResponse.value.id)") return .post(publishResponse) } diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift index 90d432825..c81da3be3 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/TableViewCell/ComposeContentTableViewCell.swift @@ -5,14 +5,11 @@ // Created by MainasuK Cirno on 2021-6-28. // -import os.log import UIKit import UIHostingConfigurationBackport final class ComposeContentTableViewCell: UITableViewCell { - let logger = Logger(subsystem: "ComposeContentTableViewCell", category: "View") - override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) _init() diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift index 71f7c9cb5..70430f400 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/Toolbar/ComposeContentToolbarView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 22/10/18. // -import os.log import SwiftUI import MastodonAsset import MastodonLocalization diff --git a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift index d540985b5..58489a8e2 100644 --- a/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift +++ b/MastodonSDK/Sources/MastodonUI/Scene/ComposeContent/View/ComposeContentView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 22/9/30. // -import os.log import SwiftUI import MastodonAsset import MastodonCore @@ -14,9 +13,6 @@ import Stripes public struct ComposeContentView: View { - static let logger = Logger(subsystem: "ComposeContentView", category: "View") - var logger: Logger { ComposeContentView.logger } - static let contentViewCoordinateSpace = "ComposeContentView.Content" static var margin: CGFloat = 16 @@ -112,7 +108,6 @@ public struct ComposeContentView: View { Color.clear.preference(key: ViewFramePreferenceKey.self, value: proxy.frame(in: .named(ComposeContentView.contentViewCoordinateSpace))) } .onPreferenceChange(ViewFramePreferenceKey.self) { frame in - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): content textView frame: \(frame.debugDescription)") let rect = frame.standardized viewModel.contentTextViewFrame = CGRect( origin: frame.origin, @@ -132,7 +127,6 @@ public struct ComposeContentView: View { Color.clear.preference(key: ViewFramePreferenceKey.self, value: proxy.frame(in: .local)) } .onPreferenceChange(ViewFramePreferenceKey.self) { frame in - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): content frame: \(frame.debugDescription)") let rect = frame.standardized viewModel.contentCellFrame = CGRect( origin: frame.origin, diff --git a/MastodonSDK/Sources/MastodonUI/View/Container/AudioContainerView.swift b/MastodonSDK/Sources/MastodonUI/View/Container/AudioContainerView.swift index d23759a31..fdce4015a 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Container/AudioContainerView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Container/AudioContainerView.swift @@ -6,7 +6,6 @@ // import CoreDataStack -import os.log import UIKit import MastodonAsset import MastodonLocalization diff --git a/MastodonSDK/Sources/MastodonUI/View/Container/MediaGridContainerView.swift b/MastodonSDK/Sources/MastodonUI/View/Container/MediaGridContainerView.swift index b28f63942..192101516 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Container/MediaGridContainerView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Container/MediaGridContainerView.swift @@ -6,7 +6,6 @@ // Copyright © 2021 Twidere. All rights reserved. // -import os.log import UIKit import func AVFoundation.AVMakeRect @@ -20,8 +19,6 @@ public final class MediaGridContainerView: UIView { static let sensitiveToggleButtonSize = CGSize(width: 34, height: 34) public static let maxCount = 9 - let logger = Logger(subsystem: "MediaGridContainerView", category: "UI") - public weak var delegate: MediaGridContainerViewDelegate? public private(set) lazy var viewModel: ViewModel = { let viewModel = ViewModel() @@ -79,13 +76,11 @@ extension MediaGridContainerView { extension MediaGridContainerView { @objc private func mediaViewTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { guard let index = _mediaViews.firstIndex(where: { $0.container === sender.view }) else { return } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(index)") let mediaView = _mediaViews[index] delegate?.mediaGridContainerView(self, didTapMediaView: mediaView, at: index) } @objc private func sensitiveToggleButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.mediaGridContainerView(self, mediaSensitiveButtonDidPressed: sender) } } diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift index 651ae5b13..cd4871414 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/FamiliarFollowersDashboardView+ViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-5-16. // -import os.log import UIKit import Combine import CoreDataStack @@ -17,8 +16,6 @@ import MastodonLocalization extension FamiliarFollowersDashboardView { public final class ViewModel: ObservableObject { public var disposeBag = Set() - - let logger = Logger(subsystem: "FamiliarFollowersDashboardView", category: "ViewModel") @Published var avatarURLs: [URL?] = [] @Published var names: [String] = [] diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift index f37ae28b4..2ee2c91dc 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView+ViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-21. // -import os.log import UIKit import Combine import Meta @@ -22,8 +21,6 @@ extension NotificationView { public var disposeBag = Set() public var objects = Set() - let logger = Logger(subsystem: "NotificationView", category: "ViewModel") - @Published public var context: AppContext? @Published public var authContext: AuthContext? diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift index 8900b4cb3..394904dc1 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/NotificationView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-21. // -import os.log import UIKit import Combine import MetaTextKit @@ -40,8 +39,6 @@ public final class NotificationView: UIView { static let containerLayoutMargin = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 16) - let logger = Logger(subsystem: "NotificationView", category: "View") - public weak var delegate: NotificationViewDelegate? var _disposeBag = Set() @@ -434,17 +431,14 @@ extension NotificationView { extension NotificationView { @objc private func avatarButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.notificationView(self, authorAvatarButtonDidPressed: avatarButton) } @objc private func acceptFollowRequestButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.notificationView(self, acceptFollowRequestButtonDidPressed: sender) } @objc private func rejectFollowRequestButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.notificationView(self, rejectFollowRequestButtonDidPressed: sender) } @@ -652,8 +646,6 @@ extension NotificationView: StatusViewDelegate { // MARK: - MastodonMenuDelegate extension NotificationView: MastodonMenuDelegate { public func menuAction(_ action: MastodonMenu.Action) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - delegate?.notificationView(self, menuButton: menuButton, didSelectAction: action) } } diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+ViewModel.swift index 111568e46..2266cc3f2 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView+ViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-14. // -import os.log import UIKit import Combine import Meta @@ -18,7 +17,6 @@ import MastodonCore extension ProfileCardView { public class ViewModel: ObservableObject { - let logger = Logger(subsystem: "ProfileCardView", category: "ViewModel") var disposeBag = Set() public let relationshipViewModel = RelationshipViewModel() diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView.swift index 3da0f7b41..ad8762c71 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/ProfileCardView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-14. // -import os.log import UIKit import Combine import MetaTextKit @@ -18,8 +17,6 @@ public protocol ProfileCardViewDelegate: AnyObject { public final class ProfileCardView: UIView, AXCustomContentProvider { - let logger = Logger(subsystem: "ProfileCardView", category: "View") - static let avatarSize = CGSize(width: 56, height: 56) static let friendshipActionButtonSize = CGSize(width: 108, height: 34) static let contentMargin: CGFloat = 16 @@ -288,13 +285,11 @@ extension ProfileCardView { extension ProfileCardView { @objc private func relationshipActionButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") assert(sender === relationshipActionButton) delegate?.profileCardView(self, relationshipButtonDidPressed: relationshipActionButton) } @objc private func familiarFollowersDashboardViewDidPressed(_ sender: UITapGestureRecognizer) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") assert(sender.view === familiarFollowersDashboardView) delegate?.profileCardView(self, familiarFollowersDashboardViewDidPressed: familiarFollowersDashboardView) } diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift index 6d3abd749..4e9c8cbf9 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusAuthorView.swift @@ -5,7 +5,6 @@ // Created by Jed Fox on 2022-10-31. // -import os.log import UIKit import Combine import Meta @@ -15,7 +14,6 @@ import MastodonCore import MastodonLocalization public class StatusAuthorView: UIStackView { - let logger = Logger(subsystem: "StatusAuthorView", category: "View") private var _disposeBag = Set() // which lifetime same to view scope weak var statusView: StatusView? diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift index ebae0d12e..e43a4ed07 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView+ViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-10. // -import os.log import UIKit import Combine import CoreData @@ -25,8 +24,6 @@ extension StatusView { var observations = Set() public var objects = Set() - let logger = Logger(subsystem: "StatusView", category: "ViewModel") - public var context: AppContext? public var authContext: AuthContext? public var originalStatus: Status? diff --git a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift index ed1d5ed8c..d669c5d2d 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Content/StatusView.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-1-10. // -import os.log import UIKit import Combine import MetaTextKit @@ -45,8 +44,6 @@ public final class StatusView: UIView { public static let containerLayoutMargin: CGFloat = 16 - let logger = Logger(subsystem: "StatusView", category: "View") - private var _disposeBag = Set() // which lifetime same to view scope public var disposeBag = Set() @@ -394,23 +391,19 @@ extension StatusView { extension StatusView { @objc private func headerDidPressed(_ sender: UITapGestureRecognizer) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") assert(sender.view === headerContainerView) delegate?.statusView(self, headerDidPressed: headerContainerView) } @objc private func pollVoteButtonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.statusView(self, pollVoteButtonPressed: pollVoteButton) } @objc private func spoilerOverlayViewTapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") delegate?.statusView(self, spoilerOverlayViewDidPressed: spoilerOverlayView) } @objc private func statusCardControlPressed(_ sender: StatusCardControl) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") guard let url = viewModel.card?.url else { return } delegate?.statusView(self, didTapCardWithURL: url) } @@ -723,7 +716,6 @@ extension StatusView: UITextViewDelegate { // MARK: - MetaTextViewDelegate extension StatusView: MetaTextViewDelegate { public func metaTextView(_ metaTextView: MetaTextView, didSelectMeta meta: Meta) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): meta: \(String(describing: meta))") switch metaTextView { case contentMetaText.textView: delegate?.statusView(self, metaText: contentMetaText, didSelectMeta: meta) @@ -748,7 +740,6 @@ extension StatusView: MediaGridContainerViewDelegate { // MARK: - UITableViewDelegate extension StatusView: UITableViewDelegate { public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): select \(indexPath.debugDescription)") switch tableView { case pollTableView: diff --git a/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift b/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift index 41c5c1b01..1dd2b3b52 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Control/ActionToolbarContainer.swift @@ -5,7 +5,6 @@ // Created by sxiaojian on 2021/2/1. // -import os.log import UIKit import MastodonAsset import MastodonLocalization @@ -19,8 +18,6 @@ public protocol ActionToolbarContainerDelegate: AnyObject { public final class ActionToolbarContainer: UIView { - let logger = Logger(subsystem: "ActionToolbarContainer", category: "Control") - static let replyImage = Asset.Communication.bubbleLeftAndBubbleRight.image.withRenderingMode(.alwaysTemplate) static let reblogImage = Asset.Arrow.repeat.image.withRenderingMode(.alwaysTemplate) static let starImage = Asset.ObjectsAndTools.star.image.withRenderingMode(.alwaysTemplate) @@ -194,8 +191,7 @@ extension ActionToolbarContainer { extension ActionToolbarContainer { @objc private func buttonDidPressed(_ sender: UIButton) { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - + let _action: Action? switch sender { case replyButton: _action = .reply @@ -210,7 +206,6 @@ extension ActionToolbarContainer { return } - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): \(action.rawValue) button pressed") delegate?.actionToolbarContainer(self, buttonDidPressed: sender, action: action) } diff --git a/MastodonSDK/Sources/MastodonUI/View/Control/ContentWarningOverlayView.swift b/MastodonSDK/Sources/MastodonUI/View/Control/ContentWarningOverlayView.swift index 70be5bbc2..71018898e 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Control/ContentWarningOverlayView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Control/ContentWarningOverlayView.swift @@ -5,14 +5,11 @@ // Created by MainasuK on 2021-12-14. // -import os.log import UIKit import MastodonLocalization public final class ContentWarningOverlayView: UIView { - let logger = Logger(subsystem: "ContentWarningOverlayView", category: "View") - let hintLabel: UILabel = { let label = UILabel() label.font = .systemFont(ofSize: 18, weight: .regular) diff --git a/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift b/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift index 3be447292..0fb25a239 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Control/ProfileStatusDashboardView.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-30. // -import os.log import UIKit import MastodonAsset import MastodonLocalization @@ -79,7 +78,6 @@ extension ProfileStatusDashboardView { extension ProfileStatusDashboardView { @objc private func tapGestureRecognizerHandler(_ sender: UITapGestureRecognizer) { - os_log(.debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) guard let sourceView = sender.view as? ProfileStatusDashboardMeterView else { assertionFailure() return diff --git a/MastodonSDK/Sources/MastodonUI/View/Control/StripProgressView.swift b/MastodonSDK/Sources/MastodonUI/View/Control/StripProgressView.swift index 8d429594f..3bcfbe462 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Control/StripProgressView.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Control/StripProgressView.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-3-3. // -import os.log import UIKit import Combine @@ -34,8 +33,6 @@ public final class StripProgressLayer: CALayer { return presentation()?.progress ?? self.progress }() - // os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: progress: %.2f", ((#file as NSString).lastPathComponent), #line, #function, progress) - UIGraphicsBeginImageContextWithOptions(bounds.size, false, 0) guard let context = UIGraphicsGetCurrentContext() else { assertionFailure() diff --git a/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell+Configuration.swift b/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell+Configuration.swift index 1274b7960..d4767048a 100644 --- a/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell+Configuration.swift +++ b/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell+Configuration.swift @@ -21,7 +21,6 @@ extension ProfileCardTableViewCell { assert(layoutMarginsGuide.layoutFrame.width > .zero) shadowBackgroundContainer.frame.size.width = layoutMarginsGuide.layoutFrame.width profileCardView.setupLayoutFrame(layoutMarginsGuide.layoutFrame) - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): did layout for new cell") } profileCardView.configure(user: user) diff --git a/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell.swift b/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell.swift index a14028ea2..3b3227e23 100644 --- a/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell.swift +++ b/MastodonSDK/Sources/MastodonUI/View/TableViewCell/ProfileCardTableViewCell.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022-4-14. // -import os.log import UIKit import Combine @@ -16,8 +15,6 @@ public protocol ProfileCardTableViewCellDelegate: AnyObject { public final class ProfileCardTableViewCell: UITableViewCell { - let logger = Logger(subsystem: "ProfileCardTableViewCell", category: "Cell") - public weak var delegate: ProfileCardTableViewCellDelegate? public var disposeBag = Set() diff --git a/MastodonSDK/Sources/MastodonUI/View/TableViewCell/TimelineMiddleLoaderTableViewCell.swift b/MastodonSDK/Sources/MastodonUI/View/TableViewCell/TimelineMiddleLoaderTableViewCell.swift index 7cb5f2b44..7b928c97a 100644 --- a/MastodonSDK/Sources/MastodonUI/View/TableViewCell/TimelineMiddleLoaderTableViewCell.swift +++ b/MastodonSDK/Sources/MastodonUI/View/TableViewCell/TimelineMiddleLoaderTableViewCell.swift @@ -7,7 +7,6 @@ import Combine import CoreData -import os.log import UIKit public protocol TimelineMiddleLoaderTableViewCellDelegate: AnyObject { @@ -60,7 +59,6 @@ public final class TimelineMiddleLoaderTableViewCell: TimelineLoaderTableViewCel extension TimelineMiddleLoaderTableViewCell { @objc private func loadMoreButtonDidPressed(_ sender: UIButton) { - os_log("%{public}s[%{public}ld], %{public}s", (#file as NSString).lastPathComponent, #line, #function) delegate?.timelineMiddleLoaderTableViewCell(self, loadMoreButtonDidPressed: sender) } } diff --git a/MastodonSDK/Sources/MastodonUI/View/Utility/ViewLayoutFrame.swift b/MastodonSDK/Sources/MastodonUI/View/Utility/ViewLayoutFrame.swift index e97453fdb..c879489bd 100644 --- a/MastodonSDK/Sources/MastodonUI/View/Utility/ViewLayoutFrame.swift +++ b/MastodonSDK/Sources/MastodonUI/View/Utility/ViewLayoutFrame.swift @@ -5,13 +5,10 @@ // Created by MainasuK on 2022-8-17. // -import os.log import UIKit import CoreGraphics public struct ViewLayoutFrame { - let logger = Logger(subsystem: "ViewLayoutFrame", category: "ViewLayoutFrame") - public var layoutFrame: CGRect public var safeAreaLayoutFrame: CGRect public var readableContentLayoutFrame: CGRect diff --git a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AccountTests.swift b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AccountTests.swift index b113672ec..6ea98595f 100644 --- a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AccountTests.swift +++ b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AccountTests.swift @@ -5,7 +5,6 @@ // Created by jk234ert on 2/9/21. // -import os.log import XCTest import Combine import UIKit diff --git a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AppTests.swift b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AppTests.swift index 5638a9754..1a7f339eb 100644 --- a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AppTests.swift +++ b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+AppTests.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/1/29. // -import os.log import XCTest import Combine @testable import MastodonSDK @@ -37,8 +36,6 @@ extension MastodonSDKTests { XCTAssertEqual(response.value.name, "XCTest") XCTAssertEqual(response.value.website, nil) XCTAssertEqual(response.value.redirectURI, "urn:ietf:wg:oauth:2.0:oob") - os_log("%{public}s[%{public}ld], %{public}s: (%s) clientID %s", ((#file as NSString).lastPathComponent), #line, #function, domain, response.value.clientID ?? "nil") - os_log("%{public}s[%{public}ld], %{public}s: (%s) clientSecret %s", ((#file as NSString).lastPathComponent), #line, #function, domain, response.value.clientSecret ?? "nil") theExpectation.fulfill() } .store(in: &disposeBag) diff --git a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+Instance.swift b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+Instance.swift index ee02cf073..a89d50a42 100644 --- a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+Instance.swift +++ b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+Instance.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-2-5. // -import os.log import XCTest import Combine @testable import MastodonSDK diff --git a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OAuthTests.swift b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OAuthTests.swift index c1f09eb99..9a04aea04 100644 --- a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OAuthTests.swift +++ b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OAuthTests.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/1/29. // -import os.log import XCTest import Combine @testable import MastodonSDK @@ -19,7 +18,6 @@ extension MastodonSDKTests { func _testOAuthAuthorize(domain: String) throws { let query = Mastodon.API.OAuth.AuthorizeQuery(clientID: "StubClientID", redirectURI: "mastodon://joinmastodon.org/oauth") let authorizeURL = Mastodon.API.OAuth.authorizeURL(domain: domain, query: query) - os_log("%{public}s[%{public}ld], %{public}s: (%s) authorizeURL %s", ((#file as NSString).lastPathComponent), #line, #function, domain, authorizeURL.absoluteString) XCTAssertEqual( authorizeURL.absoluteString, "\(URL.httpScheme(domain: domain))://\(domain)/oauth/authorize?response_type=code&client_id=StubClientID&redirect_uri=mastodon://joinmastodon.org/oauth&scope=read%20write%20follow%20push" diff --git a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OnboardingTests.swift b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OnboardingTests.swift index 0590888f6..fbe03b86b 100644 --- a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OnboardingTests.swift +++ b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+OnboardingTests.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-2-18. // -import os.log import XCTest import Combine @testable import MastodonSDK @@ -13,8 +12,8 @@ import Combine extension MastodonSDKTests { func testServers() throws { - try _testServers(query: Mastodon.API.Onboarding.ServersQuery(language: nil, category: nil)) - try _testServers(query: Mastodon.API.Onboarding.ServersQuery(language: "en", category: "tech")) + try _testServers(query: Mastodon.API.Onboarding.ServersQuery(language: nil, category: nil, registrations: nil)) + try _testServers(query: Mastodon.API.Onboarding.ServersQuery(language: "en", category: "tech", registrations: nil)) } func _testServers(query: Mastodon.API.Onboarding.ServersQuery) throws { diff --git a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+TimelineTests.swift b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+TimelineTests.swift index 68e5bb669..973de3480 100644 --- a/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+TimelineTests.swift +++ b/MastodonSDK/Tests/MastodonSDKTests/API/MastodonSDK+API+TimelineTests.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021/2/3. // -import os.log import XCTest import Combine @testable import MastodonSDK diff --git a/NotificationService/NotificationService+Decrypt.swift b/NotificationService/NotificationService+Decrypt.swift index 858e7c2c5..e1abfea65 100644 --- a/NotificationService/NotificationService+Decrypt.swift +++ b/NotificationService/NotificationService+Decrypt.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-4-25. // -import os.log import Foundation import CryptoKit @@ -13,7 +12,6 @@ extension NotificationService { static func decrypt(payload: Data, salt: Data, auth: Data, privateKey: P256.KeyAgreement.PrivateKey, publicKey: P256.KeyAgreement.PublicKey) -> Data? { guard let sharedSecret = try? privateKey.sharedSecretFromKeyAgreement(with: publicKey) else { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: failed to craete shared secret", ((#file as NSString).lastPathComponent), #line, #function) return nil } @@ -28,7 +26,6 @@ extension NotificationService { let nonceData = nonce.withUnsafeBytes(Array.init) guard let sealedBox = try? AES.GCM.SealedBox(combined: nonceData + payload) else { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: failed to create sealedBox", ((#file as NSString).lastPathComponent), #line, #function) return nil } @@ -36,10 +33,8 @@ extension NotificationService { do { _plaintext = try AES.GCM.open(sealedBox, using: key) } catch { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: sealedBox open fail %s", ((#file as NSString).lastPathComponent), #line, #function, error.localizedDescription) } guard let plaintext = _plaintext else { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: failed to open sealedBox", ((#file as NSString).lastPathComponent), #line, #function) return nil } diff --git a/Podfile.lock b/Podfile.lock index b83291363..d2d050297 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -1,5 +1,4 @@ PODS: - - FLEX (5.22.10) - Kanna (5.2.7) - Sourcery (1.9.0): - Sourcery/CLI-Only (= 1.9.0) @@ -8,7 +7,6 @@ PODS: - XLPagerTabStrip (9.0.0) DEPENDENCIES: - - FLEX (~> 5.22.10) - Kanna (~> 5.2.2) - Sourcery (~> 1.9) - SwiftGen (~> 6.6.2) @@ -16,19 +14,17 @@ DEPENDENCIES: SPEC REPOS: trunk: - - FLEX - Kanna - Sourcery - SwiftGen - XLPagerTabStrip SPEC CHECKSUMS: - FLEX: f21ee4f498eed3f8a1eded66b21939fd3b7a22ce Kanna: 01cfbddc127f5ff0963692f285fcbc8a9d62d234 Sourcery: d7c59d100e55bf59123c8ae7d65a24cf30748979 SwiftGen: 1366a7f71aeef49954ca5a63ba4bef6b0f24138c XLPagerTabStrip: 61c57fd61f611ee5f01ff1495ad6fbee8bf496c5 -PODFILE CHECKSUM: 219ef7456c1c3111c3f61653632501ce09918bf0 +PODFILE CHECKSUM: 698a840245d400e5a1c93345481965cc16067dc0 COCOAPODS: 1.12.1 diff --git a/ShareActionExtension/Scene/ShareViewController.swift b/ShareActionExtension/Scene/ShareViewController.swift index 18383a053..67a5eca14 100644 --- a/ShareActionExtension/Scene/ShareViewController.swift +++ b/ShareActionExtension/Scene/ShareViewController.swift @@ -5,7 +5,6 @@ // Created by MainasuK on 2022/11/13. // -import os.log import UIKit import Combine import CoreDataStack @@ -17,8 +16,6 @@ import UniformTypeIdentifiers final class ShareViewController: UIViewController { - let logger = Logger(subsystem: "ShareViewController", category: "ViewController") - var disposeBag = Set() let context = AppContext.shared @@ -65,9 +62,6 @@ final class ShareViewController: UIViewController { return label }() - deinit { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } } @@ -120,7 +114,6 @@ extension ShareViewController { await load(inputItems: inputItems) } // end Task } catch { - logger.log(level: .debug, "\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): error: \(error.localizedDescription)") } viewModel.$isPublishing @@ -141,15 +134,10 @@ extension ShareViewController { extension ShareViewController { @objc private func cancelBarButtonItemPressed(_ sender: UIBarButtonItem) { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - extensionContext?.cancelRequest(withError: NSError(domain: "org.joinmastodon.app.ShareActionExtension", code: -1)) } @objc private func publishBarButtonItemPressed(_ sender: UIBarButtonItem) { - logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public)") - - Task { @MainActor in viewModel.isPublishing = true do { @@ -225,14 +213,8 @@ extension ShareViewController: UIAdaptivePresentationControllerDelegate { } func presentationControllerDidAttemptToDismiss(_ presentationController: UIPresentationController) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) showDismissConfirmAlertController() } - - func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { - os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - } - } extension ShareViewController { diff --git a/ShareActionExtension/Scene/ShareViewModel.swift b/ShareActionExtension/Scene/ShareViewModel.swift index ef8e200a6..d2c67373b 100644 --- a/ShareActionExtension/Scene/ShareViewModel.swift +++ b/ShareActionExtension/Scene/ShareViewModel.swift @@ -5,7 +5,6 @@ // Created by MainasuK Cirno on 2021-7-16. // -import os.log import Foundation import Combine import CoreData @@ -20,8 +19,6 @@ import MastodonCore final class ShareViewModel { - let logger = Logger(subsystem: "ComposeViewModel", category: "ViewModel") - var disposeBag = Set() // input