From 5985c47e946fa3d51289cacc8aac6f48d67981df Mon Sep 17 00:00:00 2001 From: baegteun Date: Mon, 26 Aug 2024 23:08:09 +0900 Subject: [PATCH 1/3] =?UTF-8?q?:chart=5Fwith=5Fupwards=5Ftrend:=20::=20[#1?= =?UTF-8?q?237]=20=EC=8B=A0=EA=B7=9C=EB=A1=9C=EA=B7=B8=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/Sources/Application/AppDelegate.swift | 4 ++++ .../Analytics/SettingAnalyticsLog.swift | 2 ++ .../Sources/Reactors/SettingReactor.swift | 2 +- .../PlayTypeTogglePopupViewController.swift | 6 +++--- .../Setting/SettingViewController.swift | 19 +++++++++++++++++-- .../Views/SettingItemTableViewCell.swift | 2 +- .../Sources/AnalyticsUserProperty.swift | 2 ++ .../Sources/Manager/PreferenceManager.swift | 2 +- 8 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Projects/App/Sources/Application/AppDelegate.swift b/Projects/App/Sources/Application/AppDelegate.swift index 7de90988e..054e09640 100644 --- a/Projects/App/Sources/Application/AppDelegate.swift +++ b/Projects/App/Sources/Application/AppDelegate.swift @@ -131,6 +131,10 @@ extension AppDelegate { LogManager.clearUserProperty(property: .fruitTotal(count: -1)) } + if let playPlatform = PreferenceManager.songPlayPlatformType { + LogManager.setUserProperty(property: .songPlayPlatform(platform: playPlatform.display)) + } + LogManager.setUserProperty(property: .playlistSongTotal(count: PlayState.shared.count)) } } diff --git a/Projects/Features/MyInfoFeature/Sources/Analytics/SettingAnalyticsLog.swift b/Projects/Features/MyInfoFeature/Sources/Analytics/SettingAnalyticsLog.swift index ff63d29e1..5cb1a9553 100644 --- a/Projects/Features/MyInfoFeature/Sources/Analytics/SettingAnalyticsLog.swift +++ b/Projects/Features/MyInfoFeature/Sources/Analytics/SettingAnalyticsLog.swift @@ -4,6 +4,8 @@ enum SettingAnalyticsLog: AnalyticsLogType { case clickNotificationButton case clickTermsOfServiceButton case clickPrivacyPolicyButton + case clickSongPlayPlatform + case completeSelectSongPlayPlatform(platform: String) case clickOpensourceButton case clickRemoveCacheButton case completeRemoveCache(size: String) diff --git a/Projects/Features/MyInfoFeature/Sources/Reactors/SettingReactor.swift b/Projects/Features/MyInfoFeature/Sources/Reactors/SettingReactor.swift index 7679b37c2..785ecf21b 100644 --- a/Projects/Features/MyInfoFeature/Sources/Reactors/SettingReactor.swift +++ b/Projects/Features/MyInfoFeature/Sources/Reactors/SettingReactor.swift @@ -165,7 +165,7 @@ final class SettingReactor: Reactor { return .just(.changedNotificationAuthorizationStatus(granted)) } - let updatePlayTypeMutation = PreferenceManager.$playWithYoutubeMusic + let updatePlayTypeMutation = PreferenceManager.$songPlayPlatformType .distinctUntilChanged() .map { $0 ?? .youtube } .flatMap { playType -> Observable in diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift index 7cba2d1db..e977391d9 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift @@ -224,11 +224,11 @@ private extension PlayTypeTogglePopupViewController { self.view.backgroundColor = .clear contentView.clipsToBounds = true - let playType = PreferenceManager.playWithYoutubeMusic ?? .youtube + let playType = PreferenceManager.songPlayPlatformType ?? .youtube self.selectedItemString = playType.display - firstItemButton.setTitleWithOption(title: playType.display) - secondItemButton.setTitleWithOption(title: playType.display, shouldCheckAppIsInstalled: true) + firstItemButton.setTitleWithOption(title: YoutubePlayType.youtube.display) + secondItemButton.setTitleWithOption(title: YoutubePlayType.youtubeMusic.display, shouldCheckAppIsInstalled: true) firstItemButton.isSelected = playType == .youtube secondItemButton.isSelected = playType == .youtubeMusic diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Setting/SettingViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Setting/SettingViewController.swift index 9d9a9c54d..5a60741db 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/Setting/SettingViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/Setting/SettingViewController.swift @@ -234,6 +234,7 @@ extension SettingViewController: UITableViewDelegate { LogManager.analytics(SettingAnalyticsLog.clickNotificationButton) reactor?.action.onNext(.appPushSettingNavigationDidTap) case .playType: + LogManager.analytics(SettingAnalyticsLog.clickSongPlayPlatform) showPlayTypeTogglePopup() case .serviceTerms: LogManager.analytics(SettingAnalyticsLog.clickTermsOfServiceButton) reactor?.action.onNext(.serviceTermsNavigationDidTap) @@ -260,9 +261,23 @@ extension SettingViewController: UITableViewDelegate { completion: { selectedItemString in switch selectedItemString { case YoutubePlayType.youtube.display: - PreferenceManager.playWithYoutubeMusic = .youtube + PreferenceManager.songPlayPlatformType = .youtube + LogManager.analytics( + SettingAnalyticsLog.completeSelectSongPlayPlatform(platform: YoutubePlayType.youtube.display) + ) + LogManager.setUserProperty( + property: .songPlayPlatform(platform: YoutubePlayType.youtube.display) + ) case YoutubePlayType.youtubeMusic.display: - PreferenceManager.playWithYoutubeMusic = .youtubeMusic + PreferenceManager.songPlayPlatformType = .youtubeMusic + LogManager.analytics( + SettingAnalyticsLog.completeSelectSongPlayPlatform( + platform: YoutubePlayType.youtubeMusic.display + ) + ) + LogManager.setUserProperty( + property: .songPlayPlatform(platform: YoutubePlayType.youtubeMusic.display) + ) default: break } diff --git a/Projects/Features/MyInfoFeature/Sources/Views/SettingItemTableViewCell.swift b/Projects/Features/MyInfoFeature/Sources/Views/SettingItemTableViewCell.swift index 600d4b9ca..d35b6a63b 100644 --- a/Projects/Features/MyInfoFeature/Sources/Views/SettingItemTableViewCell.swift +++ b/Projects/Features/MyInfoFeature/Sources/Views/SettingItemTableViewCell.swift @@ -72,7 +72,7 @@ private extension SettingItemTableViewCell { switch type { case let .navigate(category): let pushNotificationAuthorizationStatus = PreferenceManager.pushNotificationAuthorizationStatus ?? false - let playType = PreferenceManager.playWithYoutubeMusic ?? .youtube + let playType = PreferenceManager.songPlayPlatformType ?? .youtube switch category { case .appPush: self.subTitleLabel.text = pushNotificationAuthorizationStatus ? "켜짐" : "꺼짐" diff --git a/Projects/Modules/LogManager/Sources/AnalyticsUserProperty.swift b/Projects/Modules/LogManager/Sources/AnalyticsUserProperty.swift index 272f2b141..c4994fb33 100644 --- a/Projects/Modules/LogManager/Sources/AnalyticsUserProperty.swift +++ b/Projects/Modules/LogManager/Sources/AnalyticsUserProperty.swift @@ -10,6 +10,7 @@ public enum AnalyticsUserProperty { case fruitTotal(count: Int) case playlistSongTotal(count: Int) case latestSearchKeyword(keyword: String) + case songPlayPlatform(platform: String) } extension AnalyticsUserProperty: UserPropertyRepresentable { @@ -27,6 +28,7 @@ extension AnalyticsUserProperty: UserPropertyRepresentable { case let .fruitTotal(count): return "\(count)" case let .playlistSongTotal(count): return "\(count)" case let .latestSearchKeyword(keyword): return keyword + case let .songPlayPlatform(platform): return platform } } } diff --git a/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift b/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift index dcb552714..47ce70289 100644 --- a/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift +++ b/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift @@ -47,7 +47,7 @@ public final class PreferenceManager { public static var pushNotificationAuthorizationStatus: Bool? @UserDefaultWrapper(key: Constants.playWithYoutubeMusic.rawValue, defaultValue: YoutubePlayType.youtube) - public static var playWithYoutubeMusic: YoutubePlayType? + public static var songPlayPlatformType: YoutubePlayType? } @propertyWrapper From 8b8ac9740628ff4dc86189595a7a0c9671bc954d Mon Sep 17 00:00:00 2001 From: baegteun Date: Mon, 26 Aug 2024 23:08:47 +0900 Subject: [PATCH 2/3] =?UTF-8?q?:art:=20::=20=EC=BD=94=EB=93=9C=20Formattin?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlayTypeTogglePopupViewController.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift b/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift index e977391d9..14360ccbb 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift @@ -228,7 +228,10 @@ private extension PlayTypeTogglePopupViewController { self.selectedItemString = playType.display firstItemButton.setTitleWithOption(title: YoutubePlayType.youtube.display) - secondItemButton.setTitleWithOption(title: YoutubePlayType.youtubeMusic.display, shouldCheckAppIsInstalled: true) + secondItemButton.setTitleWithOption( + title: YoutubePlayType.youtubeMusic.display, + shouldCheckAppIsInstalled: true + ) firstItemButton.isSelected = playType == .youtube secondItemButton.isSelected = playType == .youtubeMusic From e3ea1a745dd95588bc79002f5f03c15a7afa9eb9 Mon Sep 17 00:00:00 2001 From: baegteun Date: Tue, 27 Aug 2024 01:37:47 +0900 Subject: [PATCH 3/3] :truck: :: [#1237] playWithYoutubeMusic -> SongPlayPlatform --- .../Modules/Utility/Sources/Manager/PreferenceManager.swift | 4 ++-- .../Utility/Sources/Player/WakmusicYoutubePlayer.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift b/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift index 47ce70289..c3f1df5e6 100644 --- a/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift +++ b/Projects/Modules/Utility/Sources/Manager/PreferenceManager.swift @@ -22,7 +22,7 @@ public final class PreferenceManager { case ignoredPopupIDs // 다시보지 않는 팝업 IDs case readNoticeIDs // 이미 읽은 공지 IDs case pushNotificationAuthorizationStatus // 기기알림 on/off 상태 - case playWithYoutubeMusic // 유튜브뮤직으로 재생할지 여부 + case songPlayPlatformType // 유튜브뮤직으로 재생할지 여부 } @UserDefaultWrapper(key: Constants.recentRecords.rawValue, defaultValue: nil) @@ -46,7 +46,7 @@ public final class PreferenceManager { @UserDefaultWrapper(key: Constants.pushNotificationAuthorizationStatus.rawValue, defaultValue: nil) public static var pushNotificationAuthorizationStatus: Bool? - @UserDefaultWrapper(key: Constants.playWithYoutubeMusic.rawValue, defaultValue: YoutubePlayType.youtube) + @UserDefaultWrapper(key: Constants.songPlayPlatformType.rawValue, defaultValue: YoutubePlayType.youtube) public static var songPlayPlatformType: YoutubePlayType? } diff --git a/Projects/Modules/Utility/Sources/Player/WakmusicYoutubePlayer.swift b/Projects/Modules/Utility/Sources/Player/WakmusicYoutubePlayer.swift index 07d1eb7a0..8ec13ed3d 100644 --- a/Projects/Modules/Utility/Sources/Player/WakmusicYoutubePlayer.swift +++ b/Projects/Modules/Utility/Sources/Player/WakmusicYoutubePlayer.swift @@ -11,7 +11,7 @@ public struct WakmusicYoutubePlayer: WakmusicPlayer { private let youtubeURLGenerator: any YoutubeURLGeneratable private let ids: [String] private var openerPlatform: OpenerPlatform { - let platform = PreferenceManager.playWithYoutubeMusic ?? .youtube + let platform = PreferenceManager.songPlayPlatformType ?? .youtube switch platform { case .youtube: return .youtube case .youtubeMusic: return .youtubeMusic