示例#1
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);
            }
        }
        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);
            }
        }
示例#3
0
        public ApiService(
            ITokenService tokenService,
            IPlatformUtilsService platformUtilsService,
            Func <Tuple <string, bool, bool>, Task> logoutCallbackAsync,
            string customUserAgent = null)
        {
            _tokenService         = tokenService;
            _platformUtilsService = platformUtilsService;
            _logoutCallbackAsync  = logoutCallbackAsync;
            var device = (int)_platformUtilsService.GetDevice();

            _httpClient.DefaultRequestHeaders.Add("Device-Type", device.ToString());
            _httpClient.DefaultRequestHeaders.Add("Bitwarden-Client-Name", _platformUtilsService.GetClientType().GetString());
            _httpClient.DefaultRequestHeaders.Add("Bitwarden-Client-Version", _platformUtilsService.GetApplicationVersion());
            if (!string.IsNullOrWhiteSpace(customUserAgent))
            {
                _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(customUserAgent);
            }
        }