Skip to content

Commit

Permalink
Merge pull request #75 from brminnick/AppStore-Screenshots
Browse files Browse the repository at this point in the history
Fix KeyNotFoundException
  • Loading branch information
brminnick authored May 8, 2020
2 parents 0cd9b46 + 7dae0c4 commit 4b828cb
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion GitTrends.Android/Properties/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="20" android:versionName="1.0.2" package="com.minnick.gittrends" android:installLocation="auto">
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="21" android:versionName="1.0.3" package="com.minnick.gittrends" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="29" />
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<application android:label="GitTrends" android:fullBackupContent="@xml/auto_backup_rules">
Expand Down
9 changes: 7 additions & 2 deletions GitTrends.Android/Services/NotificationService_Android.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
using Microsoft.Azure.NotificationHubs;
using Xamarin.Forms;

[assembly: Dependency(typeof(BadgeService_Android))]
[assembly: Dependency(typeof(NotificationService_Android))]
namespace GitTrends.Droid
{
public class BadgeService_Android : INotificationService
public class NotificationService_Android : INotificationService
{
Context CurrentContext => Xamarin.Essentials.Platform.AppContext;

public void Initialize()
{

}

public Task<bool?> AreNotificationEnabled()
{
bool isPushNotificationEnabled;
Expand Down
4 changes: 2 additions & 2 deletions GitTrends.iOS/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@
<string>processing</string>
</array>
<key>CFBundleShortVersionString</key>
<string>1.0.2</string>
<string>1.0.3</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>com.minnick.GitTrends.NotifyTrendingRepositories</string>
<string>com.minnick.GitTrends.CleanUpDatabase</string>
</array>
<key>CFBundleVersion</key>
<string>20</string>
<string>21</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion GitTrends.iOS/Services/NotificationService_iOS.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace GitTrends.iOS
{
public class NotificationService_iOS : INotificationService
{
public NotificationService_iOS()
public void Initialize()
{
using var scope = ContainerService.Container.BeginLifetimeScope();
scope.Resolve<NotificationService>().RegisterForNotificationsCompleted += HandleRegisterForNotificationsCompleted;
Expand Down
4 changes: 4 additions & 0 deletions GitTrends/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using AsyncAwaitBestPractices;
using Autofac;
using Shiny;
using Xamarin.Essentials;
using Xamarin.Forms;
using Xamarin.Forms.PlatformConfiguration;
using Xamarin.Forms.PlatformConfiguration.iOSSpecific;
Expand Down Expand Up @@ -74,7 +75,10 @@ void InitializeEssentialServices()
using var scope = ContainerService.Container.BeginLifetimeScope();

var themeService = scope.Resolve<ThemeService>();
themeService.Initialize();

var notificationService = DependencyService.Resolve<INotificationService>();
notificationService.Initialize();
}

void OnResumed() => _resumedEventManager.HandleEvent(this, EventArgs.Empty, nameof(Resumed));
Expand Down
1 change: 1 addition & 0 deletions GitTrends/Services/INotificationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ public interface INotificationService
{
Task SetiOSBadgeCount(int count);
Task<bool?> AreNotificationEnabled();
void Initialize();
}
}
4 changes: 2 additions & 2 deletions GitTrends/Services/ThemeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ public ThemeService(AnalyticsService analyticsService)
_analyticsService = analyticsService;

Application.Current.RequestedThemeChanged += HandleRequestedThemeChanged;

SetAppTheme(Preference);
}

public static event EventHandler<PreferredTheme> PreferenceChanged
Expand All @@ -37,6 +35,8 @@ public PreferredTheme Preference
}
}

public void Initialize() => SetAppTheme(Preference);

void SetAppTheme(PreferredTheme preferredTheme)
{
BaseTheme theme = preferredTheme switch
Expand Down

0 comments on commit 4b828cb

Please sign in to comment.