| @@ -97,7 +97,6 @@ | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| Account = await GetUserData(); | |||
| if (!string.IsNullOrEmpty(FromRoute) && ReportDataProvider.Report != null) { | |||
| UserDataProvider.MapUserData(Account, ReportDataProvider.Report); | |||
| @@ -125,6 +124,7 @@ | |||
| } | |||
| private void Next() { | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| if ("Found".Equals(FromRoute)) { | |||
| UserDataProvider.MapReport(ReportDataProvider.Report, Account); | |||
| NavigationManager.NavigateTo("fundvelo/conclusion_found"); | |||
| @@ -41,10 +41,10 @@ | |||
| protected override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.Reset(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| } | |||
| private void FundVelo_LostFound() { | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| NavigationManager.NavigateTo("fundvelo/lost_found"); | |||
| } | |||
| @@ -92,7 +92,6 @@ | |||
| protected override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.OnBeforeNavigateBack = new EventCallback(this, (Action)OnBeforeNavigateBack); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| refreshGUIFromDto(); | |||
| StateHasChanged(); | |||
| } | |||
| @@ -103,6 +102,7 @@ | |||
| private void Next() { | |||
| updateDtoFromGUI(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| NavigationManager.NavigateTo("fundvelo/account/Found"); | |||
| } | |||
| @@ -74,7 +74,6 @@ | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| try { | |||
| if (ReportDataProvider.ReportRepositoryItem != null) { | |||
| response = await IBicycleRestService.SendFoundReport((FoundReportRepositoryItem)ReportDataProvider.ReportRepositoryItem); | |||
| @@ -216,7 +216,6 @@ | |||
| await GetBicycleTypes(); | |||
| await GetBrands(); | |||
| refreshGUIFromDto(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| OnlineStatusProvider.AddOnlineStatusChangeCallBack(OnOnlineStatusChanged); | |||
| StateHasChanged(); | |||
| } | |||
| @@ -227,15 +226,22 @@ | |||
| private async void AfterRenderMap() { | |||
| FoundReport report = ReportDataProvider.GetFoundReport(); | |||
| if (report.GeographicInfo.Latitude != 0 && report.GeographicInfo.Longitude != 0) { | |||
| MouseEvent mouseEvent = new MouseEvent(); | |||
| LatLng coordinates; | |||
| LatLng devicePosition = await InitializeDeviceMapPosition(); | |||
| if (report != null && report.GeographicInfo.Latitude != 0 && report.GeographicInfo.Longitude != 0) { | |||
| bicycleGeoPosition.DisplayCity = await GetFormattedAddressZipAndTown(ReportDataProvider); | |||
| LatLng coordinates = new LatLng(report.GeographicInfo.Latitude, report.GeographicInfo.Longitude); | |||
| MouseEvent mouseEvent = new MouseEvent(); | |||
| coordinates = new LatLng(report.GeographicInfo.Latitude, report.GeographicInfo.Longitude); | |||
| mouseEvent.LatLng = coordinates; | |||
| await InitializeBicycleMapPosition(); | |||
| await AddBicycleMarkerOnClickPosition(mouseEvent); | |||
| StateHasChanged(); | |||
| } else { // Set bicycle postion equal to device position | |||
| coordinates = new LatLng(devicePosition.Lat, devicePosition.Lng); | |||
| mouseEvent.LatLng = coordinates; | |||
| await OnMouseMapClicked(mouseEvent); | |||
| } | |||
| StateHasChanged(); | |||
| } | |||
| private Brand getBrand(Brand brand) { | |||
| @@ -268,6 +274,7 @@ | |||
| private void Next() { | |||
| updateDtoFromGUI(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| if (abholadresseIsNotContact) { | |||
| NavigationManager.NavigateTo("fundvelo/alternate_pickup"); | |||
| } else { | |||
| @@ -64,10 +64,10 @@ namespace cwebplusApp.Pages { | |||
| await this.mapRef.OnClick(async (MouseEvent mouseEvent) => await OnMouseMapClicked(mouseEvent)); | |||
| } | |||
| protected async Task InitializeDeviceMapPosition() { | |||
| protected async Task<LatLng> InitializeDeviceMapPosition() { | |||
| CreateBicycleMarkerOptions(); | |||
| await AddEventsToMap(); | |||
| await ShowDeviceGeoLocation(); | |||
| return await ShowDeviceGeoLocation(); | |||
| } | |||
| protected async Task InitializeBicycleMapPosition() { | |||
| @@ -98,6 +98,18 @@ namespace cwebplusApp.Pages { | |||
| this.bicyclePositionMarker = await this.MarkerFactory.CreateAndAddToMap(mouseEvent.LatLng, this.mapRef, this.bicycleMarkerOptions); | |||
| } | |||
| protected async Task<LatLng> GetDeviceGeoLocation() { | |||
| LatLng geoPosition; | |||
| BlazorGeolocationPosition position = await this.BlazorGeolocationService.GetPositionAsync(); | |||
| if (position.ErrorCode != null) { | |||
| Toaster.ShowError(I18n.GetString("Error.GeoLocation.Title", position.ErrorCode), I18n.GetString("Error.GeoLocation.Msg", position.ErrorMessage)); | |||
| geoPosition = new(0, 0); | |||
| } else { | |||
| geoPosition = new((double)position.Latitude, (double)position.Longitude); | |||
| } | |||
| return geoPosition; | |||
| } | |||
| private async void CreateBicycleMarkerOptions() { | |||
| this.bicycleMarkerOptions = new MarkerOptions() { | |||
| IconRef = await this.IconFactory.Create(new IconOptions() { | |||
| @@ -111,21 +123,17 @@ namespace cwebplusApp.Pages { | |||
| }; | |||
| } | |||
| private async Task ShowDeviceGeoLocation() { | |||
| BlazorGeolocationPosition position = await this.BlazorGeolocationService.GetPositionAsync(); | |||
| if (position.ErrorCode != null) { | |||
| Toaster.ShowError(I18n.GetString("Error.GeoLocation.Title", position.ErrorCode), I18n.GetString("Error.GeoLocation.Msg", position.ErrorMessage)); | |||
| } else { | |||
| LatLng geoPosition = new((double)position.Latitude, (double)position.Longitude); | |||
| if (this.devicePositionMarker != null) { | |||
| await devicePositionMarker.Remove(); | |||
| } | |||
| this.devicePositionMarker = await this.MarkerFactory.CreateAndAddToMap(geoPosition, this.mapRef); | |||
| private async Task<LatLng> ShowDeviceGeoLocation() { | |||
| LatLng geoPosition = await GetDeviceGeoLocation(); | |||
| await this.mapRef.SetZoom(16); | |||
| await this.mapRef.SetView(geoPosition); | |||
| if (this.devicePositionMarker != null) { | |||
| await devicePositionMarker.Remove(); | |||
| } | |||
| this.devicePositionMarker = await this.MarkerFactory.CreateAndAddToMap(geoPosition, this.mapRef); | |||
| await this.mapRef.SetZoom(16); | |||
| await this.mapRef.SetView(geoPosition); | |||
| return geoPosition; | |||
| } | |||
| private async Task ShowBicycleGeoLocation() { | |||
| @@ -149,7 +157,7 @@ namespace cwebplusApp.Pages { | |||
| return String.IsNullOrEmpty(postcode) ? "" : postcode.Split("-", StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)[0]; | |||
| } | |||
| private async Task OnMouseMapClicked(MouseEvent mouseEvent) { | |||
| protected async Task OnMouseMapClicked(MouseEvent mouseEvent) { | |||
| await AddBicycleMarkerOnClickPosition(mouseEvent); | |||
| this.bicycleGeoPosition.Latitude = mouseEvent.LatLng.Lat; | |||
| @@ -73,7 +73,6 @@ | |||
| protected override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| StateHasChanged(); | |||
| } | |||
| @@ -65,7 +65,6 @@ | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| ReportDataProvider.Report = null; | |||
| ReportDataProvider.ReportRepositoryItem = null; | |||
| StateHasChanged(); | |||
| @@ -77,6 +76,7 @@ | |||
| Report report = new FoundReport(); | |||
| UserDataProvider.MapReport(report, await UserDataProvider.Get()); | |||
| ReportDataProvider.Report = report; | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| NavigationManager.NavigateTo("fundvelo/keydata/Found"); | |||
| } | |||
| @@ -84,6 +84,7 @@ | |||
| Report report = new MissingReport(); | |||
| UserDataProvider.MapReport(report, await UserDataProvider.Get()); | |||
| ReportDataProvider.Report = report; | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| NavigationManager.NavigateTo("fundvelo/keydata/Missing"); | |||
| } | |||
| @@ -103,7 +103,6 @@ | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| try { | |||
| if (ReportDataProvider.ReportRepositoryItem != null) { | |||
| response = await IBicycleRestService.SendMissingReport((MissingReportRepositoryItem)ReportDataProvider.ReportRepositoryItem); | |||
| @@ -186,7 +186,6 @@ | |||
| await GetBrands(); | |||
| await GetSearchServices(); | |||
| refreshGUIFromDto(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| StateHasChanged(); | |||
| } | |||
| @@ -228,6 +227,7 @@ | |||
| private void Next() { | |||
| updateDtoFromGUI(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| NavigationManager.NavigateTo("fundvelo/account/Missing"); | |||
| } | |||
| @@ -56,7 +56,6 @@ | |||
| protected async override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| pendingReports.AddRange(await ReportRepositoryService.GetPendingFoundReports()); | |||
| pendingReports.AddRange(await ReportRepositoryService.GetPendingMissingReports()); | |||
| StateHasChanged(); | |||
| @@ -68,7 +68,6 @@ | |||
| protected override void OnInitialized() { | |||
| base.OnInitialized(); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| version = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion; | |||
| } | |||
| @@ -115,7 +115,6 @@ | |||
| base.OnInitialized(); | |||
| AppState.OnChange += StateHasChanged; | |||
| NavigationManager.LocationChanged += LocationChanged; | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| locUrl = I18n.GetString(NavigationManager.Uri.Replace(NavigationManager.BaseUri, "")); | |||
| StateHasChanged(); | |||
| } | |||
| @@ -127,6 +126,7 @@ | |||
| private void ButtonClicked(int _Index) { | |||
| index = _Index; | |||
| navSubMenuOpen = (index == 3 || index == 4); | |||
| PageHistoryManager.AddPageToHistory(NavigationManager.Uri); | |||
| StateHasChanged(); | |||
| ButtonClicked(); | |||
| } | |||
| @@ -28,8 +28,7 @@ namespace cwebplusApp.Shared.Services { | |||
| public string GetPreviousPage() { | |||
| if (CanGoBack()) { | |||
| // You add a page on initialization, so you need to return the 2nd from the last | |||
| string previousPage = previousPages.ElementAt(previousPages.Count - 2); | |||
| previousPages.RemoveAt(previousPages.Count - 1); | |||
| string previousPage = previousPages.ElementAt(previousPages.Count - 1); | |||
| previousPages.RemoveAt(previousPages.Count - 1); | |||
| return previousPage; | |||
| } | |||
| @@ -39,7 +38,7 @@ namespace cwebplusApp.Shared.Services { | |||
| } | |||
| public bool CanGoBack() { | |||
| return previousPages.Count > 1; | |||
| return previousPages.Count >= 1; | |||
| } | |||
| public async void NavigateBack() { | |||
| @@ -248,4 +248,9 @@ div.mat-select.required span#outlined-select-label.mdc-floating-label::after { | |||
| .mdc-nav-item.selected { | |||
| background-color: var(--primary); | |||
| color: #fff !important; | |||
| } | |||
| .mat-drawer { | |||
| border-right-width: 0px; | |||
| width: var(--mat-drawer-custom-width, 300px); | |||
| } | |||