Skip to content

Commit

Permalink
Merge branch 'bitwarden:master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhane authored Sep 27, 2023
2 parents e759e44 + 218a30b commit 4fefcab
Show file tree
Hide file tree
Showing 114 changed files with 1,236 additions and 570 deletions.
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
# Unless a later match takes precedence
# @bitwarden/tech-leads

@bitwarden/dept-development-mobile

## Auth team files ##

## Platform team files ##
Expand Down
8 changes: 5 additions & 3 deletions src/Android/Autofill/AutofillHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Bit.Core.Abstractions;
using SaveFlags = Android.Service.Autofill.SaveFlags;
using Bit.Droid.Utilities;
using Bit.Core.Services;

namespace Bit.Droid.Autofill
{
Expand Down Expand Up @@ -152,23 +153,24 @@ public static class AutofillHelpers
"androidapp://com.oneplus.applocker",
};

public static async Task<List<FilledItem>> GetFillItemsAsync(Parser parser, ICipherService cipherService)
public static async Task<List<FilledItem>> GetFillItemsAsync(Parser parser, ICipherService cipherService, IUserVerificationService userVerificationService)
{
var userHasMasterPassword = await userVerificationService.HasMasterPasswordAsync();
if (parser.FieldCollection.FillableForLogin)
{
var ciphers = await cipherService.GetAllDecryptedByUrlAsync(parser.Uri);
if (ciphers.Item1.Any() || ciphers.Item2.Any())
{
var allCiphers = ciphers.Item1.ToList();
allCiphers.AddRange(ciphers.Item2.ToList());
var nonPromptCiphers = allCiphers.Where(cipher => cipher.Reprompt == CipherRepromptType.None);
var nonPromptCiphers = allCiphers.Where(cipher => !userHasMasterPassword || cipher.Reprompt == CipherRepromptType.None);
return nonPromptCiphers.Select(c => new FilledItem(c)).ToList();
}
}
else if (parser.FieldCollection.FillableForCard)
{
var ciphers = await cipherService.GetAllDecryptedAsync();
return ciphers.Where(c => c.Type == CipherType.Card && c.Reprompt == CipherRepromptType.None).Select(c => new FilledItem(c)).ToList();
return ciphers.Where(c => c.Type == CipherType.Card && (!userHasMasterPassword || c.Reprompt == CipherRepromptType.None)).Select(c => new FilledItem(c)).ToList();
}
return new List<FilledItem>();
}
Expand Down
10 changes: 5 additions & 5 deletions src/Android/Autofill/AutofillService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Bit.Core;
using Bit.Core.Abstractions;
using Bit.Core.Enums;
using Bit.Core.Services;
using Bit.Core.Utilities;

namespace Bit.Droid.Autofill
Expand All @@ -26,6 +27,7 @@ public class AutofillService : Android.Service.Autofill.AutofillService
private IPolicyService _policyService;
private IStateService _stateService;
private LazyResolve<ILogger> _logger = new LazyResolve<ILogger>("logger");
private IUserVerificationService _userVerificationService;

public async override void OnFillRequest(FillRequest request, CancellationSignal cancellationSignal,
FillCallback callback)
Expand Down Expand Up @@ -64,11 +66,9 @@ public async override void OnFillRequest(FillRequest request, CancellationSignal
var locked = await _vaultTimeoutService.IsLockedAsync();
if (!locked)
{
if (_cipherService == null)
{
_cipherService = ServiceContainer.Resolve<ICipherService>("cipherService");
}
items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService);
_cipherService ??= ServiceContainer.Resolve<ICipherService>();
_userVerificationService ??= ServiceContainer.Resolve<IUserVerificationService>();
items = await AutofillHelpers.GetFillItemsAsync(parser, _cipherService, _userVerificationService);
}

// build response
Expand Down
2 changes: 1 addition & 1 deletion src/Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="2023.8.1" android:installLocation="internalOnly" package="com.x8bit.bitwarden">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:versionCode="1" android:versionName="2023.9.2" android:installLocation="internalOnly" package="com.x8bit.bitwarden">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="33" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.NFC" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public bool IsAccount

public bool ShowHostname
{
get => !string.IsNullOrWhiteSpace(AccountView.Hostname) && AccountView.Hostname != "vault.bitwarden.com";
get => !string.IsNullOrWhiteSpace(AccountView.Hostname);
}

public bool IsActive
Expand Down
Loading

0 comments on commit 4fefcab

Please sign in to comment.