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

Commit 1f232be

Browse files
committed
Fixed crash during UIActionView
1 parent 980a87f commit 1f232be

11 files changed

Lines changed: 108 additions & 162 deletions

File tree

CodeHub.Core/ViewModels/App/MenuViewModel.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,15 @@ public ICommand LoadCommand
158158

159159
private async void Load()
160160
{
161-
var t1 = this.GetApplication().Client.ExecuteAsync(this.GetApplication().Client.Notifications.GetAll()).ContinueWith(x =>
161+
this.GetApplication().Client.ExecuteAsync(this.GetApplication().Client.Notifications.GetAll()).ContinueWith(x =>
162162
{
163163
Notifications = x.Result.Data.Count;
164-
}, TaskContinuationOptions.OnlyOnRanToCompletion);
164+
}, TaskContinuationOptions.OnlyOnRanToCompletion).FireAndForget();
165165

166-
var t2 = this.GetApplication().Client.ExecuteAsync(this.GetApplication().Client.AuthenticatedUser.GetOrganizations()).ContinueWith(x =>
166+
this.GetApplication().Client.ExecuteAsync(this.GetApplication().Client.AuthenticatedUser.GetOrganizations()).ContinueWith(x =>
167167
{
168168
Organizations = x.Result.Data.Select(y => y.Login).ToList();
169-
},TaskContinuationOptions.OnlyOnRanToCompletion);
170-
171-
await Task.WhenAll(t1, t2);
169+
}, TaskContinuationOptions.OnlyOnRanToCompletion).FireAndForget();
172170
}
173171
}
174172
}

CodeHub.Core/ViewModels/Gists/GistViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public ICommand GoToViewableFileCommand
6767

6868
public ICommand GoToHtmlUrlCommand
6969
{
70-
get { return new MvxCommand(() => ShowViewModel<WebBrowserViewModel>(new WebBrowserViewModel.NavObject { Url = _gist.HtmlUrl }), () => _gist != null); }
70+
get { return new MvxCommand(() => GoToUrlCommand.Execute(_gist.HtmlUrl), () => _gist != null); }
7171
}
7272

7373
public ICommand ForkCommand

CodeHub.Core/ViewModels/Repositories/ReadmeViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public string Path
3131

3232
public ICommand GoToGitHubCommand
3333
{
34-
get { return new MvxCommand(() => ShowViewModel<WebBrowserViewModel>(new WebBrowserViewModel.NavObject { Url = _contentModel.HtmlUrl }), () => _contentModel != null); }
34+
get { return new MvxCommand(() => GoToUrlCommand.Execute(_contentModel.HtmlUrl), () => _contentModel != null); }
3535
}
3636

3737
public ICommand GoToLinkCommand
3838
{
39-
get { return new MvxCommand<string>(x => ShowViewModel<WebBrowserViewModel>(new WebBrowserViewModel.NavObject { Url = x })); }
39+
get { return GoToUrlCommand; }
4040
}
4141

4242
protected override async Task Load(bool forceCacheInvalidation)

CodeHub.Core/ViewModels/ViewModelExtensions.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ public static class ViewModelExtensions
3030

3131
if (result.WasCached)
3232
{
33-
try
34-
{
35-
request.RequestFromCache = false;
36-
var r = application.Client.Execute(request);
37-
uiThrad.MarshalOnUIThread(() => update(r));
38-
}
39-
catch (NotModifiedException)
40-
{
41-
Console.WriteLine("Not modified: " + request.Url);
42-
}
43-
catch (Exception)
33+
request.RequestFromCache = false;
34+
35+
Task.Run(() =>
4436
{
45-
Console.WriteLine("SHIT! " + request.Url);
46-
}
37+
try
38+
{
39+
var r = application.Client.Execute(request);
40+
uiThrad.MarshalOnUIThread(() => update(r));
41+
}
42+
catch (NotModifiedException)
43+
{
44+
System.Diagnostics.Debug.WriteLine("Not modified: " + request.Url);
45+
}
46+
}).FireAndForget();
4747
}
4848
});
49-
}
49+
}
5050

5151
public static void CreateMore<T>(this MvxViewModel viewModel, GitHubResponse<T> response,
5252
Action<Task> assignMore, Action<T> newDataAction) where T : new()

