public override async Task Init() { await NavService.PushAlertPopupAsync("Loading..."); if (!_hasLoaded) { /* TOGGLE DEMO MODE HERE */ /* DEMO MODE ON */ //For development only -> Demo mode //StateService.SetCurrentUser(DemoUser.UserGeorge.ToModelObj()); //await ((App)Application.Current).SetModeAndSync(true); /* DEMO MODE OFF - BYPASS AZURE AD AUTHENTICATION */ // Hardcode authentication by doing this - robin's dev user - already in the db //await DataDownloadService.InsertOrReplaceAuthenticatedUser(Guid.Parse("b79ed0e3-ddb9-4920-8900-ffc55a73b4b5")); //var user = await DataRetrievalService.GetUserByEmailOrNullAsync("*****@*****.**"); /* DEMO MODE OFF - USE AZURE AD AUTHENTICATION */ //Assuming here that we will be using the same user that just authenticated //now that the user has logged in, we need to see if they are a bingoBuzz user, if not, we can add them //TODO: should probably do a try parse here if we add more providers await DataDownloadService.InsertOrReplaceAuthenticatedUser( StateService.GetAuthEmail(), Guid.Parse(StateService.GetAuthId()), StateService.GetAuthGivenName(), StateService.GetAuthSurName() ); var user = await DataRetrievalService.GetUserByEmailOrNullAsync(StateService.GetAuthEmail()); /* END TOGGLE DEMO MODE HERE */ if (user != null) { StateService.SetCurrentUser(user); } else { string whatHappened = "Can't find this BingoBuzz user!"; LoggingService.Error(whatHappened, LogMessageType.Instance.Info_Synchronization); throw new Exception(whatHappened); } await((App)Application.Current).SetModeAndSync(user.UserId, false); //Load the contents of the welcome page Meetings = (await DataRetrievalService.GetMeetingsAsync()).ToObservableCollection(); _hasLoaded = true; } await CheckAppCenter(); await NavService.PopAlertPopupsAsync(); }