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

Commit 583b6ec

Browse files
committed
Better support for the push notification popup
1 parent 3bbf6ae commit 583b6ec

File tree

8 files changed

+68
-57
lines changed

8 files changed

+68
-57
lines changed

CodeHub.Core/ViewModels/Accounts/LoginViewModel.cs

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -111,38 +111,41 @@ public async Task Login(string code)
111111
apiUrl = GitHubSharp.Client.DefaultApi;
112112
}
113113

114+
LoginData loginData = null;
115+
114116
try
115117
{
116118
IsLoggingIn = true;
117119
var account = AttemptedAccount;
118-
var data = await _loginFactory.LoginWithToken(ClientId, ClientSecret, code, RedirectUri, WebDomain, apiUrl, account);
119-
120-
try
121-
{
122-
if (!IsEnterprise)
123-
{
124-
var features = Mvx.Resolve<IFeaturesService>();
125-
if (!features.IsPushNotificationsActivated)
126-
{
127-
await Mvx.Resolve<IFeatureFactory>().PromptPushNotificationFeature();
128-
}
129-
}
130-
}
131-
catch
132-
{
133-
// Don't do anything...
134-
}
135-
136-
this.GetApplication().ActivateUser(data.Account, data.Client);
120+
loginData = await _loginFactory.LoginWithToken(ClientId, ClientSecret, code, RedirectUri, WebDomain, apiUrl, account);
137121
}
138122
catch (Exception e)
139123
{
140124
DisplayAlert(e.Message);
125+
return;
141126
}
142127
finally
143128
{
144129
IsLoggingIn = false;
145130
}
131+
132+
try
133+
{
134+
if (!IsEnterprise)
135+
{
136+
var features = Mvx.Resolve<IFeaturesService>();
137+
if (!features.IsPushNotificationsActivated)
138+
{
139+
await Mvx.Resolve<IFeatureFactory>().PromptPushNotificationFeature();
140+
}
141+
}
142+
}
143+
catch
144+
{
145+
// Don't do anything...
146+
}
147+
148+
this.GetApplication().ActivateUser(loginData.Account, loginData.Client);
146149
}
147150

148151
public class NavObject

CodeHub.Core/ViewModels/App/SettingsViewModel.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ public bool AnalyticsEnabled
6565

6666
public bool LargeFonts
6767
{
68-
get { return _defaultValueService.Get<bool>("large_fonts"); }
68+
get
69+
{
70+
bool value;
71+
_defaultValueService.TryGet<bool>("large_fonts", out value);
72+
return value;
73+
}
6974
set { _defaultValueService.Set("large_fonts", value); }
7075
}
7176

CodeHub.iOS/AppDelegate.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ public override bool FinishedLaunching(UIApplication app, NSDictionary options)
6969
var setup = new Setup(this, presenter);
7070
setup.Initialize();
7171

72+
Mvx.Resolve<CodeFramework.Core.Services.IErrorService>().Init("http://sentry.dillonbuchanan.com/api/5/store/", "17e8a650e8cc44678d1bf40c9d86529b ", "9498e93bcdd046d8bb85d4755ca9d330");
73+
7274
// Setup theme
7375
Theme.Setup();
7476

