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

Feature/artem pavlov/create a series module #209

Merged
merged 10 commits into from
Dec 4, 2023
2 changes: 2 additions & 0 deletions Random/App/Resources/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"can_generate_random_contact" = "Es ist möglich, einen zufälligen Kontakt aus einer Liste zu generieren";
"can_generate_random_lottery_ticket" = "Es ist möglich, ein zufälliges Los für die Teilnahme am Gewinnspiel zu generieren";
"can_generate_random_movie" = "Es ist möglich, einen zufälligen Film zu erzeugen";
"can_generate_random_series" = "Es ist möglich, eine zufällige Serie zu erzeugen";
"can_generate_random_password" = "Es ist möglich, ein zufälliges Passwort für die Registrierung zu generieren";
"can_generate_random_photo_filter" = "Es ist möglich, einen zufälligen Filter für ein Foto zu erzeugen";
"can_participate_in_weekly_prize_draw" = "Sie können an der wöchentlichen Verlosung teilnehmen";
Expand Down Expand Up @@ -216,6 +217,7 @@
"select_coin_style" = "Münzstil auswählen";
"select_icon" = "Symbol auswählen";
"selen" = "Selen";
"series" = "Serien";
"september" = "September";
"settings" = "Einstellungen";
"seven_days_free" = "7 Tage kostenlos";
Expand Down
2 changes: 2 additions & 0 deletions Random/App/Resources/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"can_generate_random_contact" = "You can generate a random contact from the list";
"can_generate_random_lottery_ticket" = "You can generate a random lot to participate in the lottery";
"can_generate_random_movie" = "You can generate a random movie";
"can_generate_random_series" = "You can generate a random series";
"can_generate_random_password" = "You can generate a random password for registration";
"can_generate_random_photo_filter" = "You can generate a random filter for photos";
"can_participate_in_weekly_prize_draw" = "You can participate in the weekly prize draw";
Expand Down Expand Up @@ -216,6 +217,7 @@
"select_coin_style" = "Select coin style";
"select_icon" = "Select icon";
"selen" = "Selenium";
"series" = "Series";
"september" = "September";
"settings" = "Settings";
"seven_days_free" = "7 days free";
Expand Down
2 changes: 2 additions & 0 deletions Random/App/Resources/es.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"can_generate_random_contact" = "se puede generar un contacto aleatorio de una lista";
"can_generate_random_lottery_ticket" = "se puede generar un lote aleatorio para participar en la lotería";
"can_generate_random_movie" = "se puede generar una película aleatoria";
"can_generate_random_series" = "Se puede generar una serie aleatoria";
"can_generate_random_password" = "se puede generar una contraseña aleatoria para el registro";
"can_generate_random_photo_filter" = "se puede generar un filtro aleatorio para la foto";
"can_participate_in_weekly_prize_draw" = "se Puede participar en el sorteo semanal";
Expand Down Expand Up @@ -216,6 +217,7 @@
"select_coin_style" = "Seleccionar estilo de moneda";
"select_icon" = "Seleccione un icono";
"selen" = "Selenio";
"series" = "Seriales";
"september" = "Septiembre";
"settings" = "Configuraciones";
"seven_days_free" = "7 días gratis";
Expand Down
2 changes: 2 additions & 0 deletions Random/App/Resources/it.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"can_generate_random_contact" = "è possibile generare un contatto casuale dall'elenco";
"can_generate_random_lottery_ticket" = "è possibile generare un lotto casuale per partecipare alla lotteria";
"can_generate_random_movie" = "è possibile generare un filmato casuale";
"can_generate_random_series" = "È possibile generare una serie casuale";
"can_generate_random_password" = "è possibile generare una password casuale per la registrazione";
"can_generate_random_photo_filter" = "è possibile generare un filtro casuale per le foto";
"can_participate_in_weekly_prize_draw" = "puoi partecipare all'estrazione settimanale dei Premi";
Expand Down Expand Up @@ -216,6 +217,7 @@
"select_coin_style" = "Seleziona stile moneta";
"select_icon" = "Scegli un'icona";
"selen" = "selenio";
"series" = "Serials";
"september" = "settembre";
"settings" = "Impostazioni";
"seven_days_free" = "7 giorni gratis";
Expand Down
2 changes: 2 additions & 0 deletions Random/App/Resources/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"can_generate_random_contact" = "Можно генерировать рандомный контакт из списка";
"can_generate_random_lottery_ticket" = "Можно генерировать рандомный лот для участия в лотереи";
"can_generate_random_movie" = "Можно генерировать рандомный фильм";
"can_generate_random_series" = "Можно генерировать рандомный сериал";
"can_generate_random_password" = "Можно генерировать рандомный пароль для регистрации";
"can_generate_random_photo_filter" = "Можно генерировать рандомный фильтр для фото";
"can_participate_in_weekly_prize_draw" = "Можно участвовать в еженедельном розыгрыше призов";
Expand Down Expand Up @@ -216,6 +217,7 @@
"select_coin_style" = "Выбрать стиль монеты";
"select_icon" = "Выберите иконку";
"selen" = "Селен";
"series" = "Сериалы";
"september" = "Сентябрь";
"settings" = "Настройки";
"seven_days_free" = "7 дней бесплатно";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ enum DeepLinkType: CaseIterable, UserDefaultsCodable {
return "settings_share_app"
case .settingsfeedBackButton:
return "settings_feed_back_button"
case .series:
return "series_screen"
}
}

