Skip to content

[IDLE-119] 네트워크 모듈 코드및 설정 변경 #12

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

Merged
merged 1 commit into from
Jul 3, 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
8 changes: 4 additions & 4 deletions .github/workflows/merge_to_develop_on_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ jobs:
uses: actions/checkout@v4

#5. fetch XCConfig from repository
- name: fetch xcconfig
- name: fetch Secrets
uses: actions/checkout@v4
with:
repository: ${{ secrets.XCCONFIG_REPO }}
token: ${{ secrets.XCCONFIG_REPO_TOKEN }}
path: '${{ github.workspace }}/project/XcodeConfiguration'
path: '${{ github.workspace }}/project/Secrets'

- name: check xcconfig files
- name: check secret files
run: |
echo "Checking configurations are loaded..."
tree ${{ github.workspace }}/project/XcodeConfiguration
tree ${{ github.workspace }}/project/Secrets

#6. test tuist project
- name: Test project
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
**/*.xcworkspace

# Ignore all xcconfig files in all directories
**/*.xcconfig
XcodeConfiguration/
project/Secrets/

# Ignore Derived
**/Derived/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ public enum IdleConfiguration {
}

private enum XcconfigFile {
static let appDebug: Path = .relativeToRoot("XcodeConfiguration/App/appDebug.xcconfig")
static let appRelease: Path = .relativeToRoot("XcodeConfiguration/App/appRelease.xcconfig")
static let appDebug: Path = .relativeToRoot("Secrets/XcodeConfiguration/App/appDebug.xcconfig")
static let appRelease: Path = .relativeToRoot("Secrets/XcodeConfiguration/App/appRelease.xcconfig")

static let domainDebug: Path = .relativeToRoot("XcodeConfiguration/Domain/domainDebug.xcconfig")
static let domainRelease: Path = .relativeToRoot("XcodeConfiguration/Domain/domainRelease.xcconfig")
static let domainDebug: Path = .relativeToRoot("Secrets/XcodeConfiguration/Domain/domainDebug.xcconfig")
static let domainRelease: Path = .relativeToRoot("Secrets/XcodeConfiguration/Domain/domainRelease.xcconfig")

static let dataDebug: Path = .relativeToRoot("XcodeConfiguration/Data/dataDebug.xcconfig")
static let dataRelease: Path = .relativeToRoot("XcodeConfiguration/Data/dataRelease.xcconfig")
static let dataDebug: Path = .relativeToRoot("Secrets/XcodeConfiguration/Data/dataDebug.xcconfig")
static let dataRelease: Path = .relativeToRoot("Secrets/XcodeConfiguration/Data/dataRelease.xcconfig")

static let presentationDebug: Path = .relativeToRoot("XcodeConfiguration/Presentation/presentationDebug.xcconfig")
static let presentationRelease: Path = .relativeToRoot("XcodeConfiguration/Presentation/presentationRelease.xcconfig")
static let presentationDebug: Path = .relativeToRoot("Secrets/XcodeConfiguration/Presentation/presentationDebug.xcconfig")
static let presentationRelease: Path = .relativeToRoot("Secrets/XcodeConfiguration/Presentation/presentationRelease.xcconfig")
}

public static let debugConfigName = Name.debug
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public extension ModuleDependency {
public static let Swinject: TargetDependency = .external(name: "Swinject")
public static let Alamofire: TargetDependency = .external(name: "Alamofire")
public static let KeyChainAccess: TargetDependency = .external(name: "KeychainAccess")
public static let Moya: TargetDependency = .external(name: "Moya")
public static let RxMoya: TargetDependency = .external(name: "RxMoya")
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// SecretSource.swift
// DependencyPlugin
//
// Created by choijunios on 7/3/24.
//

import ProjectDescription

// MARK: SecretSource
public enum SecretSource {

public static let networkDataSource: SourceFileGlob = .glob(.relativeToRoot("Secrets/SwiftCode/NetworkDataSource/**"))
}
48 changes: 0 additions & 48 deletions project/Projects/Data/ConcretesTests/APITesting/TokenTesting.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,51 +41,3 @@ class TestKeyValueStore: KeyValueStore {
testStore.removeAll()
}
}

// TestAPI
public enum TestAPI: BaseAPI {

public static let apiType: APIType = .test

case testEndPoint

public var method: ReqeustConponents.HTTPMethod { .get }

public var headers: [String: String] {

var myHeader = defaultHeaders

myHeader[ReqeustConponents.Header.authorization.key] = ReqeustConponents.Header.authorization.defaultValue

return myHeader
}

public var endPoint: String {

switch self {
case .testEndPoint:
return ""
}
}
}

protocol TestService {

func testRequest() -> Single<[Person]>
}

class DefaultTestService: BaseNetworkService<TestAPI> { }

extension DefaultTestService: TestService {

func testRequest() -> Single<[Person]> {

request(api: .testEndPoint)
}
}

struct Person: Codable {
let name: String
let age: String
let id: String
}
72 changes: 0 additions & 72 deletions project/Projects/Data/NetworkDataSource/API/APIType.swift

This file was deleted.

52 changes: 22 additions & 30 deletions project/Projects/Data/NetworkDataSource/API/BaseAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,41 @@
//

import Foundation
import Moya

protocol BaseAPI {
enum APIType {

static var apiType: APIType { get }
var headers: [String: String] { get }
var method: ReqeustConponents.HTTPMethod { get }
var queryItems: [URLQueryItem]? { get }
var endPoint: String { get }
case test
}

// MARK: BaseAPI
protocol BaseAPI: TargetType {

var apiType: APIType { get }
}

extension BaseAPI {

var baseUrl: URL {

var baseUrlString = Config.baseUrlString

[
Self.apiType.additionalPath,
endPoint
].forEach { path in
if !path.isEmpty {
baseUrlString.append("/\(path)")
}
}
var baseURL: URL {

return URL(string: baseUrlString)!
}


var headers: [String: String] {
let base = URL(string: NetworkConfig.baseUrl)!

return defaultHeaders
return base.appendingPathComponent(self.path)
}

var defaultHeaders: [String: String] {
var path: String {

return [
ReqeustConponents.Header.contentType.key: ReqeustConponents.Header.contentType.defaultValue
]
switch apiType {
case .test:
"test"
default:
preconditionFailure("APIType is not defined")
}
}

var queryItems: [URLQueryItem]? {
/// Default header
var headers: [String : String]? {

return nil
return ["Content-Type": "application/json"]
}
}
13 changes: 0 additions & 13 deletions project/Projects/Data/NetworkDataSource/API/Config.swift

This file was deleted.

Loading