Exemplo n.º 1
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            LoggerService = Container.Resolve <ILoggerService>();
            LoggerService.StartMethod();
            LogFileService = Container.Resolve <ILogFileService>();
            LogFileService.AddSkipBackupAttribute();

            // Local Notification tap event listener
            //NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            INavigationResult result = await NavigationService.NavigateAsync("/" + nameof(SplashPage));

            if (!result.Success)
            {
                LoggerService.Info($"Failed transition.");

                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }

            LoggerService.EndMethod();
        }
Exemplo n.º 2
0
        protected override async void OnInitialized()
        {
            InitializeComponent();
            INavigationResult result;

            // Check user data and skip tutorial
            UserData userData = Container.Resolve <UserData>();

            if (Application.Current.Properties.ContainsKey("UserData"))
            {
                result = await NavigationService.NavigateAsync("NavigationPage/BeaconPage");
            }
            else
            {
                result = await NavigationService.NavigateAsync("NavigationPage/StartTutorialPage");
            }

            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
        }
Exemplo n.º 3
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            // Exposure Notification

#if DEBUG
            // For debug mode, set the mock api provider to interact
            // with some fake data
            Xamarin.ExposureNotifications.ExposureNotification.OverrideNativeImplementation(new Services.TestNativeImplementation());
#endif
            Xamarin.ExposureNotifications.ExposureNotification.Init();

            // Local Notification tap event listener
            NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            Distribute.ReleaseAvailable    = OnReleaseAvailable;
            Push.PushNotificationReceived += OnPushNotificationReceived;
            AppCenter.Start($"android={AppConstants.AppCenterTokensAndroid};ios={AppConstants.AppCenterTokensIOS};", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));
            Container.Resolve <ILogger>().Log("Started App Center");

            _ = InitializeBackgroundTasks();

            INavigationResult result;
            // Check user data and skip tutorial
            UserDataService userDataService = Container.Resolve <UserDataService>();

            if (userDataService.IsExistUserData)
            {
                var userData = userDataService.Get();
                if (userData.IsOptined)
                {
                    result = await NavigationService.NavigateAsync("/" + nameof(MenuPage) + "/" + nameof(NavigationPage) + "/" + nameof(HomePage));
                }
                else
                {
                    result = await NavigationService.NavigateAsync("/" + nameof(StartTutorialPage));
                }
            }
            else
            {
                result = await NavigationService.NavigateAsync("/" + nameof(StartTutorialPage));
            }

            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
        }
Exemplo n.º 4
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

#if USE_MOCK
            // For debug mode, set the mock api provider to interact
            // with some fake data
            Xamarin.ExposureNotifications.ExposureNotification.OverrideNativeImplementation(new Services.TestNativeImplementation());
#endif
            Xamarin.ExposureNotifications.ExposureNotification.Init();

            // Local Notification tap event listener
            //NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            // Migrate userData
            await UserDataMigrationService.Migrate();

            // ignore backup
            Xamarin.Forms.DependencyService.Get <ISkipBackup>().skipBackup(AppConstants.PropertyStore);

            INavigationResult result;
            // Check user data and skip tutorial
            UserDataService userDataService = Container.Resolve <UserDataService>();

            if (userDataService.IsExistUserData)
            {
                var userData = userDataService.Get();
                if (userData.IsOptined && userData.IsPolicyAccepted)
                {
                    result = await NavigationService.NavigateAsync("/" + nameof(MenuPage) + "/" + nameof(NavigationPage) + "/" + nameof(HomePage));
                }
                else
                {
                    result = await NavigationService.NavigateAsync("/" + nameof(TutorialPage1));
                }
            }
            else
            {
                result = await NavigationService.NavigateAsync("/" + nameof(TutorialPage1));
            }

            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
            _ = InitializeBackgroundTasks();
        }
Exemplo n.º 5
0
        protected override async void OnInitialized()
        {
            InitializeComponent();
            LogUnobservedTaskExceptions();

            Distribute.ReleaseAvailable    = OnReleaseAvailable;
            Push.PushNotificationReceived += OnPushNotificationReceived;
            AppCenter.Start($"android={AppConstants.AppCenterTokensAndroid};ios={AppConstants.AppCenterTokensIOS};", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));
            Container.Resolve <ILogger>().Log("Started App Center");

            INavigationResult result;

            result = await NavigationService.NavigateAsync(nameof(MenuPage) + "/" + nameof(NavigationPage) + "/" + nameof(HomePage));

            // Check user data and skip tutorial

            /*
             *          UserDataService userDataService = Container.Resolve<UserDataService>();
             *          if (userDataService.IsExistUserData)
             *          {
             *              // TODO Wire Start Exposure Notification
             *              /*
             *              var isStart = await ExposureNotification.IsEnabledAsync();
             *              if (!isStart)
             *              {
             *                  await ExposureNotification.StartAsync();
             *              }
             *
             *              UserDataModel _userData = userDataService.Get();
             *              result = await NavigationService.NavigateAsync("/MenuPage");
             *          }
             *          else
             *          {
             *              result = await NavigationService.NavigateAsync("/MainPage");
             *          }
             */
            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
        }
Exemplo n.º 6
0
        public App()
        {
            try
            {
                InitializeComponent();

                PermissionCheck().Wait();
                PermissionCheck2();

                //IfDeveloper();

                MainPage = new NavigationPage(new MainPage());
            }
            catch (System.Exception e)
            {
                Exception = e;
                MainPage  = new ExceptionPage();
            }
        }
