Beispiel #1
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
			var iRate = MTiRate.iRate.SharedInstance;
			iRate.AppStoreID = 707173885;

			this.window = new UIWindow(UIScreen.MainScreen.Bounds);
            var presenter = new TouchViewPresenter(this.window);
            var setup = new Setup(this, presenter);
            setup.Initialize();

            Mvx.Resolve<CodeFramework.Core.Services.IErrorService>().Init("http://sentry.dillonbuchanan.com/api/5/store/", "17e8a650e8cc44678d1bf40c9d86529b ", "9498e93bcdd046d8bb85d4755ca9d330");

            // Setup theme
            Theme.Setup();

            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) 
                {
                    var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if(remoteNotification != null) {
                        HandleNotification(remoteNotification, true);
                    }
                }
            }

            var startup = Mvx.Resolve<IMvxAppStart>();
			startup.Start();

            this.window.MakeKeyAndVisible();

            InAppPurchases.Instance.PurchaseError += HandlePurchaseError;
            InAppPurchases.Instance.PurchaseSuccess += HandlePurchaseSuccess;

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

            // Automatic activations in debug mode!
            #if DEBUG
            Mvx.Resolve<CodeFramework.Core.Services.IDefaultValueService>().Set(FeatureIds.PushNotifications, true);
            #endif


			// Notifications don't work on teh simulator so don't bother
            if (MonoTouch.ObjCRuntime.Runtime.Arch != MonoTouch.ObjCRuntime.Arch.SIMULATOR && features.IsPushNotificationsActivated)
			{
				const UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
				UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
			}

            return true;
        }
Beispiel #2
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
			var iRate = MTiRate.iRate.SharedInstance;
			iRate.AppStoreID = 707173885;

			this.window = new UIWindow(UIScreen.MainScreen.Bounds);

            // Setup theme
            Theme.Setup();

            var presenter = new TouchViewPresenter(this.window);

            var setup = new Setup(this, presenter);
            setup.Initialize();

			Mvx.Resolve<CodeFramework.Core.Services.IAnalyticsService>().Init("UA-44040302-1", "CodeHub");

            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) 
                {
                    var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if(remoteNotification != null) {
                        HandleNotification(remoteNotification, true);
                    }
                }
            }

            var startup = Mvx.Resolve<IMvxAppStart>();
			startup.Start();

            this.window.MakeKeyAndVisible();

            InAppPurchases.Instance.PurchaseError += HandlePurchaseError;
            InAppPurchases.Instance.PurchaseSuccess += HandlePurchaseSuccess;

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

			// Notifications don't work on teh simulator so don't bother
            if (MonoTouch.ObjCRuntime.Runtime.Arch != MonoTouch.ObjCRuntime.Arch.SIMULATOR && features.IsPushNotificationsActivated)
			{
				const UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
				UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
			}

            return true;
        }
Beispiel #3
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
			var iRate = MTiRate.iRate.SharedInstance;
			iRate.AppStoreID = 707173885;

			UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
			UINavigationBar.Appearance.TintColor = UIColor.White;
			UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(50, 50, 50);
			UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) });
			CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);

			UserVoice.UVStyleSheet.StyleSheet = new UserVoiceStyleSheet();

			UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
			UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
			UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136);
			UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f);

			UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245);

			UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes()
			{
				TextColor = UIColor.White,
			}, UIControlState.Normal);

			this.window = new UIWindow(UIScreen.MainScreen.Bounds);

            // Setup theme
            Theme.Setup();

            var presenter = new TouchViewPresenter(this.window);

            var setup = new Setup(this, presenter);
            setup.Initialize();

			Mvx.Resolve<CodeFramework.Core.Services.IAnalyticsService>().Init("UA-44040302-1", "CodeHub");

            var startup = Mvx.Resolve<IMvxAppStart>();
			startup.Start();

            this.window.MakeKeyAndVisible();

//			if (options != null)
//			{
//				if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey)) 
//				{
//					var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
//					if(remoteNotification != null) {
//						HandleNotification(remoteNotification);
//					}
//				}
//			}

			// Notifications don't work on teh simulator so don't bother
