diff --git a/src/Android/Android.csproj b/src/Android/Android.csproj
index 9b31afc71..8d965e627 100644
--- a/src/Android/Android.csproj
+++ b/src/Android/Android.csproj
@@ -871,7 +871,7 @@
-
+
diff --git a/src/Android/MainApplication.cs b/src/Android/MainApplication.cs
index 1d5d68a10..63b3a0d0e 100644
--- a/src/Android/MainApplication.cs
+++ b/src/Android/MainApplication.cs
@@ -13,7 +13,6 @@ using Plugin.Fingerprint;
using Plugin.Settings;
using XLabs.Ioc;
using System.Threading.Tasks;
-using FFImageLoading.Forms.Droid;
using XLabs.Ioc.SimpleInjectorContainer;
using SimpleInjector;
@@ -24,13 +23,11 @@ namespace Bit.Android
#else
[Application(Debuggable = false)]
#endif
- public class MainApplication : Application, Application.IActivityLifecycleCallbacks
+ public class MainApplication : Application
{
private const string FirstLaunchKey = "firstLaunch";
private const string LastVersionCodeKey = "lastVersionCode";
- public static Context AppContext;
-
public MainApplication(IntPtr handle, JniHandleOwnership transer)
: base(handle, transer)
{
@@ -56,52 +53,13 @@ namespace Bit.Android
// workaround for app compat bug
// ref https://forums.xamarin.com/discussion/62414/app-resuming-results-in-crash-with-formsappcompatactivity
Task.Delay(10).Wait();
-
- RegisterActivityLifecycleCallbacks(this);
- AppContext = ApplicationContext;
- }
-
- public override void OnTerminate()
- {
- base.OnTerminate();
- UnregisterActivityLifecycleCallbacks(this);
- }
-
- public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
- {
- CrossCurrentActivity.Current.Activity = activity;
- }
-
- public void OnActivityDestroyed(Activity activity)
- {
- }
-
- public void OnActivityPaused(Activity activity)
- {
- }
-
- public void OnActivityResumed(Activity activity)
- {
- CrossCurrentActivity.Current.Activity = activity;
- }
-
- public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
- {
- }
-
- public void OnActivityStarted(Activity activity)
- {
- CrossCurrentActivity.Current.Activity = activity;
- }
-
- public void OnActivityStopped(Activity activity)
- {
+ CrossCurrentActivity.Current.Init(this);
}
public static void SetIoc(Application application)
{
Refractored.FabControl.Droid.FloatingActionButtonViewRenderer.Init();
- CachedImageRenderer.Init(true);
+ FFImageLoading.Forms.Platform.CachedImageRenderer.Init(true);
ZXing.Net.Mobile.Forms.Android.Platform.Init();
CrossFingerprint.SetCurrentActivityResolver(() => CrossCurrentActivity.Current.Activity);
@@ -109,8 +67,8 @@ namespace Bit.Android
var container = new Container();
// Android Stuff
- container.RegisterSingleton(application.ApplicationContext);
- container.RegisterSingleton(application);
+ container.RegisterInstance(application.ApplicationContext);
+ container.RegisterInstance(application);
// Services
container.RegisterSingleton();
@@ -158,9 +116,9 @@ namespace Bit.Android
container.RegisterSingleton();
// Other
- container.RegisterSingleton(CrossSettings.Current);
- container.RegisterSingleton(CrossConnectivity.Current);
- container.RegisterSingleton(CrossFingerprint.Current);
+ container.RegisterInstance(CrossSettings.Current);
+ container.RegisterInstance(CrossConnectivity.Current);
+ container.RegisterInstance(CrossFingerprint.Current);
// Push
#if FDROID
diff --git a/src/iOS/AppDelegate.cs b/src/iOS/AppDelegate.cs
index 601071f20..af3d95d2a 100644
--- a/src/iOS/AppDelegate.cs
+++ b/src/iOS/AppDelegate.cs
@@ -17,7 +17,6 @@ using Bit.App.Pages;
using HockeyApp.iOS;
using Bit.iOS.Core;
using Google.Analytics;
-using FFImageLoading.Forms.Touch;
using SimpleInjector;
using XLabs.Ioc.SimpleInjectorContainer;
using CoreNFC;
@@ -301,17 +300,17 @@ namespace Bit.iOS
container.RegisterSingleton();
// Other
- container.RegisterSingleton(CrossConnectivity.Current);
- container.RegisterSingleton(CrossFingerprint.Current);
+ container.RegisterInstance(CrossConnectivity.Current);
+ container.RegisterInstance(CrossFingerprint.Current);
Settings = new Settings("group.com.8bit.bitwarden");
- container.RegisterSingleton(Settings);
+ container.RegisterInstance(Settings);
// Push
container.RegisterSingleton();
container.RegisterSingleton();
- CachedImageRenderer.Init();
+ FFImageLoading.Forms.Platform.CachedImageRenderer.Init();
Resolver.SetResolver(new SimpleInjectorResolver(container));
}