diff --git a/TMT/TMT.xcodeproj/project.pbxproj b/TMT/TMT.xcodeproj/project.pbxproj index d53fe5c..c9ab101 100644 --- a/TMT/TMT.xcodeproj/project.pbxproj +++ b/TMT/TMT.xcodeproj/project.pbxproj @@ -66,6 +66,8 @@ D8A1C0972CFA1B5C007D9F3F /* CaptureDark.json in Resources */ = {isa = PBXBuildFile; fileRef = D8A1C0932CFA1B5C007D9F3F /* CaptureDark.json */; }; D8A1C0982CFA1B5C007D9F3F /* IntroFinishDark.json in Resources */ = {isa = PBXBuildFile; fileRef = D8A1C0952CFA1B5C007D9F3F /* IntroFinishDark.json */; }; D8A1C0992CFA1B5C007D9F3F /* BusDotIntroDark.json in Resources */ = {isa = PBXBuildFile; fileRef = D8A1C0922CFA1B5C007D9F3F /* BusDotIntroDark.json */; }; + D8C5E7322D006D31005FE865 /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8C5E7312D006D31005FE865 /* LoadingView.swift */; }; + D8C5E7362D006D53005FE865 /* LoadingCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8C5E7352D006D53005FE865 /* LoadingCase.swift */; }; D8D377E92CBE95C30043D103 /* BusSearchItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D377E82CBE95C30043D103 /* BusSearchItem.swift */; }; D8D377EB2CBE95CA0043D103 /* BusSearchModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D377EA2CBE95CA0043D103 /* BusSearchModel.swift */; }; D8E054DD2CF1AF89006B1879 /* View.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8E054DC2CF1AF89006B1879 /* View.swift */; }; @@ -167,6 +169,8 @@ D8A1C0932CFA1B5C007D9F3F /* CaptureDark.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = CaptureDark.json; sourceTree = ""; }; D8A1C0942CFA1B5C007D9F3F /* GoNaverMapDark.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = GoNaverMapDark.json; sourceTree = ""; }; D8A1C0952CFA1B5C007D9F3F /* IntroFinishDark.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = IntroFinishDark.json; sourceTree = ""; }; + D8C5E7312D006D31005FE865 /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = ""; }; + D8C5E7352D006D53005FE865 /* LoadingCase.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingCase.swift; sourceTree = ""; }; D8D377E82CBE95C30043D103 /* BusSearchItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BusSearchItem.swift; sourceTree = ""; }; D8D377EA2CBE95CA0043D103 /* BusSearchModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BusSearchModel.swift; sourceTree = ""; }; D8E054DC2CF1AF89006B1879 /* View.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = View.swift; sourceTree = ""; }; @@ -428,6 +432,7 @@ D8D377E72CBE95B80043D103 /* BusSearch */, 5B2D9A0E2CCA14FB001FF6CC /* BusJourneyScanned */, 5BCE456F2CC389FE00CF38CE /* Map */, + D8C5E7302D006D22005FE865 /* Loading */, D844BCD82CC1472E0059E31F /* Utils */, D826488D2CD3553B000A448D /* UIComponent */, D81D9E982CE47F02004F2024 /* Extension */, @@ -496,6 +501,31 @@ path = DarkMode; sourceTree = ""; }; + D8C5E7302D006D22005FE865 /* Loading */ = { + isa = PBXGroup; + children = ( + D8C5E7332D006D35005FE865 /* Models */, + D8C5E7342D006D3C005FE865 /* Views */, + ); + path = Loading; + sourceTree = ""; + }; + D8C5E7332D006D35005FE865 /* Models */ = { + isa = PBXGroup; + children = ( + D8C5E7352D006D53005FE865 /* LoadingCase.swift */, + ); + path = Models; + sourceTree = ""; + }; + D8C5E7342D006D3C005FE865 /* Views */ = { + isa = PBXGroup; + children = ( + D8C5E7312D006D31005FE865 /* LoadingView.swift */, + ); + path = Views; + sourceTree = ""; + }; D8D377E42CBE548F0043D103 /* Resource */ = { isa = PBXGroup; children = ( @@ -700,6 +730,7 @@ 5B85B1C22CD91CC000469D03 /* HomeView.swift in Sources */, 5B0C4AF42CD52E1800031147 /* StopStatusEnum.swift in Sources */, 5B347FCE2CF49DEA00A1E852 /* BusStopArrivalView.swift in Sources */, + D8C5E7362D006D53005FE865 /* LoadingCase.swift in Sources */, 5B347FD02CF4F72400A1E852 /* AppDelegate.swift in Sources */, 5B6DA5B82CBE551400613ACB /* MapView.swift in Sources */, 5B6DA5BA2CBE6F8C00613ACB /* LocationManager.swift in Sources */, @@ -713,6 +744,7 @@ 5BE1BF082CF867590082648D /* NotificationManager.swift in Sources */, D801A1BA2CF2213C00AD0D64 /* BusDataMock.swift in Sources */, D876BF312CECE89E0098B68E /* OnboardingView.swift in Sources */, + D8C5E7322D006D31005FE865 /* LoadingView.swift in Sources */, 5B64AF952CCF823D0083CA23 /* BusInfoEnum.swift in Sources */, D82CB2342CFE103800A93217 /* UIApplication.swift in Sources */, 5BA06D4A2CF38E5400834BBD /* TappedStopView.swift in Sources */, diff --git a/TMT/TMT/BusJourneyScanned/Views/ScannedJourneyInfoView.swift b/TMT/TMT/BusJourneyScanned/Views/ScannedJourneyInfoView.swift index 0bf7314..a95372b 100644 --- a/TMT/TMT/BusJourneyScanned/Views/ScannedJourneyInfoView.swift +++ b/TMT/TMT/BusJourneyScanned/Views/ScannedJourneyInfoView.swift @@ -14,15 +14,18 @@ struct ScannedJourneyInfoView: View { @EnvironmentObject var searchModel: BusSearchModel @EnvironmentObject var journeyModel: JourneySettingModel @EnvironmentObject var activityManager: LiveActivityManager - + @State private var tag: Int? = nil + @State private var showingAlert: Bool = false - @State private var showingPhotosPicker: Bool = false @State private var isShowingInformation = false + @State private var isLoading = false + + @State private var showingPhotosPicker: Bool = false @State private var pickedItem: PhotosPickerItem? = nil - + @Binding var path: [String] - + var body: some View { ZStack { Color.brandBackground @@ -34,14 +37,14 @@ struct ScannedJourneyInfoView: View { } else { UploadedPhotoView(selectedImage: .constant(nil)) } - + VStack(alignment: .leading) { uploadedInfoBox(title: "Bus Number", scannedInfo: $imageHandler.scannedJourneyInfo.busNumber) uploadedInfoBox(title: "Departure Stop", scannedInfo: $imageHandler.scannedJourneyInfo.startStop) uploadedInfoBox(title: "Arrival Stop", scannedInfo: $imageHandler.scannedJourneyInfo.endStop) } } - + if imageHandler.showAlertText { HStack { VStack { @@ -59,7 +62,7 @@ struct ScannedJourneyInfoView: View { .frame(height: 42) .foregroundStyle(.red600) } - + HStack(spacing: 0) { Group { if imageHandler.showAlertText { @@ -84,7 +87,7 @@ struct ScannedJourneyInfoView: View { Text("Cancel") .foregroundStyle(.blue) } - + Button { showingAlert = false showingPhotosPicker = true @@ -97,7 +100,7 @@ struct ScannedJourneyInfoView: View { } message: { Text("The previously uploaded image information will disappear. Do you want to proceed?") } - + PhotosPicker(selection: $pickedItem, matching: .screenshots) { EmptyView() } @@ -105,15 +108,14 @@ struct ScannedJourneyInfoView: View { imageHandler.loadImageByPhotosPickerItem(from: pickedItem, viewCategory: "ScannedJourneyInfoView", completion: {}) } .photosPicker(isPresented: $showingPhotosPicker, selection: $pickedItem, matching: .screenshots) - + NavigationLink(destination: MapView(path: $path), tag: 1, selection: $tag) { EmptyView() } - - FilledButton( - title: "Start", - fillColor: imageHandler.showAlertText ? .grey100 : .brandPrimary - ) { + + FilledButton(title: "Start", + fillColor: imageHandler.showAlertText ? .grey100 : .brandPrimary) { + isLoading = true Task { await NotificationManager.shared.requestNotificationPermission() if !imageHandler.showAlertText { @@ -122,26 +124,34 @@ struct ScannedJourneyInfoView: View { startStopString: imageHandler.scannedJourneyInfo.startStop, endStopString: imageHandler.scannedJourneyInfo.endStop ) - + guard let startStop = journeyModel.journeyStops.first else { return } guard let endStop = journeyModel.journeyStops.last else { return } - + activityManager.startLiveActivity(startBusStop: startStop, endBusStop: endStop, remainingStops: locationManager.remainingStops) - tag = 1 - path.append("BusStop") + + DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { + isLoading = false + tag = 1 + path.append("BusStop") + } } } } - .disabled(imageHandler.showAlertText) + .disabled(imageHandler.showAlertText) } .frame(height: 52) .padding(.vertical, 12.5) } .padding(.horizontal, 16) - + if isShowingInformation { InformationModalView(isShowingInformation: $isShowingInformation) } + + if isLoading { + LoadingView() + } } .onTapGesture { UIApplication.shared.endEditing() @@ -157,15 +167,15 @@ struct ScannedJourneyInfoView: View { } .disabled(isShowingInformation) } - + } - + private func uploadedInfoBox(title: String, scannedInfo: Binding) -> some View { VStack(alignment: .leading) { Text("\(title)") .foregroundStyle(.grey300) .font(.system(size: 14, weight: .medium)) - + TextField("\(scannedInfo.wrappedValue)", text: scannedInfo) .foregroundStyle(.textDefault) .font(.system(size: 20, weight: .bold)) diff --git a/TMT/TMT/TMT.entitlements b/TMT/TMT/TMT.entitlements index 2eb7e33..ec6582e 100644 --- a/TMT/TMT/TMT.entitlements +++ b/TMT/TMT/TMT.entitlements @@ -3,6 +3,8 @@ com.apple.security.application-groups - + + group.twomanythinking.TMT + diff --git a/TMT/TMT/TMTRelease.entitlements b/TMT/TMT/TMTRelease.entitlements index 2eb7e33..ec6582e 100644 --- a/TMT/TMT/TMTRelease.entitlements +++ b/TMT/TMT/TMTRelease.entitlements @@ -3,6 +3,8 @@ com.apple.security.application-groups - + + group.twomanythinking.TMT + diff --git a/TMT/TMTShareExtension/TMTShareExtension.entitlements b/TMT/TMTShareExtension/TMTShareExtension.entitlements index 2eb7e33..ec6582e 100644 --- a/TMT/TMTShareExtension/TMTShareExtension.entitlements +++ b/TMT/TMTShareExtension/TMTShareExtension.entitlements @@ -3,6 +3,8 @@ com.apple.security.application-groups - + + group.twomanythinking.TMT + diff --git a/TMT/TMTShareExtension/TMTShareExtensionRelease.entitlements b/TMT/TMTShareExtension/TMTShareExtensionRelease.entitlements index 2eb7e33..ec6582e 100644 --- a/TMT/TMTShareExtension/TMTShareExtensionRelease.entitlements +++ b/TMT/TMTShareExtension/TMTShareExtensionRelease.entitlements @@ -3,6 +3,8 @@ com.apple.security.application-groups - + + group.twomanythinking.TMT +