示例#1
0
        private void ReturnCredentials(VaultListPageModel.Login login)
        {
            Intent data = new Intent();

            if (login == null)
            {
                data.PutExtra("canceled", "true");
            }
            else
            {
                var isPremium       = Resolver.Resolve <ITokenService>()?.TokenPremium ?? false;
                var autoCopyEnabled = !_settings.GetValueOrDefault(Constants.SettingDisableTotpCopy, false);
                if (isPremium && autoCopyEnabled && _deviceActionService != null && login.Totp.Value != null)
                {
                    _deviceActionService.CopyToClipboard(App.Utilities.Crypto.Totp(login.Totp.Value));
                }

                data.PutExtra("uri", login.Uri.Value);
                data.PutExtra("username", login.Username);
                data.PutExtra("password", login.Password.Value);
            }

            if (Parent == null)
            {
                SetResult(Result.Ok, data);
            }
            else
            {
                Parent.SetResult(Result.Ok, data);
            }

            Finish();
        }