35 lines
1.0 KiB
Swift
35 lines
1.0 KiB
Swift
//
|
|
// ContentMainTabHomeRepository.swift
|
|
// SodaLive
|
|
//
|
|
// Created by klaus on 2/20/25.
|
|
//
|
|
|
|
import Foundation
|
|
import CombineMoya
|
|
import Combine
|
|
import Moya
|
|
|
|
class ContentMainTabHomeRepository {
|
|
private let api = MoyaProvider<ContentApi>()
|
|
|
|
func getContentMainHome() -> AnyPublisher<Response, MoyaError> {
|
|
return api.requestPublisher(
|
|
.getContentMainHome(
|
|
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
|
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL
|
|
)
|
|
)
|
|
}
|
|
|
|
func getPopularContentByCreator(creatorId: Int) -> AnyPublisher<Response, MoyaError> {
|
|
return api.requestPublisher(
|
|
.getPopularContentByCreator(
|
|
creatorId: creatorId,
|
|
isAdultContentVisible: UserDefaults.isAdultContentVisible(),
|
|
contentType: ContentType(rawValue: UserDefaults.string(forKey: .contentPreference)) ?? ContentType.ALL
|
|
)
|
|
)
|
|
}
|
|
}
|