mirror of
https://github.com/bitwarden/mobile.git
synced 2024-12-22 16:18:21 +01:00
Same service for keychain storage across apps. Changed keychain access group name. Updated fill script with results from site selection in extension.
This commit is contained in:
parent
1307b6a1b2
commit
e7fef012b8
@ -66,9 +66,9 @@ namespace Bit.iOS.Core.Services
|
||||
{
|
||||
var record = new SecRecord(SecKind.GenericPassword)
|
||||
{
|
||||
Service = NSBundle.MainBundle.BundleIdentifier,
|
||||
Service = "com.8bit.bitwarden",
|
||||
Account = key,
|
||||
AccessGroup = "TEAMID.bitwarden"
|
||||
AccessGroup = "TEAMID.com.8bit.bitwarden"
|
||||
};
|
||||
|
||||
if(data != null)
|
||||
|
@ -9,7 +9,6 @@ using Foundation;
|
||||
using MobileCoreServices;
|
||||
using Newtonsoft.Json;
|
||||
using UIKit;
|
||||
using Microsoft.Practices.Unity;
|
||||
using XLabs.Ioc;
|
||||
|
||||
namespace Bit.iOS.Extension
|
||||
@ -33,15 +32,10 @@ namespace Bit.iOS.Extension
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
|
||||
Debug.WriteLine("BW LOG, Container");
|
||||
var siteService = Resolver.Resolve<ISiteService>();
|
||||
Debug.WriteLine("BW LOG, siteService: " + siteService);
|
||||
var sites = await siteService.GetAllAsync();
|
||||
Debug.WriteLine("BW LOG, sites: " + sites.Count());
|
||||
var siteModels = sites.Select(s => new SiteViewModel(s));
|
||||
Debug.WriteLine("BW LOG, siteModels: " + siteModels.Count());
|
||||
var filteredSiteModels = siteModels.Where(s => s.HostName == Context.Url?.Host);
|
||||
Debug.WriteLine("BW LOG, filteredSiteModels: " + filteredSiteModels.Count());
|
||||
tableView.Source = new TableSource(filteredSiteModels, this);
|
||||
AutomaticallyAdjustsScrollViewInsets = false;
|
||||
}
|
||||
@ -98,10 +92,16 @@ namespace Bit.iOS.Extension
|
||||
|
||||
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
|
||||
{
|
||||
var item = _tableItems.ElementAt(indexPath.Row);
|
||||
if(item == null)
|
||||
{
|
||||
_controller.CompleteRequest(null);
|
||||
}
|
||||
|
||||
NSDictionary itemData = null;
|
||||
if(_context.ProviderType == UTType.PropertyList)
|
||||
{
|
||||
var fillScript = new FillScript(_context.Details);
|
||||
var fillScript = new FillScript(_context.Details, item.Username, item.Password);
|
||||
var scriptJson = JsonConvert.SerializeObject(fillScript, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
var scriptDict = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson);
|
||||
itemData = new NSDictionary(NSJavaScriptExtension.FinalizeArgumentKey, scriptDict);
|
||||
@ -109,21 +109,21 @@ namespace Bit.iOS.Extension
|
||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionFindLoginAction)
|
||||
{
|
||||
itemData = new NSDictionary(
|
||||
Constants.AppExtensionUsernameKey, "me@example.com",
|
||||
Constants.AppExtensionPasswordKey, "mypassword");
|
||||
Constants.AppExtensionUsernameKey, item.Username,
|
||||
Constants.AppExtensionPasswordKey, item.Password);
|
||||
}
|
||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionFillBrowserAction
|
||||
|| _context.ProviderType == Constants.UTTypeAppExtensionFillWebViewAction)
|
||||
{
|
||||
var fillScript = new FillScript(_context.Details);
|
||||
var fillScript = new FillScript(_context.Details, item.Username, item.Password);
|
||||
var scriptJson = JsonConvert.SerializeObject(fillScript, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
itemData = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson);
|
||||
}
|
||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionSaveLoginAction)
|
||||
{
|
||||
itemData = new NSDictionary(
|
||||
Constants.AppExtensionUsernameKey, "me@example.com",
|
||||
Constants.AppExtensionPasswordKey, "mypassword");
|
||||
Constants.AppExtensionUsernameKey, item.Username,
|
||||
Constants.AppExtensionPasswordKey, item.Password);
|
||||
}
|
||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionChangePasswordAction)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
</array>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>TEAMID.bitwarden</string>
|
||||
<string>$(AppIdentifierPrefix)com.8bit.bitwarden</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -7,7 +7,7 @@ namespace Bit.iOS.Extension.Models
|
||||
{
|
||||
public class FillScript
|
||||
{
|
||||
public FillScript(PageDetails pageDetails)
|
||||
public FillScript(PageDetails pageDetails, string fillUsername, string fillPassword)
|
||||
{
|
||||
if(pageDetails == null)
|
||||
{
|
||||
@ -36,11 +36,11 @@ namespace Bit.iOS.Extension.Models
|
||||
if(username != null)
|
||||
{
|
||||
Script.Add(new List<string> { "click_on_opid", username.OpId });
|
||||
Script.Add(new List<string> { "fill_by_opid", username.OpId, "me@example.com" });
|
||||
Script.Add(new List<string> { "fill_by_opid", username.OpId, fillUsername });
|
||||
}
|
||||
|
||||
Script.Add(new List<string> { "click_on_opid", password.OpId });
|
||||
Script.Add(new List<string> { "fill_by_opid", password.OpId, "mypassword" });
|
||||
Script.Add(new List<string> { "fill_by_opid", password.OpId, fillPassword });
|
||||
|
||||
if(loginForm.HtmlAction != null)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
</array>
|
||||
<key>keychain-access-groups</key>
|
||||
<array>
|
||||
<string>TEAMID.bitwarden</string>
|
||||
<string>$(AppIdentifierPrefix)com.8bit.bitwarden</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
Loading…
Reference in New Issue
Block a user