generated from semicolondsm/Semicolon_Repository_Generator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
217 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import SwiftUI | ||
import SemicolonDesign | ||
|
||
struct SettingView: View { | ||
|
||
@StateObject var viewModel: SettingViewModel | ||
|
||
var body: some View { | ||
VStack(alignment: .center) { | ||
Spacer().frame(height: 16) | ||
HStack { | ||
Text("μ νν μλ¦Όμ 보λ΄λ릴κ²μ.\n곡μ§μ¬ν μλ¦Όμ κΊΌλ λ°μ μ μμ΄μ.") | ||
.sdText(type: .body4, textColor: .GrayScale.gray400) | ||
Spacer() | ||
} | ||
.padding(.horizontal, 16) | ||
Spacer().frame(height: 20) | ||
ToggleView( | ||
title: "νΌλ μλ¦Ό", | ||
subTitle: "νΌλμ λκΈκ³Ό μ’μμ λ±μ μλ¦Όμ μ€μ ν΄μ", | ||
isToggle: $viewModel.isFeedToggle | ||
) | ||
ToggleView( | ||
title: "μ μ² μλ¦Ό", | ||
subTitle: "κΈμκ³Ό μΈμΆμ μ² λ±μ μλ¦Όμ μ€μ ν΄μ", | ||
isToggle: $viewModel.isApplicationToggle | ||
) | ||
ToggleView( | ||
title: "μλ²μ μλ¦Ό", | ||
subTitle: "μλ²μ λ±μ μλ¦Όμ μ€μ ν΄μ", | ||
isToggle: $viewModel.isAllToggle | ||
) | ||
ToggleView( | ||
title: "μΌμ μλ¦Ό", | ||
subTitle: "μΌμ μ μλ¦Όμ μ€μ ν΄μ", | ||
isToggle: $viewModel.isScheduleToggle | ||
) | ||
Spacer() | ||
} | ||
.navigationTitle("μ€μ ") | ||
.navigationBarTitleDisplayMode(.inline) | ||
.setNavigationBackButtonWithRouter() | ||
.navigationBarBackButtonHidden() | ||
.onAppear(perform: viewModel.fetchActivatedCategoryList) | ||
.onDisappear(perform: viewModel.activeNotificationCategory) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import SwiftUI | ||
|
||
import RxSwift | ||
import NotificationService | ||
|
||
class SettingViewModel: ObservableObject { | ||
@Published var isFeedToggle: Bool = false | ||
@Published var isApplicationToggle: Bool = false | ||
@Published var isAllToggle: Bool = false | ||
@Published var isScheduleToggle: Bool = false | ||
@Published var isSucceed: Bool = false | ||
|
||
private let activeNotificationCategoryUseCase: ActiveNotificationCategoryUseCase | ||
private let fetchActivatedCategoryListUseCase: FetchActivatedCategoryListUseCase | ||
|
||
init( | ||
activeNotificationCategoryUseCase: ActiveNotificationCategoryUseCase, | ||
fetchActivatedCategoryListUseCase: FetchActivatedCategoryListUseCase | ||
) { | ||
self.activeNotificationCategoryUseCase = activeNotificationCategoryUseCase | ||
self.fetchActivatedCategoryListUseCase = fetchActivatedCategoryListUseCase | ||
} | ||
|
||
private var disposeBag = DisposeBag() | ||
|
||
func activeNotificationCategory() { | ||
self.activeNotificationCategoryUseCase.excute(topics: [ | ||
.all: isAllToggle, | ||
.application: isApplicationToggle, | ||
.feed: isFeedToggle, | ||
.schedule: isScheduleToggle | ||
]) | ||
.subscribe(onCompleted: { self.isSucceed = true }) | ||
.disposed(by: disposeBag) | ||
} | ||
|
||
func fetchActivatedCategoryList() { | ||
self.fetchActivatedCategoryListUseCase.excute() | ||
.subscribe(onNext: { | ||
$0.forEach { | ||
switch $0.topic { | ||
case .feed: self.isFeedToggle = $0.isActivate | ||
case .application: self.isApplicationToggle = $0.isActivate | ||
case .all: self.isAllToggle = $0.isActivate | ||
case .schedule: self.isScheduleToggle = $0.isActivate | ||
} | ||
} | ||
}) | ||
.disposed(by: disposeBag) | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
Application/Sources/Scene/Setting/ToggleCell/ToggleView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import SwiftUI | ||
|
||
import SemicolonDesign | ||
|
||
struct ToggleView: View { | ||
|
||
var title: String | ||
var subTitle: String | ||
@Binding var isToggle: Bool | ||
var body: some View { | ||
HStack(alignment: .center) { | ||
VStack(alignment: .leading, spacing: 0) { | ||
Text(title) | ||
.sdText(type: .body1, textColor: .GrayScale.gray900) | ||
Text(subTitle) | ||
.sdText(type: .caption, textColor: .GrayScale.gray500) | ||
} | ||
Spacer() | ||
Toggle("", isOn: $isToggle) | ||
.toggleStyle(SwitchToggleStyle(tint: .Primary.purple400)) | ||
.labelsHidden() | ||
} | ||
.padding(.horizontal, 16) | ||
.padding(.bottom, 24) | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Services/BugService/Sources/Data/Remote/Repository/BugRepositoryImpl.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import Foundation | ||
|
||
import RxSwift | ||
|
||
class ReportRepositoryImpl: ReportRepository { | ||
|
||
private let remoteDataSource: RemoteReportDataSource | ||
|
||
init(remoteDataSource: RemoteReportDataSource) { | ||
self.remoteDataSource = remoteDataSource | ||
} | ||
|
||
func postBugReport( | ||
reason: String, | ||
category: BugCategory, | ||
imageUrl: [String] | ||
) -> Completable { | ||
return remoteDataSource.postBugReport( | ||
reason: reason, | ||
category: category, | ||
imageUrl: imageUrl | ||
) | ||
} | ||
func fetchReleaseNote() -> Observable<[ReleaseNoteEntity]> { | ||
return remoteDataSource.fetchReleaseNote().asObservable() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
Services/NotificationService/Sources/Data/Remote/Response/CategoryListResponse.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import Foundation | ||
|
||
struct CategoryListResponse: Decodable { | ||
let categories: [CategoryResponse] | ||
let settings: [CategoryResponse] | ||
} | ||
|
||
extension CategoryListResponse { | ||
func toDomain() -> [CategoryEntity] { | ||
return categories.map { $0.toDomain() } | ||
return settings.map { $0.toDomain() } | ||
} | ||
} |
15 changes: 9 additions & 6 deletions
15
Services/NotificationService/Sources/Data/Remote/Response/CategoryResponse.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
import Foundation | ||
|
||
struct CategoryResponse: Decodable { | ||
let id: String | ||
let name: String | ||
let destination: String | ||
let topic: String | ||
let isActivate: Bool | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case topic | ||
case isActivate = "is_activate" | ||
} | ||
} | ||
|
||
extension CategoryResponse { | ||
func toDomain() -> CategoryEntity { | ||
return .init( | ||
id: id, | ||
name: name, | ||
destination: destination | ||
topic: .init(rawValue: topic) ?? .all, | ||
isActivate: isActivate | ||
) | ||
} | ||
} |
Oops, something went wrong.