CodeHub.iOS/CodeHub.iOS.csproj

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,6 @@
188188
<Project>{2698B412-26A3-4269-AA01-AC3BC79A0F14}</Project>
189189
<Name>CodeFramework.iOS</Name>
190190
</ProjectReference>
191-
<ProjectReference Include="..\lib\CodeFramework\CodeFramework.iOS\lib\MonoTouch.Dialog\MonoTouch.Dialog\MonoTouch.Dialog.csproj">
192-
<Project>{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}</Project>
193-
<Name>MonoTouch.Dialog</Name>
194-
</ProjectReference>
195-
<ProjectReference Include="..\lib\CodeFramework\CodeFramework.iOS\lib\MonoTouch.SlideoutNavigation\MonoTouch.SlideoutNavigation\MonoTouch.SlideoutNavigation.csproj">
196-
<Project>{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}</Project>
197-
<Name>MonoTouch.SlideoutNavigation</Name>
198-
</ProjectReference>
199191
<ProjectReference Include="..\CodeHub.Core\CodeHub.Core.iOS.csproj">
200192
<Project>{B7970173-9022-466B-B57A-7AB1E1F3145F}</Project>
201193
<Name>CodeHub.Core.iOS</Name>
@@ -239,6 +231,12 @@
239231
<Reference Include="MTiRate">
240232
<HintPath>..\lib\CodeFramework\lib\iOS\MTiRate.dll</HintPath>
241233
</Reference>
234+
<Reference Include="MonoTouch.Dialog">
235+
<HintPath>..\lib\CodeFramework\lib\iOS\MonoTouch.Dialog.dll</HintPath>
236+
</Reference>
237+
<Reference Include="MonoTouch.Slideout">
238+
<HintPath>..\lib\CodeFramework\lib\iOS\MonoTouch.Slideout.dll</HintPath>
239+
</Reference>
242240
</ItemGroup>
243241
<ItemGroup>
244242
<Content Include="Images\anonymous%402x.png" />

CodeHub.iOS/CodeHub.iOS.sln

