From 41129e1ba20727afe10d9d4860ebb9a0b44d6f47 Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Sun, 23 Jun 2024 23:44:15 -0400 Subject: [PATCH 1/7] visual adjustments --- .../Presentation/Helpers/HeaderView.swift | 18 ++++++----- .../Presentation/Home/HomeView.swift | 31 ++++++++++++------- 2 files changed, 30 insertions(+), 19 deletions(-) diff --git a/mobile-courier-app/Presentation/Helpers/HeaderView.swift b/mobile-courier-app/Presentation/Helpers/HeaderView.swift index e380711..fb411c1 100644 --- a/mobile-courier-app/Presentation/Helpers/HeaderView.swift +++ b/mobile-courier-app/Presentation/Helpers/HeaderView.swift @@ -11,16 +11,20 @@ struct HeaderView: View { @EnvironmentObject var appData: AppData var body: some View { - ZStack { + HStack { HStack { Image("shortLogo") .resizable() .renderingMode(.template) .foregroundStyle(.white) .aspectRatio(contentMode: .fit) - .padding(16) - .opacity(0.4) - Spacer() + .padding(.init( + top: 16, + leading: 16, + bottom: 16, + trailing: .zero) + ) + .frame(height: 60) } if let username = appData.username?.capitalized { @@ -29,12 +33,12 @@ struct HeaderView: View { .font(.title3) .fontWeight(.bold) .foregroundStyle(.white) - Spacer() } - .padding(.leading, 60) } + + Spacer() } - .frame(maxWidth: .infinity, maxHeight: 60) + .frame(maxWidth: .infinity) .background(.accent) } } diff --git a/mobile-courier-app/Presentation/Home/HomeView.swift b/mobile-courier-app/Presentation/Home/HomeView.swift index 39005e2..e1388de 100644 --- a/mobile-courier-app/Presentation/Home/HomeView.swift +++ b/mobile-courier-app/Presentation/Home/HomeView.swift @@ -14,8 +14,26 @@ struct HomeView: View { @State var selectedTab = 0 var body: some View { - HeaderView() + VStack(spacing: .zero) { + HeaderView() + getTabView() + .navigationTitle("") + .toolbar(.hidden) + .sheet(item: $coordinator.sheet) { sheet in + coordinator.build(sheet: sheet) + } + .toast(message: $viewModel.toastMessage) + .onAppear { + Task { + await viewModel.getAddresses() + } + } + } + } + + @ViewBuilder + private func getTabView() -> some View { TabView(selection: $selectedTab) { coordinator.build(page: .packagesForWithdrawl) .tabItem { @@ -41,17 +59,6 @@ struct HomeView: View { } .tag(3) } - .navigationTitle("") - .toolbar(.hidden) - .sheet(item: $coordinator.sheet) { sheet in - coordinator.build(sheet: sheet) - } - .toast(message: $viewModel.toastMessage) - .onAppear { - Task { - await viewModel.getAddresses() - } - } } @ViewBuilder From a825bb8d27aa67bce155ce88b14977b3f5f68ebe Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Mon, 24 Jun 2024 22:56:19 -0400 Subject: [PATCH 2/7] fixed logout issue --- mobile-courier-app.xcodeproj/project.pbxproj | 40 +++++++++++++------ mobile-courier-app/App/AppDIContainer.swift | 6 ++- .../ConcreteRepositories/AuthRepository.swift | 4 ++ .../Repositories/AuthRepositoryProtocol.swift | 5 +++ .../Presentation/Login/LoginView.swift | 3 +- .../Presentation/Navigation/Coordinator.swift | 2 +- .../Previews/AppDIContainerMock.swift | 4 ++ .../Previews/SettingsViewModelMock.swift | 14 +++++++ .../SettingsView.swift} | 8 ++-- .../Settings/SettingsViewModel.swift | 20 ++++++++++ .../Utilities/Localizable.xcstrings | 9 +++++ 11 files changed, 97 insertions(+), 18 deletions(-) create mode 100644 mobile-courier-app/Presentation/Previews/SettingsViewModelMock.swift rename mobile-courier-app/Presentation/{Configurations/ConfigurationView.swift => Settings/SettingsView.swift} (75%) create mode 100644 mobile-courier-app/Presentation/Settings/SettingsViewModel.swift diff --git a/mobile-courier-app.xcodeproj/project.pbxproj b/mobile-courier-app.xcodeproj/project.pbxproj index 2566744..12f2c8b 100644 --- a/mobile-courier-app.xcodeproj/project.pbxproj +++ b/mobile-courier-app.xcodeproj/project.pbxproj @@ -23,7 +23,7 @@ 1B4047192C2782B300101DF4 /* HomeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B4047182C2782B300101DF4 /* HomeViewModel.swift */; }; 1B40471B2C27854200101DF4 /* AddressEntityMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B40471A2C27854200101DF4 /* AddressEntityMock.swift */; }; 1B40471D2C27C3CB00101DF4 /* GroupedPackageStyleModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B40471C2C27C3CB00101DF4 /* GroupedPackageStyleModifier.swift */; }; - 1B4047242C27DF9600101DF4 /* ConfigurationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B4047232C27DF9600101DF4 /* ConfigurationView.swift */; }; + 1B4047242C27DF9600101DF4 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B4047232C27DF9600101DF4 /* SettingsView.swift */; }; 1B4047282C27E04600101DF4 /* AppDIContainerMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B4047272C27E04600101DF4 /* AppDIContainerMock.swift */; }; 1B40472A2C27E99D00101DF4 /* AppDataMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B4047292C27E99D00101DF4 /* AppDataMock.swift */; }; 1B58EF772BE6BBE90066F447 /* MobileCourierApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B58EF762BE6BBE90066F447 /* MobileCourierApp.swift */; }; @@ -62,6 +62,7 @@ 1B9274D22C115E53008F4FA3 /* AddressRepositoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B9274D12C115E53008F4FA3 /* AddressRepositoryProtocol.swift */; }; 1B9274D42C115EA4008F4FA3 /* AddressesEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B9274D32C115EA4008F4FA3 /* AddressesEntity.swift */; }; 1B99600F2C12992F00976BBC /* AddressRespository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1B99600E2C12992F00976BBC /* AddressRespository.swift */; }; + 1BA99DD32C2A6712003D38F8 /* SettingsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BA99DD22C2A6712003D38F8 /* SettingsViewModel.swift */; }; 1BAB0EE62BFEE2D9004DF155 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 1BAB0EE52BFEE2D9004DF155 /* Localizable.xcstrings */; }; 1BC0717A2C140C6A006EC08E /* HomeViewModelMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BC071792C140C6A006EC08E /* HomeViewModelMock.swift */; }; 1BC0717C2C140CA9006EC08E /* AddressesRepositoryMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BC0717B2C140CA9006EC08E /* AddressesRepositoryMock.swift */; }; @@ -77,6 +78,7 @@ 1BE63F6F2BE972A60016A26E /* AuthRepositoryProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE63F6E2BE972A60016A26E /* AuthRepositoryProtocol.swift */; }; 1BE63F712BE980D60016A26E /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE63F702BE980D60016A26E /* Storage.swift */; }; 1BEE841F2C17D6FF00B8A367 /* RowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BEE841E2C17D6FF00B8A367 /* RowView.swift */; }; + 1BFD1EAF2C2A688B002E4232 /* SettingsViewModelMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EAE2C2A688B002E4232 /* SettingsViewModelMock.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -113,7 +115,7 @@ 1B4047182C2782B300101DF4 /* HomeViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModel.swift; sourceTree = ""; }; 1B40471A2C27854200101DF4 /* AddressEntityMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressEntityMock.swift; sourceTree = ""; }; 1B40471C2C27C3CB00101DF4 /* GroupedPackageStyleModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupedPackageStyleModifier.swift; sourceTree = ""; }; - 1B4047232C27DF9600101DF4 /* ConfigurationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigurationView.swift; sourceTree = ""; }; + 1B4047232C27DF9600101DF4 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 1B4047272C27E04600101DF4 /* AppDIContainerMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDIContainerMock.swift; sourceTree = ""; }; 1B4047292C27E99D00101DF4 /* AppDataMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDataMock.swift; sourceTree = ""; }; 1B58EF732BE6BBE90066F447 /* JustACourierApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JustACourierApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -156,6 +158,7 @@ 1B9274D12C115E53008F4FA3 /* AddressRepositoryProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressRepositoryProtocol.swift; sourceTree = ""; }; 1B9274D32C115EA4008F4FA3 /* AddressesEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressesEntity.swift; sourceTree = ""; }; 1B99600E2C12992F00976BBC /* AddressRespository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressRespository.swift; sourceTree = ""; }; + 1BA99DD22C2A6712003D38F8 /* SettingsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModel.swift; sourceTree = ""; }; 1BAB0EE52BFEE2D9004DF155 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = ""; }; 1BC071792C140C6A006EC08E /* HomeViewModelMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HomeViewModelMock.swift; sourceTree = ""; }; 1BC0717B2C140CA9006EC08E /* AddressesRepositoryMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressesRepositoryMock.swift; sourceTree = ""; }; @@ -172,6 +175,7 @@ 1BE63F702BE980D60016A26E /* Storage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Storage.swift; sourceTree = ""; }; 1BE63F722BE98ADD0016A26E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 1BEE841E2C17D6FF00B8A367 /* RowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RowView.swift; sourceTree = ""; }; + 1BFD1EAE2C2A688B002E4232 /* SettingsViewModelMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModelMock.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -222,12 +226,13 @@ path = WithdrawnPackages; sourceTree = ""; }; - 1B40471E2C27DF3100101DF4 /* Configurations */ = { + 1B40471E2C27DF3100101DF4 /* Settings */ = { isa = PBXGroup; children = ( - 1B4047232C27DF9600101DF4 /* ConfigurationView.swift */, + 1B4047232C27DF9600101DF4 /* SettingsView.swift */, + 1BA99DD22C2A6712003D38F8 /* SettingsViewModel.swift */, ); - path = Configurations; + path = Settings; sourceTree = ""; }; 1B58EF6A2BE6BBE90066F447 = { @@ -444,16 +449,16 @@ isa = PBXGroup; children = ( 1B58EF782BE6BBE90066F447 /* CoordinatorRootView.swift */, - 1B40471E2C27DF3100101DF4 /* Configurations */, + 1B40471E2C27DF3100101DF4 /* Settings */, 1B6D751A2C23DF820067BB56 /* ShipmentDetail */, 1B6D75152C23BDA40067BB56 /* PackagesForWithdrawal */, 1B2DDEF02C1E652A003EC97C /* WithdrawnPackages */, 1B8500132C100DE2006E96A0 /* Profile */, 1BD17E612C0EB42B009B6C67 /* Navigation */, 1BE58CB12C0585B400C7DF63 /* Home */, - 1BE58CA42C05725500C7DF63 /* Previews */, 1B07BC8B2BFD676100D8B149 /* Helpers */, 1B58EFA12BE6BF870066F447 /* Login */, + 1BE58CA42C05725500C7DF63 /* Previews */, ); path = Presentation; sourceTree = ""; @@ -498,6 +503,7 @@ 1B6590E32C228DD700D46A27 /* PackagesForWithdrawalViewModelMock.swift */, 1B40471A2C27854200101DF4 /* AddressEntityMock.swift */, 1B4047292C27E99D00101DF4 /* AppDataMock.swift */, + 1BFD1EAE2C2A688B002E4232 /* SettingsViewModelMock.swift */, ); path = Previews; sourceTree = ""; @@ -689,13 +695,14 @@ buildActionMask = 2147483647; files = ( 1B99600F2C12992F00976BBC /* AddressRespository.swift in Sources */, - 1B4047242C27DF9600101DF4 /* ConfigurationView.swift in Sources */, + 1B4047242C27DF9600101DF4 /* SettingsView.swift in Sources */, 1B58EFB92BE729D20066F447 /* Endpoint.swift in Sources */, 1B2DDEF42C1E7DD4003EC97C /* PackagePlaceholderView.swift in Sources */, 1B07BC8D2BFD677900D8B149 /* RippleSpinnerView.swift in Sources */, 1B4047282C27E04600101DF4 /* AppDIContainerMock.swift in Sources */, 1B9274D02C115AF1008F4FA3 /* AddressesModel.swift in Sources */, 1BE58CA82C0572B400C7DF63 /* StorageMock.swift in Sources */, + 1BFD1EAF2C2A688B002E4232 /* SettingsViewModelMock.swift in Sources */, 1B8B0A442C1BDDE600D1A7AC /* HeaderView.swift in Sources */, 1B85E8E22BFC4DAE003040CC /* LoginModel.swift in Sources */, 1B6590E02C22853400D46A27 /* PackagesForWithdrawalView.swift in Sources */, @@ -737,6 +744,7 @@ 1B85E8EA2BFC4E85003040CC /* AuthRepository.swift in Sources */, 1B9274CD2C1158E0008F4FA3 /* AddressEndpoints.swift in Sources */, 1B5E849F2C267F9600EDFDE2 /* DIContainerProtocol.swift in Sources */, + 1BA99DD32C2A6712003D38F8 /* SettingsViewModel.swift in Sources */, 1B85E8E72BFC4E24003040CC /* LoginEntity.swift in Sources */, 1B58EF772BE6BBE90066F447 /* MobileCourierApp.swift in Sources */, 1B2DDF022C1E9AC8003EC97C /* WithdrawnPackagesViewModelMock.swift in Sources */, @@ -907,10 +915,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "mobile-courier-app/mobile_courier_app.entitlements"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"mobile-courier-app/Preview Content\""; - DEVELOPMENT_TEAM = LXE5SAW38H; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = LXE5SAW38H; ENABLE_PREVIEWS = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; @@ -933,6 +942,8 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = "com.just.another.mobile-courier-app"; PRODUCT_NAME = JustACourierApp; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = JustCourierAppAdHoc; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; @@ -948,10 +959,13 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "mobile-courier-app/mobile_courier_app.entitlements"; - CODE_SIGN_STYLE = Automatic; + CODE_SIGN_IDENTITY = "Apple Development"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; + CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"mobile-courier-app/Preview Content\""; - DEVELOPMENT_TEAM = LXE5SAW38H; + DEVELOPMENT_TEAM = ""; + "DEVELOPMENT_TEAM[sdk=iphoneos*]" = LXE5SAW38H; ENABLE_PREVIEWS = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; @@ -974,6 +988,8 @@ MARKETING_VERSION = 1.0; PRODUCT_BUNDLE_IDENTIFIER = "com.just.another.mobile-courier-app"; PRODUCT_NAME = JustACourierApp; + PROVISIONING_PROFILE_SPECIFIER = ""; + "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = JustCourierAppAdHoc; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/mobile-courier-app/App/AppDIContainer.swift b/mobile-courier-app/App/AppDIContainer.swift index 4e66932..e5b59c5 100644 --- a/mobile-courier-app/App/AppDIContainer.swift +++ b/mobile-courier-app/App/AppDIContainer.swift @@ -16,7 +16,7 @@ final class AppDIContainer: DIContainerProtocol { register(AddressRespository(), for: AddressRepositoryProtocol.self) register(PackagesRepository(), for: PackagesRepositoryProtocol.self) - //Helpers + // Helpers register(UserDefaultsStorage(), for: Storage.self) // ViewModels @@ -38,6 +38,10 @@ final class AppDIContainer: DIContainerProtocol { PackagesForWithdrawalViewModel(packagesRepository: resolve(PackagesRepositoryProtocol.self)), for: PackagesForWithdrawalViewModel.self ) + register( + SettingsViewModel(authRepository: resolve(AuthRepositoryProtocol.self)), + for: SettingsViewModel.self + ) } func register(_ service: T, for type: T.Type) { diff --git a/mobile-courier-app/Data/ConcreteRepositories/AuthRepository.swift b/mobile-courier-app/Data/ConcreteRepositories/AuthRepository.swift index b6820ff..2432974 100644 --- a/mobile-courier-app/Data/ConcreteRepositories/AuthRepository.swift +++ b/mobile-courier-app/Data/ConcreteRepositories/AuthRepository.swift @@ -22,4 +22,8 @@ struct AuthRepository: AuthRepositoryProtocol { AppData.shared.updateToken(model.accessToken) } + + func performLogout() { + AppData.shared.updateToken(nil) + } } diff --git a/mobile-courier-app/Domain/Repositories/AuthRepositoryProtocol.swift b/mobile-courier-app/Domain/Repositories/AuthRepositoryProtocol.swift index 32399cc..de24b26 100644 --- a/mobile-courier-app/Domain/Repositories/AuthRepositoryProtocol.swift +++ b/mobile-courier-app/Domain/Repositories/AuthRepositoryProtocol.swift @@ -9,4 +9,9 @@ import Foundation protocol AuthRepositoryProtocol { func performLogin(email: String, password: String) async throws + func performLogout() +} + +extension AuthRepositoryProtocol { + func performLogout() { } } diff --git a/mobile-courier-app/Presentation/Login/LoginView.swift b/mobile-courier-app/Presentation/Login/LoginView.swift index 3254266..b99fb54 100644 --- a/mobile-courier-app/Presentation/Login/LoginView.swift +++ b/mobile-courier-app/Presentation/Login/LoginView.swift @@ -45,7 +45,6 @@ struct LoginView: View { .submitLabel(.done) .textContentType(.password) .onSubmit { - focusField = nil navigateToLogin() } @@ -74,6 +73,8 @@ struct LoginView: View { } private func navigateToLogin() { + focusField = nil + Task { guard await viewModel.doLogin() else { return } coordinator.push(.home) diff --git a/mobile-courier-app/Presentation/Navigation/Coordinator.swift b/mobile-courier-app/Presentation/Navigation/Coordinator.swift index 9662636..3f49110 100644 --- a/mobile-courier-app/Presentation/Navigation/Coordinator.swift +++ b/mobile-courier-app/Presentation/Navigation/Coordinator.swift @@ -85,7 +85,7 @@ final class Coordinator: ObservableObject { viewModel: diContainer.resolve(PackagesForWithdrawalViewModel.self) ) case .configurations: - ConfigurationView() + SettingsView(viewModel: diContainer.resolve(SettingsViewModel.self)) } } diff --git a/mobile-courier-app/Presentation/Previews/AppDIContainerMock.swift b/mobile-courier-app/Presentation/Previews/AppDIContainerMock.swift index e9e1f70..a8ded20 100644 --- a/mobile-courier-app/Presentation/Previews/AppDIContainerMock.swift +++ b/mobile-courier-app/Presentation/Previews/AppDIContainerMock.swift @@ -28,6 +28,10 @@ final class AppDIContainerMock: DIContainerProtocol { PackagesForWithdrawalViewModel.previewInstance(), for: PackagesForWithdrawalViewModel.self ) + register( + SettingsViewModel.previewInstance(), + for: SettingsViewModel.self + ) } func register(_ service: T, for type: T.Type) { diff --git a/mobile-courier-app/Presentation/Previews/SettingsViewModelMock.swift b/mobile-courier-app/Presentation/Previews/SettingsViewModelMock.swift new file mode 100644 index 0000000..2b941e3 --- /dev/null +++ b/mobile-courier-app/Presentation/Previews/SettingsViewModelMock.swift @@ -0,0 +1,14 @@ +// +// SettingsViewModelMock.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-24. +// + +import Foundation + +extension SettingsViewModel { + static func previewInstance() -> SettingsViewModel { + .init(authRepository: AuthRepositoryMock()) + } +} diff --git a/mobile-courier-app/Presentation/Configurations/ConfigurationView.swift b/mobile-courier-app/Presentation/Settings/SettingsView.swift similarity index 75% rename from mobile-courier-app/Presentation/Configurations/ConfigurationView.swift rename to mobile-courier-app/Presentation/Settings/SettingsView.swift index 9c534b4..035d6f4 100644 --- a/mobile-courier-app/Presentation/Configurations/ConfigurationView.swift +++ b/mobile-courier-app/Presentation/Settings/SettingsView.swift @@ -1,5 +1,5 @@ // -// ConfigurationView.swift +// SettingsView.swift // mobile-courier-app // // Created by Vladimir Espinola on 2024-06-23. @@ -7,9 +7,10 @@ import SwiftUI -struct ConfigurationView: View { +struct SettingsView: View { @AppStorage("isDarkMode") var darkModeOn: Bool = false @EnvironmentObject var coordinator: Coordinator + @ObservedObject var viewModel: SettingsViewModel var body: some View { VStack { @@ -20,6 +21,7 @@ struct ConfigurationView: View { Section { Button("Log out", role: .destructive) { + viewModel.doLogout() coordinator.popToRoot() } } @@ -29,6 +31,6 @@ struct ConfigurationView: View { } #Preview { - ConfigurationView() + SettingsView(viewModel: .previewInstance()) .environmentObject(Coordinator(diContainer: AppDIContainerMock())) } diff --git a/mobile-courier-app/Presentation/Settings/SettingsViewModel.swift b/mobile-courier-app/Presentation/Settings/SettingsViewModel.swift new file mode 100644 index 0000000..7d3e9e1 --- /dev/null +++ b/mobile-courier-app/Presentation/Settings/SettingsViewModel.swift @@ -0,0 +1,20 @@ +// +// SettingsViewModel.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-24. +// + +import Foundation + +final class SettingsViewModel: ObservableObject { + private let authRepository: AuthRepositoryProtocol + + init(authRepository: AuthRepositoryProtocol) { + self.authRepository = authRepository + } + + func doLogout() { + authRepository.performLogout() + } +} diff --git a/mobile-courier-app/Utilities/Localizable.xcstrings b/mobile-courier-app/Utilities/Localizable.xcstrings index b439bd5..2351449 100644 --- a/mobile-courier-app/Utilities/Localizable.xcstrings +++ b/mobile-courier-app/Utilities/Localizable.xcstrings @@ -3,6 +3,9 @@ "strings" : { "" : { + }, + "%lld" : { + }, "%lld packages" : { "localizations" : { @@ -184,6 +187,9 @@ } } } + }, + "Please select a year" : { + }, "Processing" : { "localizations" : { @@ -231,6 +237,9 @@ } } } + }, + "Select Year" : { + }, "Settings" : { "localizations" : { From 7fdc27e2f96073201db7e6d22ccf2ce2a388c699 Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Mon, 24 Jun 2024 23:36:48 -0400 Subject: [PATCH 3/7] refactored properties --- .../AddressRespository.swift | 2 +- .../Networking/Models/AddressesModel.swift | 139 +++++++++++------- .../Networking/Models/PackagesModel.swift | 87 +++++------ .../Domain/Entities/AddressesEntity.swift | 48 +++--- .../Domain/Entities/PackageEntity.swift | 48 +++--- .../GroupedPackageReadyView.swift | 6 +- .../Previews/AddressEntityMock.swift | 89 ++++++----- .../Previews/PackagesRepositoryMock.swift | 6 +- .../Presentation/Profile/ProfileView.swift | 4 +- .../Profile/ShipmentRowView.swift | 20 +-- .../ShipmentDetail/ShipmentDetailView.swift | 10 +- .../GroupedPackageRowView.swift | 6 +- .../Utilities/Localizable.xcstrings | 9 -- 13 files changed, 256 insertions(+), 218 deletions(-) diff --git a/mobile-courier-app/Data/ConcreteRepositories/AddressRespository.swift b/mobile-courier-app/Data/ConcreteRepositories/AddressRespository.swift index b18dc78..166e469 100644 --- a/mobile-courier-app/Data/ConcreteRepositories/AddressRespository.swift +++ b/mobile-courier-app/Data/ConcreteRepositories/AddressRespository.swift @@ -20,7 +20,7 @@ struct AddressRespository: AddressRepositoryProtocol { decoder: JSONDecoder() ) - AppData.shared.setUsername(model.enviosAereos.cliente.clienteNombre) + AppData.shared.setUsername(model.airShipments.client.clientFirstName) return model.asEntity() } diff --git a/mobile-courier-app/Data/Networking/Models/AddressesModel.swift b/mobile-courier-app/Data/Networking/Models/AddressesModel.swift index b8cb248..11ef02b 100644 --- a/mobile-courier-app/Data/Networking/Models/AddressesModel.swift +++ b/mobile-courier-app/Data/Networking/Models/AddressesModel.swift @@ -8,88 +8,119 @@ import Foundation struct AddressesModel: Codable { - let enviosAereos: EnviosModel - let viaMaritima: EnviosModel + let airShipments: ShipmentsModel + let seaShipments: ShipmentsModel + + enum CodingKeys: String, CodingKey { + case airShipments = "enviosAereos" + case seaShipments = "viaMaritima" + } } -struct EnviosModel: Codable { - let ciudad: String - let cliente: ClienteModel - let direccion: String - let empresa: String - let pais: String - let telefono: String +struct ShipmentsModel: Codable { + let city: String + let client: ClientModel + let address: String + let company: String + let country: String + let phone: String + + enum CodingKeys: String, CodingKey { + case city = "ciudad" + case client = "cliente" + case address = "direccion" + case company = "empresa" + case country = "pais" + case phone = "telefono" + } } -struct ClienteModel: Codable { +struct ClientModel: Codable { let classType: String let id: Int - let apellidoAutorizado: String - let autorizaEmail: Int - let ciautorizado: String - let ciudad: Int - let clienteApellido: String - let clienteCelular: String - let clienteCi: String - let clienteDireccion: String - let clienteNombre: String - let clienteObservacion: String - let clienteTelefono: String - let diaNac: Int - let estado: Int - let estante: String - let mesNac: Int - let nombreAutorizado: String - let pagoAnualidad: String? + let authorizedLastName: String + let authorizeEmail: Int + let authorizedCi: String + let city: Int + let clientLastName: String + let clientCellPhone: String + let clientCi: String + let clientAddress: String + let clientFirstName: String + let clientNotes: String + let clientPhone: String + let birthDay: Int + let status: Int + let shelf: String + let birthMonth: Int + let authorizedFirstName: String + let annualPayment: String? let password: String - let ruc: String - let tarifa: Double + let taxId: String + let rate: Double let username: String enum CodingKeys: String, CodingKey { case classType = "class" - case id, apellidoAutorizado = "apellidoautorizado", autorizaEmail = "autorizaemail", ciautorizado, ciudad - case clienteApellido = "clienteapellido", clienteCelular = "clientecelular", clienteCi = "clienteci" - case clienteDireccion = "clientedireccion", clienteNombre = "clientenombre", clienteObservacion = "clienteobservacion" - case clienteTelefono = "clientetelefono", diaNac = "dianac", estado, estante, mesNac = "mesnac" - case nombreAutorizado = "nombreautorizado", pagoAnualidad, password, ruc, tarifa, username + case id + case authorizedLastName = "apellidoautorizado" + case authorizeEmail = "autorizaemail" + case authorizedCi = "ciautorizado" + case city = "ciudad" + case clientLastName = "clienteapellido" + case clientCellPhone = "clientecelular" + case clientCi = "clienteci" + case clientAddress = "clientedireccion" + case clientFirstName = "clientenombre" + case clientNotes = "clienteobservacion" + case clientPhone = "clientetelefono" + case birthDay = "dianac" + case status = "estado" + case shelf = "estante" + case birthMonth = "mesnac" + case authorizedFirstName = "nombreautorizado" + case annualPayment = "pagoanualidad" + case password + case taxId = "ruc" + case rate = "tarifa" + case username } } extension AddressesModel { func asEntity() -> AddressesEntity { .init( - enviosAereos: enviosAereos.asEntity(), - viaMaritima: viaMaritima.asEntity() + airShipments: airShipments.asEntity(), + seaShipments: seaShipments.asEntity() ) } } -extension EnviosModel { - func asEntity() -> EnviosEntity { +extension ShipmentsModel { + func asEntity() -> ShipmentsEntity { .init( - ciudad: ciudad, - cliente: cliente.asEntity(), - direccion: direccion, - empresa: empresa, - pais: pais, - telefono: telefono + city: city, + client: client.asEntity(), + address: address, + company: company, + country: country, + phone: phone ) } } -extension ClienteModel { - func asEntity() -> ClienteEntity { +extension ClientModel { + func asEntity() -> ClientEntity { .init( id: id, - autorizaEmail: autorizaEmail, - ciautorizado: ciautorizado, - ciudad: ciudad, - clienteCelular: clienteCelular, - clienteCi: clienteCi, - clienteTelefono: clienteTelefono, - ruc: ruc, - tarifa: tarifa, + authorizeEmail: authorizeEmail, + authorizedCi: authorizedCi, + city: city, + clientCellPhone: clientCellPhone, + clientCi: clientCi, + clientPhone: clientPhone, + taxId: taxId, + rate: rate, userName: username ) } diff --git a/mobile-courier-app/Data/Networking/Models/PackagesModel.swift b/mobile-courier-app/Data/Networking/Models/PackagesModel.swift index 456ab5e..1c0cf71 100644 --- a/mobile-courier-app/Data/Networking/Models/PackagesModel.swift +++ b/mobile-courier-app/Data/Networking/Models/PackagesModel.swift @@ -8,71 +8,74 @@ import Foundation struct PackagesModel: Codable { - let paquetes: [PackageModel] + let packages: [PackageModel] + + enum CodingKeys: String, CodingKey { + case packages = "paquetes" + } } struct PackageModel: Codable { - let estado: String - let embarqueEstado: String - var paqueteFechaRetiro: String? - let embarqueMedio: String - let tarifaPrecioCli: Decimal - let paqueteDescripcion: String - let paqueteTracking: String - let cotizacion: Decimal - let embarqueFecha: String - let paquetePeso: Decimal - let embarqueCodigo: Int + let status: String + let shipmentStatus: String + var packagePickupDate: String? + let shipmentMethod: String + let clientPriceRate: Decimal + let packageDescription: String + let packageTrackingNumber: String + let quotation: Decimal + let shipmentDate: String + let packageWeight: Decimal + let shipmentCode: Int let id: Int - let paquetePrecio: Decimal + let packagePrice: Decimal enum CodingKeys: String, CodingKey { - case estado - case embarqueEstado = "embarqueestado" - case paqueteFechaRetiro = "paquetefecharetiro" - case embarqueMedio = "embarquemedio" - case tarifaPrecioCli = "tarifapreciocli" - case paqueteDescripcion = "paquetedescripcion" - case paqueteTracking = "paquetetracking" - case cotizacion - case embarqueFecha = "embarquefecha" - case paquetePeso = "paquetepeso" - case embarqueCodigo = "embarquecodigo" + case status = "estado" + case shipmentStatus = "embarqueestado" + case packagePickupDate = "paquetefecharetiro" + case shipmentMethod = "embarquemedio" + case clientPriceRate = "tarifapreciocli" + case packageDescription = "paquetedescripcion" + case packageTrackingNumber = "paquetetracking" + case quotation = "cotizacion" + case shipmentDate = "embarquefecha" + case packageWeight = "paquetepeso" + case shipmentCode = "embarquecodigo" case id - case paquetePrecio = "paqueteprecio" + case packagePrice = "paqueteprecio" } } extension PackageModel { func asEntity() -> PackageEntity { - .init( - estado: estado, - embarqueEstado: embarqueEstado, - paqueteFechaRetiro: paqueteFechaRetiro ?? "", - embarqueMedio: embarqueMedio, - tarifaPrecioCli: tarifaPrecioCli, - paqueteDescripcion: paqueteDescripcion, - paqueteTracking: paqueteTracking, - cotizacion: cotizacion, - embarqueFecha: embarqueFecha, - paquetePeso: paquetePeso, - embarqueCodigo: embarqueCodigo, + return PackageEntity( + status: status, + shipmentStatus: shipmentStatus, + packagePickupDate: packagePickupDate ?? "", + shipmentMethod: shipmentMethod, + clientPriceRate: clientPriceRate, + packageDescription: packageDescription, + packageTrackingNumber: packageTrackingNumber, + quotation: quotation, + shipmentDate: shipmentDate, + packageWeight: packageWeight, + shipmentCode: shipmentCode, id: id, - paquetePrecio: paquetePrecio + packagePrice: packagePrice ) } } - extension PackagesModel { func asEntity() -> [GroupedPackageEntity] { - Dictionary(grouping: paquetes, by: { $0.embarqueCodigo }) + Dictionary(grouping: packages, by: { $0.shipmentCode }) .sorted(by: { Int($0.key) > Int($1.key) }) .map { GroupedPackageEntity( - embarqueCodigo: $0.key, - paquetes: $0.value.map { $0.asEntity() } + shipmentCode: $0.key, + packages: $0.value.map { $0.asEntity() } ) } } diff --git a/mobile-courier-app/Domain/Entities/AddressesEntity.swift b/mobile-courier-app/Domain/Entities/AddressesEntity.swift index e127600..4c07032 100644 --- a/mobile-courier-app/Domain/Entities/AddressesEntity.swift +++ b/mobile-courier-app/Domain/Entities/AddressesEntity.swift @@ -8,47 +8,47 @@ import Foundation final class AddressesEntity: ObservableObject { - let enviosAereos: EnviosEntity - let viaMaritima: EnviosEntity + let airShipments: ShipmentsEntity + let seaShipments: ShipmentsEntity - init(enviosAereos: EnviosEntity, viaMaritima: EnviosEntity) { - self.enviosAereos = enviosAereos - self.viaMaritima = viaMaritima + init(airShipments: ShipmentsEntity, seaShipments: ShipmentsEntity) { + self.airShipments = airShipments + self.seaShipments = seaShipments } } -struct EnviosEntity { - let ciudad: String - var cliente: ClienteEntity? - let direccion: String - let empresa: String - let pais: String - let telefono: String +struct ShipmentsEntity { + let city: String + var client: ClientEntity? + let address: String + let company: String + let country: String + let phone: String } -struct ClienteEntity { +struct ClientEntity { let id: Int - let autorizaEmail: Int - let ciautorizado: String - let ciudad: Int - let clienteCelular: String - let clienteCi: String - let clienteTelefono: String - let ruc: String - let tarifa: Double + let authorizeEmail: Int + let authorizedCi: String + let city: Int + let clientCellPhone: String + let clientCi: String + let clientPhone: String + let taxId: String + let rate: Double let userName: String } extension AddressesEntity { var documentNumber: String { - enviosAereos.cliente?.clienteCi ?? "-" + airShipments.client?.clientCi ?? "-" } var phoneNumber: String { - enviosAereos.cliente?.clienteCelular ?? "-" + airShipments.client?.clientCellPhone ?? "-" } var email: String { - enviosAereos.cliente?.userName ?? "-" + airShipments.client?.userName ?? "-" } } diff --git a/mobile-courier-app/Domain/Entities/PackageEntity.swift b/mobile-courier-app/Domain/Entities/PackageEntity.swift index 3b4bd91..c6a07e8 100644 --- a/mobile-courier-app/Domain/Entities/PackageEntity.swift +++ b/mobile-courier-app/Domain/Entities/PackageEntity.swift @@ -36,14 +36,14 @@ enum ShipmentStatus: String, CaseIterable, Identifiable { } struct GroupedPackageEntity: Identifiable { - var id: Int { embarqueCodigo } + var id: Int { shipmentCode } - var embarqueCodigo: Int - var paquetes: [PackageEntity] + var shipmentCode: Int + var packages: [PackageEntity] var totalCost: Decimal { let thousand: Decimal = 1000 - let cost = paquetes.reduce(.zero) { + let cost = packages.reduce(.zero) { $0 + $1.guaraniesCost } @@ -53,8 +53,8 @@ struct GroupedPackageEntity: Identifiable { } var totalWeight: Decimal { - paquetes.reduce(.zero) { - $0 + $1.paquetePeso + packages.reduce(.zero) { + $0 + $1.packageWeight } } @@ -67,7 +67,7 @@ struct GroupedPackageEntity: Identifiable { let inputDateFormatter = DateFormatter() inputDateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" - guard let firstDate = paquetes.first?.embarqueFecha, + guard let firstDate = packages.first?.shipmentDate, let date = inputDateFormatter.date(from: firstDate) else { return "" } let outputDateFormatter = DateFormatter() @@ -85,13 +85,13 @@ struct GroupedPackageEntity: Identifiable { formatter.allowsFloats = false formatter.groupingSeparator = "" - let formattedValue = NSDecimalNumber(value: embarqueCodigo) + let formattedValue = NSDecimalNumber(value: shipmentCode) return formatter.string(from: formattedValue) ?? "0" } var packageCurrentStatus: ShipmentStatus { - guard let shippingStatus = paquetes.first?.embarqueEstado, - let status = paquetes.first?.estado else { + guard let shippingStatus = packages.first?.shipmentStatus, + let status = packages.first?.status else { return .unknown } if shippingStatus.caseInsensitiveCompare("ORIGEN") == .orderedSame { @@ -123,25 +123,25 @@ extension Array where Element == GroupedPackageEntity { } } -struct PackageEntity: Codable, Identifiable, Hashable { - let estado: String - let embarqueEstado: String - let paqueteFechaRetiro: String - let embarqueMedio: String - let tarifaPrecioCli: Decimal - let paqueteDescripcion: String - let paqueteTracking: String - let cotizacion: Decimal - let embarqueFecha: String - let paquetePeso: Decimal - let embarqueCodigo: Int +struct PackageEntity: Identifiable, Hashable { + let status: String + let shipmentStatus: String + let packagePickupDate: String + let shipmentMethod: String + let clientPriceRate: Decimal + let packageDescription: String + let packageTrackingNumber: String + let quotation: Decimal + let shipmentDate: String + let packageWeight: Decimal + let shipmentCode: Int let id: Int - let paquetePrecio: Decimal + let packagePrice: Decimal } extension PackageEntity { var guaraniesCost: Decimal { - tarifaPrecioCli * cotizacion * paquetePeso + clientPriceRate * quotation * packageWeight } var formattedCost: String { diff --git a/mobile-courier-app/Presentation/PackagesForWithdrawal/GroupedPackageReadyView.swift b/mobile-courier-app/Presentation/PackagesForWithdrawal/GroupedPackageReadyView.swift index afafc5c..5f8e30c 100644 --- a/mobile-courier-app/Presentation/PackagesForWithdrawal/GroupedPackageReadyView.swift +++ b/mobile-courier-app/Presentation/PackagesForWithdrawal/GroupedPackageReadyView.swift @@ -25,7 +25,7 @@ struct GroupedPackageReadyView: View { } HStack { - Text("\(groupedPackage.paquetes.count) packages") + Text("\(groupedPackage.packages.count) packages") Spacer() @@ -55,8 +55,8 @@ struct GroupedPackageReadyView: View { #Preview { GroupedPackageReadyView( groupedPackage: .init( - embarqueCodigo: 2000, - paquetes: [ + shipmentCode: 2000, + packages: [ .mock ] ) diff --git a/mobile-courier-app/Presentation/Previews/AddressEntityMock.swift b/mobile-courier-app/Presentation/Previews/AddressEntityMock.swift index 6248888..993b6e1 100644 --- a/mobile-courier-app/Presentation/Previews/AddressEntityMock.swift +++ b/mobile-courier-app/Presentation/Previews/AddressEntityMock.swift @@ -9,62 +9,75 @@ import Foundation extension AddressesEntity { static var mock: AddressesEntity { - let cliente = ClienteEntity( + let client = ClientEntity( id: 12345, - autorizaEmail: 1, - ciautorizado: "1234567-3", - ciudad: 1, - clienteCelular: "0981123123", - clienteCi: "12345678", - clienteTelefono: "0982123321", - ruc: "1112223-4", - tarifa: 22.5, - userName: "test@gmail.com") - let enviosMaritimos = EnviosEntity(ciudad: "Asuncion", cliente: cliente, direccion: "Direccion", empresa: "empresa", pais: "Paraguay", telefono: "0982333111") - let enviosAeros = enviosMaritimos - return .init(enviosAereos: enviosAeros, viaMaritima: enviosMaritimos) + authorizeEmail: 1, + authorizedCi: "1234567-3", + city: 1, + clientCellPhone: "0981123123", + clientCi: "12345678", + clientPhone: "0982123321", + taxId: "1112223-4", + rate: 22.5, + userName: "test@gmail.com" + ) + + let seaShipments = ShipmentsEntity( + city: "Asuncion", + client: client, + address: "Direccion", + company: "empresa", + country: "Paraguay", + phone: "0982333111" + ) + + let airShipments = seaShipments + + return .init(airShipments: airShipments, seaShipments: seaShipments) } } extension PackageEntity { static var mock: PackageEntity { .init( - estado: "c", - embarqueEstado: "c", - paqueteFechaRetiro: "2024-05-10T04:00:00Z", - embarqueMedio: "Air shipment", - tarifaPrecioCli: 22, - paqueteDescripcion: "It's a package", - paqueteTracking: "Tracking", - cotizacion: 7450, - embarqueFecha: "2024-05-10T04:00:00Z", - paquetePeso: 1.2, - embarqueCodigo: 2143, + status: "c", + shipmentStatus: "c", + packagePickupDate: "2024-05-10T04:00:00Z", + shipmentMethod: "Air shipment", + clientPriceRate: 22, + packageDescription: "It's a package", + packageTrackingNumber: "Tracking", + quotation: 7450, + shipmentDate: "2024-05-10T04:00:00Z", + packageWeight: 1.2, + shipmentCode: 2143, id: 1, - paquetePrecio: 5000) + packagePrice: 5000 + ) } static var atBranchMock: PackageEntity { .init( - estado: "B", - embarqueEstado: "ASUNCION", - paqueteFechaRetiro: "2024-05-10T04:00:00Z", - embarqueMedio: "Air shipment", - tarifaPrecioCli: 22, - paqueteDescripcion: "It's a package", - paqueteTracking: "Tracking", - cotizacion: 7450, - embarqueFecha: "2024-05-10T04:00:00Z", - paquetePeso: 1.2, - embarqueCodigo: 2142, + status: "B", + shipmentStatus: "ASUNCION", + packagePickupDate: "2024-05-10T04:00:00Z", + shipmentMethod: "Air shipment", + clientPriceRate: 22, + packageDescription: "It's a package", + packageTrackingNumber: "Tracking", + quotation: 7450, + shipmentDate: "2024-05-10T04:00:00Z", + packageWeight: 1.2, + shipmentCode: 2142, id: 1, - paquetePrecio: 5000) + packagePrice: 5000 + ) } } extension GroupedPackageEntity { static var mock: GroupedPackageEntity { - .init(embarqueCodigo: 2223, paquetes: [ + .init(shipmentCode: 2223, packages: [ .mock, ]) } diff --git a/mobile-courier-app/Presentation/Previews/PackagesRepositoryMock.swift b/mobile-courier-app/Presentation/Previews/PackagesRepositoryMock.swift index b0af0f1..1128fe0 100644 --- a/mobile-courier-app/Presentation/Previews/PackagesRepositoryMock.swift +++ b/mobile-courier-app/Presentation/Previews/PackagesRepositoryMock.swift @@ -10,10 +10,10 @@ import Foundation struct PackagesRepositoryMock: PackagesRepositoryProtocol { func getPackagesForWithdrawl() async throws -> [GroupedPackageEntity] { [ - .init(embarqueCodigo: 2223, paquetes: [ + .init(shipmentCode: 2223, packages: [ .mock, ]), - .init(embarqueCodigo: 2221, paquetes: [ + .init(shipmentCode: 2221, packages: [ .atBranchMock ]), ] @@ -21,7 +21,7 @@ struct PackagesRepositoryMock: PackagesRepositoryProtocol { func getWithdrawnPackages() async throws -> [GroupedPackageEntity] { [ - .init(embarqueCodigo: 2143, paquetes: [ .mock ]) + .init(shipmentCode: 2143, packages: [ .mock ]) ] } } diff --git a/mobile-courier-app/Presentation/Profile/ProfileView.swift b/mobile-courier-app/Presentation/Profile/ProfileView.swift index ed2f2e0..3f878ec 100644 --- a/mobile-courier-app/Presentation/Profile/ProfileView.swift +++ b/mobile-courier-app/Presentation/Profile/ProfileView.swift @@ -24,8 +24,8 @@ struct ProfileView: View { } Section { - ShipmentRowView(shipment: addressEntity.enviosAereos, title: "Air shipments") - ShipmentRowView(shipment: addressEntity.viaMaritima, title: "Maritime Route") + ShipmentRowView(shipment: addressEntity.airShipments, title: "Air Shipments") + ShipmentRowView(shipment: addressEntity.seaShipments, title: "Sea Shipments") } } } diff --git a/mobile-courier-app/Presentation/Profile/ShipmentRowView.swift b/mobile-courier-app/Presentation/Profile/ShipmentRowView.swift index cc14f86..b5a3eb6 100644 --- a/mobile-courier-app/Presentation/Profile/ShipmentRowView.swift +++ b/mobile-courier-app/Presentation/Profile/ShipmentRowView.swift @@ -8,7 +8,7 @@ import SwiftUI struct ShipmentRowView: View { - var shipment: EnviosEntity + var shipment: ShipmentsEntity var title: String var body: some View { @@ -18,10 +18,10 @@ struct ShipmentRowView: View { .foregroundStyle(.accent) .padding(.bottom, 4) Group { - Text(shipment.direccion) - Text(shipment.ciudad) - Text(shipment.telefono) - Text(shipment.pais) + Text(shipment.address) + Text(shipment.city) + Text(shipment.phone) + Text(shipment.country) } .font(.caption) .frame(maxWidth: .infinity, alignment: .leading) @@ -39,11 +39,11 @@ struct ShipmentRowView: View { ShipmentRowView( shipment: .init( - ciudad: "Boston", - direccion: "164 NW STE 32", - empresa: "", - pais: "Argentina", - telefono: "(301) 123-1234" + city: "Boston", + address: "164 NW STE 32", + company: "", + country: "Argentina", + phone: "(301) 123-1234" ), title: "Envíos Marítimos" ) diff --git a/mobile-courier-app/Presentation/ShipmentDetail/ShipmentDetailView.swift b/mobile-courier-app/Presentation/ShipmentDetail/ShipmentDetailView.swift index 0b1f58f..6ee3420 100644 --- a/mobile-courier-app/Presentation/ShipmentDetail/ShipmentDetailView.swift +++ b/mobile-courier-app/Presentation/ShipmentDetail/ShipmentDetailView.swift @@ -57,22 +57,22 @@ struct ShipmentDetailView: View { @ViewBuilder private func getPackageList() -> some View { - List(groupedPackage.paquetes) { row in + List(groupedPackage.packages) { currentPackage in HStack { VStack(alignment: .leading) { - Text(row.paqueteDescripcion) + Text(currentPackage.packageDescription) .fontWeight(.bold) - Text(row.paqueteTracking) + Text(currentPackage.packageTrackingNumber) .font(.caption) } Spacer() VStack(alignment: .trailing) { - Text("Gs \(row.formattedCost)") + Text("Gs \(currentPackage.formattedCost)") .foregroundStyle(.accent) .fontWeight(.bold) - Text("\(row.paquetePeso) Kg") + Text("\(currentPackage.packageWeight) Kg") .font(.caption) } } diff --git a/mobile-courier-app/Presentation/WithdrawnPackages/GroupedPackageRowView.swift b/mobile-courier-app/Presentation/WithdrawnPackages/GroupedPackageRowView.swift index c160e18..8e1eab9 100644 --- a/mobile-courier-app/Presentation/WithdrawnPackages/GroupedPackageRowView.swift +++ b/mobile-courier-app/Presentation/WithdrawnPackages/GroupedPackageRowView.swift @@ -33,7 +33,7 @@ struct GroupedPackageRowView: View { Spacer() - Text("\(groupedPackage.paquetes.count) packages") + Text("\(groupedPackage.packages.count) packages") } } @@ -56,8 +56,8 @@ struct GroupedPackageRowView: View { #Preview { GroupedPackageRowView( groupedPackage: .init( - embarqueCodigo: 2000, - paquetes: [.mock] + shipmentCode: 2000, + packages: [.mock] ) ) } diff --git a/mobile-courier-app/Utilities/Localizable.xcstrings b/mobile-courier-app/Utilities/Localizable.xcstrings index 2351449..b439bd5 100644 --- a/mobile-courier-app/Utilities/Localizable.xcstrings +++ b/mobile-courier-app/Utilities/Localizable.xcstrings @@ -3,9 +3,6 @@ "strings" : { "" : { - }, - "%lld" : { - }, "%lld packages" : { "localizations" : { @@ -187,9 +184,6 @@ } } } - }, - "Please select a year" : { - }, "Processing" : { "localizations" : { @@ -237,9 +231,6 @@ } } } - }, - "Select Year" : { - }, "Settings" : { "localizations" : { From 4ef86be4c834f5addb947b3b7d20a2028dc03022 Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Tue, 25 Jun 2024 00:37:47 -0400 Subject: [PATCH 4/7] removed duplicated code --- mobile-courier-app.xcodeproj/project.pbxproj | 43 +++++- .../Entities/GroupedPackageEntity.swift | 68 +++++++++ .../Domain/Entities/PackageEntity.swift | 136 +----------------- .../Domain/Entities/ShipmentStatus.swift | 36 +++++ .../Domain/Extensions/Date+Domain.swift | 16 +++ .../Extensions/NSDecimalNumber+Domain.swift | 38 +++++ .../Domain/Extensions/String+Domain.swift | 30 ++++ .../Domain/Helpers/DateFormatType.swift | 13 ++ 8 files changed, 249 insertions(+), 131 deletions(-) create mode 100644 mobile-courier-app/Domain/Entities/GroupedPackageEntity.swift create mode 100644 mobile-courier-app/Domain/Entities/ShipmentStatus.swift create mode 100644 mobile-courier-app/Domain/Extensions/Date+Domain.swift create mode 100644 mobile-courier-app/Domain/Extensions/NSDecimalNumber+Domain.swift create mode 100644 mobile-courier-app/Domain/Extensions/String+Domain.swift create mode 100644 mobile-courier-app/Domain/Helpers/DateFormatType.swift diff --git a/mobile-courier-app.xcodeproj/project.pbxproj b/mobile-courier-app.xcodeproj/project.pbxproj index 12f2c8b..d1affe5 100644 --- a/mobile-courier-app.xcodeproj/project.pbxproj +++ b/mobile-courier-app.xcodeproj/project.pbxproj @@ -79,6 +79,12 @@ 1BE63F712BE980D60016A26E /* Storage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BE63F702BE980D60016A26E /* Storage.swift */; }; 1BEE841F2C17D6FF00B8A367 /* RowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BEE841E2C17D6FF00B8A367 /* RowView.swift */; }; 1BFD1EAF2C2A688B002E4232 /* SettingsViewModelMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EAE2C2A688B002E4232 /* SettingsViewModelMock.swift */; }; + 1BFD1EB12C2A7907002E4232 /* GroupedPackageEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EB02C2A7907002E4232 /* GroupedPackageEntity.swift */; }; + 1BFD1EB32C2A7927002E4232 /* ShipmentStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EB22C2A7927002E4232 /* ShipmentStatus.swift */; }; + 1BFD1EB62C2A79E4002E4232 /* NSDecimalNumber+Domain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EB52C2A79E4002E4232 /* NSDecimalNumber+Domain.swift */; }; + 1BFD1EB82C2A7D14002E4232 /* String+Domain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EB72C2A7D14002E4232 /* String+Domain.swift */; }; + 1BFD1EBA2C2A7E8E002E4232 /* Date+Domain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EB92C2A7E8E002E4232 /* Date+Domain.swift */; }; + 1BFD1EBD2C2A7EC7002E4232 /* DateFormatType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EBC2C2A7EC7002E4232 /* DateFormatType.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -176,6 +182,12 @@ 1BE63F722BE98ADD0016A26E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; 1BEE841E2C17D6FF00B8A367 /* RowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RowView.swift; sourceTree = ""; }; 1BFD1EAE2C2A688B002E4232 /* SettingsViewModelMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewModelMock.swift; sourceTree = ""; }; + 1BFD1EB02C2A7907002E4232 /* GroupedPackageEntity.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GroupedPackageEntity.swift; sourceTree = ""; }; + 1BFD1EB22C2A7927002E4232 /* ShipmentStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShipmentStatus.swift; sourceTree = ""; }; + 1BFD1EB52C2A79E4002E4232 /* NSDecimalNumber+Domain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSDecimalNumber+Domain.swift"; sourceTree = ""; }; + 1BFD1EB72C2A7D14002E4232 /* String+Domain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Domain.swift"; sourceTree = ""; }; + 1BFD1EB92C2A7E8E002E4232 /* Date+Domain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Domain.swift"; sourceTree = ""; }; + 1BFD1EBC2C2A7EC7002E4232 /* DateFormatType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateFormatType.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -409,6 +421,8 @@ 1B85E8E32BFC4DF9003040CC /* Domain */ = { isa = PBXGroup; children = ( + 1BFD1EBB2C2A7EBA002E4232 /* Helpers */, + 1BFD1EB42C2A79CB002E4232 /* Extensions */, 1B85E8E52BFC4E12003040CC /* Entities */, 1B85E8DF2BFC4D0B003040CC /* Repositories */, ); @@ -431,6 +445,8 @@ 1B85E8E62BFC4E24003040CC /* LoginEntity.swift */, 1B9274D32C115EA4008F4FA3 /* AddressesEntity.swift */, 1B2DDEF92C1E951A003EC97C /* PackageEntity.swift */, + 1BFD1EB02C2A7907002E4232 /* GroupedPackageEntity.swift */, + 1BFD1EB22C2A7927002E4232 /* ShipmentStatus.swift */, ); path = Entities; sourceTree = ""; @@ -534,6 +550,24 @@ path = Home; sourceTree = ""; }; + 1BFD1EB42C2A79CB002E4232 /* Extensions */ = { + isa = PBXGroup; + children = ( + 1BFD1EB52C2A79E4002E4232 /* NSDecimalNumber+Domain.swift */, + 1BFD1EB72C2A7D14002E4232 /* String+Domain.swift */, + 1BFD1EB92C2A7E8E002E4232 /* Date+Domain.swift */, + ); + path = Extensions; + sourceTree = ""; + }; + 1BFD1EBB2C2A7EBA002E4232 /* Helpers */ = { + isa = PBXGroup; + children = ( + 1BFD1EBC2C2A7EC7002E4232 /* DateFormatType.swift */, + ); + path = Helpers; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -695,6 +729,7 @@ buildActionMask = 2147483647; files = ( 1B99600F2C12992F00976BBC /* AddressRespository.swift in Sources */, + 1BFD1EBD2C2A7EC7002E4232 /* DateFormatType.swift in Sources */, 1B4047242C27DF9600101DF4 /* SettingsView.swift in Sources */, 1B58EFB92BE729D20066F447 /* Endpoint.swift in Sources */, 1B2DDEF42C1E7DD4003EC97C /* PackagePlaceholderView.swift in Sources */, @@ -703,11 +738,13 @@ 1B9274D02C115AF1008F4FA3 /* AddressesModel.swift in Sources */, 1BE58CA82C0572B400C7DF63 /* StorageMock.swift in Sources */, 1BFD1EAF2C2A688B002E4232 /* SettingsViewModelMock.swift in Sources */, + 1BFD1EBA2C2A7E8E002E4232 /* Date+Domain.swift in Sources */, 1B8B0A442C1BDDE600D1A7AC /* HeaderView.swift in Sources */, 1B85E8E22BFC4DAE003040CC /* LoginModel.swift in Sources */, 1B6590E02C22853400D46A27 /* PackagesForWithdrawalView.swift in Sources */, 1B9274CB2C1156C6008F4FA3 /* AppData.swift in Sources */, 1BE58CAA2C05731B00C7DF63 /* LoginViewModelMock.swift in Sources */, + 1BFD1EB62C2A79E4002E4232 /* NSDecimalNumber+Domain.swift in Sources */, 1B40471D2C27C3CB00101DF4 /* GroupedPackageStyleModifier.swift in Sources */, 1BE63F712BE980D60016A26E /* Storage.swift in Sources */, 1B2DDEFC2C1E956C003EC97C /* PackagesRepositoryProtocol.swift in Sources */, @@ -738,6 +775,7 @@ 1BC0717C2C140CA9006EC08E /* AddressesRepositoryMock.swift in Sources */, 1B821F192C1AA50600ED1795 /* CustomSessionDelegate.swift in Sources */, 1B9274D42C115EA4008F4FA3 /* AddressesEntity.swift in Sources */, + 1BFD1EB32C2A7927002E4232 /* ShipmentStatus.swift in Sources */, 1B40471B2C27854200101DF4 /* AddressEntityMock.swift in Sources */, 1B8500152C100DF1006E96A0 /* ProfileView.swift in Sources */, 1B6D751C2C23DF910067BB56 /* ShipmentDetailView.swift in Sources */, @@ -746,6 +784,7 @@ 1B5E849F2C267F9600EDFDE2 /* DIContainerProtocol.swift in Sources */, 1BA99DD32C2A6712003D38F8 /* SettingsViewModel.swift in Sources */, 1B85E8E72BFC4E24003040CC /* LoginEntity.swift in Sources */, + 1BFD1EB12C2A7907002E4232 /* GroupedPackageEntity.swift in Sources */, 1B58EF772BE6BBE90066F447 /* MobileCourierApp.swift in Sources */, 1B2DDF022C1E9AC8003EC97C /* WithdrawnPackagesViewModelMock.swift in Sources */, 1B40472A2C27E99D00101DF4 /* AppDataMock.swift in Sources */, @@ -756,6 +795,7 @@ 1BE58CA62C05727500C7DF63 /* AuthRepositoryMock.swift in Sources */, 1BE58CB32C0585C400C7DF63 /* HomeView.swift in Sources */, 1B2DDF062C1E9F85003EC97C /* GroupedPackageRowView.swift in Sources */, + 1BFD1EB82C2A7D14002E4232 /* String+Domain.swift in Sources */, 1BD17E632C0EB438009B6C67 /* Coordinator.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -915,11 +955,11 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "mobile-courier-app/mobile_courier_app.entitlements"; + CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Manual; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"mobile-courier-app/Preview Content\""; DEVELOPMENT_TEAM = ""; - "DEVELOPMENT_TEAM[sdk=iphoneos*]" = LXE5SAW38H; ENABLE_PREVIEWS = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; @@ -943,7 +983,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.just.another.mobile-courier-app"; PRODUCT_NAME = JustACourierApp; PROVISIONING_PROFILE_SPECIFIER = ""; - "PROVISIONING_PROFILE_SPECIFIER[sdk=iphoneos*]" = JustCourierAppAdHoc; SDKROOT = auto; SUPPORTED_PLATFORMS = "iphoneos iphonesimulator"; SUPPORTS_MACCATALYST = NO; diff --git a/mobile-courier-app/Domain/Entities/GroupedPackageEntity.swift b/mobile-courier-app/Domain/Entities/GroupedPackageEntity.swift new file mode 100644 index 0000000..44e1e60 --- /dev/null +++ b/mobile-courier-app/Domain/Entities/GroupedPackageEntity.swift @@ -0,0 +1,68 @@ +// +// GroupedPackageEntity.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-25. +// + +import Foundation + +struct GroupedPackageEntity: Identifiable { + var id: Int { shipmentCode } + + var shipmentCode: Int + var packages: [PackageEntity] + + var totalCost: Decimal { + let thousand: Decimal = 1000 + let cost = packages.reduce(.zero) { + $0 + $1.packageCostInGuaranies + } + + let divided = cost / thousand + let rounded = NSDecimalNumber(decimal: divided).rounding(accordingToBehavior: nil) + return rounded.multiplying(by: thousand as NSDecimalNumber) as Decimal + } + + var totalWeight: Decimal { + packages.reduce(.zero) { + $0 + $1.packageWeight + } + } + + var formattedTotalCost: String { + NSDecimalNumber(decimal: totalCost).applyFormatForAmountInGuaranies() + } + + var formattedDate: String { + packages.first?.formattedDate ?? "" + } + + var formattedId: String { + NSDecimalNumber(value: shipmentCode).applyFormatForIdentifier() + } + + var packageCurrentStatus: ShipmentStatus { + guard let shippingStatus = packages.first?.shipmentStatus, + let status = packages.first?.status else { + return .unknown + } + if shippingStatus.caseInsensitiveCompare("ORIGEN") == .orderedSame { + return .inLocker + } else if shippingStatus.caseInsensitiveCompare("TRANSITO") == .orderedSame { + return .onTheWay + } else if shippingStatus.caseInsensitiveCompare("UBICANDO") == .orderedSame && status.caseInsensitiveCompare("A") == .orderedSame { + return .processing + } else if (shippingStatus.caseInsensitiveCompare("UBICANDO") == .orderedSame || shippingStatus.caseInsensitiveCompare("ASUNCION") == .orderedSame) && status.caseInsensitiveCompare("B") == .orderedSame { + return .readyForPickup + } + + return status.caseInsensitiveCompare("C") == .orderedSame ? .inconsistent : .unknown + } +} + +extension Array where Element == GroupedPackageEntity { + func filterGroupedPackages(by shipmentStatus: ShipmentStatus) -> [Element] { + filter { $0.packageCurrentStatus == shipmentStatus } + } +} diff --git a/mobile-courier-app/Domain/Entities/PackageEntity.swift b/mobile-courier-app/Domain/Entities/PackageEntity.swift index c6a07e8..0b9bc99 100644 --- a/mobile-courier-app/Domain/Entities/PackageEntity.swift +++ b/mobile-courier-app/Domain/Entities/PackageEntity.swift @@ -7,122 +7,6 @@ import Foundation -enum ShipmentStatus: String, CaseIterable, Identifiable { - case readyForPickup = "Ready for Pickup" - case processing = "Processing" - case onTheWay = "On the Way" - case inLocker = "In Locker" - case inconsistent = "Inconsistent" - case unknown = "Unknown Status" - - var id: String { self.rawValue } - - var localized: String { - switch self { - case .readyForPickup: - return NSLocalizedString("Ready for Pickup", comment: "") - case .processing: - return NSLocalizedString("Processing", comment: "") - case .onTheWay: - return NSLocalizedString("On the Way", comment: "") - case .inLocker: - return NSLocalizedString("In Locker", comment: "") - case .inconsistent: - return NSLocalizedString("Inconsistent", comment: "") - case .unknown: - return NSLocalizedString("Unknown Status", comment: "") - } - } -} - -struct GroupedPackageEntity: Identifiable { - var id: Int { shipmentCode } - - var shipmentCode: Int - var packages: [PackageEntity] - - var totalCost: Decimal { - let thousand: Decimal = 1000 - let cost = packages.reduce(.zero) { - $0 + $1.guaraniesCost - } - - let divided = cost / thousand - let rounded = NSDecimalNumber(decimal: divided).rounding(accordingToBehavior: nil) - return rounded.multiplying(by: thousand as NSDecimalNumber) as Decimal - } - - var totalWeight: Decimal { - packages.reduce(.zero) { - $0 + $1.packageWeight - } - } - - var formattedTotalCost: String { - let formattedValue = NSDecimalNumber(decimal: totalCost) - return numberFormatter.string(from: formattedValue) ?? "0" - } - - var formattedDate: String { - let inputDateFormatter = DateFormatter() - inputDateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" - - guard let firstDate = packages.first?.shipmentDate, - let date = inputDateFormatter.date(from: firstDate) else { return "" } - - let outputDateFormatter = DateFormatter() - outputDateFormatter.dateFormat = "MMMM d, yyyy" - - let formattedDateString = outputDateFormatter.string(from: date) - - return formattedDateString - } - - var formattedId: String { - let formatter = NumberFormatter() - formatter.numberStyle = .decimal - formatter.minimumFractionDigits = .zero - formatter.allowsFloats = false - formatter.groupingSeparator = "" - - let formattedValue = NSDecimalNumber(value: shipmentCode) - return formatter.string(from: formattedValue) ?? "0" - } - - var packageCurrentStatus: ShipmentStatus { - guard let shippingStatus = packages.first?.shipmentStatus, - let status = packages.first?.status else { - return .unknown - } - if shippingStatus.caseInsensitiveCompare("ORIGEN") == .orderedSame { - return .inLocker - } else if shippingStatus.caseInsensitiveCompare("TRANSITO") == .orderedSame { - return .onTheWay - } else if shippingStatus.caseInsensitiveCompare("UBICANDO") == .orderedSame && status.caseInsensitiveCompare("A") == .orderedSame { - return .processing - } else if (shippingStatus.caseInsensitiveCompare("UBICANDO") == .orderedSame || shippingStatus.caseInsensitiveCompare("ASUNCION") == .orderedSame) && status.caseInsensitiveCompare("B") == .orderedSame { - return .readyForPickup - } - - return status.caseInsensitiveCompare("C") == .orderedSame ? .inconsistent : .unknown - } - - private var numberFormatter: NumberFormatter { - let formatter = NumberFormatter() - formatter.numberStyle = .decimal - formatter.minimumFractionDigits = .zero - formatter.allowsFloats = false - formatter.groupingSeparator = "." - return formatter - } -} - -extension Array where Element == GroupedPackageEntity { - func filterGroupedPackages(by shipmentStatus: ShipmentStatus) -> [Element] { - filter { $0.packageCurrentStatus == shipmentStatus } - } -} - struct PackageEntity: Identifiable, Hashable { let status: String let shipmentStatus: String @@ -140,25 +24,19 @@ struct PackageEntity: Identifiable, Hashable { } extension PackageEntity { - var guaraniesCost: Decimal { + var packageCostInGuaranies: Decimal { clientPriceRate * quotation * packageWeight } + var formattedDate: String? { + shipmentDate.formatDate() + } + var formattedCost: String { let thousand: Decimal = 1000 - let divided = guaraniesCost / thousand + let divided = packageCostInGuaranies / thousand let rounded = NSDecimalNumber(decimal: divided).rounding(accordingToBehavior: nil) let multiplied = rounded.multiplying(by: thousand as NSDecimalNumber) as Decimal - let formattedValue = NSDecimalNumber(decimal: multiplied) - return numberFormatter.string(from: formattedValue) ?? "0" - } - - private var numberFormatter: NumberFormatter { - let formatter = NumberFormatter() - formatter.numberStyle = .decimal - formatter.minimumFractionDigits = .zero - formatter.allowsFloats = false - formatter.groupingSeparator = "." - return formatter + return NSDecimalNumber(decimal: multiplied).applyFormatForAmountInGuaranies() } } diff --git a/mobile-courier-app/Domain/Entities/ShipmentStatus.swift b/mobile-courier-app/Domain/Entities/ShipmentStatus.swift new file mode 100644 index 0000000..d87e0fe --- /dev/null +++ b/mobile-courier-app/Domain/Entities/ShipmentStatus.swift @@ -0,0 +1,36 @@ +// +// ShipmentStatus.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-25. +// + +import Foundation + +enum ShipmentStatus: String, CaseIterable, Identifiable { + case readyForPickup = "Ready for Pickup" + case processing = "Processing" + case onTheWay = "On the Way" + case inLocker = "In Locker" + case inconsistent = "Inconsistent" + case unknown = "Unknown Status" + + var id: String { self.rawValue } + + var localized: String { + switch self { + case .readyForPickup: + return NSLocalizedString("Ready for Pickup", comment: "") + case .processing: + return NSLocalizedString("Processing", comment: "") + case .onTheWay: + return NSLocalizedString("On the Way", comment: "") + case .inLocker: + return NSLocalizedString("In Locker", comment: "") + case .inconsistent: + return NSLocalizedString("Inconsistent", comment: "") + case .unknown: + return NSLocalizedString("Unknown Status", comment: "") + } + } +} diff --git a/mobile-courier-app/Domain/Extensions/Date+Domain.swift b/mobile-courier-app/Domain/Extensions/Date+Domain.swift new file mode 100644 index 0000000..859e9fb --- /dev/null +++ b/mobile-courier-app/Domain/Extensions/Date+Domain.swift @@ -0,0 +1,16 @@ +// +// Date+Domain.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-25. +// + +import Foundation + +extension Date { + func getStringFromDate(formatType: DateFormatType) -> String { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = formatType.rawValue + return dateFormatter.string(from: self) + } +} diff --git a/mobile-courier-app/Domain/Extensions/NSDecimalNumber+Domain.swift b/mobile-courier-app/Domain/Extensions/NSDecimalNumber+Domain.swift new file mode 100644 index 0000000..6f2d931 --- /dev/null +++ b/mobile-courier-app/Domain/Extensions/NSDecimalNumber+Domain.swift @@ -0,0 +1,38 @@ +// +// NSDecimalNumber+Domain.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-25. +// + +import Foundation + +private extension NSDecimalNumber { + var identifierFormatter: NumberFormatter { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = .zero + formatter.allowsFloats = false + formatter.groupingSeparator = "" + return formatter + } + + var guaraniesFormatter: NumberFormatter { + let formatter = NumberFormatter() + formatter.numberStyle = .decimal + formatter.minimumFractionDigits = .zero + formatter.allowsFloats = false + formatter.groupingSeparator = "." + return formatter + } +} + +extension NSDecimalNumber { + func applyFormatForIdentifier() -> String { + identifierFormatter.string(from: self) ?? "0" + } + + func applyFormatForAmountInGuaranies() -> String { + guaraniesFormatter.string(from: self) ?? "0" + } +} diff --git a/mobile-courier-app/Domain/Extensions/String+Domain.swift b/mobile-courier-app/Domain/Extensions/String+Domain.swift new file mode 100644 index 0000000..d29f10a --- /dev/null +++ b/mobile-courier-app/Domain/Extensions/String+Domain.swift @@ -0,0 +1,30 @@ +// +// String+Domain.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-25. +// + +import Foundation + +extension String { + func getDateFrom(formatType: DateFormatType) -> Date? { + let dateFormatter = DateFormatter() + dateFormatter.dateFormat = formatType.rawValue + return dateFormatter.date(from: self) + } + + func formatDate( + from originalFormat: DateFormatType = .server, + to newFormat: DateFormatType = .display + ) -> String? { + let originalFormatter = DateFormatter() + originalFormatter.dateFormat = originalFormat.rawValue + + guard let originalDate = originalFormatter.date(from: self) else { return nil } + + let newFormatter = DateFormatter() + newFormatter.dateFormat = newFormat.rawValue + return newFormatter.string(from: originalDate) + } +} diff --git a/mobile-courier-app/Domain/Helpers/DateFormatType.swift b/mobile-courier-app/Domain/Helpers/DateFormatType.swift new file mode 100644 index 0000000..b3414e0 --- /dev/null +++ b/mobile-courier-app/Domain/Helpers/DateFormatType.swift @@ -0,0 +1,13 @@ +// +// DateFormatType.swift +// mobile-courier-app +// +// Created by Vladimir Espinola on 2024-06-25. +// + +import Foundation + +enum DateFormatType: String { + case server = "yyyy-MM-dd'T'HH:mm:ssZ" + case display = "MMMM d, yyyy" +} From 6c0a2b039b2693918c9ddd933bbcf238ba357b6a Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Tue, 25 Jun 2024 00:43:41 -0400 Subject: [PATCH 5/7] fixed dark mode --- mobile-courier-app.xcodeproj/project.pbxproj | 4 ++-- mobile-courier-app/App/MobileCourierApp.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mobile-courier-app.xcodeproj/project.pbxproj b/mobile-courier-app.xcodeproj/project.pbxproj index d1affe5..fa0c4c7 100644 --- a/mobile-courier-app.xcodeproj/project.pbxproj +++ b/mobile-courier-app.xcodeproj/project.pbxproj @@ -956,10 +956,10 @@ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; CODE_SIGN_ENTITLEMENTS = "mobile-courier-app/mobile_courier_app.entitlements"; CODE_SIGN_IDENTITY = "Apple Development"; - CODE_SIGN_STYLE = Manual; + CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_ASSET_PATHS = "\"mobile-courier-app/Preview Content\""; - DEVELOPMENT_TEAM = ""; + DEVELOPMENT_TEAM = LXE5SAW38H; ENABLE_PREVIEWS = YES; ENABLE_USER_SCRIPT_SANDBOXING = NO; GENERATE_INFOPLIST_FILE = YES; diff --git a/mobile-courier-app/App/MobileCourierApp.swift b/mobile-courier-app/App/MobileCourierApp.swift index 590e035..ed19ce4 100644 --- a/mobile-courier-app/App/MobileCourierApp.swift +++ b/mobile-courier-app/App/MobileCourierApp.swift @@ -9,7 +9,7 @@ import SwiftUI @main struct MobileCourierApp: App { - @AppStorage("isDarkMode") var isDarkMode: Bool = true + @AppStorage("isDarkMode") var isDarkMode: Bool = false @StateObject var coordinator = Coordinator(diContainer: AppDIContainer()) @StateObject var appData = AppData.shared From 8f259c451de4996712102066fb422623d5469fcf Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Tue, 25 Jun 2024 01:15:23 -0400 Subject: [PATCH 6/7] added mock data --- mobile-courier-app.xcodeproj/project.pbxproj | 24 + .../Data/Networking/APIRequestClient.swift | 12 +- .../Endpoints/AddressEndpoints.swift | 2 +- .../Networking/Endpoints/AuthEndpoints.swift | 4 +- .../Data/Networking/Endpoints/Endpoint.swift | 2 - .../Endpoints/PackageEndpoints.swift | 7 +- .../Data/Networking/MockFiles/Address.json | 68 + .../Data/Networking/MockFiles/Login.json | 4 + .../MockFiles/PackagesForWithdrawl.json | 32 + .../MockFiles/WithdrawnPackages.json | 1624 +++++++++++++++++ 10 files changed, 1767 insertions(+), 12 deletions(-) create mode 100644 mobile-courier-app/Data/Networking/MockFiles/Address.json create mode 100644 mobile-courier-app/Data/Networking/MockFiles/Login.json create mode 100644 mobile-courier-app/Data/Networking/MockFiles/PackagesForWithdrawl.json create mode 100644 mobile-courier-app/Data/Networking/MockFiles/WithdrawnPackages.json diff --git a/mobile-courier-app.xcodeproj/project.pbxproj b/mobile-courier-app.xcodeproj/project.pbxproj index fa0c4c7..8c92afa 100644 --- a/mobile-courier-app.xcodeproj/project.pbxproj +++ b/mobile-courier-app.xcodeproj/project.pbxproj @@ -85,6 +85,10 @@ 1BFD1EB82C2A7D14002E4232 /* String+Domain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EB72C2A7D14002E4232 /* String+Domain.swift */; }; 1BFD1EBA2C2A7E8E002E4232 /* Date+Domain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EB92C2A7E8E002E4232 /* Date+Domain.swift */; }; 1BFD1EBD2C2A7EC7002E4232 /* DateFormatType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1BFD1EBC2C2A7EC7002E4232 /* DateFormatType.swift */; }; + 1BFD1EC02C2A838D002E4232 /* Login.json in Resources */ = {isa = PBXBuildFile; fileRef = 1BFD1EBF2C2A838D002E4232 /* Login.json */; }; + 1BFD1EC22C2A83D5002E4232 /* Address.json in Resources */ = {isa = PBXBuildFile; fileRef = 1BFD1EC12C2A83D5002E4232 /* Address.json */; }; + 1BFD1EC42C2A841C002E4232 /* PackagesForWithdrawl.json in Resources */ = {isa = PBXBuildFile; fileRef = 1BFD1EC32C2A841C002E4232 /* PackagesForWithdrawl.json */; }; + 1BFD1EC62C2A843A002E4232 /* WithdrawnPackages.json in Resources */ = {isa = PBXBuildFile; fileRef = 1BFD1EC52C2A843A002E4232 /* WithdrawnPackages.json */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -188,6 +192,10 @@ 1BFD1EB72C2A7D14002E4232 /* String+Domain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Domain.swift"; sourceTree = ""; }; 1BFD1EB92C2A7E8E002E4232 /* Date+Domain.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Date+Domain.swift"; sourceTree = ""; }; 1BFD1EBC2C2A7EC7002E4232 /* DateFormatType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateFormatType.swift; sourceTree = ""; }; + 1BFD1EBF2C2A838D002E4232 /* Login.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = Login.json; sourceTree = ""; }; + 1BFD1EC12C2A83D5002E4232 /* Address.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = Address.json; sourceTree = ""; }; + 1BFD1EC32C2A841C002E4232 /* PackagesForWithdrawl.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = PackagesForWithdrawl.json; sourceTree = ""; }; + 1BFD1EC52C2A843A002E4232 /* WithdrawnPackages.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = WithdrawnPackages.json; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -351,6 +359,7 @@ 1B58EFAF2BE6E9D00066F447 /* Networking */ = { isa = PBXGroup; children = ( + 1BFD1EBE2C2A836F002E4232 /* MockFiles */, 1B9274CE2C1158E6008F4FA3 /* Endpoints */, 1B85E8E02BFC4D9F003040CC /* Models */, 1BE63F6C2BE9193E0016A26E /* APIRequestClient.swift */, @@ -568,6 +577,17 @@ path = Helpers; sourceTree = ""; }; + 1BFD1EBE2C2A836F002E4232 /* MockFiles */ = { + isa = PBXGroup; + children = ( + 1BFD1EBF2C2A838D002E4232 /* Login.json */, + 1BFD1EC12C2A83D5002E4232 /* Address.json */, + 1BFD1EC32C2A841C002E4232 /* PackagesForWithdrawl.json */, + 1BFD1EC52C2A843A002E4232 /* WithdrawnPackages.json */, + ); + path = MockFiles; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -680,8 +700,12 @@ files = ( 1B58EFAB2BE6C1F30066F447 /* LaunchScreen.storyboard in Resources */, 1BAB0EE62BFEE2D9004DF155 /* Localizable.xcstrings in Resources */, + 1BFD1EC22C2A83D5002E4232 /* Address.json in Resources */, + 1BFD1EC02C2A838D002E4232 /* Login.json in Resources */, 1B58EF7F2BE6BBEA0066F447 /* Preview Assets.xcassets in Resources */, + 1BFD1EC62C2A843A002E4232 /* WithdrawnPackages.json in Resources */, 1B58EF7B2BE6BBEA0066F447 /* Assets.xcassets in Resources */, + 1BFD1EC42C2A841C002E4232 /* PackagesForWithdrawl.json in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/mobile-courier-app/Data/Networking/APIRequestClient.swift b/mobile-courier-app/Data/Networking/APIRequestClient.swift index 248efc0..c9aa29d 100644 --- a/mobile-courier-app/Data/Networking/APIRequestClient.swift +++ b/mobile-courier-app/Data/Networking/APIRequestClient.swift @@ -26,16 +26,18 @@ final class APIRequestClient: NSObject, APIRequestClientProtocol { private lazy var delegate: URLSessionDelegate? = CustomSessionDelegate() func performRequest(endpoint: Endpoint, decoder: JSONDecoder = JSONDecoder()) async throws -> T { + if let mockfile = endpoint.mockFile, let fileUrl = Bundle.main.url(forResource: mockfile, withExtension: "json") { + decoder.keyDecodingStrategy = .convertFromSnakeCase + let decodedData = try decoder.decode(T.self, from: Data(contentsOf: fileUrl)) + try? await Task.sleep(nanoseconds: 2 * 1_000_000_000) + return decodedData + } + guard let urlRequest = try? endpoint.asRequest() else { throw APIErrorMessage.invalidRequest } do { -// -// #if DEBUG -// endpoint.mockFile = -// #endif - let configuration = URLSessionConfiguration.default configuration.timeoutIntervalForRequest = 10 configuration.timeoutIntervalForResource = 10 diff --git a/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift b/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift index e9824af..a643363 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift @@ -13,7 +13,7 @@ enum AddressEndpoints { extension AddressEndpoints: Endpoint { var mockFile: String? { - "" + "Address" } var requestType: RequestType { diff --git a/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift b/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift index 4cdf58e..530dd7e 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift @@ -14,11 +14,9 @@ enum AuthEndpoints { extension AuthEndpoints: Endpoint { - #if DEBUG var mockFile: String? { - "login-response" + "Login" } - #endif var requestType: RequestType { switch self { diff --git a/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift b/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift index bee453b..45e60c4 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift @@ -23,9 +23,7 @@ protocol Endpoint { var authToken: String? { get } var port: Int { get } - #if DEBUG var mockFile: String? { get } - #endif } extension Endpoint { diff --git a/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift b/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift index 3ebf968..dc17d50 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift @@ -14,7 +14,12 @@ enum PackageEndpoints { extension PackageEndpoints: Endpoint { var mockFile: String? { - "" + switch self { + case .withdrawn: + "WithdrawnPackages" + case .forWithdrawl: + "PackagesForWithdrawl" + } } var requestType: RequestType { diff --git a/mobile-courier-app/Data/Networking/MockFiles/Address.json b/mobile-courier-app/Data/Networking/MockFiles/Address.json new file mode 100644 index 0000000..7232a78 --- /dev/null +++ b/mobile-courier-app/Data/Networking/MockFiles/Address.json @@ -0,0 +1,68 @@ +{ + "enviosAereos": { + "ciudad": "New York, NY 10001", + "cliente": { + "class": "com.example.Clientes", + "id": 12345, + "apellidoautorizado": "SMITH", + "autorizaemail": 1, + "ciautorizado": "1234567", + "ciudad": 1, + "clienteapellido": "DOE", + "clientecelular": "1234567890", + "clienteci": "12345678", + "clientedireccion": "123 Main St", + "clientenombre": "JOHN", + "clienteobservacion": "", + "clientetelefono": "0987654321", + "dianac": 1, + "estado": 1, + "estante": "A1", + "mesnac": 1, + "nombreautorizado": "JANE", + "pagoAnualidad": null, + "password": "passwordhash", + "ruc": "9876543", + "tarifa": 25.0, + "username": "john.doe@example.com" + }, + "direccion": "789 Broadway", + "empresa": "EXAMPLE USA", + "pais": "United States", + "telefono": "(555) 123-4567", + "viaMaritima": false + }, + "viaMaritima": { + "ciudad": "Los Angeles, CA 90001", + "cliente": { + "class": "com.example.Clientes", + "id": 12345, + "apellidoautorizado": "SMITH", + "autorizaemail": 1, + "ciautorizado": "1234567", + "ciudad": 1, + "clienteapellido": "DOE", + "clientecelular": "1234567890", + "clienteci": "12345678", + "clientedireccion": "123 Main St", + "clientenombre": "JOHN", + "clienteobservacion": "", + "clientetelefono": "0987654321", + "dianac": 1, + "estado": 1, + "estante": "A1", + "mesnac": 1, + "nombreautorizado": "JANE", + "pagoAnualidad": null, + "password": "passwordhash", + "ruc": "9876543", + "tarifa": 25.0, + "username": "john.doe@example.com" + }, + "direccion": "123 Ocean Blvd", + "empresa": "EXAMPLE USA", + "pais": "United States", + "telefono": "(555) 987-6543", + "viaMaritima": true + } +} diff --git a/mobile-courier-app/Data/Networking/MockFiles/Login.json b/mobile-courier-app/Data/Networking/MockFiles/Login.json new file mode 100644 index 0000000..7f261b7 --- /dev/null +++ b/mobile-courier-app/Data/Networking/MockFiles/Login.json @@ -0,0 +1,4 @@ +{ + "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJwcmluY2lwYWwiOiJINHNJQUFBQUFBQUFBSlZTejJzVFFSUitpU2tWaXRnV0ZFUXFIdXBOTmpZaE5DR1gybEtsc0NSaXpLV0NaYkw3c2s0N083UE96S2FiaThTTFBYZ1ExSUxneFlNbjZYXC9peVQ5QUVPODk5K3FidE0ybVhvckx3aTV2dnYxK3ZUMDZoaG1qb1JwcHhvWHhFcEZHWEhvbTBWeEdCb05VY3p2MFVvTTZSRHRHUEI0RHV6U0IwNnRRaElJUFJSNWFXUFIzMllDVkJaTlJ1ZDNieGNBMk13MFZwYU16eHI1bU1lNHJ2ZWROdUFPbDhZSkFUbDFZSzhMc05peXdJRkNwdEMwbE43T0Vhd3kzWVQ2ZitTclljNk1iQVoyZ3RKd0pNdzJkUmAsNkFrTWY1bGhxWHlwUzVXZ3NYRDgxbTFvdXloMjBUUit1SnN3WWN2ZFBrbzUxMXQyNXN5a3B3U3Q0RGFVc0tkQkYzZDF6VU1cL3hlQnRLQ0VyTmxUVExYUm1ya1BlNUV5ZiswZEtIbisrXC9qTHBGQU9ya1wvdVhmNVBOYjZ6RDY4ZUxrenJqb1FtRGg1cFQxSE5iTUVuS3prRE1cLzAraVVmMzErOHZIdytPRDVGVkoyaUVmXC92NFwvbGgyZk5EVGRVbkRETnJKcmFFZEh1bDl3N2thOWZUbjYraGFIWDRYRWlrUDRvYVRHY1NPVEVGTGVrbFRqdjI4SzFwMjFcL2M2ZlYzbkhQVG1iaGJyOGZybFRweGxWV2J6UjZyRjZyWTZOU3FmYnJxMkd0aGc4czNCNElGdktZYXc5TndxVVNiQzJLS1JtWmlTZDl1VVY3VzJRalFyMzQ1K3Uza3pjSGRkTGZncGtCRXluU3h1WnpYQ3VOZTZqZkhoMHV6WDM2XC9XNmNIOERcL1wvaGNLbEMyeFN3TUFBQT09Iiwic3ViIjoidmxhZGltaXIuZXNwaW5vbGFAZ21haWwuY29tIiwiZXhwIjoxNzI1MzM4ODE5LCJpYXQiOjE3MTkyOTA4MTksInJvbGVzIjpbIlJPTEVfTk9fUk9MRVMiXX0.Us_2_7asxxzrPv6D6LqKwVctdgD397XpyB4rfHC0pEK", + "username": "john.doe@gmail.com" +} diff --git a/mobile-courier-app/Data/Networking/MockFiles/PackagesForWithdrawl.json b/mobile-courier-app/Data/Networking/MockFiles/PackagesForWithdrawl.json new file mode 100644 index 0000000..ab0b79b --- /dev/null +++ b/mobile-courier-app/Data/Networking/MockFiles/PackagesForWithdrawl.json @@ -0,0 +1,32 @@ +{ + "paquetes": [ + { + "paquetedescripcion": "TOY", + "paquetetracking": "CNUSUP00000773583", + "estado": "B", + "cotizacion": 7585.0, + "embarqueestado": "ASUNCION", + "embarquefecha": "2024-06-11T04:00:00Z", + "paquetepeso": 0.2, + "embarquemedio": "Aereo", + "embarquecodigo": 2179, + "id": 1606577, + "tarifapreciocli": 22.5, + "paqueteprecio": 22.5 + }, + { + "paquetedescripcion": "ACC", + "paquetetracking": "420331869361289677032421065418", + "estado": "A", + "cotizacion": 7585.0, + "embarqueestado": "TRANSITO", + "embarquefecha": "2024-06-18T04:00:00Z", + "paquetepeso": 0.12, + "embarquemedio": "Aereo", + "embarquecodigo": 2182, + "id": 1610658, + "tarifapreciocli": 22.5, + "paqueteprecio": 22.5 + } + ] +} diff --git a/mobile-courier-app/Data/Networking/MockFiles/WithdrawnPackages.json b/mobile-courier-app/Data/Networking/MockFiles/WithdrawnPackages.json new file mode 100644 index 0000000..e5a8742 --- /dev/null +++ b/mobile-courier-app/Data/Networking/MockFiles/WithdrawnPackages.json @@ -0,0 +1,1624 @@ +{ + "paquetes": [ + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2024-05-17T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "UBC HUB", + "paquetetracking": "754258-USPS", + "cotizacion": 7520.0, + "embarquefecha": "2024-05-10T04:00:00Z", + "paquetepeso": 0.26, + "embarquecodigo": 2165, + "id": 1589435, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2024-04-01T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "TBA312182035683", + "cotizacion": 7300.0, + "embarquefecha": "2024-03-18T03:00:00Z", + "paquetepeso": 0.56, + "embarquecodigo": 2135, + "id": 1561248, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2024-02-14T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ACC", + "paquetetracking": "420331869374869903508665268491", + "cotizacion": 7330.0, + "embarquefecha": "2024-02-01T03:00:00Z", + "paquetepeso": 0.3, + "embarquecodigo": 2110, + "id": 1535193, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2024-02-14T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ACC", + "paquetetracking": "LD048958895HK", + "cotizacion": 7380.0, + "embarquefecha": "2024-01-23T03:00:00Z", + "paquetepeso": 0.18, + "embarquecodigo": 2105, + "id": 1530242, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-12-29T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "TBA311964", + "cotizacion": 7420.0, + "embarquefecha": "2023-12-22T03:00:00Z", + "paquetepeso": 1.06, + "embarquecodigo": 2089, + "id": 1514270, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-12-29T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ACC", + "paquetetracking": "TBA758192", + "cotizacion": 7410.0, + "embarquefecha": "2023-12-19T03:00:00Z", + "paquetepeso": 0.1, + "embarquecodigo": 2086, + "id": 1511892, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-10-21T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ROPA,TOY", + "paquetetracking": "420331869361289677024480412937", + "cotizacion": 7460.0, + "embarquefecha": "2023-10-18T03:00:00Z", + "paquetepeso": 0.78, + "embarquecodigo": 2049, + "id": 1474694, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-10-04T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "SNACK SPREAD", + "paquetetracking": "420331869361289677023895657971", + "cotizacion": 7330.0, + "embarquefecha": "2023-09-27T04:00:00Z", + "paquetepeso": 1.17, + "embarquecodigo": 2035, + "id": 1463620, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-10-04T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TRIMMER", + "paquetetracking": "4203318692748927005455000421442657", + "cotizacion": 7310.0, + "embarquefecha": "2023-09-22T04:00:00Z", + "paquetepeso": 0.24, + "embarquecodigo": 2032, + "id": 1461648, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-07-20T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "MAC MINI", + "paquetetracking": "1027586661520003318600780920090170", + "cotizacion": 7340.0, + "embarquefecha": "2023-07-14T04:00:00Z", + "paquetepeso": 1.79, + "embarquecodigo": 1980, + "id": 1423084, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-07-13T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "LED WATCH REPAIR", + "paquetetracking": "4203318692748903338851000006836818", + "cotizacion": 7360.0, + "embarquefecha": "2023-06-30T04:00:00Z", + "paquetepeso": 0.18, + "embarquecodigo": 1970, + "id": 1416559, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-06-10T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "BATTERY", + "paquetetracking": "420331869400136102262794512035", + "cotizacion": 7310.0, + "embarquefecha": "2023-06-06T04:00:00Z", + "paquetepeso": 0.07, + "embarquecodigo": 1950, + "id": 1405095, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-06-10T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "TBA306986766604", + "cotizacion": 7330.0, + "embarquefecha": "2023-06-04T04:00:00Z", + "paquetepeso": 0.08, + "embarquecodigo": 1948, + "id": 1403099, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-06-01T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "TBA306811545296", + "cotizacion": 7300.0, + "embarquefecha": "2023-05-23T04:00:00Z", + "paquetepeso": 0.2, + "embarquecodigo": 1940, + "id": 1397901, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-05-22T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "SOLAR CHARGER", + "paquetetracking": "4203318692748903338851000002519081", + "cotizacion": 7230.0, + "embarquefecha": "2023-05-05T04:00:00Z", + "paquetepeso": 0.32, + "embarquecodigo": 1926, + "id": 1389577, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-03-16T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "WIPE WARMER", + "paquetetracking": "420331869361289677018594873319", + "cotizacion": 7260.0, + "embarquefecha": "2023-03-01T03:00:00Z", + "paquetepeso": 2.0, + "embarquecodigo": 1877, + "id": 1358470, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-03-06T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ROPA", + "paquetetracking": "420331869361289677018583051421", + "cotizacion": 7300.0, + "embarquefecha": "2023-02-28T03:00:00Z", + "paquetepeso": 0.89, + "embarquecodigo": 1876, + "id": 1357735, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-01-11T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "BOOK", + "paquetetracking": "NT230104150513738 AMAZON", + "cotizacion": 7330.0, + "embarquefecha": "2023-01-03T03:00:00Z", + "paquetepeso": 0.46, + "embarquecodigo": 1827, + "id": 1331276, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2023-01-11T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "BOOK", + "paquetetracking": "TBA304552798819", + "cotizacion": 7330.0, + "embarquefecha": "2022-12-27T03:00:00Z", + "paquetepeso": 0.97, + "embarquecodigo": 1822, + "id": 1328381, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-12-23T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "LAPT", + "paquetetracking": "1Z87F7430392688857 UPS", + "cotizacion": 7230.0, + "embarquefecha": "2022-12-20T03:00:00Z", + "paquetepeso": 2.88, + "embarquecodigo": 1816, + "id": 1324274, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-11-28T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "1222282463290003318600390871428266", + "cotizacion": 7250.0, + "embarquefecha": "2022-11-21T03:00:00Z", + "paquetepeso": 1.16, + "embarquecodigo": 1793, + "id": 1308655, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-11-28T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "MEMORY", + "paquetetracking": "420331869374889677015860709781", + "cotizacion": 7200.0, + "embarquefecha": "2022-11-15T03:00:00Z", + "paquetepeso": 0.02, + "embarquecodigo": 1787, + "id": 1304420, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-10-17T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "CARGADOR", + "paquetetracking": "1Z2451R80304749475", + "cotizacion": 7125.0, + "embarquefecha": "2022-10-12T03:00:00Z", + "paquetepeso": 0.92, + "embarquecodigo": 1762, + "id": 1287554, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-10-10T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "CD GAME", + "paquetetracking": "TBA303021803148", + "cotizacion": 7010.0, + "embarquefecha": "2022-09-20T04:00:00Z", + "paquetepeso": 0.07, + "embarquecodigo": 1750, + "id": 1277437, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-09-19T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ROPA", + "paquetetracking": "TBA051238730704", + "cotizacion": 6990.0, + "embarquefecha": "2022-09-15T04:00:00Z", + "paquetepeso": 0.82, + "embarquecodigo": 1746, + "id": 1274278, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-09-16T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "PART", + "paquetetracking": "420331869248790281670600085413", + "cotizacion": 6960.0, + "embarquefecha": "2022-09-08T04:00:00Z", + "paquetepeso": 0.55, + "embarquecodigo": 1742, + "id": 1271730, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-30T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ELECTRONIC", + "paquetetracking": "420331869361210912400710389844", + "cotizacion": 6930.0, + "embarquefecha": "2022-08-26T04:00:00Z", + "paquetepeso": 0.76, + "embarquecodigo": 1735, + "id": 1266377, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-30T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "TBA026798044904", + "cotizacion": 6930.0, + "embarquefecha": "2022-08-26T04:00:00Z", + "paquetepeso": 0.82, + "embarquecodigo": 1735, + "id": 1266169, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-20T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ACC", + "paquetetracking": "LB306327154SG", + "cotizacion": 6930.0, + "embarquefecha": "2022-08-17T04:00:00Z", + "paquetepeso": 0.16, + "embarquecodigo": 1729, + "id": 1261656, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-20T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "BATERIA", + "paquetetracking": "420331869274890198179014443343", + "cotizacion": 6930.0, + "embarquefecha": "2022-08-17T04:00:00Z", + "paquetepeso": 0.35, + "embarquecodigo": 1729, + "id": 1261123, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-20T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "1Z5W0W960315275653", + "cotizacion": 6950.0, + "embarquefecha": "2022-08-16T04:00:00Z", + "paquetepeso": 1.0, + "embarquecodigo": 1728, + "id": 1260122, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-20T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ACC", + "paquetetracking": "LW245538308CN", + "cotizacion": 6950.0, + "embarquefecha": "2022-08-01T04:00:00Z", + "paquetepeso": 0.22, + "embarquecodigo": 1720, + "id": 1253591, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-02T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "SMART CEILING", + "paquetetracking": "TBA174720882104", + "cotizacion": 6920.0, + "embarquefecha": "2022-07-20T04:00:00Z", + "paquetepeso": 0.21, + "embarquecodigo": 1711, + "id": 1247610, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-08-02T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "GEL PACK COLD", + "paquetetracking": "1Z82V5421319996651", + "cotizacion": 6920.0, + "embarquefecha": "2022-07-13T04:00:00Z", + "paquetepeso": 0.75, + "embarquecodigo": 1705, + "id": 1243115, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-07-16T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "TOY", + "paquetetracking": "TBA159887002504", + "cotizacion": 6900.0, + "embarquefecha": "2022-07-07T04:00:00Z", + "paquetepeso": 0.24, + "embarquecodigo": 1702, + "id": 1241767, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-06-08T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "HEADPHONE", + "paquetetracking": "420331869274890278833966853050", + "cotizacion": 6930.0, + "embarquefecha": "2022-06-03T04:00:00Z", + "paquetepeso": 0.07, + "embarquecodigo": 1679, + "id": 1226272, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-05-28T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ACC", + "paquetetracking": "9274890233787680412857", + "cotizacion": 6900.0, + "embarquefecha": "2022-05-03T04:00:00Z", + "paquetepeso": 0.02, + "embarquecodigo": 1658, + "id": 1212231, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-05-28T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "CC", + "paquetetracking": "TBA180174872301", + "cotizacion": 6900.0, + "embarquefecha": "2022-04-30T04:00:00Z", + "paquetepeso": 0.36, + "embarquecodigo": 1657, + "id": 1211428, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-04-04T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "PARTS", + "paquetetracking": "420331869274890233787689337748", + "cotizacion": 7000.0, + "embarquefecha": "2022-03-26T03:00:00Z", + "paquetepeso": 0.06, + "embarquecodigo": 1640, + "id": 1196644, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-04-04T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "CASE", + "paquetetracking": "NT220322165305635", + "cotizacion": 7000.0, + "embarquefecha": "2022-03-22T03:00:00Z", + "paquetepeso": 0.08, + "embarquecodigo": 1637, + "id": 1194409, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-03-11T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "4HEAD", + "paquetetracking": "TBA176221847701", + "cotizacion": 7000.0, + "embarquefecha": "2022-03-04T03:00:00Z", + "paquetepeso": 0.03, + "embarquecodigo": 1626, + "id": 1186430, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-03-11T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 22.5, + "paquetedescripcion": "ROPA", + "paquetetracking": "TBA176229110301", + "cotizacion": 7000.0, + "embarquefecha": "2022-03-04T03:00:00Z", + "paquetepeso": 0.98, + "embarquecodigo": 1626, + "id": 1186182, + "paqueteprecio": 22.5 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2022-01-10T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "CASE", + "paquetetracking": "9274890240790104616922", + "cotizacion": 6900.0, + "embarquefecha": "2021-11-02T03:00:00Z", + "paquetepeso": 0.02, + "embarquecodigo": 1562, + "id": 1132475, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-09-29T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "PURSE", + "paquetetracking": "TBA166001500901", + "cotizacion": 6900.0, + "embarquefecha": "2021-09-25T04:00:00Z", + "paquetepeso": 0.61, + "embarquecodigo": 1528, + "id": 1114319, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-09-29T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "BOOK", + "paquetetracking": "9241990988197226564902", + "cotizacion": 6930.0, + "embarquefecha": "2021-08-26T04:00:00Z", + "paquetepeso": 1.5, + "embarquecodigo": 1510, + "id": 1103918, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-08-16T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "TRIMMER", + "paquetetracking": "1001905171370003318600282367826738", + "cotizacion": 6910.0, + "embarquefecha": "2021-08-11T04:00:00Z", + "paquetepeso": 0.91, + "embarquecodigo": 1501, + "id": 1096915, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-07-20T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "BATERIA", + "paquetetracking": "420331869400111899560674640899", + "cotizacion": 6830.0, + "embarquefecha": "2021-07-16T04:00:00Z", + "paquetepeso": 0.33, + "embarquecodigo": 1485, + "id": 1085670, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-07-20T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ADAPTER", + "paquetetracking": "NT210713165531517", + "cotizacion": 6800.0, + "embarquefecha": "2021-07-15T04:00:00Z", + "paquetepeso": 0.02, + "embarquecodigo": 1484, + "id": 1084425, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-07-13T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACC", + "paquetetracking": "9200190228643962255267", + "cotizacion": 6780.0, + "embarquefecha": "2021-07-09T04:00:00Z", + "paquetepeso": 0.07, + "embarquecodigo": 1481, + "id": 1082315, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-07-08T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "LAPT", + "paquetetracking": "1ZE4W1684297848405", + "cotizacion": 6780.0, + "embarquefecha": "2021-07-02T04:00:00Z", + "paquetepeso": 5.0, + "embarquecodigo": 1478, + "id": 1080080, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-05-03T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "MOUSEPAFD,HEADPHONE", + "paquetetracking": "TBA158492649401", + "cotizacion": 6530.0, + "embarquefecha": "2021-04-27T04:00:00Z", + "paquetepeso": 1.5, + "embarquecodigo": 1436, + "id": 1049362, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-04-07T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACC/ELECTRONIC", + "paquetetracking": "1001905234370003318600785271964686", + "cotizacion": 6430.0, + "embarquefecha": "2021-04-01T04:00:00Z", + "paquetepeso": 0.32, + "embarquecodigo": 1417, + "id": 1037313, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-03-09T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "TOY", + "paquetetracking": "9405511899560538670164", + "cotizacion": 6710.0, + "embarquefecha": "2021-03-06T03:00:00Z", + "paquetepeso": 1.16, + "embarquecodigo": 1396, + "id": 1023918, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-01-23T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "LAPTOP ACER", + "paquetetracking": "420331869410803699300131620001", + "cotizacion": 6940.0, + "embarquefecha": "2021-01-20T03:00:00Z", + "paquetepeso": 3.5, + "embarquecodigo": 1359, + "id": 1002381, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-01-23T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "CLIPPER", + "paquetetracking": "TBA153720441801", + "cotizacion": 6920.0, + "embarquefecha": "2021-01-19T03:00:00Z", + "paquetepeso": 0.79, + "embarquecodigo": 1358, + "id": 1002084, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2021-01-23T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACCESSORY ELECTRONIC", + "paquetetracking": "9405536895232481575281", + "cotizacion": 7020.0, + "embarquefecha": "2021-01-04T03:00:00Z", + "paquetepeso": 0.0, + "embarquecodigo": 1346, + "id": 994397, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-12-30T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "HOME MINI", + "paquetetracking": "9400108205496946287479", + "cotizacion": 6990.0, + "embarquefecha": "2020-12-23T03:00:00Z", + "paquetepeso": 0.37, + "embarquecodigo": 1340, + "id": 990480, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-12-09T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACC", + "paquetetracking": "9400108205497592605747", + "cotizacion": 7055.0, + "embarquefecha": "2020-12-02T03:00:00Z", + "paquetepeso": 0.15, + "embarquecodigo": 1326, + "id": 975737, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-11-05T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACC ELECTRONIC", + "paquetetracking": "4203318692612902410401000105392717", + "cotizacion": 7020.0, + "embarquefecha": "2020-10-30T03:00:00Z", + "paquetepeso": 0.81, + "embarquecodigo": 1312, + "id": 963772, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-10-17T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "HEADPHONE", + "paquetetracking": "TBAMIA517764514", + "cotizacion": 6960.0, + "embarquefecha": "2020-10-15T03:00:00Z", + "paquetepeso": 0.32, + "embarquecodigo": 1306, + "id": 956131, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-10-17T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "GAME, BEAUTY, ACC", + "paquetetracking": "1Z3Y12980394073541", + "cotizacion": 6960.0, + "embarquefecha": "2020-10-09T03:00:00Z", + "paquetepeso": 0.56, + "embarquecodigo": 1304, + "id": 954038, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-09-05T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "TOY", + "paquetetracking": "TBAMIA517341108", + "cotizacion": 6950.0, + "embarquefecha": "2020-09-01T04:00:00Z", + "paquetepeso": 1.0, + "embarquecodigo": 1288, + "id": 934876, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-09-05T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "AFTERSALE SERVICE CARD", + "paquetetracking": "TBA127347863201", + "cotizacion": 6980.0, + "embarquefecha": "2020-08-29T04:00:00Z", + "paquetepeso": 0.22, + "embarquecodigo": 1287, + "id": 933068, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-09-05T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "PRO GAMING HEAD SET", + "paquetetracking": "TBAMIA517132373", + "cotizacion": 6880.0, + "embarquefecha": "2020-08-12T04:00:00Z", + "paquetepeso": 0.63, + "embarquecodigo": 1278, + "id": 924029, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-06-08T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "LAMP,CASE", + "paquetetracking": "1Z065R0Y0308069733", + "cotizacion": 6550.0, + "embarquefecha": "2020-05-29T04:00:00Z", + "paquetepeso": 0.29, + "embarquecodigo": 1237, + "id": 886230, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-06-08T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "TECLADO", + "paquetetracking": "TBAMIA516222302", + "cotizacion": 6550.0, + "embarquefecha": "2020-05-29T04:00:00Z", + "paquetepeso": 1.53, + "embarquecodigo": 1237, + "id": 885495, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-03-11T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACCESSORY FOR PHONE", + "paquetetracking": "TBAMIA515530224", + "cotizacion": 6380.0, + "embarquefecha": "2020-03-06T03:00:00Z", + "paquetepeso": 0.2, + "embarquecodigo": 1188, + "id": 857737, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-03-11T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "CABLE", + "paquetetracking": "TBAMIA515530043", + "cotizacion": 6370.0, + "embarquefecha": "2020-03-02T03:00:00Z", + "paquetepeso": 0.13, + "embarquecodigo": 1184, + "id": 856543, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-02-17T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "REPLACEMENT JOYSTICK", + "paquetetracking": "TBAMIA515296390", + "cotizacion": 6390.0, + "embarquefecha": "2020-02-07T03:00:00Z", + "paquetepeso": 0.17, + "embarquecodigo": 1162, + "id": 847398, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-02-17T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "TOOL", + "paquetetracking": "TBAMIA515278300", + "cotizacion": 6390.0, + "embarquefecha": "2020-02-07T03:00:00Z", + "paquetepeso": 0.27, + "embarquecodigo": 1162, + "id": 847149, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-01-09T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "MOTHERBOARD,CORSAIR 2X 8GB/16,RYZER", + "paquetetracking": "TBAMIA514873604", + "cotizacion": 6380.0, + "embarquefecha": "2019-12-28T03:00:00Z", + "paquetepeso": 2.0, + "embarquecodigo": 1140, + "id": 830532, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2020-01-09T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "HARD DISK DRIVE", + "paquetetracking": "TBAMIA514830590", + "cotizacion": 6340.0, + "embarquefecha": "2019-12-20T03:00:00Z", + "paquetepeso": 0.13, + "embarquecodigo": 1137, + "id": 827974, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-12-24T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACC CARRO", + "paquetetracking": "TBAMIA514811488", + "cotizacion": 6340.0, + "embarquefecha": "2019-12-19T03:00:00Z", + "paquetepeso": 0.09, + "embarquecodigo": 1136, + "id": 827326, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-12-24T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "CASE", + "paquetetracking": "TBAMIA514747551", + "cotizacion": 6300.0, + "embarquefecha": "2019-12-18T03:00:00Z", + "paquetepeso": 0.08, + "embarquecodigo": 1135, + "id": 825416, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-12-19T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACCESORIOS TELEFONICOS", + "paquetetracking": "tbamia514667315", + "cotizacion": 6300.0, + "embarquefecha": "2019-12-13T03:00:00Z", + "paquetepeso": 0.64, + "embarquecodigo": 1133, + "id": 819827, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-12-07T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "KINDLE", + "paquetetracking": "1Z2Y842V0310077308", + "cotizacion": 6300.0, + "embarquefecha": "2019-12-04T03:00:00Z", + "paquetepeso": 0.35, + "embarquecodigo": 1126, + "id": 817478, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-12-07T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "STICKER", + "paquetetracking": "TBAMIA514356592", + "cotizacion": 6340.0, + "embarquefecha": "2019-11-22T03:00:00Z", + "paquetepeso": 0.22, + "embarquecodigo": 1122, + "id": 813184, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-11-12T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ACC", + "paquetetracking": "TBAMIA514168338", + "cotizacion": 6380.0, + "embarquefecha": "2019-11-06T03:00:00Z", + "paquetepeso": 0.35, + "embarquecodigo": 1111, + "id": 807691, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-10-28T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "INTEL I5 PROCESSOR", + "paquetetracking": "420331869300120111403953047526", + "cotizacion": 6430.0, + "embarquefecha": "2019-10-22T03:00:00Z", + "paquetepeso": 0.06, + "embarquecodigo": 1100, + "id": 799384, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-10-12T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "MEMORIA", + "paquetetracking": "TBAMIA513787618", + "cotizacion": 6250.0, + "embarquefecha": "2019-10-01T04:00:00Z", + "paquetepeso": 0.08, + "embarquecodigo": 1084, + "id": 790341, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-10-05T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "REPUESTO", + "paquetetracking": "TBAMIA513786051", + "cotizacion": 6250.0, + "embarquefecha": "2019-10-02T04:00:00Z", + "paquetepeso": 0.02, + "embarquecodigo": 1085, + "id": 790257, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-10-05T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "BATERIA", + "paquetetracking": "TBAMIA513789690", + "cotizacion": 6280.0, + "embarquefecha": "2019-10-03T04:00:00Z", + "paquetepeso": 0.09, + "embarquecodigo": 1086, + "id": 790256, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-09-19T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "TABLET", + "paquetetracking": "TBAMIA513625177", + "cotizacion": 6220.0, + "embarquefecha": "2019-09-13T04:00:00Z", + "paquetepeso": 1.12, + "embarquecodigo": 1072, + "id": 783508, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-06-29T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "AURICULAR DEPORTIVO", + "paquetetracking": "TBA339987827000", + "cotizacion": 6190.0, + "embarquefecha": "2019-06-19T04:00:00Z", + "paquetepeso": 0.1, + "embarquecodigo": 1009, + "id": 746900, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-05-25T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "PLUG TO 3 SMM", + "paquetetracking": "TBAMIA512484367", + "cotizacion": 6300.0, + "embarquefecha": "2019-05-06T04:00:00Z", + "paquetepeso": 0.02, + "embarquecodigo": 975, + "id": 730712, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-04-27T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "DISIPADOR", + "paquetetracking": "tba029705722000", + "cotizacion": 6200.0, + "embarquefecha": "2019-04-11T04:00:00Z", + "paquetepeso": 0.61, + "embarquecodigo": 957, + "id": 720959, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-04-16T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "CABLE Y FLAUTA", + "paquetetracking": "TBAMIA512202954", + "cotizacion": 6190.0, + "embarquefecha": "2019-04-10T04:00:00Z", + "paquetepeso": 0.62, + "embarquecodigo": 956, + "id": 719726, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-04-11T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "PASTA TERMICA", + "paquetetracking": "TBAMIA512136102", + "cotizacion": 6160.0, + "embarquefecha": "2019-04-05T04:00:00Z", + "paquetepeso": 0.03, + "embarquecodigo": 953, + "id": 717669, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-04-05T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "TARJETA GRAFICA", + "paquetetracking": "tba975016822000", + "cotizacion": 6160.0, + "embarquefecha": "2019-03-29T04:00:00Z", + "paquetepeso": 1.76, + "embarquecodigo": 948, + "id": 716846, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-04-05T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "ADAPTADOR", + "paquetetracking": "TBA972343384000", + "cotizacion": 6160.0, + "embarquefecha": "2019-03-29T04:00:00Z", + "paquetepeso": 0.06, + "embarquecodigo": 948, + "id": 716253, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-04-11T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "PROCESADOR", + "paquetetracking": "9305520111403464999157", + "cotizacion": 6160.0, + "embarquefecha": "2019-04-05T04:00:00Z", + "paquetepeso": 0.08, + "embarquecodigo": 953, + "id": 716144, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-03-16T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "MOVIE", + "paquetetracking": "TBAMIA511800535", + "cotizacion": 6100.0, + "embarquefecha": "2019-03-07T03:00:00Z", + "paquetepeso": 0.17, + "embarquecodigo": 933, + "id": 707665, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-02-23T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "DISCO SSD", + "paquetetracking": "TBAMIA511591449", + "cotizacion": 6060.0, + "embarquefecha": "2019-02-19T03:00:00Z", + "paquetepeso": 0.09, + "embarquecodigo": 921, + "id": 701777, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-02-16T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "PELUCHE", + "paquetetracking": "TBAMIA511395953", + "cotizacion": 6150.0, + "embarquefecha": "2019-02-04T03:00:00Z", + "paquetepeso": 0.44, + "embarquecodigo": 911, + "id": 696541, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2019-01-07T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "SSD", + "paquetetracking": "1ZWX93600358185579", + "cotizacion": 5990.0, + "embarquefecha": "2018-12-28T03:00:00Z", + "paquetepeso": 0.06, + "embarquecodigo": 885, + "id": 683162, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-12-13T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "GLOVE", + "paquetetracking": "TBAMIA510396770", + "cotizacion": 5990.0, + "embarquefecha": "2018-12-03T03:00:00Z", + "paquetepeso": 1.22, + "embarquecodigo": 863, + "id": 673365, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-12-13T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "HEADPHONE", + "paquetetracking": "TBAMIA510354006", + "cotizacion": 5950.0, + "embarquefecha": "2018-11-30T03:00:00Z", + "paquetepeso": 0.44, + "embarquecodigo": 860, + "id": 672211, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-11-17T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 20.9, + "paquetedescripcion": "BOOK", + "paquetetracking": "1ZWX93600355372345", + "cotizacion": 6020.0, + "embarquefecha": "2018-11-09T03:00:00Z", + "paquetepeso": 0.33, + "embarquecodigo": 845, + "id": 665437, + "paqueteprecio": 20.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-10-27T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 18.9, + "paquetedescripcion": "TOY", + "paquetetracking": "1Z6X7R290300220187", + "cotizacion": 5910.0, + "embarquefecha": "2018-10-06T04:00:00Z", + "paquetepeso": 0.67, + "embarquecodigo": 818, + "id": 654361, + "paqueteprecio": 18.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-07-18T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 18.9, + "paquetedescripcion": "CLIPPER", + "paquetetracking": "1ZWX93600348793387", + "cotizacion": 5750.0, + "embarquefecha": "2018-07-06T04:00:00Z", + "paquetepeso": 0.62, + "embarquecodigo": 759, + "id": 616267, + "paqueteprecio": 18.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-05-26T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 18.9, + "paquetedescripcion": "TOY", + "paquetetracking": "420331869405515901715640489827", + "cotizacion": 5610.0, + "embarquefecha": "2018-05-14T04:00:00Z", + "paquetepeso": 0.55, + "embarquecodigo": 726, + "id": 593696, + "paqueteprecio": 18.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-05-09T04:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 18.9, + "paquetedescripcion": "PHONE, ACC", + "paquetetracking": "420331869374889677090205517696", + "cotizacion": 5540.0, + "embarquefecha": "2018-04-20T04:00:00Z", + "paquetepeso": 0.33, + "embarquecodigo": 715, + "id": 584028, + "paqueteprecio": 18.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-02-17T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 18.9, + "paquetedescripcion": "ACC", + "paquetetracking": "420331869200192148980219812545", + "cotizacion": 5610.0, + "embarquefecha": "2018-02-07T03:00:00Z", + "paquetepeso": 0.04, + "embarquecodigo": 676, + "id": 553285, + "paqueteprecio": 18.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-02-10T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 17.9, + "paquetedescripcion": "CARDS", + "paquetetracking": "420331869374889677090178841910", + "cotizacion": 5599.0, + "embarquefecha": "2018-02-02T03:00:00Z", + "paquetepeso": 0.12, + "embarquecodigo": 674, + "id": 552046, + "paqueteprecio": 17.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-02-10T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 17.9, + "paquetedescripcion": "ACC", + "paquetetracking": "NT180127172024528", + "cotizacion": 5680.0, + "embarquefecha": "2018-01-29T03:00:00Z", + "paquetepeso": 0.01, + "embarquecodigo": 672, + "id": 548151, + "paqueteprecio": 17.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-01-27T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 17.9, + "paquetedescripcion": "CARTAS", + "paquetetracking": "0173557748", + "cotizacion": 5680.0, + "embarquefecha": "2018-01-22T03:00:00Z", + "paquetepeso": 0.09, + "embarquecodigo": 668, + "id": 545168, + "paqueteprecio": 17.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-01-10T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 17.9, + "paquetedescripcion": "ACC", + "paquetetracking": "9920582556", + "cotizacion": 5680.0, + "embarquefecha": "2018-01-05T03:00:00Z", + "paquetepeso": 0.19, + "embarquecodigo": 660, + "id": 539115, + "paqueteprecio": 17.9 + }, + { + "estado": "C", + "embarqueestado": "ASUNCION", + "paquetefecharetiro": "2018-01-10T03:00:00Z", + "embarquemedio": "Aereo", + "tarifapreciocli": 17.9, + "paquetedescripcion": "CARDBOARD", + "paquetetracking": "1ZWX93600341081579", + "cotizacion": 5680.0, + "embarquefecha": "2018-01-02T03:00:00Z", + "paquetepeso": 0.19, + "embarquecodigo": 658, + "id": 537640, + "paqueteprecio": 17.9 + } + ] +} From d325fb882b931ffbd2cff12df69834f7719a04cb Mon Sep 17 00:00:00 2001 From: Vladimir Espinola Date: Tue, 25 Jun 2024 01:25:48 -0400 Subject: [PATCH 7/7] clean up --- .../Data/Networking/APIRequestClient.swift | 2 ++ .../Networking/CustomSessionDelegate.swift | 24 ------------------- .../Endpoints/AddressEndpoints.swift | 2 +- .../Networking/Endpoints/AuthEndpoints.swift | 6 ++--- .../Data/Networking/Endpoints/Endpoint.swift | 2 +- .../Endpoints/PackageEndpoints.swift | 12 +++++----- 6 files changed, 13 insertions(+), 35 deletions(-) diff --git a/mobile-courier-app/Data/Networking/APIRequestClient.swift b/mobile-courier-app/Data/Networking/APIRequestClient.swift index c9aa29d..35076dd 100644 --- a/mobile-courier-app/Data/Networking/APIRequestClient.swift +++ b/mobile-courier-app/Data/Networking/APIRequestClient.swift @@ -26,12 +26,14 @@ final class APIRequestClient: NSObject, APIRequestClientProtocol { private lazy var delegate: URLSessionDelegate? = CustomSessionDelegate() func performRequest(endpoint: Endpoint, decoder: JSONDecoder = JSONDecoder()) async throws -> T { + #if DEBUG if let mockfile = endpoint.mockFile, let fileUrl = Bundle.main.url(forResource: mockfile, withExtension: "json") { decoder.keyDecodingStrategy = .convertFromSnakeCase let decodedData = try decoder.decode(T.self, from: Data(contentsOf: fileUrl)) try? await Task.sleep(nanoseconds: 2 * 1_000_000_000) return decodedData } + #endif guard let urlRequest = try? endpoint.asRequest() else { throw APIErrorMessage.invalidRequest diff --git a/mobile-courier-app/Data/Networking/CustomSessionDelegate.swift b/mobile-courier-app/Data/Networking/CustomSessionDelegate.swift index f957ca4..4b8ea18 100644 --- a/mobile-courier-app/Data/Networking/CustomSessionDelegate.swift +++ b/mobile-courier-app/Data/Networking/CustomSessionDelegate.swift @@ -8,30 +8,6 @@ import Foundation final class CustomSessionDelegate: NSObject, URLSessionDataDelegate { - func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive data: Data) { - do { - let jsonObject = try JSONSerialization.jsonObject(with: data, options: []) - let jsonData = try JSONSerialization.data(withJSONObject: jsonObject, options: [.prettyPrinted]) - - if let jsonString = String(data: jsonData, encoding: .utf8) { - let urlString = dataTask.currentRequest?.url?.absoluteString ?? "Unknown URL" - print("Data received from '\(urlString)' ➡️ \n\(jsonString)") - } - } catch { - print("Failed to parse JSON: \(error.localizedDescription)") - } - } - - func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) { - if let error = error { - print("Error: \(error.localizedDescription)") - } else { - print("Request completed successfully.") - } - } -} - -extension CustomSessionDelegate { func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust, let serverTrust = challenge.protectionSpace.serverTrust else { diff --git a/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift b/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift index a643363..b9f25e4 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/AddressEndpoints.swift @@ -21,7 +21,7 @@ extension AddressEndpoints: Endpoint { } var path: String { - "/frontliner-middleware/api/direccion" + "/direccion" } var body: [AnyHashable: Any]? { diff --git a/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift b/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift index 530dd7e..e4161ad 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/AuthEndpoints.swift @@ -20,7 +20,7 @@ extension AuthEndpoints: Endpoint { var requestType: RequestType { switch self { - case .login(email: _, password: _): + case .login: return .post default: return .get @@ -29,8 +29,8 @@ extension AuthEndpoints: Endpoint { var path: String { switch self { - case .login(email: _, password: _): - return "/frontliner-middleware/api/ingresar" + case .login: + return "/ingresar" default: return "" } diff --git a/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift b/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift index 45e60c4..4139f95 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/Endpoint.swift @@ -28,7 +28,7 @@ protocol Endpoint { extension Endpoint { var scheme: String { "https" } - var host: String { "frontliner.com.py" } + var host: String { "justacourier.com.py" } var port: Int { 8449 } var headers: [String: String] { var internalHeaders = [ diff --git a/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift b/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift index dc17d50..0cf91e3 100644 --- a/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift +++ b/mobile-courier-app/Data/Networking/Endpoints/PackageEndpoints.swift @@ -15,10 +15,10 @@ enum PackageEndpoints { extension PackageEndpoints: Endpoint { var mockFile: String? { switch self { - case .withdrawn: - "WithdrawnPackages" - case .forWithdrawl: - "PackagesForWithdrawl" + case .withdrawn: + "WithdrawnPackages" + case .forWithdrawl: + "PackagesForWithdrawl" } } @@ -29,9 +29,9 @@ extension PackageEndpoints: Endpoint { var path: String { switch self { case .withdrawn: - "/frontliner-middleware/api/paquetesRetirados" + "/paquetesRetirados" case .forWithdrawl: - "/frontliner-middleware/api/paquetesPendientes" + "/paquetesPendientes" } }