mirror of
https://github.com/bitwarden/android.git
synced 2024-10-31 15:15:34 +03: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
5 changed files with 19 additions and 19 deletions
|
@ -66,9 +66,9 @@ namespace Bit.iOS.Core.Services
|
||||||
{
|
{
|
||||||
var record = new SecRecord(SecKind.GenericPassword)
|
var record = new SecRecord(SecKind.GenericPassword)
|
||||||
{
|
{
|
||||||
Service = NSBundle.MainBundle.BundleIdentifier,
|
Service = "com.8bit.bitwarden",
|
||||||
Account = key,
|
Account = key,
|
||||||
AccessGroup = "TEAMID.bitwarden"
|
AccessGroup = "TEAMID.com.8bit.bitwarden"
|
||||||
};
|
};
|
||||||
|
|
||||||
if(data != null)
|
if(data != null)
|
||||||
|
|
|
@ -9,7 +9,6 @@ using Foundation;
|
||||||
using MobileCoreServices;
|
using MobileCoreServices;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using UIKit;
|
using UIKit;
|
||||||
using Microsoft.Practices.Unity;
|
|
||||||
using XLabs.Ioc;
|
using XLabs.Ioc;
|
||||||
|
|
||||||
namespace Bit.iOS.Extension
|
namespace Bit.iOS.Extension
|
||||||
|
@ -33,15 +32,10 @@ namespace Bit.iOS.Extension
|
||||||
{
|
{
|
||||||
base.ViewDidLoad();
|
base.ViewDidLoad();
|
||||||
|
|
||||||
Debug.WriteLine("BW LOG, Container");
|
|
||||||
var siteService = Resolver.Resolve<ISiteService>();
|
var siteService = Resolver.Resolve<ISiteService>();
|
||||||
Debug.WriteLine("BW LOG, siteService: " + siteService);
|
|
||||||
var sites = await siteService.GetAllAsync();
|
var sites = await siteService.GetAllAsync();
|
||||||
Debug.WriteLine("BW LOG, sites: " + sites.Count());
|
|
||||||
var siteModels = sites.Select(s => new SiteViewModel(s));
|
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);
|
var filteredSiteModels = siteModels.Where(s => s.HostName == Context.Url?.Host);
|
||||||
Debug.WriteLine("BW LOG, filteredSiteModels: " + filteredSiteModels.Count());
|
|
||||||
tableView.Source = new TableSource(filteredSiteModels, this);
|
tableView.Source = new TableSource(filteredSiteModels, this);
|
||||||
AutomaticallyAdjustsScrollViewInsets = false;
|
AutomaticallyAdjustsScrollViewInsets = false;
|
||||||
}
|
}
|
||||||
|
@ -98,10 +92,16 @@ namespace Bit.iOS.Extension
|
||||||
|
|
||||||
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
|
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
|
||||||
{
|
{
|
||||||
|
var item = _tableItems.ElementAt(indexPath.Row);
|
||||||
|
if(item == null)
|
||||||
|
{
|
||||||
|
_controller.CompleteRequest(null);
|
||||||
|
}
|
||||||
|
|
||||||
NSDictionary itemData = null;
|
NSDictionary itemData = null;
|
||||||
if(_context.ProviderType == UTType.PropertyList)
|
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 scriptJson = JsonConvert.SerializeObject(fillScript, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||||
var scriptDict = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson);
|
var scriptDict = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson);
|
||||||
itemData = new NSDictionary(NSJavaScriptExtension.FinalizeArgumentKey, scriptDict);
|
itemData = new NSDictionary(NSJavaScriptExtension.FinalizeArgumentKey, scriptDict);
|
||||||
|
@ -109,21 +109,21 @@ namespace Bit.iOS.Extension
|
||||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionFindLoginAction)
|
else if(_context.ProviderType == Constants.UTTypeAppExtensionFindLoginAction)
|
||||||
{
|
{
|
||||||
itemData = new NSDictionary(
|
itemData = new NSDictionary(
|
||||||
Constants.AppExtensionUsernameKey, "me@example.com",
|
Constants.AppExtensionUsernameKey, item.Username,
|
||||||
Constants.AppExtensionPasswordKey, "mypassword");
|
Constants.AppExtensionPasswordKey, item.Password);
|
||||||
}
|
}
|
||||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionFillBrowserAction
|
else if(_context.ProviderType == Constants.UTTypeAppExtensionFillBrowserAction
|
||||||
|| _context.ProviderType == Constants.UTTypeAppExtensionFillWebViewAction)
|
|| _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 });
|
var scriptJson = JsonConvert.SerializeObject(fillScript, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||||
itemData = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson);
|
itemData = new NSDictionary(Constants.AppExtensionWebViewPageFillScript, scriptJson);
|
||||||
}
|
}
|
||||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionSaveLoginAction)
|
else if(_context.ProviderType == Constants.UTTypeAppExtensionSaveLoginAction)
|
||||||
{
|
{
|
||||||
itemData = new NSDictionary(
|
itemData = new NSDictionary(
|
||||||
Constants.AppExtensionUsernameKey, "me@example.com",
|
Constants.AppExtensionUsernameKey, item.Username,
|
||||||
Constants.AppExtensionPasswordKey, "mypassword");
|
Constants.AppExtensionPasswordKey, item.Password);
|
||||||
}
|
}
|
||||||
else if(_context.ProviderType == Constants.UTTypeAppExtensionChangePasswordAction)
|
else if(_context.ProviderType == Constants.UTTypeAppExtensionChangePasswordAction)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>keychain-access-groups</key>
|
<key>keychain-access-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>TEAMID.bitwarden</string>
|
<string>$(AppIdentifierPrefix)com.8bit.bitwarden</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -7,7 +7,7 @@ namespace Bit.iOS.Extension.Models
|
||||||
{
|
{
|
||||||
public class FillScript
|
public class FillScript
|
||||||
{
|
{
|
||||||
public FillScript(PageDetails pageDetails)
|
public FillScript(PageDetails pageDetails, string fillUsername, string fillPassword)
|
||||||
{
|
{
|
||||||
if(pageDetails == null)
|
if(pageDetails == null)
|
||||||
{
|
{
|
||||||
|
@ -36,11 +36,11 @@ namespace Bit.iOS.Extension.Models
|
||||||
if(username != null)
|
if(username != null)
|
||||||
{
|
{
|
||||||
Script.Add(new List<string> { "click_on_opid", username.OpId });
|
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> { "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)
|
if(loginForm.HtmlAction != null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
</array>
|
</array>
|
||||||
<key>keychain-access-groups</key>
|
<key>keychain-access-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>TEAMID.bitwarden</string>
|
<string>$(AppIdentifierPrefix)com.8bit.bitwarden</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
Loading…
Reference in a new issue