Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            System.Net.ServicePointManager.ServerCertificateValidationCallback +=
                (sender, cert, chain, sslPolicyErrors) =>
            {
                System.Diagnostics.Debug.WriteLine(cert.GetSerialNumberString());
                System.Diagnostics.Debug.WriteLine(cert.Issuer);
                System.Diagnostics.Debug.WriteLine(cert.Subject);
                return(true);
            };

            CachedImageRenderer.Init(true);
            UserDialogs.Init(this);
            Rg.Plugins.Popup.Popup.Init(this, bundle);

            CrossCurrentActivity.Current.Init(this, bundle);
            CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
            CrossFingerprint.SetDialogFragmentType <CustomFingerprintDialogFragment>();

            OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
            ZXing.Net.Mobile.Forms.Android.Platform.Init();
            MobileBarcodeScanner.Initialize(Application);

            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

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

            LoadApplication(new App(null));
        }
Exemplo n.º 2
0
 protected override void OnCreate(Bundle bundle)
 {
     base.OnCreate(bundle);
     SetContentView(Resource.Layout.MainView);
     CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
     CrossFingerprint.SetDialogFragmentType <FingerprintLoginDialogFragment>();
 }
Exemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
            CrossFingerprint.SetDialogFragmentType <PlatformImpl.MyCustomDialogFragment>();
            DependencyUtils.Init(this.GetType().Assembly);
            base.OnCreate(savedInstanceState);
            ZXing.Net.Mobile.Forms.Android.Platform.Init();
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
            LoadApplication(new App());
        }
Exemplo n.º 4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            ZXing.Mobile.MobileBarcodeScanner.Initialize(Application);
            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
            CrossFingerprint.SetDialogFragmentType <MyCustomDialogFragment>();
            CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
            LoadApplication(new App());
        }
Exemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            //Enables the experimental usage of carousel and indicator views.
            //Forms.SetFlags(new string[] { "CarouselView_Experimental", "IndicatorView_Experimental" });
            Forms.SetFlags("SwipeView_Experimental");

            Rg.Plugins.Popup.Popup.Init(this, savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            Xamarin.FormsGoogleMaps.Init(this, savedInstanceState);
            CrossCurrentActivity.Current.Init(this, savedInstanceState);
            CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
            CrossFingerprint.SetDialogFragmentType <CustomFingerprintDialogFragment>();
            CardsViewRenderer.Preserve();

            Window.SetStatusBarColor(Android.Graphics.Color.ParseColor("#007CFF"));
            LoadApplication(new App());
        }
Exemplo n.º 6
0
        private void RegisterLocalServices()
        {
            ServiceContainer.Register <ILogService>("logService", new AndroidLogService());
            ServiceContainer.Register("settingsShim", new App.Migration.SettingsShim());
            if (App.Migration.MigrationHelpers.NeedsMigration())
            {
                ServiceContainer.Register <App.Migration.Abstractions.IOldSecureStorageService>(
                    "oldSecureStorageService", new Migration.AndroidKeyStoreStorageService());
            }

            Refractored.FabControl.Droid.FloatingActionButtonViewRenderer.Init();
            // Note: This might cause a race condition. Investigate more.
            Task.Run(() =>
            {
                FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
                FFImageLoading.ImageService.Instance.Initialize(new FFImageLoading.Config.Configuration
                {
                    FadeAnimationEnabled         = false,
                    FadeAnimationForCachedImages = false
                });
                ZXing.Net.Mobile.Forms.Android.Platform.Init();
            });
            CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
            CrossFingerprint.SetDialogFragmentType <CustomFingerprintDialogFragment>();

            var preferencesStorage = new PreferencesStorageService(null);
            var documentsPath      = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
            var liteDbStorage      = new LiteDbStorageService(Path.Combine(documentsPath, "bitwarden.db"));

            liteDbStorage.InitAsync();
            var localizeService        = new LocalizeService();
            var broadcasterService     = new BroadcasterService();
            var messagingService       = new MobileBroadcasterMessagingService(broadcasterService);
            var i18nService            = new MobileI18nService(localizeService.GetCurrentCultureInfo());
            var secureStorageService   = new SecureStorageService();
            var cryptoPrimitiveService = new CryptoPrimitiveService();
            var mobileStorageService   = new MobileStorageService(preferencesStorage, liteDbStorage);
            var deviceActionService    = new DeviceActionService(mobileStorageService, messagingService,
                                                                 broadcasterService, () => ServiceContainer.Resolve <IEventService>("eventService"));
            var platformUtilsService = new MobilePlatformUtilsService(deviceActionService, messagingService,
                                                                      broadcasterService);

            ServiceContainer.Register <IBroadcasterService>("broadcasterService", broadcasterService);
            ServiceContainer.Register <IMessagingService>("messagingService", messagingService);
            ServiceContainer.Register <ILocalizeService>("localizeService", localizeService);
            ServiceContainer.Register <II18nService>("i18nService", i18nService);
            ServiceContainer.Register <ICryptoPrimitiveService>("cryptoPrimitiveService", cryptoPrimitiveService);
            ServiceContainer.Register <IStorageService>("storageService", mobileStorageService);
            ServiceContainer.Register <IStorageService>("secureStorageService", secureStorageService);
            ServiceContainer.Register <IDeviceActionService>("deviceActionService", deviceActionService);
            ServiceContainer.Register <IPlatformUtilsService>("platformUtilsService", platformUtilsService);

            // Push
#if FDROID
            ServiceContainer.Register <IPushNotificationListenerService>(
                "pushNotificationListenerService", new NoopPushNotificationListenerService());
            ServiceContainer.Register <IPushNotificationService>(
                "pushNotificationService", new NoopPushNotificationService());
#else
            var notificationListenerService = new PushNotificationListenerService();
            ServiceContainer.Register <IPushNotificationListenerService>(
                "pushNotificationListenerService", notificationListenerService);
            var androidPushNotificationService = new AndroidPushNotificationService(
                mobileStorageService, notificationListenerService);
            ServiceContainer.Register <IPushNotificationService>(
                "pushNotificationService", androidPushNotificationService);
#endif
        }
