2016-07-08 03:53:01 +03:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.Linq;
|
|
|
|
using Bit.App.Abstractions;
|
|
|
|
using Bit.App.Models;
|
|
|
|
using Bit.iOS.Core;
|
|
|
|
using Bit.iOS.Extension.Models;
|
|
|
|
using Foundation;
|
|
|
|
using MobileCoreServices;
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
using UIKit;
|
|
|
|
using XLabs.Ioc;
|
|
|
|
|
|
|
|
namespace Bit.iOS.Extension
|
|
|
|
{
|
|
|
|
public partial class AddSiteViewController : UITableViewController
|
|
|
|
{
|
|
|
|
public AddSiteViewController(IntPtr handle) : base(handle)
|
|
|
|
{ }
|
|
|
|
|
|
|
|
public Context Context { get; set; }
|
|
|
|
|
|
|
|
public override void ViewWillAppear(bool animated)
|
|
|
|
{
|
|
|
|
UINavigationBar.Appearance.ShadowImage = new UIImage();
|
|
|
|
UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
|
|
|
|
|
|
|
|
base.ViewWillAppear(animated);
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void ViewDidLoad()
|
|
|
|
{
|
|
|
|
tableView.RowHeight = UITableView.AutomaticDimension;
|
|
|
|
tableView.EstimatedRowHeight = 44;
|
2016-07-08 07:06:10 +03:00
|
|
|
tableView.Source = new TableSource (this);
|
2016-07-08 03:53:01 +03:00
|
|
|
|
|
|
|
base.ViewDidLoad();
|
|
|
|
}
|
|
|
|
|
|
|
|
partial void UIBarButtonItem2289_Activated(UIBarButtonItem sender)
|
|
|
|
{
|
|
|
|
DismissViewController(true, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
partial void UIBarButtonItem2290_Activated(UIBarButtonItem sender)
|
|
|
|
{
|
|
|
|
DismissViewController(true, null);
|
|
|
|
}
|
2016-07-08 07:06:10 +03:00
|
|
|
|
|
|
|
public class TableSource : UITableViewSource
|
|
|
|
{
|
|
|
|
private AddSiteViewController _controller;
|
|
|
|
|
|
|
|
public TableSource (AddSiteViewController controller)
|
|
|
|
{
|
|
|
|
_controller = controller;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
|
|
|
|
{
|
|
|
|
if (indexPath.Row == 0) {
|
|
|
|
return _controller.nameCell;
|
|
|
|
} else if (indexPath.Row == 1) {
|
|
|
|
return _controller.uriCell;
|
|
|
|
} else if (indexPath.Row == 2) {
|
|
|
|
return _controller.usernameCell;
|
|
|
|
} else if (indexPath.Row == 3) {
|
|
|
|
return _controller.passwordCell;
|
|
|
|
} else if (indexPath.Row == 4) {
|
|
|
|
return _controller.generatePasswordCell;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new UITableViewCell();
|
|
|
|
}
|
|
|
|
|
|
|
|
public override nfloat GetHeightForRow (UITableView tableView, NSIndexPath indexPath)
|
|
|
|
{
|
|
|
|
return UITableView.AutomaticDimension;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override nint RowsInSection (UITableView tableview, nint section)
|
|
|
|
{
|
|
|
|
if (section == 0) {
|
|
|
|
return 5;
|
|
|
|
} else if (section == 1) {
|
|
|
|
return 2;
|
|
|
|
} else {
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override nfloat GetHeightForHeader (UITableView tableView, nint section)
|
|
|
|
{
|
|
|
|
return UITableView.AutomaticDimension;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override string TitleForHeader (UITableView tableView, nint section)
|
|
|
|
{
|
|
|
|
if (section == 0) {
|
|
|
|
return "Site Information";
|
|
|
|
} else if (section == 2) {
|
|
|
|
return "Notes";
|
|
|
|
}
|
|
|
|
|
|
|
|
return " ";
|
|
|
|
}
|
|
|
|
}
|
2016-07-08 03:53:01 +03:00
|
|
|
}
|
|
|
|
}
|