Exemplo n.º 7
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            LoggerService = Container.Resolve <ILoggerService>();
            LoggerService.StartMethod();
            LogFileService = Container.Resolve <ILogFileService>();
            LogFileService.AddSkipBackupAttribute();

#if USE_MOCK
            // For debug mode, set the mock api provider to interact
            // with some fake data
            Xamarin.ExposureNotifications.ExposureNotification.OverrideNativeImplementation(new Services.TestNativeImplementation());
#endif
            Xamarin.ExposureNotifications.ExposureNotification.Init();

            // var enabled = await Xamarin.ExposureNotifications.ExposureNotification.IsEnabledAsync();
            // App.LoggerService.Info($"IsEnabledAsync is {enabled}");

            // Local Notification tap event listener
            //NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            INavigationResult result = await NavigationService.NavigateAsync("/" + nameof(SplashPage));

            if (!result.Success)
            {
                LoggerService.Info($"Failed transition.");

                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }

            LoggerService.EndMethod();
        }
Exemplo n.º 8
0
        protected override async void OnInitialized()
        {
            InitializeComponent();
            LogUnobservedTaskExceptions();

            Distribute.ReleaseAvailable    = OnReleaseAvailable;
            Push.PushNotificationReceived += OnPushNotificationReceived;
            AppCenter.Start($"android={AppConstants.AppCenterTokensAndroid};ios={AppConstants.AppCenterTokensIOS};", typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push));
            Container.Resolve <ILogger>().Log("Started App Center");

            INavigationResult result;
            // Check user data and skip tutorial
            UserDataService userDataService = Xamarin.Forms.DependencyService.Resolve <UserDataService>();

            if (userDataService.IsExistUserData)
            {
                UserDataModel _userData = userDataService.Get();
                _beaconService = Xamarin.Forms.DependencyService.Resolve <IBeaconService>();
                // Only Call InitializeService! Start automagically!
                AppUtils.CheckPermission();
                _beaconService.InitializeService();
                result = await NavigationService.NavigateAsync("NavigationPage/HomePage");
            }
            else
            {
                result = await NavigationService.NavigateAsync("NavigationPage/StartTutorialPage");
            }

            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
        }
Exemplo n.º 9
0
        protected override async void OnInitialized()
        {
            InitializeComponent();
            INavigationResult result;

            // Check user data and skip tutorial
            UserDataService userDataService = Xamarin.Forms.DependencyService.Resolve <UserDataService>();

            //UserDataModel userData =await userDataService.Register();

            if (userDataService.IsExistUserData())
            {
                _userData      = userDataService.Get();
                _beaconService = Xamarin.Forms.DependencyService.Resolve <IBeaconService>();
                // Only Call InitializeService! Start automagically!
                AppUtils.CheckPermission();
                _beaconService.InitializeService();

                result = await NavigationService.NavigateAsync("NavigationPage/HomePage");
            }
            else
            {
                result = await NavigationService.NavigateAsync("NavigationPage/StartTutorialPage");
            }

            if (!result.Success)
            {
                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }
        }
Exemplo n.º 10
0
        protected override async void OnInitialized()
        {
            InitializeComponent();

            LoggerService = Container.Resolve <ILoggerService>();
            LoggerService.StartMethod();
            LogFileService = Container.Resolve <ILogFileService>();
            LogFileService.AddSkipBackupAttribute();

#if USE_MOCK
            // For debug mode, set the mock api provider to interact
            // with some fake data
            Xamarin.ExposureNotifications.ExposureNotification.OverrideNativeImplementation(new Services.TestNativeImplementation());
#endif
            Xamarin.ExposureNotifications.ExposureNotification.Init();

            // Local Notification tap event listener
            //NotificationCenter.Current.NotificationTapped += OnNotificationTapped;
            LogUnobservedTaskExceptions();

            INavigationResult result;
            // Check user data and skip tutorial
            IUserDataService userDataService = Container.Resolve <IUserDataService>();

            if (userDataService.IsExistUserData)
            {
                LoggerService.Info("User data exists");
                var userData = userDataService.Get();
                LoggerService.Info($"userData.IsOptined: {userData.IsOptined}");
                LoggerService.Info($"userData.IsPolicyAccepted: {userData.IsPolicyAccepted}");
                if (userData.IsOptined && userData.IsPolicyAccepted)
                {
                    LoggerService.Info($"Transition to SplashPage");
                    result = await NavigationService.NavigateAsync("/" + nameof(SplashPage));
                }
                else
                {
                    LoggerService.Info($"Transition to TutorialPage1");
                    result = await NavigationService.NavigateAsync("/" + nameof(TutorialPage1));
                }
            }
            else
            {
                LoggerService.Info("No user data exists");
                LoggerService.Info($"Transition to TutorialPage1");
                result = await NavigationService.NavigateAsync("/" + nameof(TutorialPage1));
            }

            if (!result.Success)
            {
                LoggerService.Info($"Failed transition.");

                MainPage = new ExceptionPage
                {
                    BindingContext = new ExceptionPageViewModel()
                    {
                        Message = result.Exception.Message
                    }
                };
                System.Diagnostics.Debugger.Break();
            }

            LoggerService.EndMethod();
        }