Exemplo n.º 7
0
        public override void Initialize()
        {
            base.Initialize();

            CreatableTypes()
            .EndingWith("Service")
            .AsInterfaces()
            .RegisterAsLazySingleton();

            Mvx.IoCProvider.RegisterSingleton <ITextProvider>(
                new ResxTextProvider(Localization.Resource.ResourceManager,
                                     Mvx.IoCProvider.Resolve <IMvxMessenger>()));

            Mvx.IoCProvider.RegisterSingleton(() => SetupLogging());

            Mvx.IoCProvider.ConstructAndRegisterSingleton <IAppSettingsService, AppSettingsService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <IAndroidAppSettings, AppSettingsService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <IDialogService, DialogService>();

            Mvx.IoCProvider.RegisterType <IUserCredentialService, UserCredentialService>();
            Mvx.IoCProvider.RegisterType <INetworkService, NetworkService>();
            Mvx.IoCProvider.RegisterType <ISyncService, SyncService>();
            Mvx.IoCProvider.RegisterType <IBackgroundTaskManagerService, BackgroundTaskManagerService>();
            Mvx.IoCProvider.RegisterType <IAndroidNotificationService, NotificationService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <ITelemetryService, TelemetryService>();

            Mvx.IoCProvider.RegisterSingleton(CreateMapper);

            Mvx.IoCProvider.ConstructAndRegisterSingleton <IUserDataService, UserDataService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <ITaskListDataService, TaskListDataService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <ITaskDataService, TaskDataService>();
            Mvx.IoCProvider.ConstructAndRegisterSingleton <IMiraiNotesDataService, MiraiNotesDataService>();

            CrossFingerprint.SetCurrentActivityResolver(() =>
            {
                var top = Mvx.IoCProvider.Resolve <IMvxAndroidCurrentTopActivity>();
                return(top.Activity);
            });

            Mvx.IoCProvider.RegisterType(() => CrossFingerprint.Current);
            CrossFingerprint.SetDialogFragmentType <FingerprintCustomDialogFragment>();

            var client = new HttpClient(
                new AuthenticatedHttpClientHandler(
                    Mvx.IoCProvider.Resolve <ILogger>().ForContext <AuthenticatedHttpClientHandler>(),
                    () => Mvx.IoCProvider.Resolve <IGoogleApiService>(),
                    () => Mvx.IoCProvider.Resolve <IUserCredentialService>()))
            {
                BaseAddress = new Uri(AppConstants.BaseGoogleApiUrl)
            };

            var googleApiService = RestService.For <IGoogleApi>(client);

            Mvx.IoCProvider.RegisterSingleton(googleApiService);

            Mvx.IoCProvider.RegisterType <IGoogleApiService, GoogleApiService>();

            AssemblyScanner
            .FindValidatorsInAssembly(typeof(PasswordDialogViewModelValidator).Assembly)
            .ForEach(scanResult => Mvx.IoCProvider.RegisterType(scanResult.InterfaceType, scanResult.ValidatorType));
            Mvx.IoCProvider.RegisterType <IValidatorFactory, ValidatorFactory>();

            //since im using automapper to resolve this one, i need to explicit register it
            Mvx.IoCProvider.RegisterType <GoogleUserViewModel>();
            Mvx.IoCProvider.RegisterType <TaskItemViewModel>();
            Mvx.IoCProvider.RegisterType <TaskListItemViewModel>();

            RegisterAppStart <LoginViewModel>();

            // if you want to use a custom AppStart, you should replace the previous line with this one:
            // RegisterCustomAppStart<MyCustomAppStart>();
        }