Skip to content

Commit

Permalink
[Refactor/#95] 팩토리 패턴을 활용해서 OAuthService 분기처리
Browse files Browse the repository at this point in the history
  • Loading branch information
HELLOHIDI committed Nov 2, 2024
1 parent fa55c94 commit 5eedcff
Show file tree
Hide file tree
Showing 19 changed files with 466 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@
ReferencedContainer = "container:Projects/Data/Data.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "2EE1E3864350B203170C3C4F"
BuildableName = "DataDemo.app"
BlueprintName = "DataDemo"
ReferencedContainer = "container:Projects/Data/Data.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
76 changes: 76 additions & 0 deletions HMH_Tuist_iOS/Projects/Data/Derived/InfoPlists/DataDemo-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BASE_URL</key>
<string>$(BASE_URL)</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.HMH.dailyTask</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>kakao$(KAKAO_API_KEY)</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>KAKAO_API_KEY</key>
<string>$(KAKAO_API_KEY)</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>kakaokompassauth</string>
<string>kakaolink</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIAppFonts</key>
<array>
<string>Pretendard-Regular.otf</string>
<string>Pretendard-SemiBold.otf</string>
<string>Pretendard-Medium.otf</string>
</array>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<false/>
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
// swiftlint:disable all
// swift-format-ignore-file
// swiftformat:disable all
// Generated using tuist — https://github.com/tuist/tuist

#if os(macOS)
import AppKit
#elseif os(iOS)
import UIKit
#elseif os(tvOS) || os(watchOS)
import UIKit
#endif
#if canImport(SwiftUI)
import SwiftUI
#endif

// swiftlint:disable superfluous_disable_command file_length implicit_return

// MARK: - Asset Catalogs

// swiftlint:disable identifier_name line_length nesting type_body_length type_name
public enum DataDemoAsset {
public static let accentColor = DataDemoColors(name: "AccentColor")
}
// swiftlint:enable identifier_name line_length nesting type_body_length type_name

// MARK: - Implementation Details

public final class DataDemoColors {
public fileprivate(set) var name: String

#if os(macOS)
public typealias Color = NSColor
#elseif os(iOS) || os(tvOS) || os(watchOS)
public typealias Color = UIColor
#endif

@available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *)
public private(set) lazy var color: Color = {
guard let color = Color(asset: self) else {
fatalError("Unable to load color asset named \(name).")
}
return color
}()

#if canImport(SwiftUI)
private var _swiftUIColor: Any? = nil
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *)
public private(set) var swiftUIColor: SwiftUI.Color {
get {
if self._swiftUIColor == nil {
self._swiftUIColor = SwiftUI.Color(asset: self)
}

return self._swiftUIColor as! SwiftUI.Color
}
set {
self._swiftUIColor = newValue
}
}
#endif

fileprivate init(name: String) {
self.name = name
}
}

public extension DataDemoColors.Color {
@available(iOS 11.0, tvOS 11.0, watchOS 4.0, macOS 10.13, *)
convenience init?(asset: DataDemoColors) {
let bundle = DataDemoResources.bundle
#if os(iOS) || os(tvOS)
self.init(named: asset.name, in: bundle, compatibleWith: nil)
#elseif os(macOS)
self.init(named: NSColor.Name(asset.name), bundle: bundle)
#elseif os(watchOS)
self.init(named: asset.name)
#endif
}
}

#if canImport(SwiftUI)
@available(iOS 13.0, tvOS 13.0, watchOS 6.0, macOS 10.15, *)
public extension SwiftUI.Color {
init(asset: DataDemoColors) {
let bundle = DataDemoResources.bundle
self.init(asset.name, bundle: bundle)
}
}
#endif

// swiftlint:enable all
// swiftformat:enable all
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// swiftlint:disable all
// swift-format-ignore-file
// swiftformat:disable all
import Foundation

// MARK: - Swift Bundle Accessor

private class BundleFinder {}

extension Foundation.Bundle {
/// Since DataDemo is a application, the bundle for classes within this module can be used directly.
static let module = Bundle(for: BundleFinder.self)
}

// MARK: - Objective-C Bundle Accessor

@objc
public class DataDemoResources: NSObject {
@objc public class var bundle: Bundle {
return .module
}
}
// swiftlint:enable all
// swiftformat:enable all
2 changes: 1 addition & 1 deletion HMH_Tuist_iOS/Projects/Data/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import DependencyPlugin

let project = Project.makeModule(
name: "Data",
targets: [.staticFramework],
targets: [.staticFramework, .demo],
internalDependencies: [
.domain,
.Modules.networks
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// OAuthServiceFactory.swift
// Data
//
// Created by 류희재 on 11/2/24.
// Copyright © 2024 HMH-iOS. All rights reserved.
//

import Foundation

import Domain
import Networks

public protocol OAuthServiceFactoryType {
func makeOAuthService(for providerType: OAuthProviderType) -> OAuthServiceType
}

public class OAuthServiceFactory: OAuthServiceFactoryType {
public init() {}

public func makeOAuthService(for providerType: OAuthProviderType) -> OAuthServiceType {
switch providerType {
case .kakao:
return OAuthKakaoService()
case .apple:
return OAuthAppleService()
}
}
}
Loading

0 comments on commit 5eedcff

Please sign in to comment.