Expand Down Expand Up @@ -187,4 +189,7 @@ enum DeepLinkType: CaseIterable, UserDefaultsCodable {

/// Раздел мемов
case memes

/// Раздел `Сериалы`
case series
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ enum MetricsSections: String {
case memes = "Раздел Мемов"
case onboarding = "Раздел Onboarding"
case sales = "Sales"
case seriesScreen = "Series"

// Настройки главного экрана
case mainSettingsScreen = "Настройки главного экрана"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ protocol MainScreenModuleOutput: AnyObject {

/// Открыть раздел `Мемы`
func openMemes()

/// Открыть раздел `Сериалы`
func openSeries()

/// Была нажата кнопка (настройки)
func settingButtonAction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ extension MainScreenFactory {
isPremium: true,
advLabel: .none
))
case .series:
allSections.append(MainScreenModel.Section(
type: section,
isEnabled: true,
isHidden: false,
isPremium: true,
advLabel: .none
))
}
}

Expand Down Expand Up @@ -543,6 +551,14 @@ extension MainScreenFactory {
isPremium: model.isPremium,
advLabel: self.setLabelFrom(featureToggleRawValue: labelString, oldLabel: model.advLabel)
))
case .series:
cardSections.append(MainScreenModel.Section(
type: model.type,
isEnabled: model.isEnabled,
isHidden: self.ifDebugFeatureSectionIsHidden(isHidenSection),
isPremium: model.isPremium,
advLabel: self.setLabelFrom(featureToggleRawValue: labelString, oldLabel: model.advLabel)
))
}
}
DispatchQueue.main.async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ extension MainScreenModel {
let imageFiltersDescriptionForNoPremiumAccess = RandomStrings.Localizable.canGenerateRandomPhotoFilter
let filmsDescriptionForNoPremiumAccess = RandomStrings.Localizable.canGenerateRandomMovie
let nickNameDescriptionForNoPremiumAccess = RandomStrings.Localizable.generateRandomNickname

let seriesDescriptionForNoPremiumAccess = RandomStrings.Localizable.canGenerateRandomSeries

let imageCardTeam = "person.circle"
let titleCardTeam = RandomStrings.Localizable.teams

Expand Down Expand Up @@ -79,6 +80,9 @@ extension MainScreenModel {

let imageFilms = "film"
let titleFilms = RandomStrings.Localizable.movies

let imageSeries = "film.stack"
let titleSeries = RandomStrings.Localizable.series

let imageNickName = "square.and.pencil"
let titleNickName = RandomStrings.Localizable.nickname
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ extension MainScreenModel {
return appearance.titleTruthOrDareOther
case .memes:
return appearance.titleMemes
case .series:
return appearance.titleSeries
}
}

Expand Down Expand Up @@ -149,6 +151,8 @@ extension MainScreenModel {
return appearance.imageTruthOrDare
case .memes:
return appearance.imageMemes
case .series:
return appearance.imageSeries
}
}

Expand Down Expand Up @@ -212,6 +216,8 @@ extension MainScreenModel {
return appearance.fortuneWheelDescriptionForNoPremiumAccess
case .memes:
return appearance.memesDescriptionForNoPremiumAccess
case .series:
return appearance.seriesDescriptionForNoPremiumAccess
}
}

Expand Down Expand Up @@ -264,6 +270,9 @@ extension MainScreenModel {

/// Раздел `Фильмы`
case films

/// Раздел `Сериалы`
case series

/// Раздел `Никнейм`
case nickName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ final class MainScreenViewController: MainScreenModule {
// MARK: - MainScreenViewOutput

extension MainScreenViewController: MainScreenViewOutput {
func openSeries() {
moduleOutput?.openSeries()
}

func openMemes() {
moduleOutput?.openMemes()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ protocol MainScreenViewOutput: AnyObject {

/// Открыть раздел `Мемы`
func openMemes()

/// Открыть раздел `Сериалы`
func openSeries()

/// Нет премиум доступа
/// - Parameter section: Секция на главном экране
Expand Down Expand Up @@ -257,6 +260,8 @@ extension MainScreenView: UICollectionViewDelegate {
output?.openTruthOrDare()
case .memes:
output?.openMemes()
case .series:
output?.openSeries()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// SeriesScreenAbstractions.swift
// Random
//
// Created by Artem Pavlov on 13.11.2023.
//

import FancyUIKit

/// События которые отправляем из `SeriesScreenModule` в `Coordinator`
public protocol SeriesScreenModuleOutput: AnyObject {

/// Что-то пошло не так
func somethingWentWrong()

/// Проиграть трайлер по ссылке
/// - Parameter url: Ссылка на трейлер
func playTrailerActionWith(url: String)

/// Модуль был закрыт
func moduleClosed()
}

/// События которые отправляем из `Coordinator` в `SeriesScreenModule`
public protocol SeriesScreenModuleInput {

/// События которые отправляем из `SeriesScreenModule` в `Coordinator`
var moduleOutput: SeriesScreenModuleOutput? { get set }
}

/// Готовый модуль `SeriesScreenModule`
public typealias SeriesScreenModule = ViewController & SeriesScreenModuleInput
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//
// SeriesScreenAssembly.swift
// Random
//
// Created by Artem Pavlov on 13.11.2023.
//

import Foundation

/// Сборщик `SeriesScreen`
final class SeriesScreenAssembly {

// public init() {}
ArtemPavlov72 marked this conversation as resolved.
Show resolved Hide resolved

/// Собирает модуль `SeriesScreen`
/// - Parameter services: Сервисы приложения
/// - Returns: Cобранный модуль `SeriesScreen`
func createModule(services: ApplicationServices) -> SeriesScreenModule {
let view = SeriesScreenView()
let factory = SeriesScreenFactory()
let interactor = SeriesScreenInteractor(services: services, factory: factory)
let presenter = SeriesScreenViewController(
moduleView: view,
interactor: interactor,
factory: factory
)

view.output = presenter
interactor.output = presenter
factory.output = presenter
return presenter
}
}
Loading