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

Commit 1d64b3c

Browse files
committed
Big refactor
1 parent e588776 commit 1d64b3c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+430
-96
lines changed

CodeHub.Core/App.cs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,10 @@ public override void Initialize()
1919
Cirrious.MvvmCross.Plugins.Messenger.PluginLoader.Instance.EnsureLoaded();
2020

2121
var httpService = Mvx.Resolve<IHttpClientService>();
22-
var jsonSerializerService = Mvx.Resolve<IJsonSerializationService>();
2322
GitHubSharp.Client.ClientConstructor = httpService.Create;
24-
GitHubSharp.Client.Serializer = new GitHubSharpSerializer(jsonSerializerService);
2523

2624
// Start the app with the First View Model.
2725
this.RegisterAppStart<StartupViewModel>();
2826
}
29-
30-
class GitHubSharpSerializer : GitHubSharp.ISerializer
31-
{
32-
readonly IJsonSerializationService _service;
33-
public GitHubSharpSerializer(IJsonSerializationService service)
34-
{
35-
this._service = service;
36-
}
37-
public string Serialize(object o)
38-
{
39-
return _service.Serialize(o);
40-
}
41-
public TData Deserialize<TData>(string data)
42-
{
43-
return _service.Deserialize<TData>(data);
44-
}
45-
}
4627
}
4728
}

CodeHub.Core/CodeHub.Core.iOS.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@
121121
<Compile Include="Messages\NotificationCountMessage.cs" />
122122
<Compile Include="Services\IPushNotificationsService.cs" />
123123
<Compile Include="ViewModels\App\AboutViewModel.cs" />
124+
<Compile Include="ViewModels\Source\EditSourceViewModel.cs" />
125+
<Compile Include="Messages\SourceEditMessage.cs" />
124126
</ItemGroup>
125127
<ItemGroup />
126128
<ItemGroup>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using Cirrious.MvvmCross.Plugins.Messenger;
3+
using GitHubSharp.Models;
4+
5+
namespace CodeHub.Core.Messages
6+
{
7+
public class SourceEditMessage : MvxMessage
8+
{
9+
public SourceEditMessage(object sender) : base(sender) {}
10+
11+
public string OldSha;
12+
public string Data;
13+
public ContentUpdateModel Update;
14+
}
15+
}
16+

CodeHub.Core/Services/ApplicationService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ public string GetETag(string url)
6868
return data.CacheTag;
6969
}
7070

71-
public T Get<T>(string url) where T : new()
71+
public byte[] Get(string url)
7272
{
73-
var data = _account.Get<T>(url);
73+
var data = _account.Get(url);
7474
if (data == null)
75-
return default(T);
75+
return null;
7676

7777
System.Console.WriteLine("[GET] cache: {0}", url);
7878
return data;
7979
}
8080

81-
public void Set(string url, object data, string etag)
81+
public void Set(string url, byte[] data, string etag)
8282
{
8383
System.Console.WriteLine("[SET] cache: {0}", url);
8484
_account.Set(url, data, etag);

CodeHub.Core/ViewModels/Events/BaseEventsViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public ICommand GoToGistCommand
123123
get { return new MvxCommand<EventModel.GistEvent>(x => ShowViewModel<GistViewModel>(new GistViewModel.NavObject { Id = x.Gist.Id }), x => x != null && x.Gist != null); }
124124
}
125125

126-
private void GoToIssue(RepositoryIdentifier repo, ulong id)
126+
private void GoToIssue(RepositoryIdentifier repo, long id)
127127
{
128128
if (repo == null || string.IsNullOrEmpty(repo.Name) || string.IsNullOrEmpty(repo.Owner))
129129
return;
@@ -135,7 +135,7 @@ private void GoToIssue(RepositoryIdentifier repo, ulong id)
135135
});
136136
}
137137

