Esempio n. 1
0
        public static async Task <bool> PerformUpdateTasksAsync(ISyncService syncService,
                                                                IDeviceActionService deviceActionService, IStorageService storageService)
        {
            var currentBuild = deviceActionService.GetBuildNumber();
            var lastBuild    = await storageService.GetAsync <string>(Constants.LastBuildKey);

            if (!Migration.MigrationHelpers.NeedsMigration())
            {
                if (lastBuild == null)
                {
                    // Installed
                    var currentLock = await storageService.GetAsync <int?>(Constants.LockOptionKey);

                    if (currentLock == null)
                    {
                        await storageService.SaveAsync(Constants.LockOptionKey, 15);
                    }
                }
                else if (lastBuild != currentBuild)
                {
                    // Updated
                    var tasks = Task.Run(() => syncService.FullSyncAsync(true));
                }
            }
            if (lastBuild != currentBuild)
            {
                await storageService.SaveAsync(Constants.LastBuildKey, currentBuild);

                return(true);
            }
            return(false);
        }
Esempio n. 2
0
        public static async Task <bool> PerformUpdateTasksAsync(ISyncService syncService,
                                                                IDeviceActionService deviceActionService, IStateService stateService)
        {
            var currentBuild = deviceActionService.GetBuildNumber();
            var lastBuild    = await stateService.GetLastBuildAsync();

            if (lastBuild == null || lastBuild != currentBuild)
            {
                // Updated
                var tasks = Task.Run(() => syncService.FullSyncAsync(true));
                await stateService.SetLastBuildAsync(currentBuild);

                return(true);
            }
            return(false);
        }
Esempio n. 3
0
        public static async Task <bool> PerformUpdateTasksAsync(ISyncService syncService,
                                                                IDeviceActionService deviceActionService, IStorageService storageService)
        {
            var currentBuild = deviceActionService.GetBuildNumber();
            var lastBuild    = await storageService.GetAsync <string>(Constants.LastBuildKey);

            if (lastBuild == null)
            {
                // Installed
                var currentTimeout = await storageService.GetAsync <int?>(Constants.VaultTimeoutKey);

                if (currentTimeout == null)
                {
                    await storageService.SaveAsync(Constants.VaultTimeoutKey, 15);
                }

                var currentAction = await storageService.GetAsync <string>(Constants.VaultTimeoutActionKey);

                if (currentAction == null)
                {
                    await storageService.SaveAsync(Constants.VaultTimeoutActionKey, "lock");
                }
            }
            else if (lastBuild != currentBuild)
            {
                // Updated
                var tasks = Task.Run(() => syncService.FullSyncAsync(true));
            }
            if (lastBuild != currentBuild)
            {
                await storageService.SaveAsync(Constants.LastBuildKey, currentBuild);

                return(true);
            }
            return(false);
        }
        public async Task AboutAsync()
        {
            var debugText = string.Format("{0}: {1} ({2})", AppResources.Version,
                                          _platformUtilsService.GetApplicationVersion(), _deviceActionService.GetBuildNumber());
            var text = string.Format("© Bitwarden Inc. 2015-{0}\n\n{1}", DateTime.Now.Year, debugText);
            var copy = await _platformUtilsService.ShowDialogAsync(text, AppResources.Bitwarden, AppResources.Copy,
                                                                   AppResources.Close);

            if (copy)
            {
                await _platformUtilsService.CopyToClipboardAsync(debugText);
            }
        }
Esempio n. 5
0
        public async Task AboutAsync()
        {
            var debugText = string.Format("{0}: {1} ({2})", AppResources.Version,
                                          _platformUtilsService.GetApplicationVersion(), _deviceActionService.GetBuildNumber());

#if DEBUG
            var pushNotificationsRegistered = ServiceContainer.Resolve <IPushNotificationService>("pushNotificationService").IsRegisteredForPush;
            var pnServerRegDate             = await _stateService.GetPushLastRegistrationDateAsync();

            var pnServerError = await _stateService.GetPushInstallationRegistrationErrorAsync();

            var pnServerRegDateMessage = default(DateTime) == pnServerRegDate ? "-" : $"{pnServerRegDate.GetValueOrDefault().ToShortDateString()}-{pnServerRegDate.GetValueOrDefault().ToShortTimeString()} UTC";
            var errorMessage           = string.IsNullOrEmpty(pnServerError) ? string.Empty : $"Push Notifications Server Registration error: {pnServerError}";

            var text = string.Format("© Bitwarden Inc. 2015-{0}\n\n{1}\nPush Notifications registered:{2}\nPush Notifications Server Last Date :{3}\n{4}", DateTime.Now.Year, debugText, pushNotificationsRegistered, pnServerRegDateMessage, errorMessage);
#else
            var text = string.Format("© Bitwarden Inc. 2015-{0}\n\n{1}", DateTime.Now.Year, debugText);
#endif

            var copy = await _platformUtilsService.ShowDialogAsync(text, AppResources.Bitwarden, AppResources.Copy,
                                                                   AppResources.Close);

            if (copy)
            {
                await _clipboardService.CopyTextAsync(debugText);
            }
        }