public void Init(bool locateUser, string defaultHintZoomLevel = null, string order = null, string orderStatusDetail = null, string manualRidelinqDetail = null) { _locateUser = locateUser; _defaultHintZoomLevel = defaultHintZoomLevel.FromJson <ZoomToStreetLevelPresentationHint>(); if (manualRidelinqDetail != null) { var deserializedRidelinqDetails = manualRidelinqDetail.FromJson <OrderManualRideLinqDetail>(); CurrentViewState = HomeViewModelState.ManualRidelinq; BookingStatus.StartBookingStatus(deserializedRidelinqDetails, true); return; } if (order != null && orderStatusDetail != null) { var deserializedOrder = order.FromJson <Order>(); var deserializeOrderStatus = orderStatusDetail.FromJson <OrderStatusDetail>(); CurrentViewState = HomeViewModelState.BookingStatus; BookingStatus.StartBookingStatus(deserializedOrder, deserializeOrderStatus); } }
public override void OnViewStarted(bool firstTime) { base.OnViewStarted(firstTime); try { _firstTime = firstTime; _locationService.Start(); if (_orderWorkflowService.IsOrderRebooked()) { _bottomBar.ReviewOrderDetails().FireAndForget(); } if (firstTime) { Panel.Start().FireAndForget(); AddressPicker.RefreshFilteredAddress(); this.Services().ApplicationInfo.CheckVersionAsync().FireAndForget(); CheckTermsAsync(); CheckCreditCardExpiration().FireAndForget(); BottomBar.CheckManualRideLinqEnabledAsync(); _isShowingTutorial = _tutorialService.DisplayTutorialToNewUser(() => { _isShowingTutorial = false; LocateUserIfNeeded(); }); _pushNotificationService.RegisterDeviceForPushNotifications(force: true); } LocateUserIfNeeded(); if (_defaultHintZoomLevel != null) { ChangePresentation(_defaultHintZoomLevel); _defaultHintZoomLevel = null; } _vehicleService.Start(); } catch (Exception ex) { Logger.LogError(ex); } }
public async void CheckTermsAsync() { // if we're already showing the terms and conditions, do nothing if (!_isShowingTermsAndConditions) { await _termsService.CheckIfNeedsToShowTerms( (content, actionOnResult) => { _isShowingTermsAndConditions = true; ShowSubViewModel <UpdatedTermsAndConditionsViewModel, bool>(content, actionOnResult); }, (locateUser, defaultHintZoomLevel) => { // reset the viewmodel to the state it was before calling CheckTermsAsync() _locateUser = locateUser; _defaultHintZoomLevel = defaultHintZoomLevel; _isShowingTermsAndConditions = false; }, _locateUser, _defaultHintZoomLevel ).HandleErrors(); } }
public async Task CheckIfNeedsToShowTerms(Action <object, Action <bool> > actionToDoIfTrue, Action <bool, ZoomToStreetLevelPresentationHint> actionToDoOnReturn, bool initialLocateUserValue, ZoomToStreetLevelPresentationHint initialHintValue) { if (!_appSettings.Data.ShowTermsAndConditions) { return; } TermsAndConditions response = null; try { response = await GetTerms(); } catch (WebServiceException ex) { if (ex.StatusCode != (int)HttpStatusCode.NotModified) { Logger.LogError(ex); } } catch (Exception ex) { Logger.LogError(ex); } if (response == null) { return; } var currentAccount = _accountService.CurrentAccount; if (currentAccount == null) { return; } var ackKey = GetTermsAcknowledgmentKey(currentAccount.Email); var termsAcknowledged = _cacheService.Get <string>(ackKey); if (response.Updated || termsAcknowledged != "yes") { _cacheService.Clear(ackKey); actionToDoIfTrue.Invoke(new { content = response.Content.ToJson() }, acknowledged => { actionToDoOnReturn.Invoke(initialLocateUserValue, initialHintValue); AcknowledgeTerms(acknowledged, _accountService.CurrentAccount.Email); if (!acknowledged) { _accountService.SignOut(); } }); } }