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

Commit d8c7d45

Browse files
committed
Merge branch 'develop'
2 parents 63507d8 + aaee073 commit d8c7d45

File tree

183 files changed

+4251
-3668
lines changed

Some content is hidden

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

183 files changed

+4251
-3668
lines changed

CodeHub.Core/App.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ public class App : MvxApplication
1414
public override void Initialize()
1515
{
1616
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
17-
18-
//Ensure this is loaded
19-
MvvmCross.Plugins.Messenger.PluginLoader.Instance.EnsureLoaded();
2017
}
2118
}
2219
}

CodeHub.Core/Bootstrap/MessengerPluginBootstrap.cs

Lines changed: 0 additions & 9 deletions
This file was deleted.

CodeHub.Core/CodeHub.Core.iOS.csproj

Lines changed: 72 additions & 61 deletions
Large diffs are not rendered by default.

CodeHub.Core/Data/Account.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.Collections.Generic;
2-
using MvvmCross.Platform;
2+
using Newtonsoft.Json;
33

44
namespace CodeHub.Core.Data
55
{
@@ -88,8 +88,7 @@ public static class FilterExtensions
8888
{
8989
try
9090
{
91-
var serializer = Mvx.Resolve<Services.IJsonSerializationService>();
92-
return serializer.Deserialize<T>(filter.RawData);
91+
return JsonConvert.DeserializeObject<T>(filter.RawData);
9392
}
9493
catch
9594
{
@@ -99,8 +98,7 @@ public static class FilterExtensions
9998

10099
public static void SetData(this Filter filter, object o)
101100
{
102-
var serializer = Mvx.Resolve<Services.IJsonSerializationService>();
103-
filter.RawData = serializer.Serialize(o);
101+
filter.RawData = JsonConvert.SerializeObject(o);
104102
}
105103
}
106104
}

CodeHub.Core/Data/LanguageRepository.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Threading.Tasks;
1+
using System.Threading.Tasks;
32
using System.Collections.Generic;
43
using System.Net.Http;
54
using GitHubSharp;

CodeHub.Core/Data/TrendingRepository.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,29 @@
22
using System.Collections.Generic;
33
using System.Threading.Tasks;
44
using System.Net.Http;
5-
using GitHubSharp;
65

76
namespace CodeHub.Core.Data
87
{
98
public interface ITrendingRepository
109
{
11-
Task<IList<GitHubSharp.Models.RepositoryModel>> GetTrendingRepositories(string since, string language = null);
10+
Task<IList<Octokit.Repository>> GetTrendingRepositories(string since, string language = null);
1211
}
1312

1413
public class TrendingRepository : ITrendingRepository
1514
{
1615
private const string TrendingUrl = "http://trending.codehub-app.com/v2/trending";
1716

18-
public async Task<IList<GitHubSharp.Models.RepositoryModel>> GetTrendingRepositories(string since, string language = null)
17+
public async Task<IList<Octokit.Repository>> GetTrendingRepositories(string since, string language = null)
1918
{
20-
var query = "?since=" + since;
19+
var query = "?since=" + Uri.EscapeDataString(since);
2120
if (!string.IsNullOrEmpty(language))
22-
query += string.Format("&language={0}", language);
21+
query += string.Format("&language={0}", Uri.EscapeDataString(language));
2322

2423
var client = new HttpClient();
25-
var serializer = new SimpleJsonSerializer();
24+
var serializer = new Octokit.Internal.SimpleJsonSerializer();
2625
var msg = await client.GetAsync(TrendingUrl + query).ConfigureAwait(false);
2726
var content = await msg.Content.ReadAsStringAsync().ConfigureAwait(false);
28-
return serializer.Deserialize<List<GitHubSharp.Models.RepositoryModel>>(content);
27+
return serializer.Deserialize<List<Octokit.Repository>>(content);
2928
}
3029
}
3130
}
Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,14 @@
11
using System;
2-
using System.Reactive;
3-
using System.Reactive.Disposables;
42
using System.Reactive.Linq;
5-
using System.Windows.Input;
6-
using UIKit;
7-
83

94
// ReSharper disable once CheckNamespace
105
namespace ReactiveUI
116
{
127
public static class ReactiveCommandExtensions
138
{
14-
public static void ExecuteIfCan(this ICommand @this, object o)
15-
{
16-
if (@this == null)
17-
return;
18-
19-
if (@this.CanExecute(o))
20-
@this.Execute(o);
21-
}
22-
23-
public static void ExecuteIfCan(this ICommand @this)
24-
{
25-
ExecuteIfCan(@this, null);
26-
}
27-
28-
public static IReactiveCommand<T> WithSubscription<T>(this IReactiveCommand<T> @this, Action<T> action)
29-
{
30-
@this.Subscribe(action);
31-
return @this;
32-
}
33-
34-
public static IDisposable ToBarButtonItem(this IObservable<IReactiveCommand> @this, UIImage image, Action<UIBarButtonItem> assignment)
9+
public static IDisposable ExecuteNow<TParam, TResult>(this ReactiveCommand<TParam, TResult> cmd, TParam param = default(TParam))
3510
{
36-
return ToBarButtonItem(@this, () => new UIBarButtonItem { Image = image }, assignment);
37-
}
38-
39-
public static IDisposable ToBarButtonItem(this IObservable<IReactiveCommand> @this, UIBarButtonSystemItem systemItem, Action<UIBarButtonItem> assignment)
40-
{
41-
return ToBarButtonItem(@this, () => new UIBarButtonItem(systemItem), assignment);
42-
}
43-
44-
public static IDisposable ToBarButtonItem(this IObservable<IReactiveCommand> @this, Func<UIBarButtonItem> creator, Action<UIBarButtonItem> assignment)
45-
{
46-
var unassignDisposable = Disposable.Create(() => assignment(null));
47-
IDisposable recentEventDisposable = Disposable.Empty;
48-
49-
var mainDisposable = @this.Subscribe(x => {
50-
recentEventDisposable?.Dispose();
51-
52-
var button = creator();
53-
var canExecuteDisposable = x.CanExecuteObservable.Subscribe(t => button.Enabled = t);
54-
var clickDisposable = Observable.FromEventPattern(t => button.Clicked += t, t => button.Clicked -= t)
55-
.Select(_ => Unit.Default)
56-
.InvokeCommand(x);
57-
58-
recentEventDisposable = new CompositeDisposable(clickDisposable, canExecuteDisposable);
59-
assignment(button);
60-
});
61-
62-
return new CompositeDisposable(mainDisposable, unassignDisposable, Disposable.Create(() => recentEventDisposable.Dispose()));
11+
return cmd.CanExecute.Take(1).Where(x => x).Select(_ => param).InvokeCommand(cmd);
6312
}
6413
}
6514
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace System
2+
{
3+
public static class ExceptionExtensions
4+
{
5+
public static Exception GetInnerException(this Exception This)
6+
{
7+
var ex = This;
8+
while (ex.InnerException != null)
9+
ex = ex.InnerException;
10+
return ex;
11+
}
12+
}
13+
}

CodeHub.Core/Extensions/FunctionalExtensions.cs

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1-

2-
// Analysis disable once CheckNamespace
3-
namespace System.Reactive.Linq
4-
{
5-
using System;
6-
7-
public static class ObservableExtensions
8-
{
9-
public static IObservable<T> IsNotNull<T>(this IObservable<T> @this) where T : class
10-
{
11-
return @this.Where(x => x != null);
12-
}
13-
}
14-
}
15-
16-
// Analysis disable once CheckNamespace
17-
namespace System
18-
{
19-
using System;
20-
using System.Windows.Input;
21-
using System.Reactive.Disposables;
22-
using System.Reactive.Linq;
23-
24-
public static class ObservableExtensions
25-
{
26-
public static IDisposable BindCommand<T>(this IObservable<T> @this, ICommand command)
27-
{
28-
return command == null ? Disposable.Empty : @this.Where(x => command.CanExecute(x)).Subscribe(x => command.Execute(x));
29-
}
30-
}
31-
}
1+
// Analysis disable once CheckNamespace
2+
namespace System
3+
{
4+
using System;
5+
using System.Windows.Input;
6+
using System.Reactive.Disposables;
7+
using System.Reactive.Linq;
8+
9+
public static class ObservableExtensions
10+
{
11+
public static IDisposable BindCommand<T>(this IObservable<T> @this, ICommand command)
12+
{
13+
return command == null ? Disposable.Empty : @this.Where(x => command.CanExecute(x)).Subscribe(x => command.Execute(x));
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)