-
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 #22 from vespinola/14-save-login-session
14 save login session
- Loading branch information
Showing
23 changed files
with
353 additions
and
42 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
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
mobile-courier-app/Assets.xcassets/AppIcon.appiconset/Contents.json
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,6 +1,7 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "App_Icon.png", | ||
"idiom" : "universal", | ||
"platform" : "ios", | ||
"size" : "1024x1024" | ||
|
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
34 changes: 34 additions & 0 deletions
34
mobile-courier-app/Presentation/Configurations/ConfigurationView.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,34 @@ | ||
// | ||
// ConfigurationView.swift | ||
// mobile-courier-app | ||
// | ||
// Created by Vladimir Espinola on 2024-06-23. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct ConfigurationView: View { | ||
@AppStorage("isDarkMode") var darkModeOn: Bool = false | ||
@EnvironmentObject var coordinator: Coordinator | ||
|
||
var body: some View { | ||
VStack { | ||
List { | ||
Section { | ||
Toggle("Dark Mode", isOn: $darkModeOn) | ||
} | ||
|
||
Section { | ||
Button("Log out", role: .destructive) { | ||
coordinator.popToRoot() | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
#Preview { | ||
ConfigurationView() | ||
.environmentObject(Coordinator(diContainer: AppDIContainerMock())) | ||
} |
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
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
45 changes: 45 additions & 0 deletions
45
mobile-courier-app/Presentation/Previews/AppDIContainerMock.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,45 @@ | ||
// | ||
// AppDIContainerMock.swift | ||
// mobile-courier-app | ||
// | ||
// Created by Vladimir Espinola on 2024-06-23. | ||
// | ||
|
||
import Foundation | ||
|
||
final class AppDIContainerMock: DIContainerProtocol { | ||
private var services: [String: Any] = [:] | ||
|
||
init() { | ||
// ViewModels | ||
register( | ||
LoginViewModel.previewInstance(), | ||
for: LoginViewModel.self | ||
) | ||
register( | ||
HomeViewModel.previewInstance(), | ||
for: HomeViewModel.self | ||
) | ||
register( | ||
WithdrawnPackagesViewModel.previewInstance(), | ||
for: WithdrawnPackagesViewModel.self | ||
) | ||
register( | ||
PackagesForWithdrawalViewModel.previewInstance(), | ||
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 | ||
} | ||
} |
Oops, something went wrong.