Esempio n. 1
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
            // to avoid linking issues:
            var ignore = typeof(SvgCachedImage);

            VideoPlayerKit.Init();
            PullToRefreshLayoutRenderer.Init();

            global::Xamarin.Forms.Forms.Init();

            App.ScreenWidth  = UIScreen.MainScreen.Bounds.Width;
            App.ScreenHeight = UIScreen.MainScreen.Bounds.Height;

            //UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(24, 150, 188);
            UIColor accentColor = UIColor.FromRGB(24, 150, 188);

            UINavigationBar.Appearance.TintColor = accentColor;
            UISwitch.Appearance.OnTintColor      = accentColor;

            UITextAttributes textAttributes = null;

            if (UIDevice.CurrentDevice.CheckSystemVersion(9, 0))
            {
                textAttributes = new UITextAttributes()
                {
                    Font            = UIFont.FromName("SanFrancisco", (nfloat)20f),
                    TextShadowColor = UIColor.Clear,
                };
            }
            else
            {
                textAttributes = new UITextAttributes()
                {
                    Font            = UIFont.FromName("HelveticaNeue-Light", (nfloat)20f),
                    TextShadowColor = UIColor.Clear,
                };
            }

            UINavigationBar.Appearance.SetTitleTextAttributes(textAttributes);

            Distribute.DontCheckForUpdatesInDebug();

            LoadApplication(new App(new IModule[] { new PlatformContainerModule() }));

            if (options != null && options.ContainsKey(UIApplication.LaunchOptionsLocationKey))
            {
                Log.Info("LaunchOptions contains locationkey");
            }

            if (App.TabiConfig.Notifications.Enabled)
            {
                UIApplication.SharedApplication.RegisterForRemoteNotifications();
            }

            UNUserNotificationCenter.Current.RemoveDeliveredNotifications(new string[] { "termination" });

            return(base.FinishedLaunching(app, options));
        }
Esempio n. 2
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            FFImageLoading.Forms.Platform.CachedImageRenderer.Init(enableFastRenderer: true);
            // to avoid linking issues:
            var ignore = typeof(SvgCachedImage);

            VideoPlayerKit.Init();

            Toolkit.Init();
            Xamarin.FormsMaps.Init(this, bundle);
            UserDialogs.Init(() => CrossCurrentActivity.Current.Activity);
            PullToRefreshLayoutRenderer.Init();

            var width   = Resources.DisplayMetrics.WidthPixels;
            var height  = Resources.DisplayMetrics.HeightPixels;
            var density = Resources.DisplayMetrics.Density;

            App.ScreenWidth  = (width - 0.5f) / density;
            App.ScreenHeight = (height - 0.5f) / density;

            var notificationChannelHelper = new NotificationChannelHelper(Application.Context);

            notificationChannelHelper.SetupNotificationChannels();

            LoadApplication(new App(new IModule[] { new PlatformContainerModule() }));

            if (App.TabiConfig.Notifications.Enabled)
            {
                string deviceToken = FirebaseInstanceId.Instance.Token;
                Settings.Current.DeviceToken = deviceToken;
                Log.Debug("InstanceID token: " + deviceToken);
            }
        }