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

[Fix] #399 - deprecated API 반영 및 가입 일자 계산 로직 수정 #401

Merged
merged 11 commits into from
Oct 16, 2024
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public extension Date {
dateComponents.year = year
dateComponents.month = month
dateComponents.day = day
return calendar.date(from: dateComponents) ?? nil

let usaDate = calendar.date(from: dateComponents)
return usaDate!.addingTimeInterval(9 * 60 * 60)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,6 @@ extension AppMyPageRepository: AppMyPageRepositoryInterface {
.asDriver()
}

public func getNotificationIsAllowed() -> Driver<Bool> {
self.userService
.getNotificationIsAllowed()
.map(\.isOptIn)
.asDriver()
}

public func optInPushNotificationInGeneral(to isOn: Bool) -> Driver<Bool> {
self.userService
.optInPushNotificationInGeneral(to: isOn)
.map(\.isOptIn)
.asDriver()
}

public func deregisterPushToken(with token: String) -> AnyPublisher<Bool, Error> {
self.userService.deregisterPushToken(with: token)
.map {
Expand Down
15 changes: 1 addition & 14 deletions SOPT-iOS/Projects/Data/Sources/Repository/MainRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,18 @@ import Networks
public class MainRepository {

private let userService: UserService
private let configService: ConfigService
private let descriptionService: DescriptionService
private let pokeService: PokeService
private let stampService: StampService

private let cancelBag = CancelBag()

public init(userService: UserService,
configService: ConfigService,
public init(userService: UserService,
descriptionService: DescriptionService,
pokeService: PokeService,
stampService: StampService
) {
self.userService = userService
self.configService = configService
self.descriptionService = descriptionService
self.pokeService = pokeService
self.stampService = stampService
Expand Down Expand Up @@ -60,16 +57,6 @@ extension MainRepository: MainRepositoryInterface {
.eraseToAnyPublisher()
}

public func getServiceState() -> AnyPublisher<ServiceStateModel, MainError> {
configService.getServiceAvailability()
.mapError { error in
print(error)
return MainError.networkError(message: "GetServiceState 에러")
}
.map { $0.toDomain() }
.eraseToAnyPublisher()
}

public func getMainViewDescription() -> AnyPublisher<MainDescriptionModel, MainError> {
descriptionService.getMainViewDescription()
.mapError { error in
Expand Down
11 changes: 0 additions & 11 deletions SOPT-iOS/Projects/Data/Sources/Repository/SettingRepository.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,6 @@ extension SettingRepository: SettingRepositoryInterface {
.eraseToAnyPublisher()
}

public func editNickname(nickname: String) -> AnyPublisher<Bool, Never> {
return userService.changeNickname(nickname: nickname)
.map { _ in true }
.replaceError(with: false)
.handleEvents(receiveOutput: { isSuccessed in
guard isSuccessed else { return }
UserDefaultKeyList.User.soptampName = nickname
})
.eraseToAnyPublisher()
}

public func withdrawal() -> AnyPublisher<Bool, Never> {
return userService.withdraw()
.handleEvents(receiveOutput: { status in
Expand Down
31 changes: 0 additions & 31 deletions SOPT-iOS/Projects/Data/Sources/Repository/SignUpRepository.swift

This file was deleted.

6 changes: 0 additions & 6 deletions SOPT-iOS/Projects/Data/Sources/Transform/MainTransform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,3 @@ extension MainEntity {
return UserMainInfoModel.init(status: user.status, name: user.name, profileImage: user.profileImage, historyList: user.historyList, attendanceScore: operation?.attendanceScore, announcement: operation?.announcement, isAllConfirm: isAllConfirm)
}
}

extension ServiceStateEntity {
public func toDomain() -> ServiceStateModel {
return ServiceStateModel(isAvailable: isAvailable)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ extension AppDelegate {
implement: {
MainRepository(
userService: DefaultUserService(),
configService: DefaultConfigService(),
descriptionService: DefaultDescriptionService(),
pokeService: DefaultPokeService(),
stampService: DefaultStampService()
Expand Down Expand Up @@ -80,14 +79,6 @@ extension AppDelegate {
)
}
)
container.register(
interface: SignUpRepositoryInterface.self,
implement: {
SignUpRepository(
service: DefaultUserService()
)
}
)
container.register(
interface: MissionListRepositoryInterface.self,
implement: {
Expand Down
17 changes: 0 additions & 17 deletions SOPT-iOS/Projects/Domain/Sources/Model/ServiceStateModel.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ import Core

public protocol AppMyPageRepositoryInterface {
func resetStamp() -> Driver<Bool>
func getNotificationIsAllowed() -> Driver<Bool>
func optInPushNotificationInGeneral(to isOn: Bool) -> Driver<Bool>
func deregisterPushToken(with token: String) -> AnyPublisher<Bool, Error>
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Combine

public protocol MainRepositoryInterface {
func getUserMainInfo() -> AnyPublisher<UserMainInfoModel?, MainError>
func getServiceState() -> AnyPublisher<ServiceStateModel, MainError>
func getMainViewDescription() -> AnyPublisher<MainDescriptionModel, MainError>
func registerPushToken(with token: String) -> AnyPublisher<Bool, Error>
func checkPokeNewUser() -> AnyPublisher<Bool, Error>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ import Combine
public protocol SettingRepositoryInterface {
func resetStamp() -> Driver<Bool>
func editSentence(sentence: String) -> AnyPublisher<Bool, Never>
func editNickname(nickname: String) -> AnyPublisher<Bool, Never>
func withdrawal() -> AnyPublisher<Bool, Never>
}

This file was deleted.

18 changes: 0 additions & 18 deletions SOPT-iOS/Projects/Domain/Sources/UseCase/AppMyPageUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import Combine

public protocol AppMyPageUseCase {
func resetStamp()
func fetchUserNotificationIsAllowed()
func optInPushNotificationInGeneral(to isOn: Bool)
func deregisterPushToken()

var resetSuccess: PassthroughSubject<Bool, Error> { get }
Expand Down Expand Up @@ -46,22 +44,6 @@ extension DefaultAppMyPageUseCase: AppMyPageUseCase {
}.store(in: self.cancelBag)
}

public func fetchUserNotificationIsAllowed() {
self.repository
.getNotificationIsAllowed()
.sink { isAllowed in
self.originUserNotificationIsAllowedStatus.send(isAllowed)
}.store(in: self.cancelBag)
}

public func optInPushNotificationInGeneral(to isOn: Bool) {
self.repository
.optInPushNotificationInGeneral(to: isOn)
.sink { isOn in
self.optInPushNotificationResult.send(isOn)
}.store(in: self.cancelBag)
}

public func deregisterPushToken() {
guard let pushToken = UserDefaultKeyList.User.pushToken, !pushToken.isEmpty else { return }

Expand Down
15 changes: 0 additions & 15 deletions SOPT-iOS/Projects/Domain/Sources/UseCase/MainUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import Combine

public protocol MainUseCase {
var userMainInfo: PassthroughSubject<UserMainInfoModel?, Never> { get set }
var serviceState: PassthroughSubject<ServiceStateModel, Never> { get set }
var mainDescription: PassthroughSubject<MainDescriptionModel, Never> { get set }
var mainErrorOccurred: PassthroughSubject<MainError, Never> { get set }
var isPokeNewUser: PassthroughSubject<Bool, Never> { get set }
var appService: PassthroughSubject<[AppServiceModel], Never> { get set }
var hotBoard: PassthroughSubject<HotBoardModel, Never> { get set }

func getUserMainInfo()
func getServiceState()
func getMainViewDescription()
func registerPushToken()
func checkPokeNewUser()
Expand All @@ -35,7 +33,6 @@ public class DefaultMainUseCase {
private var cancelBag = CancelBag()

public var userMainInfo = PassthroughSubject<UserMainInfoModel?, Never>()
public var serviceState = PassthroughSubject<ServiceStateModel, Never>()
public var mainDescription = PassthroughSubject<MainDescriptionModel, Never>()
public var mainErrorOccurred = PassthroughSubject<MainError, Never>()
public var isPokeNewUser = PassthroughSubject<Bool, Never>()
Expand All @@ -62,18 +59,6 @@ extension DefaultMainUseCase: MainUseCase {
}.store(in: self.cancelBag)
}

public func getServiceState() {
repository.getServiceState()
.sink { [weak self] event in
print("MainUseCase getServiceState: \(event)")
if case Subscribers.Completion.failure = event {
self?.mainErrorOccurred.send(.networkError(message: "GetServiceState 실패"))
}
} receiveValue: { [weak self] serviceStateModel in
self?.serviceState.send(serviceStateModel)
}.store(in: self.cancelBag)
}

public func getMainViewDescription() {
repository.getMainViewDescription()
.replaceError(with: .defaultDescription)
Expand Down
11 changes: 0 additions & 11 deletions SOPT-iOS/Projects/Domain/Sources/UseCase/SettingUseCase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ import Core

public protocol SettingUseCase {
func resetStamp()
func editNickname(nickname: String)
func withdrawal()
var editNicknameSuccess: PassthroughSubject<Bool, Error> { get set }
var resetSuccess: PassthroughSubject<Bool, Error> { get set }
var withdrawalSuccess: PassthroughSubject<Bool, Error> { get set }
}
Expand All @@ -25,7 +23,6 @@ public class DefaultSettingUseCase {
private var cancelBag = CancelBag()

public var resetSuccess = PassthroughSubject<Bool, Error>()
public var editNicknameSuccess = PassthroughSubject<Bool, Error>()
public var withdrawalSuccess = PassthroughSubject<Bool, Error>()

public init(repository: SettingRepositoryInterface) {
Expand All @@ -42,14 +39,6 @@ extension DefaultSettingUseCase: SettingUseCase {
}.store(in: self.cancelBag)
}

public func editNickname(nickname: String) {
self.repository.editNickname(nickname: nickname)
.withUnretained(self)
.sink { owner, editSuccessed in
owner.editNicknameSuccess.send(editSuccessed)
}.store(in: self.cancelBag)
}

public func resetStamp() {
repository.resetStamp()
.sink { success in
Expand Down
55 changes: 0 additions & 55 deletions SOPT-iOS/Projects/Domain/Sources/UseCase/SignUpUseCase.swift

This file was deleted.

Loading