Skip to content
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
2 changes: 1 addition & 1 deletion Modules/DesignSystem/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ let package = Package(
.package(name: "Navigation", path: "../Navigation"),
.package(name: "Stores", path: "../Stores"),

.package(url: "https://github.com/theosementa/ToastBannerKit.git", exact: "1.0.3")
.package(url: "https://github.com/theosementa/ToastBannerKit.git", exact: "1.0.31")
],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ public struct ToastBannerView: View {
.resizable()
.renderingMode(.template)
.foregroundStyle(style.foregroundColor)
.frame(width: .standard, height: .standard)
.frame(width: .mediumLarge, height: .mediumLarge)
}

Text(banner.title)
.font(.Body.smallRegular, color: style.foregroundColor)
.font(.Body.mediumMedium, color: style.foregroundColor)
.lineLimit(1)
}
.padding(.small)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SwiftUI
import Models
import Stores
import Navigation
import ToastBannerKit

public struct ContributionRowView: View {

Expand Down Expand Up @@ -54,6 +55,7 @@ public struct ContributionRowView: View {
.contentShape(.contextMenuPreview, RoundedRectangle(cornerRadius: .medium, style: .continuous))
.confirmationAlert(.deletion, isPresented: $isAlertPresented) {
DefaultContributionStore.shared.delete(by: item.id)
ToastBannerService.shared.send(.successContributionDeleted)
}
.contextMenu {
Button {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import SwiftUI
import Models
import Stores
import Navigation
import ToastBannerKit

public struct FinancialGoalRowView: View {

Expand Down Expand Up @@ -56,6 +57,7 @@ public struct FinancialGoalRowView: View {
.contentShape(.contextMenuPreview, .rect(cornerRadius: .large))
.confirmationAlert(.deletion, isPresented: $isAlertPresented) {
DefaultFinancialGoalStore.shared.delete(by: item.id)
ToastBannerService.shared.send(.successGoalDeleted)
}
.contextMenu {
Button {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ public extension Color {

struct Success {
public static let s500: Color = Color.green
public static let s100: Color = Color.green.opacity(0.15)
public static let s100: Color = Color(hex: 0xC2EECD)
}

struct Error {
public static let e500: Color = Color.red
public static let e100: Color = Color.red.opacity(0.15)
public static let e100: Color = Color(hex: 0xFFC3C5)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,67 @@ import ToastBannerKit
import UIKit

// MARK: - Errors
@MainActor
public extension ToastBannerUIModel {

@MainActor
static let errorNameMandatory: ToastBannerUIModel = .init(
title: "toast_banner_name_mandatory".localized,
uiImage: UIImage(asset: .iconWarning),
style: ToastBannerStyle.error
)

@MainActor
static let errorAmountMandatory: ToastBannerUIModel = .init(
title: "toast_banner_amount_mandatory".localized,
uiImage: UIImage(asset: .iconWarning),
style: ToastBannerStyle.error
)

}

// MARK: - Success
@MainActor
public extension ToastBannerUIModel {

static let successGoalCreated: ToastBannerUIModel = .init(
title: "toast_banner_goal_created".localized,
uiImage: UIImage(asset: .iconCheckmarkRounded),
style: ToastBannerStyle.success
)

static let successGoalUpdated: ToastBannerUIModel = .init(
title: "toast_banner_goal_updated".localized,
uiImage: UIImage(asset: .iconCheckmarkRounded),
style: ToastBannerStyle.success
)

static let successGoalDeleted: ToastBannerUIModel = .init(
title: "toast_banner_goal_deleted".localized,
uiImage: UIImage(asset: .iconCheckmarkRounded),
style: ToastBannerStyle.success
)

static let successContributionAdded: ToastBannerUIModel = .init(
title: "toast_banner_contribution_added".localized,
uiImage: UIImage(asset: .iconCheckmarkRounded),
style: ToastBannerStyle.success
)

static let successContributionUpdated: ToastBannerUIModel = .init(
title: "toast_banner_contribution_updated".localized,
uiImage: UIImage(asset: .iconCheckmarkRounded),
style: ToastBannerStyle.success
)

static let successContributionDeleted: ToastBannerUIModel = .init(
title: "toast_banner_contribution_deleted".localized,
uiImage: UIImage(asset: .iconCheckmarkRounded),
style: ToastBannerStyle.success
)

static let successDeleteAllData: ToastBannerUIModel = .init(
title: "toast_banner_delete_all".localized,
uiImage: UIImage(asset: .iconCheckmarkRounded),
style: ToastBannerStyle.success
)

}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ private extension AddContributionScreen.ViewModel {

contributionStore.create(contribution: contribution)
router?.dismiss()
toastBannerService.send(.successContributionAdded, delay: AppConstant.Animation.toastDelayAfterCloseSheet)
}

func update() {
Expand All @@ -132,6 +133,7 @@ private extension AddContributionScreen.ViewModel {

contributionStore.update(contribution: contribution)
router?.dismiss()
toastBannerService.send(.successContributionUpdated, delay: AppConstant.Animation.toastDelayAfterCloseSheet)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private extension AddFinancialGoalScreen.ViewModel {
)
store.create(goal: domain)
router?.dismiss()
toastBannerService.send(.successGoalCreated, delay: AppConstant.Animation.toastDelayAfterCloseSheet)
}

func update() {
Expand All @@ -132,6 +133,7 @@ private extension AddFinancialGoalScreen.ViewModel {
)
store.update(goal: domain)
router?.dismiss()
toastBannerService.send(.successGoalUpdated, delay: AppConstant.Animation.toastDelayAfterCloseSheet)
}

func randomPlaceholder() -> String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@ import Core

public struct FinancialGoalListScreen: View {

// MARK: States
@State private var viewModel: ViewModel = .init()

// MARK: Environments
@Environment(\.theme) private var theme

// MARK: Init
public init() { }

// MARK: - View
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Foundation
import Core
import Models
import Stores
import ToastBannerKit

extension SettingsScreen {

Expand Down Expand Up @@ -40,6 +41,7 @@ extension SettingsScreen.ViewModel {
@MainActor
func deleteAll() {
DefaultFinancialGoalStore.shared.deleteAll()
ToastBannerService.shared.send(.successDeleteAllData)
}

}
18 changes: 18 additions & 0 deletions Modules/Models/Sources/AppConstant.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// File.swift
// Models
//
// Created by Theo Sementa on 02/04/2026.
//

import Foundation

public struct AppConstant {

public struct Animation {

public static let toastDelayAfterCloseSheet = 0.6

}

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions Modulo/App.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import Settings

@main
struct ModuloApp: App {


@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate

init() {
NavigationRegistry.shared.registerFinancialGoalsRoutes()
NavigationRegistry.shared.registerContributionRoutes()
NavigationRegistry.shared.registerSettingsRoutes()
}

var body: some Scene {
WindowGroup {
RootScreen()
Expand Down
22 changes: 22 additions & 0 deletions Modulo/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//
// AppDelegate.swift
// Modulo
//
// Created by Theo Sementa on 31/03/2026.
//

import UIKit

final class AppDelegate: NSObject, UIApplicationDelegate {

func application(
_ application: UIApplication,
configurationForConnecting connectingSceneSession: UISceneSession,
options: UIScene.ConnectionOptions
) -> UISceneConfiguration {
let config = UISceneConfiguration(name: nil, sessionRole: connectingSceneSession.role)
config.delegateClass = SceneDelegate.self
return config
}

}
24 changes: 24 additions & 0 deletions Modulo/ModuloWindow.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// ModuloWindow.swift
// Modulo
//
// Created by Theo Sementa on 31/03/2026.
//

import UIKit
import ToastBannerKit

final class ModuloWindow: UIWindow {

override func sendEvent(_ event: UIEvent) {
if event.type == .touches,
let touch = event.allTouches?.first,
touch.phase == .began {
if ToastBannerService.shared.toastBanner != nil {
ToastBannerService.shared.toastBanner = nil
}
}
super.sendEvent(event)
}

}
21 changes: 21 additions & 0 deletions Modulo/Resources/Localizable/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@
/* */
"toast_banner_amount_mandatory" = "The amount is required";

/* */
"toast_banner_contribution_added" = "Contribution added!";

/* */
"toast_banner_contribution_deleted" = "Contribution deleted!";

/* */
"toast_banner_contribution_updated" = "Contribution updated!";

/* */
"toast_banner_goal_created" = "Goal created!";

/* */
"toast_banner_delete_all" = "All data has been deleted!";

/* */
"toast_banner_goal_deleted" = "Goal deleted!";

/* */
"toast_banner_goal_updated" = "Goal updated!";

/* */
"toast_banner_name_mandatory" = "The name is required";

21 changes: 21 additions & 0 deletions Modulo/Resources/Localizable/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,27 @@
/* */
"toast_banner_amount_mandatory" = "Le montant est obligatoire";

/* */
"toast_banner_contribution_added" = "Contribution ajoutée !";

/* */
"toast_banner_contribution_deleted" = "Contribution supprimée !";

/* */
"toast_banner_contribution_updated" = "Contribution mis à jour !";

/* */
"toast_banner_delete_all" = "Toutes les données ont été supprimées !";

/* */
"toast_banner_goal_created" = "Objectif créé !";

/* */
"toast_banner_goal_deleted" = "Objectif supprimé !";

/* */
"toast_banner_goal_updated" = "Objectif mis à jour !";

/* */
"toast_banner_name_mandatory" = "Le nom est obligatoire";

11 changes: 11 additions & 0 deletions Modulo/RootScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@
import SwiftUI
import Navigation
import FinancialGoal
import ToastBannerKit
import DesignSystem

struct RootScreen: View {

// MARK: States
@State private var toastBannerService: ToastBannerService = .shared

// MARK: Constants
private let router: Router<AppDestination> = .init()
private let routerManager: AppRouterManager = .shared
Expand All @@ -24,6 +29,12 @@ struct RootScreen: View {
) {
FinancialGoalListScreen()
}
.toastBanner(
item: $toastBannerService.toastBanner,
config: .init(yOffset: 10, animation: .smooth),
) { toastBanner in
ToastBannerView(banner: toastBanner)
}
}
}

Expand Down
Loading
Loading