Skip to content

Commit

Permalink
Merge branch 'release/3.0.0' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KangTaeHoon committed Sep 7, 2024
2 parents 169d9c6 + 19699ba commit 2e2128c
Show file tree
Hide file tree
Showing 287 changed files with 4,842 additions and 2,312 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: CI

on:
pull_request:
paths:
- ".github/workflows/CI.yml"
- "**/*.swift"
push:
branches:
- develop
- master
pull_request:
branches:
- "*"

env:
CACHED_PACKAGE_DEPENDENCY_PATHS: ${{ github.workspace }}/.build
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ let packageSetting = PackageSettings(
baseSettings: .settings(
configurations: [
.debug(name: .debug),
.debug(name: .qa),
.release(name: .release)
]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import ProjectDescription
public extension Array where Element == Configuration {
static let `default`: [Configuration] = [
.debug(name: .debug, xcconfig: .relativeToRoot("Projects/App/XCConfig/Secrets.xcconfig")),
.debug(name: .qa, xcconfig: .relativeToRoot("Projects/App/XCConfig/Secrets.xcconfig")),
.release(name: .release, xcconfig: .relativeToRoot("Projects/App/XCConfig/Secrets.xcconfig"))
]
}

public extension ProjectDescription.ConfigurationName {
static let qa = ConfigurationName.configuration("QA")
}
17 changes: 15 additions & 2 deletions Projects/App/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ let settinges: Settings =
base: env.baseSetting,
configurations: [
.debug(name: .debug),
.debug(name: .qa),
.release(name: .release)
],
defaultSettings: .recommended
Expand Down Expand Up @@ -56,9 +57,11 @@ let targets: [Target] = [
base: env.baseSetting,
configurations: [
.debug(name: .debug, xcconfig: "XCConfig/Secrets.xcconfig"),
.debug(name: .qa, xcconfig: "XCConfig/Secrets.xcconfig"),
.release(name: .release, xcconfig: "XCConfig/Secrets.xcconfig")
]
)
),
environmentVariables: ["NETWORK_LOG_LEVEL": "short"]
),
.target(
name: "\(env.name)Tests",
Expand All @@ -76,7 +79,7 @@ let targets: [Target] = [

let schemes: [Scheme] = [
.scheme(
name: "\(env.name)Tests-DEBUG",
name: "\(env.name)-DEBUG",
shared: true,
buildAction: .buildAction(targets: ["\(env.name)"]),
testAction: TestAction.targets(
Expand All @@ -92,6 +95,16 @@ let schemes: [Scheme] = [
profileAction: .profileAction(configuration: .debug),
analyzeAction: .analyzeAction(configuration: .debug)
),
.scheme(
name: "\(env.name)-QA",
shared: true,
buildAction: .buildAction(targets: ["\(env.name)"]),
testAction: nil,
runAction: .runAction(configuration: .qa),
archiveAction: .archiveAction(configuration: .qa),
profileAction: .profileAction(configuration: .qa),
analyzeAction: .analyzeAction(configuration: .qa)
),
.scheme(
name: "\(env.name)-RELEASE",
shared: true,
Expand Down
6 changes: 3 additions & 3 deletions Projects/App/Sources/Application/AppComponent+Base.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import BaseFeatureInterface
import Foundation

public extension AppComponent {
var multiPurposePopUpFactory: any MultiPurposePopupFactory {
var multiPurposePopupFactory: any MultiPurposePopupFactory {
MultiPurposePopupComponent(parent: self)
}

var textPopUpFactory: any TextPopUpFactory {
TextPopUpComponent(parent: self)
var textPopupFactory: any TextPopupFactory {
TextPopupComponent(parent: self)
}

var containSongsFactory: any ContainSongsFactory {
Expand Down
6 changes: 6 additions & 0 deletions Projects/App/Sources/Application/AppComponent+Credit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ public extension AppComponent {
}
}

var fetchCreditProfileUseCase: any FetchCreditProfileUseCase {
shared {
FetchCreditProfileUseCaseImpl(creditRepository: creditRepository)
}
}

var songCreditFactory: any SongCreditFactory {
SongCreditComponent(parent: self)
}
Expand Down
4 changes: 4 additions & 0 deletions Projects/App/Sources/Application/AppComponent+MyInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,8 @@ extension AppComponent {
var profilePopupFactory: any ProfilePopupFactory {
ProfilePopupComponent(parent: self)
}

var playTypeTogglePopupFactory: any PlayTypeTogglePopupFactory {
PlayTypeTogglePopupComponent(parent: self)
}
}
6 changes: 6 additions & 0 deletions Projects/App/Sources/Application/AppComponent+Playlist.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ public extension AppComponent {
}
}

var fetchWMPlaylistDetailUseCase: any FetchWMPlaylistDetailUseCase {
shared {
FetchWMPlaylistDetailUseCaseImpl(playlistRepository: playlistRepository)
}
}

var createPlaylistUseCase: any CreatePlaylistUseCase {
shared {
CreatePlaylistUseCaseImpl(playlistRepository: playlistRepository)
Expand Down
37 changes: 22 additions & 15 deletions Projects/App/Sources/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
} else {
LogManager.setUserID(userID: nil)
}
initializeUserProperty()

Analytics.logEvent(AnalyticsEventAppOpen, parameters: nil)

Expand Down Expand Up @@ -56,20 +57,6 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
}

extension AppDelegate {
func application(
_ application: UIApplication,
didReceiveRemoteNotification userInfo: [AnyHashable: Any]
) {
// If you are receiving a notification message while your app is in the background,
// this callback will not be fired till the user taps on the notification launching the application.

// With swizzling disabled you must let Messaging know about the message, for Analytics
Messaging.messaging().appDidReceiveMessage(userInfo)

// Print full message.
LogManager.printDebug("🔔:: \(userInfo)")
}

/// [START receive_message]
func application(
_ application: UIApplication,
Expand Down Expand Up @@ -116,9 +103,29 @@ extension AppDelegate {
}
}
}

private func initializeUserProperty() {
if let loginPlatform = PreferenceManager.userInfo?.platform {
LogManager.setUserProperty(property: .loginPlatform(platform: loginPlatform))
} else {
LogManager.clearUserProperty(property: .loginPlatform(platform: ""))
}

if let fruitTotal = PreferenceManager.userInfo?.itemCount {
LogManager.setUserProperty(property: .fruitTotal(count: fruitTotal))
} else {
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))
}
}

#if DEBUG
#if DEBUG || QA
extension UIWindow {
override open func motionEnded(_ motion: UIEvent.EventSubtype, with event: UIEvent?) {
super.motionEnded(motion, with: event)
Expand Down
3 changes: 1 addition & 2 deletions Projects/App/Sources/Application/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
}
LogManager.printDebug("URL: \(webpageURL.absoluteString)")

guard webpageURL.host == WM_UNIVERSALLINK_DOMAIN() ||
webpageURL.host == WM_UNIVERSALLINK_TEST_DOMAIN() else {
guard webpageURL.host == WM_UNIVERSALLINK_DOMAIN() else {
return
}
handleUniversalLink(url: webpageURL)
Expand Down
26 changes: 6 additions & 20 deletions Projects/App/Support/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>naversearchapp</string>
<string>naversearchthirdlogin</string>
<string>naversearchapp</string>
<string>naversearchthirdlogin</string>
<string>youtube</string>
<string>youtubemusic</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
Expand All @@ -70,10 +72,10 @@
<dict>
<key>BASE_DEV_URL</key>
<string>$(BASE_DEV_URL)</string>
<key>BASE_IMAGE_URL</key>
<string>$(BASE_IMAGE_URL)</string>
<key>BASE_PROD_URL</key>
<string>$(BASE_PROD_URL)</string>
<key>CDN_DOMAIN_URL</key>
<string>$(CDN_DOMAIN_URL)</string>
<key>GOOGLE_CLIENT_ID</key>
<string>$(GOOGLE_CLIENT_ID)</string>
<key>GOOGLE_URL_SCHEME</key>
Expand All @@ -100,22 +102,6 @@
<string>$(WMDOMAIN_FAQ)</string>
<key>WMDOMAIN_IMAGE</key>
<string>$(WMDOMAIN_IMAGE)</string>
<key>WMDOMAIN_IMAGE_ARTIST_ROUND</key>
<string>$(WMDOMAIN_IMAGE_ARTIST_ROUND)</string>
<key>WMDOMAIN_IMAGE_ARTIST_SQUARE</key>
<string>$(WMDOMAIN_IMAGE_ARTIST_SQUARE)</string>
<key>WMDOMAIN_IMAGE_NEWS</key>
<string>$(WMDOMAIN_IMAGE_NEWS)</string>
<key>WMDOMAIN_IMAGE_NOTICE</key>
<string>$(WMDOMAIN_IMAGE_NOTICE)</string>
<key>WMDOMAIN_IMAGE_PLAYLIST</key>
<string>$(WMDOMAIN_IMAGE_PLAYLIST)</string>
<key>WMDOMAIN_IMAGE_PROFILE</key>
<string>$(WMDOMAIN_IMAGE_PROFILE)</string>
<key>WMDOMAIN_IMAGE_RECOMMEND_PLAYLIST_ROUND</key>
<string>$(WMDOMAIN_IMAGE_RECOMMEND_PLAYLIST_ROUND)</string>
<key>WMDOMAIN_IMAGE_RECOMMEND_PLAYLIST_SQUARE</key>
<string>$(WMDOMAIN_IMAGE_RECOMMEND_PLAYLIST_SQUARE)</string>
<key>WMDOMAIN_LIKE</key>
<string>$(WMDOMAIN_LIKE)</string>
<key>WMDOMAIN_NOTICE</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public extension ArtistDetailResponseDTO {
let enName: String

private enum CodingKeys: String, CodingKey {
case krName = "krShort"
case krName = "kr"
case enName = "en"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public extension ArtistListResponseDTO {
let enName: String

private enum CodingKeys: String, CodingKey {
case krName = "krShort"
case krName = "kr"
case enName = "en"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ open class BaseRemoteDataSource<API: WMAPI> {
) {
self.keychain = keychain

#if DEBUG
#if DEBUG || QA
self.provider = provider ?? MoyaProvider(plugins: [
JwtPlugin(keychain: keychain),
BasePlugin(keychain: keychain),
Expand Down Expand Up @@ -107,7 +107,15 @@ private extension BaseRemoteDataSource {
}

func reissueToken() -> Completable {
let provider = refreshProvider ?? MoyaProvider(plugins: [JwtPlugin(keychain: keychain), CustomLoggingPlugin()])
#if DEBUG || QA
let provider = refreshProvider ?? MoyaProvider(plugins: [
JwtPlugin(keychain: keychain),
CustomLoggingPlugin()
])
#else
let provider = refreshProvider ?? MoyaProvider(plugins: [JwtPlugin(keychain: keychain)])
#endif

if refreshProvider == nil {
refreshProvider = provider
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
//
// CustomLoggingPlugin.swift
// BaseDomain
//
// Created by KTH on 2024/03/04.
// Copyright © 2024 yongbeomkwak. All rights reserved.
//

import Foundation
import Moya
import OSLog

#if DEBUG
#if DEBUG || QA
private enum NetworkLogLevel: String {
case short
case detail
}

public final class CustomLoggingPlugin: PluginType {
public init() {}
let logger = Logger(subsystem: Bundle.main.bundleIdentifier ?? "", category: "NETWORK")
private let logLevel: NetworkLogLevel

public init() {
self.logLevel = CustomLoggingPlugin.getLogLevelFromArguments() ?? .detail
}

public func willSend(_ request: RequestType, target: TargetType) {
guard let httpRequest = request.request else {
Expand All @@ -30,7 +32,14 @@ import Moya
log.append("\(bodyString)\n")
}
log.append("---------------- END \(method) -----------------------\n")
print(log)

switch logLevel {
case .short:
let log = "[🛜 Request] [\(method)] [\(target)] \(url)"
logger.log(level: .debug, "\(log)")
case .detail:
logger.log(level: .debug, "\(log)")
}
}

public func didReceive(_ result: Result<Response, MoyaError>, target: TargetType) {
Expand All @@ -56,7 +65,14 @@ import Moya
log.append("\(reString)\n")
}
log.append("------------------- END HTTP (\(response.data.count)-byte body) -------------------\n")
print(log)

switch logLevel {
case .short:
let log = "[🛜 Response] [\(statusCode)] [\(target)] \(url)"
logger.log(level: .debug, "\(log)")
case .detail:
logger.log(level: .debug, "\(log)")
}
}

func onFail(_ error: MoyaError, target: TargetType) {
Expand All @@ -68,7 +84,18 @@ import Moya
log.append("<-- \(error.errorCode) \(target)\n")
log.append("\(error.failureReason ?? error.errorDescription ?? "unknown error")\n")
log.append("<-- END HTTP\n")
print(log)

logger.log("\(log)")
}
}

extension CustomLoggingPlugin {
/// Environment Variables 에서 로그 레벨을 가져오는 메소드
/// Scheme의 Environment Variables 에 key : NETWORK_LOG_LEVEL, value : short 또는 detail
private static func getLogLevelFromArguments() -> NetworkLogLevel? {
guard let logLevelValue = ProcessInfo.processInfo.environment["NETWORK_LOG_LEVEL"] else { return nil }
guard let networkLogLevel = NetworkLogLevel(rawValue: logLevelValue) else { return nil }
return networkLogLevel
}
}

Expand Down
2 changes: 1 addition & 1 deletion Projects/Domains/BaseDomain/Sources/WMAPI/SecretURL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public func config(key: String) -> String {

// MARK: - BASE_URL
public func BASE_URL() -> String {
#if DEBUG
#if DEBUG || QA
return config(key: "BASE_DEV_URL")
#else
return config(key: "BASE_PROD_URL")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public extension SingleChartRankingResponseDTO {
public extension SingleChartRankingResponseDTO {
func toDomain(type: ChartDateType) -> ChartEntity {
return ChartEntity(
updatedAt: Date(timeIntervalSince1970: updatedAt).changeDateFormatForChart() + " 업데이트",
updatedAt: Date(timeIntervalSince1970: updatedAt / 1000).changeDateFormatForChart() + " 업데이트",
songs: songs.map {
return ChartRankingEntity(
id: $0.songID,
Expand Down
Loading

0 comments on commit 2e2128c

Please sign in to comment.