//			if (MonoTouch.ObjCRuntime.Runtime.Arch != MonoTouch.ObjCRuntime.Arch.SIMULATOR)
//			{
//				const UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge;
//				UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
//			}

            return true;
        }
Beispiel #4
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var iRate = MTiRate.iRate.SharedInstance;
            iRate.AppStoreID = 707173885;

            UIApplication.SharedApplication.StatusBarStyle = UIStatusBarStyle.LightContent;
            UINavigationBar.Appearance.TintColor = UIColor.White;
            UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(50, 50, 50);
            UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes { TextColor = UIColor.White, Font = UIFont.SystemFontOfSize(18f) });
            CodeFramework.iOS.Utils.Hud.BackgroundTint = UIColor.FromRGBA(228, 228, 228, 128);

            UserVoice.UVStyleSheet.StyleSheet = new UserVoiceStyleSheet();

            UISegmentedControl.Appearance.TintColor = UIColor.FromRGB(110, 110, 117);
            UITableViewHeaderFooterView.Appearance.TintColor = UIColor.FromRGB(228, 228, 228);
            UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).TextColor = UIColor.FromRGB(136, 136, 136);
            UILabel.AppearanceWhenContainedIn(typeof(UITableViewHeaderFooterView)).Font = UIFont.SystemFontOfSize(13f);

            UIToolbar.Appearance.BarTintColor = UIColor.FromRGB(245, 245, 245);

            UIBarButtonItem.AppearanceWhenContainedIn(typeof(UISearchBar)).SetTitleTextAttributes(new UITextAttributes()
            {
                TextColor = UIColor.White,
            }, UIControlState.Normal);

            this.window = new UIWindow(UIScreen.MainScreen.Bounds);

            // Setup theme
            Theme.Setup();

            var presenter = new TouchViewPresenter(this.window);

            var setup = new Setup(this, presenter);
            setup.Initialize();

            Mvx.Resolve<CodeFramework.Core.Services.IAnalyticsService>().Init("UA-44040302-1", "CodeHub");

            var startup = Mvx.Resolve<IMvxAppStart>();
            startup.Start();

            this.window.MakeKeyAndVisible();

            return true;
        }
Beispiel #5
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Crashlytics.Instance.Initialize();
            Fabric.Instance.Initialize();

#if DEBUG
            Fabric.Instance.Debug = true;
#endif

            Window    = new UIWindow(UIScreen.MainScreen.Bounds);
            Presenter = new IosViewPresenter(this.Window);
            var setup = new Setup(this, Presenter);
            setup.Initialize();

            var culture = new System.Globalization.CultureInfo("en");
            System.Threading.Thread.CurrentThread.CurrentCulture           = culture;
            System.Threading.Thread.CurrentThread.CurrentUICulture         = culture;
            System.Globalization.CultureInfo.DefaultThreadCurrentCulture   = culture;
            System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = culture;

            // Setup theme
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            Theme.Setup();

            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <IApplicationService>());
            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <IAccountsService>());
            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <IAlertDialogService>());
            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <INetworkActivityService>());
            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <IMessageService>());
            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <IInAppPurchaseService>());
            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <IFeaturesService>());
            Locator.CurrentMutable.RegisterConstant(Mvx.Resolve <ILoginService>());

            Locator.CurrentMutable.RegisterLazySingleton(
                () => new ImgurService(), typeof(IImgurService));

            var features        = Mvx.Resolve <IFeaturesService>();
            var purchaseService = Mvx.Resolve <IInAppPurchaseService>();

            purchaseService.ThrownExceptions.Subscribe(ex =>
            {
                var error = new Core.UserError("Error Purchasing", ex.Message);
                Core.Interactions.Errors.Handle(error).Subscribe();
            });

            Core.Interactions.Errors.RegisterHandler(interaction =>
            {
                var error = interaction.Input;
                AlertDialogService.ShowAlert(error.Title, error.Message);
                interaction.SetOutput(System.Reactive.Unit.Default);
            });

//#if DEBUG
//            features.ActivateProDirect();
//#endif