Lines changed: 0 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Lib", "Lib", "{F7C14107-24A
1515
EndProject
1616
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHubSharp.MonoTouch", "..\lib\GitHubSharp\GitHubSharp.MonoTouch.csproj", "{89E14828-85BB-4790-9B4E-E44DD4CE000E}"
1717
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoTouch.Dialog", "..\lib\CodeFramework\CodeFramework.iOS\lib\MonoTouch.Dialog\MonoTouch.Dialog\MonoTouch.Dialog.csproj", "{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}"
19-
EndProject
20-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MonoTouch.SlideoutNavigation", "..\lib\CodeFramework\CodeFramework.iOS\lib\MonoTouch.SlideoutNavigation\MonoTouch.SlideoutNavigation\MonoTouch.SlideoutNavigation.csproj", "{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}"
21-
EndProject
2218
Global
2319
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2420
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@@ -77,78 +73,6 @@ Global
7773
{2698B412-26A3-4269-AA01-AC3BC79A0F14}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
7874
{2698B412-26A3-4269-AA01-AC3BC79A0F14}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
7975
{2698B412-26A3-4269-AA01-AC3BC79A0F14}.Release|Mixed Platforms.Build.0 = Release|Any CPU
80-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|Any CPU.ActiveCfg = Debug|iPhoneSimulator
81-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|Any CPU.Build.0 = Debug|iPhoneSimulator
82-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhone.ActiveCfg = AdHoc|iPhone
83-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|iPhone.ActiveCfg = Release|iPhone
84-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhone.Build.0 = AdHoc|iPhone
85-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|iPhone.Build.0 = Release|iPhone
86-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhoneSimulator.ActiveCfg = AdHoc|iPhoneSimulator
87-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
88-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AdHoc|iPhoneSimulator.Build.0 = AdHoc|iPhoneSimulator
89-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
90-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|Mixed Platforms.ActiveCfg = Debug|iPhoneSimulator
91-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Ad-Hoc|Mixed Platforms.Build.0 = Debug|iPhoneSimulator
92-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|Any CPU.ActiveCfg = Debug|iPhoneSimulator
93-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|Any CPU.Build.0 = Debug|iPhoneSimulator
94-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
95-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhone.Build.0 = AppStore|iPhone
96-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
97-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
98-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|Mixed Platforms.ActiveCfg = Debug|iPhoneSimulator
99-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.AppStore|Mixed Platforms.Build.0 = Debug|iPhoneSimulator
100-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|Any CPU.ActiveCfg = Debug|iPhoneSimulator
101-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|Any CPU.Build.0 = Debug|iPhoneSimulator
102-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhone.ActiveCfg = Debug|iPhone
103-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhone.Build.0 = Debug|iPhone
104-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
105-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
106-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|Mixed Platforms.ActiveCfg = Debug|iPhoneSimulator
107-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Debug|Mixed Platforms.Build.0 = Debug|iPhoneSimulator
108-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|Any CPU.ActiveCfg = Release|iPhoneSimulator
109-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|Any CPU.Build.0 = Release|iPhoneSimulator
110-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhone.ActiveCfg = Release|iPhone
111-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhone.Build.0 = Release|iPhone
112-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
113-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
114-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|Mixed Platforms.ActiveCfg = Release|iPhoneSimulator
115-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50}.Release|Mixed Platforms.Build.0 = Release|iPhoneSimulator
116-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
117-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
118-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AdHoc|iPhone.ActiveCfg = Debug|Any CPU
119-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
120-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AdHoc|iPhone.Build.0 = Debug|Any CPU
121-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
122-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AdHoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
123-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
124-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AdHoc|iPhoneSimulator.Build.0 = Debug|Any CPU
125-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
126-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|Mixed Platforms.ActiveCfg = Debug|Any CPU
127-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Ad-Hoc|Mixed Platforms.Build.0 = Debug|Any CPU
128-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
129-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|Any CPU.Build.0 = Debug|Any CPU
130-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|iPhone.ActiveCfg = Release|Any CPU
131-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|iPhone.Build.0 = Release|Any CPU
132-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
133-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
134-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|Mixed Platforms.ActiveCfg = Debug|Any CPU
135-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.AppStore|Mixed Platforms.Build.0 = Debug|Any CPU
136-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
137-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|Any CPU.Build.0 = Debug|Any CPU
138-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|iPhone.ActiveCfg = Debug|Any CPU
139-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|iPhone.Build.0 = Debug|Any CPU
140-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
141-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
142-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
143-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
144-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|Any CPU.ActiveCfg = Release|Any CPU
145-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|Any CPU.Build.0 = Release|Any CPU
146-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|iPhone.ActiveCfg = Release|Any CPU
147-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|iPhone.Build.0 = Release|Any CPU
148-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
149-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
150-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
151-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6}.Release|Mixed Platforms.Build.0 = Release|Any CPU
15276
{89E14828-85BB-4790-9B4E-E44DD4CE000E}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
15377
{89E14828-85BB-4790-9B4E-E44DD4CE000E}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
15478
{89E14828-85BB-4790-9B4E-E44DD4CE000E}.AdHoc|iPhone.ActiveCfg = Debug|Any CPU
@@ -298,8 +222,6 @@ Global
298222
{C99FE7E3-0985-48F1-9EBB-91680A795F0F} = {F112095C-7262-445E-91C4-D35C1E986E69}
299223
{B7970173-9022-466B-B57A-7AB1E1F3145F} = {F112095C-7262-445E-91C4-D35C1E986E69}
300224
{89E14828-85BB-4790-9B4E-E44DD4CE000E} = {F7C14107-24A4-404A-AD12-A12EC9F28490}
301-
{3FFBFFF8-5560-4EDE-82E5-3FFDFBBA8A50} = {F7C14107-24A4-404A-AD12-A12EC9F28490}
302-
{6D7B9B53-CFEF-46BE-A608-14A4A1381CF6} = {F7C14107-24A4-404A-AD12-A12EC9F28490}
303225
EndGlobalSection
304226
GlobalSection(MonoDevelopProperties) = preSolution
305227
StartupItem = CodeHub.iOS.csproj

CodeHub.iOS/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@
2121
<key>CFBundleIdentifier</key>
2222
<string>com.dillonbuchanan.codehub</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>2.0.1</string>
24+
<string>2.0.2</string>
2525
<key>CFBundleVersion</key>
26-
<string>2.0.1</string>
26+
<string>2.0.2</string>
2727
<key>CFBundleIconFiles</key>
2828
<array>
2929
<string>Icon-Small-50</string>