75-
Mvx.Resolve<CodeFramework.Core.Services.IErrorService>().Init("http://sentry.dillonbuchanan.com/api/5/store/", "17e8a650e8cc44678d1bf40c9d86529b ", "9498e93bcdd046d8bb85d4755ca9d330");
76-
7777
if (options != null)
7878
{
7979
if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
@@ -95,7 +95,6 @@ public override bool FinishedLaunching(UIApplication app, NSDictionary options)
9595

9696
var features = Mvx.Resolve<IFeaturesService>();
9797

98-
9998
// Automatic activations in debug mode!
10099
#if DEBUG
101100
Mvx.Resolve<CodeFramework.Core.Services.IDefaultValueService>().Set(InAppPurchases.PushNotificationsId, true);

CodeHub.iOS/CodeHub.iOS.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
<CodesignProvision>Automatic:AdHoc</CodesignProvision>
9898
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
9999
<DefineConstants>DEBUG</DefineConstants>
100+
<MtouchExtraArgs>--linkskip=CodeFramework.Core.iOS --linkskip=CodeFramework.iOS --linkskip=CodeHub.Core.iOS --linkskip=CodeHub.iOS</MtouchExtraArgs>
100101
</PropertyGroup>
101102
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
102103
<DebugType>none</DebugType>

CodeHub.iOS/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<key>CFBundleIdentifier</key>
2222
<string>com.dillonbuchanan.codehub</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>2.2.2</string>
24+
<string>2.3.0</string>
2525
<key>CFBundleIconFiles</key>
2626
<array>
2727
<string>Icon-Small-50</string>
@@ -68,6 +68,6 @@
6868
</dict>
6969
</array>
7070
<key>CFBundleVersion</key>
71-
<string>4</string>
71+
<string>1</string>
7272
</dict>
7373
</plist>

CodeHub.iOS/Services/FeaturesService.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using CodeHub.Core.Services;
2-
using System.Threading.Tasks;
32
using CodeFramework.Core.Services;
43

54
namespace CodeHub.iOS.Services

CodeHub.iOS/Theme.cs

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ public static void Setup()
1515
CodeFramework.iOS.Theme.CurrentTheme = theme;
1616

1717
var defaultValues = Cirrious.CrossCore.Mvx.Resolve<CodeFramework.Core.Services.IDefaultValueService>();
18-
Theme.CurrentTheme.FontSizeRatio = defaultValues.Get<bool>("large_fonts") ? 1.3f : 1.0f;
1918

20-
RepositoryCellView.RoundImages = false;
21-
MonoTouch.Dialog.NameTimeStringElement.NameColor = Theme.CurrentTheme.MainTitleColor;
19+
bool largeFonts;
20+
if (!defaultValues.TryGet<bool>("large_fonts", out largeFonts))
21+
largeFonts = false;
22+
Theme.CurrentTheme.FontSizeRatio = largeFonts ? 1.3f : 1.0f;
23+
24+
RepositoryCellView.RoundImages = false;
25+
MonoTouch.Dialog.NameTimeStringElement.NameColor = Theme.CurrentTheme.MainTitleColor;
2226
MonoTouch.Dialog.Element.FontSizeRatio = Theme.CurrentTheme.FontSizeRatio;
2327

2428
UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
@@ -67,16 +71,16 @@ public UITextAttributes SegmentedControlText
6771
};
6872
}
6973
}
70-
public UIImage CheckButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/check"); } }
74+
public UIImage CheckButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/check"); } }
7175
public UIImage BackButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/back"); } }
7276
public UIImage ThreeLinesButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/three_lines"); } }
7377
public UIImage CancelButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/cancel"); } }
74-
public UIImage SortButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/sort"); } }
78+
public UIImage SortButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/sort"); } }
7579
public UIImage SaveButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/save"); } }
7680
public UIImage ViewButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/view"); } }
7781
public UIImage ForkButton { get { return UIImageHelper.FromFileAuto("Images/Buttons/fork"); } }
78-
public UIImage WebBackButton { get { return UIImageHelper.FromFileAuto("Images/Web/back"); } }
79-
public UIImage WebFowardButton { get { return UIImageHelper.FromFileAuto("Images/Web/forward"); } }
82+
public UIImage WebBackButton { get { return UIImageHelper.FromFileAuto("Images/Web/back"); } }
83+
public UIImage WebFowardButton { get { return UIImageHelper.FromFileAuto("Images/Web/forward"); } }
8084

8185
public UIImage AnonymousUserImage { get { return Images.Anonymous; } }
8286

@@ -135,29 +139,29 @@ public UIImage RepositoryCellUser
135139

136140
public UIColor WebButtonTint { get { return UIColor.FromRGB(127, 125, 125); } }
137141

138-
public UIColor AccountsNavigationBarTint
139-
{
140-
get
141-
{
142-
return UIColor.Red;
143-
}
144-
}
145-
146-
public UIColor SlideoutNavigationBarTint
147-
{
148-
get
149-
{
150-
return UIColor.Black;
151-
}
152-
}
153-
154-
public UIColor ApplicationNavigationBarTint
155-
{
156-
get
157-
{
158-
return UIColor.Black;
159-
}
160-
}
142+
public UIColor AccountsNavigationBarTint
143+
{
144+
get
145+
{
146+
return UIColor.Red;
147+
}
148+
}
149+
150+
public UIColor SlideoutNavigationBarTint
151+
{
152+
get
153+
{
154+
return UIColor.Black;
155+
}
156+
}
157+
158+
public UIColor ApplicationNavigationBarTint
159+
{
160+
get
161+
{
162+
return UIColor.Black;
163+
}
164+
}
161165

162166
public float FontSizeRatio { get; set; }
163167
}

0 commit comments

Comments
 (0)