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..14360ccbb 100644 --- a/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift +++ b/Projects/Features/MyInfoFeature/Sources/ViewControllers/PlayTypeTogglePopup/PlayTypeTogglePopupViewController.swift @@ -224,11 +224,14 @@ 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..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,8 +46,8 @@ public final class PreferenceManager { @UserDefaultWrapper(key: Constants.pushNotificationAuthorizationStatus.rawValue, defaultValue: nil) public static var pushNotificationAuthorizationStatus: Bool? - @UserDefaultWrapper(key: Constants.playWithYoutubeMusic.rawValue, defaultValue: YoutubePlayType.youtube) - public static var playWithYoutubeMusic: YoutubePlayType? + @UserDefaultWrapper(key: Constants.songPlayPlatformType.rawValue, defaultValue: YoutubePlayType.youtube) + public static var songPlayPlatformType: YoutubePlayType? } @propertyWrapper 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