Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ”€ :: (#1237) ์‹ ๊ทœ ๋กœ๊ทธ ์ถ”๊ฐ€ #1239

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Projects/App/Sources/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mutation> in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ? "์ผœ์ง" : "๊บผ์ง"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading