diff --git a/AutoCat.xcodeproj/project.pbxproj b/AutoCat.xcodeproj/project.pbxproj index d79be82..210c6ad 100644 --- a/AutoCat.xcodeproj/project.pbxproj +++ b/AutoCat.xcodeproj/project.pbxproj @@ -1693,7 +1693,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 143; + CURRENT_PROJECT_VERSION = 144; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoCat; @@ -1720,7 +1720,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_ENTITLEMENTS = AutoCat/AutoCat.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 143; + CURRENT_PROJECT_VERSION = 144; DEVELOPMENT_TEAM = 46DTTB8X4S; INFOPLIST_FILE = AutoCat/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = AutoCat; diff --git a/AutoCat/AppDelegate.swift b/AutoCat/AppDelegate.swift index 08812f0..9c2ed47 100644 --- a/AutoCat/AppDelegate.swift +++ b/AutoCat/AppDelegate.swift @@ -73,12 +73,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate { HUD.allowsInteraction = false registerServices() + setupAppearance() //Logging.URLRequests = { _ in false }; return true } + func setupAppearance() { + + let tabBarAppearance = UITabBarAppearance() + tabBarAppearance.configureWithDefaultBackground() + UITabBar.appearance().standardAppearance = tabBarAppearance + UITabBar.appearance().scrollEdgeAppearance = tabBarAppearance + + let navigationBarAppearance = UINavigationBarAppearance() + navigationBarAppearance.configureWithDefaultBackground() + UINavigationBar.appearance().standardAppearance = navigationBarAppearance + UINavigationBar.appearance().scrollEdgeAppearance = navigationBarAppearance + } + func registerServices() { let container = ServiceContainer.shared diff --git a/AutoCat/Screens/EventsScreen/EventsScreen.swift b/AutoCat/Screens/EventsScreen/EventsScreen.swift index d40d888..6b23bd4 100644 --- a/AutoCat/Screens/EventsScreen/EventsScreen.swift +++ b/AutoCat/Screens/EventsScreen/EventsScreen.swift @@ -105,11 +105,6 @@ struct EventsScreen: View { @ViewBuilder func makeActions(for event: EventModel, useLabels: Bool = false) -> some View { - Button(role: .destructive) { - Task { await viewModel.deleteEvent(event) } - } label: { - Label(useLabels ? "Delete" : "", systemImage: "trash") - } Button() { Task { await viewModel.editEvent(event) } @@ -134,6 +129,12 @@ struct EventsScreen: View { ShareLink(item: link) } } + + Button(role: .destructive) { + Task { await viewModel.deleteEvent(event) } + } label: { + Label(useLabels ? "Delete" : "", systemImage: "trash") + } } } diff --git a/AutoCat/Screens/NotesScreen/NotesScreen.swift b/AutoCat/Screens/NotesScreen/NotesScreen.swift index a0118dc..05187fe 100644 --- a/AutoCat/Screens/NotesScreen/NotesScreen.swift +++ b/AutoCat/Screens/NotesScreen/NotesScreen.swift @@ -63,11 +63,6 @@ struct NotesScreen: View { @ViewBuilder func makeActions(for note: VehicleNoteDto, useLabels: Bool = false) -> some View { - Button(role: .destructive) { - Task { await viewModel.deleteNote(id: note.id) } - } label: { - Label(useLabels ? "Delete" : "", systemImage: "trash") - } Button() { selectedNoteId = note.id @@ -82,6 +77,12 @@ struct NotesScreen: View { } label: { Label(useLabels ? "Copy" : "", systemImage: "doc.on.doc") } + + Button(role: .destructive) { + Task { await viewModel.deleteNote(id: note.id) } + } label: { + Label(useLabels ? "Delete" : "", systemImage: "trash") + } } } diff --git a/AutoCatTests/EventsTests.swift b/AutoCatTests/EventsTests.swift index ee60c27..14acbaa 100644 --- a/AutoCatTests/EventsTests.swift +++ b/AutoCatTests/EventsTests.swift @@ -37,6 +37,14 @@ struct EventsTests { given(settingsServiceMock) .user.willReturn(User()) } + + func makeViewModel(vehicle: VehicleDto) -> EventsViewModel { + + EventsViewModel(apiService: apiServiceMock, + storageService: storageServiceMock, + settingsService: settingsServiceMock, + vehicle: vehicle) + } @Test("Add event", arguments: [true, false]) mutating func addEvent(isUnrecognized: Bool) async throws { @@ -55,7 +63,7 @@ struct EventsTests { .add(event: .value(.valid), to: .value(VehicleDto.validNumber)) .willReturn(unrecognizedVehicleWithEvent) - viewModel.vehicle = isUnrecognized ? .unrecognized : .normal + viewModel = makeViewModel(vehicle: isUnrecognized ? .unrecognized : .normal) await viewModel.addEvent(.valid) verify(apiServiceMock) @@ -95,7 +103,7 @@ struct EventsTests { .remove(event: .value(VehicleEventDto.validId), from: .value(VehicleDto.validNumber)) .willReturn(.unrecognized) - viewModel.vehicle = vehicleWithEvent + viewModel = makeViewModel(vehicle: vehicleWithEvent) await viewModel.deleteEvent(VehicleEventDto.valid.viewModel) verify(apiServiceMock) diff --git a/AutoCatTests/Extensions/VehicleEventDto+Presets.swift b/AutoCatTests/Extensions/VehicleEventDto+Presets.swift index 3b124d4..b7803c3 100644 --- a/AutoCatTests/Extensions/VehicleEventDto+Presets.swift +++ b/AutoCatTests/Extensions/VehicleEventDto+Presets.swift @@ -18,6 +18,9 @@ extension VehicleEventDto { static let validLatitude: Double = 42 static let validLongitude: Double = 24 + static let testAddress = "testAddress" + static let testAddressModified = "testAddressModified" + static var valid: VehicleEventDto { var event = VehicleEventDto( @@ -28,6 +31,7 @@ extension VehicleEventDto { event.id = validId event.date = 0 + event.address = testAddress return event } @@ -37,7 +41,7 @@ extension VehicleEventDto { id: id, date: "", coordinate: CLLocationCoordinate2DMake(latitude, longitude), - address: "", + address: address ?? "", isMe: true ) }