Skip to content

[IDLE-409] 딥링크 시스템 구축 및 알림을 통한 화면 분기 #85

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 11 commits into from
Oct 9, 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
12 changes: 6 additions & 6 deletions project/Projects/App/Resources/GoogleService-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
<key>STORAGE_BUCKET</key>
<string>swm-3idiots.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<false/>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<false/>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<true/>
<key>IS_GCM_ENABLED</key>
<true></true>
<true/>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<true/>
<key>GOOGLE_APP_ID</key>
<string>1:740246202578:ios:d5e59f4f2116f92342250b</string>
</dict>
</plist>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation
import Domain
import Repository
import DataSource
import RootFeature


import Swinject
Expand Down Expand Up @@ -57,5 +58,15 @@ public struct DataAssembly: Assembly {
container.register(RecruitmentPostRepository.self) { _ in
return DefaultRecruitmentPostRepository()
}

// MARK: 토큰 전송 레포지토리
container.register(NotificationTokenTransferRepository.self) { _ in
return DefaultNotificationTokenTransferRepository()
}

// MARK: 토큰 획득 레포지토리
container.register(NotificationTokenRepository.self) { _ in
return RootFeature.FCMTokenRepository()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,19 @@ public struct DomainAssembly: Assembly {
public func assemble(container: Container) {

// MARK: UseCase
container.register(NotificationTokenUseCase.self) { _ in
return DefaultNotificationTokenUseCase()
}
.inObjectScope(.container)

container.register(AuthInputValidationUseCase.self) { resolver in
let repository = resolver.resolve(AuthInputValidationRepository.self)!

return DefaultAuthInputValidationUseCase(repository: repository)
}

container.register(AuthUseCase.self) { resolver in
let authRepository = resolver.resolve(AuthRepository.self)!
let userProfileRepository = resolver.resolve(UserProfileRepository.self)!
let userInfoLocalRepository = resolver.resolve(UserInfoLocalRepository.self)!

return DefaultAuthUseCase(
authRepository: authRepository,
userProfileRepository: userProfileRepository,
userInfoLocalRepository: userInfoLocalRepository
)
container.register(AuthUseCase.self) { _ in
return DefaultAuthUseCase()
}

container.register(CenterProfileUseCase.self) { resolver in
Expand Down Expand Up @@ -61,14 +58,8 @@ public struct DomainAssembly: Assembly {
)
}

container.register(SettingScreenUseCase.self) { resolver in
let authRepository = resolver.resolve(AuthRepository.self)!
let userInfoLocalRepository = resolver.resolve(UserInfoLocalRepository.self)!

return DefaultSettingUseCase(
authRepository: authRepository,
userInfoLocalRepository: userInfoLocalRepository
)
container.register(SettingScreenUseCase.self) { _ in
return DefaultSettingUseCase()
}

container.register(CenterCertificateUseCase.self) { resolver in
Expand All @@ -80,9 +71,5 @@ public struct DomainAssembly: Assembly {
userInfoLocalRepository: userInfoLocalRepository
)
}

container.register(NotificationTokenManage.self) { resolver in
DefaultNotificationTokenManage()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import Foundation
import RootFeature
import AuthFeature
import CenterFeature
import PresentationCore
import CenterMainPageFeature

Expand Down
91 changes: 0 additions & 91 deletions project/Projects/App/Sources/RemoteNotification/FCMService.swift

This file was deleted.

6 changes: 0 additions & 6 deletions project/Projects/App/Sources/SceneDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
return coodinator
}()

// FCMService
var fcmService: FCMService!

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {

guard let windowScene = scene as? UIWindowScene else { return }
Expand All @@ -41,9 +38,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
DataAssembly(),
DomainAssembly(),
])

// FCMService
fcmService = FCMService()

// Start AppCoodinator
appCoordinator.start()
Expand Down
3 changes: 3 additions & 0 deletions project/Projects/Data/DataSource/API/BaseAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public enum APIType {
case crawling_job_postings
case external(url: String)
case applys
case notificationToken
}

// MARK: BaseAPI
Expand Down Expand Up @@ -43,6 +44,8 @@ public extension BaseAPI {
baseStr += "/applys"
case .external(let url):
baseStr = url
case .notificationToken:
baseStr += "/fcm"
}

return URL(string: baseStr)!
Expand Down
62 changes: 62 additions & 0 deletions project/Projects/Data/DataSource/API/NotificationTokenAPI.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// NotificationTokenAPI.swift
// DataSource
//
// Created by choijunios on 10/8/24.
//

import Foundation
import Moya

public enum NotificationTokenAPI {
case saveToken(deviceToken: String, userType: String)
case deleteToken(deviceToken: String)
}

extension NotificationTokenAPI: BaseAPI {

public var apiType: APIType {
.notificationToken
}

public var path: String {
switch self {
case .saveToken(let deviceToken, let userType):
"token"
case .deleteToken(let deviceToken):
"token"
}
}

public var method: Moya.Method {
switch self {
case .saveToken:
.post
case .deleteToken:
.delete
}
}

var parameterEncoding: ParameterEncoding {
switch self {
default:
return JSONEncoding.default
}
}

public var task: Moya.Task {
switch self {
case .saveToken(let deviceToken, let userType):
var bodyData: [String: String] = [
"deviceToken": deviceToken,
"userType": userType
]
return .requestParameters(parameters: bodyData, encoding: parameterEncoding)
case .deleteToken(let deviceToken):
var bodyData: [String: String] = [
"deviceToken": deviceToken
]
return .requestParameters(parameters: bodyData, encoding: parameterEncoding)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// NotificationTokenTransferService.swift
// DataSource
//
// Created by choijunios on 10/8/24.
//

import Foundation

public class NotificationTokenTransferService: BaseNetworkService<NotificationTokenAPI> {

public init() { }

public override init(keyValueStore: KeyValueStore) {
super.init(keyValueStore: keyValueStore)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import Foundation
import DataSource
import Domain
import Core


import RxSwift
Expand All @@ -18,30 +19,40 @@ public class DefaultAuthInputValidationRepository: AuthInputValidationRepository

public init() { }

public func requestPhoneNumberAuthentication(phoneNumber: String) -> Single<Void> {
public func requestPhoneNumberAuthentication(phoneNumber: String) -> Single<Result<String, DomainError>> {

networkService
let dataTask = networkService
.request(api: .startPhoneNumberAuth(phoneNumber: phoneNumber), with: .plain)
.map { _ in return () }
.map { _ in phoneNumber }

return convertToDomain(task: dataTask)
}

public func authenticateAuthNumber(phoneNumber: String, authNumber: String) -> Single<Void> {
public func authenticateAuthNumber(phoneNumber: String, authNumber: String) -> Single<Result<String, DomainError>> {

let dataTask = networkService.request(api: .checkAuthNumber(phoneNumber: phoneNumber, authNumber: authNumber), with: .plain)
.map { _ in phoneNumber }

networkService.request(api: .checkAuthNumber(phoneNumber: phoneNumber, authNumber: authNumber), with: .plain)
.map { _ in return () }
return convertToDomain(task: dataTask)
}

public func requestBusinessNumberAuthentication(businessNumber: String) -> Single<BusinessInfoVO> {
public func requestBusinessNumberAuthentication(businessNumber: String) -> Single<Result<BusinessInfoVO, DomainError>> {

networkService.requestDecodable(
let dataTask = networkService.requestDecodable(
api: .authenticateBusinessNumber(businessNumber: businessNumber),
with: .plain
).map { (dto: BusinessInfoDTO) in dto.toEntity() }

return convertToDomain(task: dataTask)
}

public func requestCheckingIdDuplication(id: String) -> Single<Void> {
networkService.request(api: .checkIdDuplication(id: id), with: .plain)
.map { _ in return () }
public func requestCheckingIdDuplication(id: String) -> Single<Result<Void, DomainError>> {

let dataTask = networkService
.request(api: .checkIdDuplication(id: id), with: .plain)
.mapToVoid()

return convertToDomain(task: dataTask)
}
}

Loading
Loading