//            options = new NSDictionary (UIApplication.LaunchOptionsRemoteNotificationKey,
//                new NSDictionary ("r", "octokit/octokit.net", "i", "739", "u", "thedillonb"));
//
            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (remoteNotification != null)
                    {
                        HandleNotification(remoteNotification, true);
                    }
                }
            }

            // Set the client constructor
            GitHubSharp.Client.ClientConstructor = () => new HttpClient(new CustomHttpMessageHandler());

            if (!Core.Settings.HasSeenWelcome)
            {
                Core.Settings.HasSeenWelcome = true;
                var welcomeViewController = new ViewControllers.Walkthrough.WelcomePageViewController();
                welcomeViewController.WantsToDimiss += GoToStartupView;
                TransitionToViewController(welcomeViewController);
            }
            else
            {
                GoToStartupView();
            }

            Window.MakeKeyAndVisible();

            // Notifications don't work on teh simulator so don't bother
            if (Runtime.Arch != Arch.SIMULATOR && features.IsProEnabled)
            {
                RegisterUserForNotifications();
            }

            return(true);
        }
Beispiel #6
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Window    = new UIWindow(UIScreen.MainScreen.Bounds);
            Presenter = new IosViewPresenter(this.Window);
            var setup = new Setup(this, Presenter);

            setup.Initialize();

            // Setup theme
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            Theme.Setup();

            var features            = Mvx.Resolve <IFeaturesService>();
            var defaultValueService = Mvx.Resolve <IDefaultValueService>();

//            var installedDate = this.StampInstallDate("CodeHub");
//            Console.WriteLine("CodeHub was installed on: " + installedDate);
//            if (installedDate < new DateTime(2016, 3, 5, 1, 1, 1))
//                features.ActivateProDirect();

            #if DEBUG
            features.ActivateProDirect();
            #endif

            if (!features.IsProEnabled)
            {
                bool isActive;
                if (defaultValueService.TryGet(FeaturesService.EnterpriseSupport, out isActive) && isActive)
                {
                    features.ActivateProDirect();
                }
                else if (defaultValueService.TryGet(FeaturesService.PushNotifications, out isActive) && isActive)
                {
                    features.ActivateProDirect();
                }
            }
//
//            options = new NSDictionary (UIApplication.LaunchOptionsRemoteNotificationKey,
//                new NSDictionary ("r", "octokit/octokit.net", "i", "739", "u", "thedillonb"));
//
            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (remoteNotification != null)
                    {
                        HandleNotification(remoteNotification, true);
                    }
                }
            }

            // Set the client constructor
            GitHubSharp.Client.ClientConstructor = () => new HttpClient(new HttpMessageHandler());

            bool hasSeenWelcome;
            if (!defaultValueService.TryGet("HAS_SEEN_WELCOME_INTRO", out hasSeenWelcome) || !hasSeenWelcome)
            {
                defaultValueService.Set("HAS_SEEN_WELCOME_INTRO", true);
                var welcomeViewController = new CodeHub.iOS.ViewControllers.Walkthrough.WelcomePageViewController();
                welcomeViewController.WantsToDimiss += GoToStartupView;
                TransitionToViewController(welcomeViewController);
            }
            else
            {
                GoToStartupView();
            }

            Window.MakeKeyAndVisible();

            // Notifications don't work on teh simulator so don't bother
            if (Runtime.Arch != Arch.SIMULATOR && features.IsPushNotificationsActivated)
            {
                RegisterUserForNotifications();
            }

            return(true);
        }