138-
private void GoToPullRequest(RepositoryIdentifier repo, ulong id)
138+
private void GoToPullRequest(RepositoryIdentifier repo, long id)
139139
{
140140
if (repo == null || string.IsNullOrEmpty(repo.Name) || string.IsNullOrEmpty(repo.Owner))
141141
return;

CodeHub.Core/ViewModels/Issues/IssueAddViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ protected override async Task Save()
1616
throw new Exception("Issue must have a title!");
1717

1818
string assignedTo = AssignedTo == null ? null : AssignedTo.Login;
19-
uint? milestone = null;
19+
int? milestone = null;
2020
if (Milestone != null)
2121
milestone = Milestone.Number;
2222
string[] labels = Labels.Items.Select(x => x.Name).ToArray();

CodeHub.Core/ViewModels/Issues/IssueAssignedToViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public CollectionViewModel<BasicUserModel> Users
4343

4444
public string Repository { get; private set; }
4545

46-
public ulong Id { get; private set; }
46+
public long Id { get; private set; }
4747

4848
public bool SaveOnSelect { get; private set; }
4949

@@ -97,7 +97,7 @@ public class NavObject
9797
{
9898
public string Username { get; set; }
9999
public string Repository { get; set; }
100-
public ulong Id { get; set; }
100+
public long Id { get; set; }
101101
public bool SaveOnSelect { get; set; }
102102
}
103103
}

CodeHub.Core/ViewModels/Issues/IssueEditViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public IssueModel Issue
3131
}
3232
}
3333

34-
public ulong Id { get; private set; }
34+
public long Id { get; private set; }
3535

3636
protected override async Task Save()
3737
{
@@ -41,7 +41,7 @@ protected override async Task Save()
4141
throw new Exception("Issue must have a title!");
4242

4343
string assignedTo = AssignedTo == null ? null : AssignedTo.Login;
44-
uint? milestone = null;
44+
int? milestone = null;
4545
if (Milestone != null)
4646
milestone = Milestone.Number;
4747
string[] labels = Labels.Items.Select(x => x.Name).ToArray();
@@ -123,7 +123,7 @@ public class NavObject
123123
{
124124
public string Username { get; set; }
125125
public string Repository { get; set; }
126-
public ulong Id { get; set; }
126+
public long Id { get; set; }
127127
}
128128
}
129129
}

CodeHub.Core/ViewModels/Issues/IssueLabelsViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public CollectionViewModel<LabelModel> SelectedLabels
4040

4141
public string Repository { get; private set; }
4242

43-
public ulong Id { get; private set; }
43+
public long Id { get; private set; }
4444

4545
public bool SaveOnSelect { get; private set; }
4646

@@ -105,7 +105,7 @@ public class NavObject
105105
{
106106
public string Username { get; set; }
107107
public string Repository { get; set; }
108-
public ulong Id { get; set; }
108+
public long Id { get; set; }
109109
public bool SaveOnSelect { get; set; }
110110
}
111111
}

CodeHub.Core/ViewModels/Issues/IssueMilestonesViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public CollectionViewModel<MilestoneModel> Milestones
4343

4444
public string Repository { get; private set; }
4545

46-
public ulong Id { get; private set; }
46+
public long Id { get; private set; }
4747

4848
public bool SaveOnSelect { get; private set; }
4949

@@ -65,7 +65,7 @@ private async Task SelectMilestone(MilestoneModel x)
6565
try
6666
{
6767
IsSaving = true;
68-
uint? milestone = null;
68+
int? milestone = null;
6969
if (x != null) milestone = x.Number;
7070
var updateReq = this.GetApplication().Client.Users[Username].Repositories[Repository].Issues[Id].UpdateMilestone(milestone);
7171
var newIssue = await this.GetApplication().Client.ExecuteAsync(updateReq);
@@ -97,7 +97,7 @@ public class NavObject
9797
{
9898
public string Username { get; set; }
9999
public string Repository { get; set; }
100-
public ulong Id { get; set; }
100+
public long Id { get; set; }
101101
public bool SaveOnSelect { get; set; }
102102
}
103103
}

0 commit comments

Comments
 (0)