-
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.
Merge pull request #21 from vespinola/20-create-package-detail-sheet
20 create package detail sheet
- Loading branch information
Showing
31 changed files
with
499 additions
and
194 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,50 @@ | ||
// | ||
// AppDIContainer.swift | ||
// mobile-courier-app | ||
// | ||
// Created by Vladimir Espinola on 2024-06-21. | ||
// | ||
|
||
import Foundation | ||
|
||
final class AppDIContainer: DIContainerProtocol { | ||
private var services: [String: Any] = [:] | ||
|
||
init() { | ||
// Repositories | ||
register(AuthRepository(), for: AuthRepositoryProtocol.self) | ||
register(AddressRespository(), for: AddressRepositoryProtocol.self) | ||
register(PackagesRepository(), for: PackagesRepositoryProtocol.self) | ||
|
||
// ViewModels | ||
register( | ||
LoginViewModel(authRepository: resolve(AuthRepositoryProtocol.self)), | ||
for: LoginViewModel.self | ||
) | ||
register( | ||
HomeViewModel(addressesRepository: resolve(AddressRepositoryProtocol.self)), | ||
for: HomeViewModel.self | ||
) | ||
register( | ||
WithdrawnPackagesViewModel(packagesRepository: resolve(PackagesRepositoryProtocol.self)), | ||
for: WithdrawnPackagesViewModel.self | ||
) | ||
register( | ||
PackagesForWithdrawalViewModel(packagesRepository: resolve(PackagesRepositoryProtocol.self)), | ||
for: PackagesForWithdrawalViewModel.self | ||
) | ||
} | ||
|
||
func register<T>(_ service: T, for type: T.Type) { | ||
let key = String(describing: type) | ||
services[key] = service | ||
} | ||
|
||
func resolve<T>(_ type: T.Type) -> T { | ||
let key = String(describing: type) | ||
guard let service = services[key] as? T else { | ||
fatalError("Service for \(type) not found") | ||
} | ||
return service | ||
} | ||
} |
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,13 @@ | ||
// | ||
// DIContainerProtocol.swift | ||
// mobile-courier-app | ||
// | ||
// Created by Vladimir Espinola on 2024-06-21. | ||
// | ||
|
||
import Foundation | ||
|
||
protocol DIContainerProtocol { | ||
func register<T>(_ service: T, for type: T.Type) | ||
func resolve<T>(_ type: T.Type) -> T | ||
} |
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 @@ | ||
// | ||
// mobile_courier_appApp.swift | ||
// mobile-courier-app | ||
// | ||
// Created by Vladimir Espinola on 2024-05-04. | ||
// | ||
|
||
import SwiftUI | ||
|
||
@main | ||
struct MobileCourierApp: App { | ||
@StateObject var coordinator = Coordinator(diContainer: AppDIContainer()) | ||
@StateObject var appData = AppData.shared | ||
|
||
init() { | ||
UITabBar.appearance().backgroundColor = UIColor.lightGray.withAlphaComponent(0.3) | ||
} | ||
|
||
var body: some Scene { | ||
WindowGroup { | ||
CoordinatorRootView() | ||
.environmentObject(coordinator) | ||
.environmentObject(appData) | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -10,7 +10,7 @@ import Foundation | |
struct AuthRepository: AuthRepositoryProtocol { | ||
private var apiRequestClient: APIRequestClientProtocol | ||
|
||
init(apiRequestClient: APIRequestClientProtocol) { | ||
init(apiRequestClient: APIRequestClientProtocol = APIRequestClient()) { | ||
self.apiRequestClient = apiRequestClient | ||
} | ||
|
||
|
@@ -20,8 +20,6 @@ struct AuthRepository: AuthRepositoryProtocol { | |
decoder: JSONDecoder() | ||
) | ||
|
||
// let model = LoginEntity(username: "[email protected]", accessToken: "eyJhbGciOiJIUzI1NiJ9.eyJwcmluY2lwYWwiOiJINHNJQUFBQUFBQUFBSlZTejJzVFFSUitpU2tWaXRnV0ZFUXFIdXBOTmpZaE5DR1gybEtsc0NSaXpLV0NaYkw3c2s0N083UE96S2FiaThTTFBYZ1ExSUxneFlNbjZYXC9peVQ5QUVPODk5K3FidE0ybVhvckx3aTV2dnYxK3ZUMDZoaG1qb1JwcHhvWHhFcEZHWEhvbTBWeEdCb05VY3p2MFVvTTZSRHRHUEI0RHV6U0IwNnRRaElJUFJSNWFXUFIzMllDVkJaTlJ1ZDNieGNBMk13MFZwYU16eHI1bU1lNHJ2ZWROdUFPbDhZSkFUbDFZSzhMc05peXdJRkNwdEMwbE43T0Vhd3kzWVQ2ZitTclljNk1iQVoyZ3RKd0pNdzJkUmNsNkFrTWY1bGhxWHlwUzVXZ3NYRDgxbTFvdXloMjBUUit1SnN3WWN2ZFBrbzUxMXQyNXN5a3B3U3Q0RGFVc0tkQkYzZDF6VU1cL3hlQnRLQ0VyTmxUVExYUm1ya1BlNUV5ZiswZEtIbisrXC9qTHBGQU9ya1wvdVhmNVBOYjZ6RDY4ZUxrenJqb1FtRGg1cFQxSE5iTUVuS3prRE1cLzAraVVmMzErOHZIdytPRDVGVkoyaUVmXC92NFwvbGgyZk5EVGRVbkRETnJKcmFFZEh1bDl3N2thOWZUbjYraGFIWDRYRWlrUDRvYVRHY1NPVEVGTGVrbFRqdjI4SzFwMjFcL2M2ZlYzbkhQVG1iaGJyOGZybFRweGxWV2J6UjZyRjZyWTZOU3FmYnJxMkd0aGc4czNCNElGdktZYXc5TndxVVNiQzJLS1JtWmlTZDl1VVY3VzJRalFyMzQ1K3Uza3pjSGRkTGZncGtCRXluU3h1WnpYQ3VOZTZqZkhoMHV6WDM2XC9XNmNIOERcL1wvaGNLbEMyeFN3TUFBQT09Iiwic3ViIjoidmxhZGltaXIuZXNwaW5vbGFAZ21haWwuY29tIiwiZXhwIjoxNzI0NTQxOTQ3LCJpYXQiOjE3MTg0OTM5NDcsInJvbGVzIjpbIlJPTEVfTk9fUk9MRVMiXX0._SSqulgIqcM0GabBT7oSULFsWEgiFGQKDGDpVKdFy3U") | ||
// | ||
AppData.shared.updateToken(model.accessToken) | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
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
24 changes: 24 additions & 0 deletions
24
mobile-courier-app/Presentation/Helpers/Modifiers/GroupedPackageStyleModifier.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,24 @@ | ||
// | ||
// GroupedPackageStyleModifier.swift | ||
// mobile-courier-app | ||
// | ||
// Created by Vladimir Espinola on 2024-06-22. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct GroupedPackageStyleModifier: ViewModifier { | ||
func body(content: Content) -> some View { | ||
content | ||
.listRowBackground(EmptyView()) | ||
.listRowSeparator(.hidden) | ||
.listRowSpacing(.zero) | ||
.listRowInsets(.none) | ||
} | ||
} | ||
|
||
extension View { | ||
func groupedPackageRowStyle() -> some View { | ||
self.modifier(GroupedPackageStyleModifier()) | ||
} | ||
} |
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
Oops, something went wrong.