예제 #1
0
        public MainApplication(IntPtr handle, JniHandleOwnership transer)
            : base(handle, transer)
        {
            if (ServiceContainer.RegisteredServices.Count == 0)
            {
                RegisterLocalServices();
                var deviceActionService = ServiceContainer.Resolve <IDeviceActionService>("deviceActionService");
                ServiceContainer.Init(deviceActionService.DeviceUserAgent, Constants.ClearCiphersCacheKey,
                                      Constants.AndroidAllClearCipherCacheKeys);

                // TODO: Update when https://github.com/bitwarden/mobile/pull/1662 gets merged
                var deleteAccountActionFlowExecutioner = new DeleteAccountActionFlowExecutioner(
                    ServiceContainer.Resolve <IApiService>("apiService"),
                    ServiceContainer.Resolve <IMessagingService>("messagingService"),
                    ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"),
                    ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"));
                ServiceContainer.Register <IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner", deleteAccountActionFlowExecutioner);

                var verificationActionsFlowHelper = new VerificationActionsFlowHelper(
                    ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"),
                    ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService"),
                    ServiceContainer.Resolve <ICryptoService>("cryptoService"));
                ServiceContainer.Register <IVerificationActionsFlowHelper>("verificationActionsFlowHelper", verificationActionsFlowHelper);
            }
#if !FDROID
            if (Build.VERSION.SdkInt <= BuildVersionCodes.Kitkat)
            {
                ProviderInstaller.InstallIfNeededAsync(ApplicationContext, this);
            }
#endif
        }
예제 #2
0
        private static async Task BootstrapAsync(Func <Task> postBootstrapFunc = null)
        {
            var disableFavicon = await ServiceContainer.Resolve <IStorageService>("storageService").GetAsync <bool?>(
                Bit.Core.Constants.DisableFaviconKey);

            await ServiceContainer.Resolve <IStateService>("stateService").SaveAsync(
                Bit.Core.Constants.DisableFaviconKey, disableFavicon);

            await ServiceContainer.Resolve <IEnvironmentService>("environmentService").SetUrlsFromStorageAsync();

            // TODO: Update when https://github.com/bitwarden/mobile/pull/1662 gets merged
            var deleteAccountActionFlowExecutioner = new DeleteAccountActionFlowExecutioner(
                ServiceContainer.Resolve <IApiService>("apiService"),
                ServiceContainer.Resolve <IMessagingService>("messagingService"),
                ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"),
                ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"));

            ServiceContainer.Register <IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner", deleteAccountActionFlowExecutioner);

            var verificationActionsFlowHelper = new VerificationActionsFlowHelper(
                ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"),
                ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService"),
                ServiceContainer.Resolve <ICryptoService>("cryptoService"));

            ServiceContainer.Register <IVerificationActionsFlowHelper>("verificationActionsFlowHelper", verificationActionsFlowHelper);

            if (postBootstrapFunc != null)
            {
                await postBootstrapFunc.Invoke();
            }
        }
예제 #3
0
        private static async Task BootstrapAsync(Func <Task> postBootstrapFunc = null)
        {
            await ServiceContainer.Resolve <IEnvironmentService>("environmentService").SetUrlsFromStorageAsync();

            // TODO: Update when https://github.com/bitwarden/mobile/pull/1662 gets merged
            var deleteAccountActionFlowExecutioner = new DeleteAccountActionFlowExecutioner(
                ServiceContainer.Resolve <IApiService>("apiService"),
                ServiceContainer.Resolve <IMessagingService>("messagingService"),
                ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"),
                ServiceContainer.Resolve <IDeviceActionService>("deviceActionService"),
                ServiceContainer.Resolve <ILogger>("logger"));

            ServiceContainer.Register <IDeleteAccountActionFlowExecutioner>("deleteAccountActionFlowExecutioner", deleteAccountActionFlowExecutioner);

            var verificationActionsFlowHelper = new VerificationActionsFlowHelper(
                ServiceContainer.Resolve <IKeyConnectorService>("keyConnectorService"),
                ServiceContainer.Resolve <IPasswordRepromptService>("passwordRepromptService"),
                ServiceContainer.Resolve <ICryptoService>("cryptoService"));

            ServiceContainer.Register <IVerificationActionsFlowHelper>("verificationActionsFlowHelper", verificationActionsFlowHelper);

            var accountsManager = new AccountsManager(
                ServiceContainer.Resolve <IBroadcasterService>("broadcasterService"),
                ServiceContainer.Resolve <IVaultTimeoutService>("vaultTimeoutService"),
                ServiceContainer.Resolve <IStorageService>("secureStorageService"),
                ServiceContainer.Resolve <IStateService>("stateService"),
                ServiceContainer.Resolve <IPlatformUtilsService>("platformUtilsService"),
                ServiceContainer.Resolve <IAuthService>("authService"),
                ServiceContainer.Resolve <ILogger>("logger"));

            ServiceContainer.Register <IAccountsManager>("accountsManager", accountsManager);

            if (postBootstrapFunc != null)
            {
                await postBootstrapFunc.Invoke();
            }
        }