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

Commit 51e71fd

Browse files
committed
Better support for scroll toolbar
1 parent 4294783 commit 51e71fd

File tree

11 files changed

+39
-8
lines changed

11 files changed

+39
-8
lines changed

CodeHub.Core/ViewModels/App/SettingsViewModel.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,25 @@ public bool PushNotificationsActivated
7171

7272
public bool PushNotificationsEnabled
7373
{
74-
get { return this.GetApplication().Account.IsPushNotificationsEnabled.HasValue && this.GetApplication().Account.IsPushNotificationsEnabled.Value; }
74+
get
75+
{
76+
return PushNotificationsActivated && this.GetApplication().Account.IsPushNotificationsEnabled.HasValue && this.GetApplication().Account.IsPushNotificationsEnabled.Value;
77+
}
7578
set
7679
{
7780
if (PushNotificationsActivated)
78-
RegisterPushNotifications(value);
81+
RegisterPushNotifications(value);
82+
else
83+
{
84+
GetService<IAlertDialogService>()
85+
.PromptYesNo("Requires Activation", "Push notifications require activation. Would you like to go there now to activate push notifications?")
86+
.ContinueWith(t =>
87+
{
88+
if (t.Status == TaskStatus.RanToCompletion && t.Result)
89+
ShowViewModel<UpgradesViewModel>();
90+
});
91+
RaisePropertyChanged(() => PushNotificationsEnabled);
92+
}
7993
}
8094
}
8195

CodeHub.iOS/CodeHub.iOS.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,12 @@
419419
<BundleResource Include="Resources\Icon-Small-40%402x.png" />
420420
<BundleResource Include="Images\chart%402x.png" />
421421
<BundleResource Include="Images\chart.png" />
422+
<BundleResource Include="Images\MarkdownComposer\link%402x.png" />
423+
<BundleResource Include="Images\MarkdownComposer\link.png" />
424+
<BundleResource Include="Images\MarkdownComposer\photo%402x.png" />
425+
<BundleResource Include="Images\MarkdownComposer\photo.png" />
426+
<BundleResource Include="Images\MarkdownComposer\picture%402x.png" />
427+
<BundleResource Include="Images\MarkdownComposer\picture.png" />
422428
</ItemGroup>
423429
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />
424430
<ItemGroup>
@@ -428,5 +434,6 @@
428434
<ItemGroup />
429435
<ItemGroup>
430436
<Folder Include="ViewControllers\" />
437+
<Folder Include="Images\MarkdownComposer\" />
431438
</ItemGroup>
432439
</Project>
330 Bytes
Loading
675 Bytes
Loading
319 Bytes
Loading
578 Bytes
Loading
255 Bytes
Loading
453 Bytes
Loading

CodeHub.iOS/ViewControllers/MarkdownComposerViewController.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
using System.Threading.Tasks;
1212
using CodeFramework.Core.Services;
1313
using System.Linq;
14+
using System.Drawing;
1415

1516
namespace CodeHub.iOS.ViewControllers
1617
{
@@ -26,26 +27,36 @@ public MarkdownComposerViewController()
2627
NavigationItem.TitleView = _viewSegment;
2728
_viewSegment.ValueChanged += SegmentValueChanged;
2829

30+
var pictureImage = UIImageHelper.FromFileAuto("Images/MarkdownComposer/picture");
31+
var linkImage = UIImageHelper.FromFileAuto("Images/MarkdownComposer/link");
32+
var photoImage = UIImageHelper.FromFileAuto("Images/MarkdownComposer/photo");
33+
2934
var buttons = new []
3035
{
3136
CreateAccessoryButton("@", () => TextView.InsertText("@")),
3237
CreateAccessoryButton("#", () => TextView.InsertText("#")),
3338
CreateAccessoryButton("*", () => TextView.InsertText("*")),
3439
CreateAccessoryButton("`", () => TextView.InsertText("`")),
35-
CreateAccessoryButton("Image", () => {
40+
CreateAccessoryButton(pictureImage, () => {
3641
var range = TextView.SelectedRange;
3742
TextView.InsertText("![]()");
3843
TextView.SelectedRange = new MonoTouch.Foundation.NSRange(range.Location + 4, 0);
3944
}),
40-
CreateAccessoryButton("Upload", () => SelectImage()),
41-
CreateAccessoryButton("Link", () => {
45+
CreateAccessoryButton(photoImage, () => SelectImage()),
46+
CreateAccessoryButton(linkImage, () => {
4247
var range = TextView.SelectedRange;
4348
TextView.InsertText("[]()");
4449
TextView.SelectedRange = new MonoTouch.Foundation.NSRange(range.Location + 1, 0);
4550
}),
4651
CreateAccessoryButton("~", () => TextView.InsertText("~")),
4752
CreateAccessoryButton("=", () => TextView.InsertText("=")),
53+
CreateAccessoryButton("-", () => TextView.InsertText("-")),
54+
CreateAccessoryButton("+", () => TextView.InsertText("+")),
4855
CreateAccessoryButton("_", () => TextView.InsertText("_")),
56+
CreateAccessoryButton("[", () => TextView.InsertText("[")),
57+
CreateAccessoryButton("]", () => TextView.InsertText("]")),
58+
CreateAccessoryButton("<", () => TextView.InsertText("<")),
59+
CreateAccessoryButton(">", () => TextView.InsertText(">")),
4960
};
5061

5162
SetAccesoryButtons(buttons);

CodeHub.iOS/Views/App/SettingsView.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ private void CreateTable()
7979
CreateTable();
8080
});
8181

82-
if (vm.PushNotificationsActivated)
83-
accountSection.Add(new TrueFalseElement("Push Notifications".t(), vm.PushNotificationsEnabled, e => vm.PushNotificationsEnabled = e.Value));
82+
accountSection.Add(new TrueFalseElement("Push Notifications".t(), vm.PushNotificationsEnabled, e => vm.PushNotificationsEnabled = e.Value));
8483

8584
var totalCacheSizeMB = vm.CacheSize.ToString("0.##");
8685
var deleteCache = new StyledStringElement("Delete Cache".t(), string.Format("{0} MB", totalCacheSizeMB), MonoTouch.UIKit.UITableViewCellStyle.Value1);

0 commit comments

Comments
 (0)