예제 #1
0
 public Task ActivateYandexPushAsync()
 {
     return(Task.Run(() =>
     {
         try
         {
             if (!_settingsService.Get(AppConstants.PUSH_NOTIFICATIONS_PARAMETER, true))
             {
                 return;
             }
             YandexMetricaPush.Activate("***REMOVED***");
             IsYandexPushActivated = true;
         }
         catch (Exception)
         {
         }
     }));
 }
예제 #2
0
        protected override async Task OnLaunchApplication(LaunchActivatedEventArgs args)
        {
            ActivateMetrica();

            var vkLoginService     = _container.Resolve <IVKLoginService>();
            var launchViewResolver = _container.Resolve <ILaunchViewResolver>();

            StartSuspendingServices();

            if (args.PreviousExecutionState == ApplicationExecutionState.ClosedByUser ||
                args.PreviousExecutionState == ApplicationExecutionState.NotRunning)
            {
                if (!launchViewResolver.TryOpenPromoView())
                {
                    if (vkLoginService.IsAuthorized)
                    {
                        if (!launchViewResolver.TryOpenSpecialViews() && await launchViewResolver.EnsureDatabaseUpdated() == false)
                        {
                            launchViewResolver.OpenDefaultView();
                        }
                    }
                    else
                    {
                        NavigationService.Navigate(AppConstants.DEFAULT_LOGIN_VIEW, null);
                    }
                }
            }

            if (vkLoginService.IsAuthorized)
            {
                try
                {
                    await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        var state = _container.Resolve <IPlayerService>().CurrentState;
                        if (state == PlayerState.Playing)
                        {
                            NavigationService.Navigate("PlayerView", null);
                        }
                    });
                }
                catch (Exception) { }
#if FULL
                _container.Resolve <IBetaService>().ExecuteAppLaunch();
#endif
                await _container.Resolve <INotificationsService>().ActivateYandexPushAsync();

                _container.Resolve <IFeedbackService>().ActivateFeedbackNotifier();
            }

            if (_container.Resolve <INotificationsService>().IsYandexPushActivated)
            {
                YandexMetricaPush.ProcessApplicationLaunch(args);
            }

            //_container.Resolve<IProtocolHandler>().ProcessProtocol("?yamp_l=vksaver%3A%2F%2Fvkad%2F-138475410_3&yamp_i=m%3D49874%26cor%3Dddd8ae32-0322-4881-b526-c96c1a708ccc");
            if (args.Kind == ActivationKind.Protocol || (args.Kind == ActivationKind.Launch && !String.IsNullOrEmpty(args.Arguments)))
            {
                _container.Resolve <IProtocolHandler>().ProcessProtocol(args.Arguments);
            }
        }