Skip to content
This repository was archived by the owner on Jul 2, 2022. It is now read-only.

Commit 6ca7aa5

Browse files
committed
Bug fixes
1 parent 00f807b commit 6ca7aa5

9 files changed

Lines changed: 21 additions & 65 deletions

File tree

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[submodule "lib/CodeFramework"]
22
path = lib/CodeFramework
3-
url = https://thedillonb@github.com/thedillonb/CodeFramework.git
3+
url = git@github.com:thedillonb/CodeFramework.git
44
[submodule "lib/GitHubSharp"]
55
path = lib/GitHubSharp
6-
url = https://thedillonb@github.com/thedillonb/GitHubSharp.git
6+
url = git@github.com:thedillonb/GitHubSharp.git

CodeHub.Core/ViewModels/Gists/GistViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public CollectionViewModel<GistCommentModel> Comments
4848

4949
public ICommand GoToUserCommand
5050
{
51-
get { return new MvxCommand(() => ShowViewModel<ProfileViewModel>(new ProfileViewModel.NavObject { Username = Gist.User.Login }), () => Gist != null && Gist.User != null); }
51+
get { return new MvxCommand(() => ShowViewModel<ProfileViewModel>(new ProfileViewModel.NavObject { Username = Gist.Owner.Login }), () => Gist != null && Gist.Owner != null); }
5252
}
5353

5454
public ICommand GoToFileSourceCommand

CodeHub.Core/ViewModels/Issues/IssueLabelsViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ private async Task SelectLabels(IEnumerable<LabelModel> x)
9898

9999
protected override Task Load(bool forceCacheInvalidation)
100100
{
101-
return Labels.SimpleCollectionLoad(this.GetApplication().Client.Users[Username].Repositories[Repository].GetLabels(), forceCacheInvalidation);
101+
return Labels.SimpleCollectionLoad(this.GetApplication().Client.Users[Username].Repositories[Repository].Labels.GetAll(), forceCacheInvalidation);
102102
}
103103

104104
public class NavObject

CodeHub.iOS/Views/Gists/GistView.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ private void UpdateOwned()
6565
{
6666
//Is it owned?
6767
var app = Cirrious.CrossCore.Mvx.Resolve<CodeHub.Core.Services.IApplicationService>();
68-
if (string.Equals(app.Account.Username, ViewModel.Gist.User.Login, StringComparison.OrdinalIgnoreCase))
68+
if (string.Equals(app.Account.Username, ViewModel.Gist.Owner.Login, StringComparison.OrdinalIgnoreCase))
6969
{
7070
NavigationItem.RightBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Compose, async (s, e) => {
7171
try
@@ -157,8 +157,8 @@ public void RenderGist()
157157
};
158158

159159
//Sometimes there's no user!
160-
d.Name = (model.User == null) ? "Anonymous" : model.User.Login;
161-
d.ImageUri = (model.User == null) ? null : new Uri(model.User.AvatarUrl);
160+
d.Name = (model.Owner == null) ? "Anonymous" : model.Owner.Login;
161+
d.ImageUri = (model.Owner == null) ? null : new Uri(model.Owner.AvatarUrl);
162162

163163
sec.Add(d);
164164

CodeHub.iOS/Views/Gists/GistsView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public override void ViewDidLoad()
2525
Image = Theme.CurrentTheme.AnonymousUserImage
2626
};
2727

28-
sse.Name = (x.User == null) ? "Anonymous" : x.User.Login;
29-
sse.ImageUri = (x.User == null) ? null : new Uri(x.User.AvatarUrl);
28+
sse.Name = (x.Owner == null) ? "Anonymous" : x.Owner.Login;
29+
sse.ImageUri = (x.Owner == null) ? null : new Uri(x.Owner.AvatarUrl);
3030
sse.Tapped += () => vm.GoToGistCommand.Execute(x);
3131
return sse;
3232
});

CodeHub.iOS/Views/Issues/IssueLabelsView.cs

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Linq;
66
using MonoTouch.UIKit;
77
using CodeFramework.iOS.Utils;
8+
using CodeFramework.iOS.Elements;
89