Beispiel #7
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Window = new UIWindow(UIScreen.MainScreen.Bounds);
            Presenter = new IosViewPresenter(this.Window);
            var setup = new Setup(this, Presenter);
            setup.Initialize();

            // Initialize the error service!
            var errorService = Mvx.Resolve<IErrorService>();
            errorService.Init();

            var culture = new System.Globalization.CultureInfo("en");
            System.Threading.Thread.CurrentThread.CurrentUICulture = culture;
            System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = culture;

            // Setup theme
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            Theme.Setup();

            var features = Mvx.Resolve<IFeaturesService>();
            var defaultValueService = Mvx.Resolve<IDefaultValueService>();
            var purchaseService = Mvx.Resolve<IInAppPurchaseService>();
            purchaseService.ThrownExceptions.Subscribe(ex => {
                AlertDialogService.ShowAlert("Error Purchasing", ex.Message);
                errorService.Log(ex);
            });

            #if DEBUG
            features.ActivateProDirect();
            #endif

            //            options = new NSDictionary (UIApplication.LaunchOptionsRemoteNotificationKey,
            //                new NSDictionary ("r", "octokit/octokit.net", "i", "739", "u", "thedillonb"));
            //
            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if(remoteNotification != null) {
                        HandleNotification(remoteNotification, true);
                    }
                }
            }

            // Set the client constructor
            GitHubSharp.Client.ClientConstructor = () => new HttpClient(new CustomHttpMessageHandler());

            bool hasSeenWelcome;
            if (!defaultValueService.TryGet("HAS_SEEN_WELCOME_INTRO", out hasSeenWelcome) || !hasSeenWelcome)
            {
                defaultValueService.Set("HAS_SEEN_WELCOME_INTRO", true);
                var welcomeViewController = new CodeHub.iOS.ViewControllers.Walkthrough.WelcomePageViewController();
                welcomeViewController.WantsToDimiss += GoToStartupView;
                TransitionToViewController(welcomeViewController);
            }
            else
            {
                GoToStartupView();
            }

            Window.MakeKeyAndVisible();

            // Notifications don't work on teh simulator so don't bother
            if (Runtime.Arch != Arch.SIMULATOR && features.IsProEnabled)
                RegisterUserForNotifications();

            return true;
        }
Beispiel #8
0
        /// <summary>
        /// Finished the launching.
        /// </summary>
        /// <param name="app">The app.</param>
        /// <param name="options">The options.</param>
        /// <returns>True or false.</returns>
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            Window    = new UIWindow(UIScreen.MainScreen.Bounds);
            Presenter = new IosViewPresenter(this.Window);
            var setup = new Setup(this, Presenter);

            setup.Initialize();

            // Initialize the error service!
            var errorService = Mvx.Resolve <IErrorService>();

            errorService.Init();

            var culture = new System.Globalization.CultureInfo("en");

            System.Threading.Thread.CurrentThread.CurrentUICulture         = culture;
            System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = culture;

            // Setup theme
            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, true);
            Theme.Setup();

            var features            = Mvx.Resolve <IFeaturesService>();
            var defaultValueService = Mvx.Resolve <IDefaultValueService>();
            var purchaseService     = Mvx.Resolve <IInAppPurchaseService>();

            purchaseService.ThrownExceptions.Subscribe(ex => {
                AlertDialogService.ShowAlert("Error Purchasing", ex.Message);
                errorService.Log(ex);
            });

            #if DEBUG
            features.ActivateProDirect();
            #endif

//            options = new NSDictionary (UIApplication.LaunchOptionsRemoteNotificationKey,
//                new NSDictionary ("r", "octokit/octokit.net", "i", "739", "u", "thedillonb"));
//
            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    var remoteNotification = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (remoteNotification != null)
                    {
                        HandleNotification(remoteNotification, true);
                    }
                }
            }

            // Set the client constructor
            GitHubSharp.Client.ClientConstructor = () => new HttpClient(new HttpMessageHandler());

            bool hasSeenWelcome;
            if (!defaultValueService.TryGet("HAS_SEEN_WELCOME_INTRO", out hasSeenWelcome) || !hasSeenWelcome)
            {
                defaultValueService.Set("HAS_SEEN_WELCOME_INTRO", true);
                var welcomeViewController = new CodeHub.iOS.ViewControllers.Walkthrough.WelcomePageViewController();
                welcomeViewController.WantsToDimiss += GoToStartupView;
                TransitionToViewController(welcomeViewController);
            }
            else
            {
                GoToStartupView();
            }

            Window.MakeKeyAndVisible();

            // Notifications don't work on teh simulator so don't bother
            if (Runtime.Arch != Arch.SIMULATOR && features.IsProEnabled)
            {
                RegisterUserForNotifications();
            }

            return(true);
        }