CodeHub.iOS/Views/Gists/GistView.cs

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,26 @@ private void ShareButtonPress()
115115
var cancelButton = sheet.AddButton("Cancel".t());
116116
sheet.CancelButtonIndex = cancelButton;
117117
sheet.DismissWithClickedButtonIndex(cancelButton, true);
118-
sheet.Clicked += (s, e) => {
119-
if (e.ButtonIndex == shareButton)
120-
{
121-
var item = UIActivity.FromObject (ViewModel.Gist.HtmlUrl);
122-
var activityItems = new NSObject[] { item };
123-
UIActivity[] applicationActivities = null;
124-
var activityController = new UIActivityViewController (activityItems, applicationActivities);
125-
PresentViewController (activityController, true, null);
126-
}
127-
else if (e.ButtonIndex == showButton)
118+
sheet.Clicked += (s, e) =>
119+
{
120+
try
121+
{
122+
if (e.ButtonIndex == shareButton)
123+
{
124+
var item = new NSUrl(ViewModel.Gist.HtmlUrl);
125+
var activityItems = new NSObject[] { item };
126+
UIActivity[] applicationActivities = null;
127+
var activityController = new UIActivityViewController (activityItems, applicationActivities);
128+
PresentViewController (activityController, true, null);
129+
}
130+
else if (e.ButtonIndex == showButton)
131+
{
132+
ViewModel.GoToHtmlUrlCommand.Execute(null);
133+
}
134+
}
135+
catch (Exception ex)
128136
{
129-
ViewModel.GoToHtmlUrlCommand.Execute(null);
130-
}
137+
}
131138
};
132139

133140
sheet.ShowFrom(_shareButton, true);

CodeHub.iOS/Views/Source/ChangesetView.cs

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using MonoTouch.UIKit;
88
using CodeFramework.iOS.Utils;
99
using System.Linq;
10+
using MonoTouch.Foundation;
1011

1112
namespace CodeHub.iOS.Views.Source
1213
{
@@ -168,28 +169,35 @@ private void ShowExtraMenu()
168169
var cancelButton = sheet.AddButton("Cancel".t());
169170
sheet.CancelButtonIndex = cancelButton;
170171
sheet.DismissWithClickedButtonIndex(cancelButton, true);
171-
sheet.Clicked += (s, e) => {
172-
// Pin to menu
173-
if (e.ButtonIndex == addComment)
174-
{
175-
AddCommentTapped();
176-
}
177-
else if (e.ButtonIndex == copySha)
172+
sheet.Clicked += (s, e) =>
173+
{
174+
try
178175
{
179-
UIPasteboard.General.String = ViewModel.Changeset.Sha;
176+
// Pin to menu
177+
if (e.ButtonIndex == addComment)
178+
{
179+
AddCommentTapped();
180+
}
181+
else if (e.ButtonIndex == copySha)
182+
{
183+
UIPasteboard.General.String = ViewModel.Changeset.Sha;
184+
}
185+
else if (e.ButtonIndex == shareButton)
186+
{
187+
var item = new NSUrl(ViewModel.Changeset.Url);
188+
var activityItems = new MonoTouch.Foundation.NSObject[] { item };
189+
UIActivity[] applicationActivities = null;
190+
var activityController = new UIActivityViewController (activityItems, applicationActivities);
191+
PresentViewController (activityController, true, null);
192+
}
193+
// else if (e.ButtonIndex == showButton)
194+
// {
195+
// ViewModel.GoToHtmlUrlCommand.Execute(null);
196+
// }
180197
}
181-
else if (e.ButtonIndex == shareButton)
198+
catch (Exception ex)
182199
{
183-
var item = UIActivity.FromObject (ViewModel.Changeset.Url);
184-
var activityItems = new MonoTouch.Foundation.NSObject[] { item };
185-
UIActivity[] applicationActivities = null;
186-
var activityController = new UIActivityViewController (activityItems, applicationActivities);
187-
PresentViewController (activityController, true, null);
188200
}
189-
// else if (e.ButtonIndex == showButton)
190-
// {
191-
// ViewModel.GoToHtmlUrlCommand.Execute(null);
192-
// }
193201
};
194202

195203
sheet.ShowInView(this.View);

0 commit comments

Comments
 (0)