910
namespace CodeHub.iOS.Views.Issues
1011
{
@@ -26,7 +27,7 @@ public override void ViewDidLoad()
2627

2728
BindCollection(vm.Labels, x =>
2829
{
29-
var e = new LabelElement(x);
30+
var e = new LabelElement(x.Name, x.Color);
3031
e.Tapped += () =>
3132
{
3233
if (e.Accessory == UITableViewCellAccessory.Checkmark)
@@ -49,7 +50,8 @@ public override void ViewDidLoad()
4950
var elements = Root[0].Elements;
5051
foreach (var el in elements.Cast<LabelElement>())
5152
{
52-
el.Accessory = vm.SelectedLabels.Contains(el.Label) ?
53+
var element = el;
54+
el.Accessory = vm.SelectedLabels.Any(y => string.Equals(y.Name, element.Name, System.StringComparison.OrdinalIgnoreCase)) ?
5355
UITableViewCellAccessory.Checkmark :
5456
UITableViewCellAccessory.None;
5557
}
@@ -64,44 +66,6 @@ public override void ViewDidLoad()
6466
else _hud.Hide();
6567
});
6668
}
67-
68-
private class LabelElement : StyledStringElement
69-
{
70-
public LabelModel Label { get; private set; }
71-
public LabelElement(LabelModel m)
72-
: base(m.Name)
73-
{
74-
Label = m;
75-
Image = CreateImage(m.Color);
76-
}
77-
78-
private static UIImage CreateImage(string color)
79-
{
80-
try
81-
{
82-
var red = color.Substring(0, 2);
83-
var green = color.Substring(2, 2);
84-
var blue = color.Substring(4, 2);
85-
86-
var redB = System.Convert.ToByte(red, 16);
87-
var greenB = System.Convert.ToByte(green, 16);
88-
var BlueB = System.Convert.ToByte(blue, 16);
89-
90-
var size = new System.Drawing.SizeF(24f, 24f);
91-
92-
UIGraphics.BeginImageContext(size);
93-
UIColor.FromRGB(redB, greenB, BlueB).SetFill();
94-
GraphicsUtil.FillRoundedRect(UIGraphics.GetCurrentContext(), new System.Drawing.RectangleF(0, 0, size.Width, size.Height), 6f);
95-
var image = UIGraphics.GetImageFromCurrentImageContext();
96-
UIGraphics.EndImageContext();
97-
return image;
98-
}
99-
catch
100-
{
101-
return null;
102-
}
103-
}
104-
}
10569
}
10670
}
10771

CodeHub.iOS/Views/Issues/IssueMilestonesView.cs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
using CodeFramework.ViewControllers;
22
using CodeHub.Core.ViewModels.Issues;
3-
using MonoTouch.Dialog;
4-
using GitHubSharp.Models;
53
using System.Linq;
64
using MonoTouch.UIKit;
75
using CodeFramework.iOS.Utils;
6+
using CodeFramework.iOS.Elements;
87

98
namespace CodeHub.iOS.Views.Issues
109
{
@@ -21,9 +20,12 @@ public override void ViewDidLoad()
2120
{
2221
base.ViewDidLoad();
2322

23+
TableView.RowHeight = 80f;
24+
TableView.SeparatorInset = new UIEdgeInsets(0, 0, 0, 0);
25+
2426
var vm = (IssueMilestonesViewModel)ViewModel;
2527
BindCollection(vm.Milestones, x => {
26-
var e = new MilestoneElement(x);
28+
var e = new MilestoneElement(x.Number, x.Title, x.OpenIssues, x.ClosedIssues, x.DueOn);
2729
e.Tapped += () => {
2830
if (vm.SelectedMilestone != null && vm.SelectedMilestone.Number == x.Number)
2931
vm.SelectedMilestone = null;
@@ -40,7 +42,7 @@ public override void ViewDidLoad()
4042
if (Root.Count == 0)
4143
return;
4244
foreach (var m in Root[0].Elements.Cast<MilestoneElement>())
43-
m.Accessory = (x != null && m.Milestone.Number == x.Number) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
45+
m.Accessory = (x != null && m.Number == x.Number) ? UITableViewCellAccessory.Checkmark : UITableViewCellAccessory.None;
4446
Root.Reload(Root[0], UITableViewRowAnimation.None);
4547
});
4648

@@ -51,16 +53,6 @@ public override void ViewDidLoad()
5153
else _hud.Hide();
5254
});
5355
}
54-
55-
private class MilestoneElement : StyledStringElement
56-
{
57-
public MilestoneModel Milestone { get; private set; }
58-
public MilestoneElement(MilestoneModel m)
59-
: base(m.Title)
60-
{
61-
Milestone = m;
62-
}
63-
}
6456
}
6557
}
6658

0 commit comments

Comments
 (0)