Пример #1
0
		//
		// This method is invoked when the application has loaded and is ready to run. In this
		// method you should instantiate the window, load the UI into it and then make the window
		// visible.
		//
		// You have 17 seconds to return from this method, or iOS will terminate your application.
		//
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			window = new UIWindow (UIScreen.MainScreen.Bounds);

			// We use NSUserDefaults to store a bool value if we are tracking the user or not 
			var optionsDict = NSDictionary.FromObjectAndKey (new NSString ("YES"), new NSString (AllowTrackingKey));
			NSUserDefaults.StandardUserDefaults.RegisterDefaults (optionsDict);

			// User must be able to opt out of tracking
			GAI.SharedInstance.OptOut = !NSUserDefaults.StandardUserDefaults.BoolForKey (AllowTrackingKey);

			// Initialize Google Analytics with a 5-second dispatch interval (Use a higher value when in production). There is a
			// tradeoff between battery usage and timely dispatch.
			GAI.SharedInstance.DispatchInterval = 5;
			GAI.SharedInstance.TrackUncaughtExceptions = true;

			Tracker = GAI.SharedInstance.GetTracker ("CuteAnimals", TrackingId);

			viewController = new DVCMenu ();
			navController = new UINavigationController (viewController);
			window.RootViewController = navController;
			window.MakeKeyAndVisible ();
			
			return true;
		}
Пример #2
0
        //private int backgroundTaskId;

        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            FavoriteLocations = new FavoritesDbManager(FavoritesDbManager.DatabaseFilePath);

            UINavigationBar.Appearance.SetBackgroundImage(new UIImage(), UIBarMetrics.Default);
            UINavigationBar.Appearance.ShadowImage     = new UIImage();
            UINavigationBar.Appearance.BackgroundColor = UIColor.Clear;
            UINavigationBar.Appearance.TintColor       = UIColor.White;

            UIApplication.SharedApplication.SetStatusBarStyle(UIStatusBarStyle.LightContent, false);



            DurationToSendLocation_Sec = 120;

            LocationManager = null;


            //setup Google Analytics

            GAI.SharedInstance.DispatchInterval        = 20;
            GAI.SharedInstance.TrackUncaughtExceptions = true;

            Tracker = GAI.SharedInstance.GetTracker(TrackingId);

            return(true);
        }
Пример #3
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            window = new UIWindow(UIScreen.MainScreen.Bounds);

            // We use NSUserDefaults to store a bool value if we are tracking the user or not
            var optionsDict = NSDictionary.FromObjectAndKey(new NSString("YES"), new NSString(AllowTrackingKey));

            NSUserDefaults.StandardUserDefaults.RegisterDefaults(optionsDict);

            // User must be able to opt out of tracking
            GAI.SharedInstance.OptOut = !NSUserDefaults.StandardUserDefaults.BoolForKey(AllowTrackingKey);

            // Initialize Google Analytics with a 5-second dispatch interval (Use a higher value when in production). There is a
            // tradeoff between battery usage and timely dispatch.
            GAI.SharedInstance.DispatchInterval        = 5;
            GAI.SharedInstance.TrackUncaughtExceptions = true;

            Tracker = GAI.SharedInstance.GetTracker("CuteAnimals", TrackingId);

            viewController            = new DVCMenu();
            navController             = new UINavigationController(viewController);
            window.RootViewController = navController;
            window.MakeKeyAndVisible();

            return(true);
        }
Пример #4
0
        public IGAITracker GetTracker(AnalyticsConfiguration configuration)
        {
            if (Tracker == null)
            {
                GAI.SharedInstance.Logger.SetLogLevel(GetLogLevel(configuration.LogLevel));
                GAI.SharedInstance.DispatchInterval        = configuration.DispatchPeriod;
                GAI.SharedInstance.DryRun                  = configuration.DryRun;
                GAI.SharedInstance.TrackUncaughtExceptions = configuration.ReportUncaughtExceptions;

                Tracker = GAI.SharedInstance.GetTracker(configuration.TrackingId);

                Tracker.Set(GAIConstants.SampleRate, configuration.SampleFrequency.ToString());
                Tracker.Set(GAIConstants.AnonymizeIp, configuration.AnonymizeIp.ToString());

                if (!string.IsNullOrEmpty(configuration.AppName))
                {
                    Tracker.Set(GAIConstants.AppName, configuration.AppName);
                }

                if (!string.IsNullOrEmpty(configuration.AppVersion))
                {
                    Tracker.Set(GAIConstants.AppVersion, configuration.AppVersion);
                }
            }

            return(Tracker);
        }
Пример #5
0
        public override bool StopTracking()
        {
            SystemLogger.Log(SystemLogger.Module.PLATFORM, "Stopping Tracking");

            if (this._tracker != null)
            {
                UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                    try {
                        /* deprecated - changes to compile with iOS 7
                         * this._tracker.StopTracker();
                         * this._tracker.Dispatch();
                         */
                        // changes for ios 8 and new version 3.0.7
                        // v2 this._tracker.Set(GAIFields.SessionControl, "end");
                        // v3
                        this._tracker.Set(GAIConstants.SessionControl, "end");

                        this._tracker.Dispose();
                        this._tracker = null;

                        SystemLogger.Log(SystemLogger.Module.PLATFORM, "Tracking STOPPED");
                    } catch (Exception e) {
                        SystemLogger.Log(SystemLogger.Module.PLATFORM, "Error stopping tracker", e);
                    }
                });
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #6
0
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{

			//Styles
			UITabBar.Appearance.TintColor = UIColor.Red;


			// create a new window instance based on the screen size
			window = new UIWindow (UIScreen.MainScreen.Bounds);
			
			// If you have defined a root view controller, set it here:
			window.RootViewController = new TabController ();
			
			// make the window visible
			window.MakeKeyAndVisible ();

			// Optional: set Google Analytics dispatch interval to e.g. 20 seconds.
			GAI.SharedInstance.DispatchInterval = 20;

			// Optional: automatically send uncaught exceptions to Google Analytics.
			GAI.SharedInstance.TrackUncaughtExceptions = true;

			// Initialize tracker.
			Tracker = GAI.SharedInstance.GetTracker (TrackingId);
			
			return true;
		}
Пример #7
0
		public override bool FinishedLaunching (UIApplication app, NSDictionary options)
		{
			App.Initialize ();

			//Google Analytics Initialization
			Tracker = GAI.SharedInstance.GetTracker (TrackingId);

			#if DEBUG
			Xamarin.Calabash.Start();
			#endif

			Window = new UIWindow (UIScreen.MainScreen.Bounds);


			Boolean versionUpgraded;
			string AppVersion = NSBundle.MainBundle.ObjectForInfoDictionary ("CFBundleShortVersionString").ToString();
			string preVersion = NSUserDefaults.StandardUserDefaults.StringForKey ("appVersion");

			Console.WriteLine ("App Version:" + AppVersion);
			Console.WriteLine ("Previous Version:" + preVersion);

			if (preVersion != null) {
				versionUpgraded = true;
			}
			else {
				versionUpgraded = false;
			}
		
			if (versionUpgraded) {
				if (preVersion != AppVersion) {
					NSUserDefaults.StandardUserDefaults.SetString (AppVersion.ToString (), "appVersion");
					NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.TouchEnabled.ToString ());
					NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.FirstAppLaunch.ToString ());
					NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.UserVerified.ToString ());
					NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.AppActiveNotification.ToString ());
					Console.WriteLine ("Upgraded version");
					NSUserDefaults.StandardUserDefaults.Synchronize ();
				} 
			} else {
				NSUserDefaults.StandardUserDefaults.SetString (AppVersion.ToString (), "appVersion");
				NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.TouchEnabled.ToString ());
				NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.FirstAppLaunch.ToString ());
				NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.UserVerified.ToString ());
				NSUserDefaults.StandardUserDefaults.SetBool (false, TouchIDUtil.TouchIDSettings.AppActiveNotification.ToString ());
				Console.WriteLine ("Agreeing Now");
				NSUserDefaults.StandardUserDefaults.Synchronize ();
			}

			if (TouchIDUtil.AskedIfFirstLaunch () == false) {
				initialViewController = Storyboard.InstantiateViewController ("UserAgreement") as RSUserAgreementViewController;
			} else {
				initialViewController = Storyboard.InstantiateViewController ("LoginScreen") as TSLoginViewController;
			}

			Window.RootViewController = initialViewController;
			Window.MakeKeyAndVisible ();

			return true;
		}
Пример #8
0
        public Tracker()
        {
            #if DEBUG
            GAI.SharedInstance.DryRun = true;
            #endif

            tracker = GAI.SharedInstance.GetTracker(Build.GoogleAnalyticsId);
        }
Пример #9
0
        public Tracker ()
        {
            #if DEBUG
            GAI.SharedInstance.DryRun = true;
            #endif

            tracker = GAI.SharedInstance.GetTracker (Build.GoogleAnalyticsId);
        }
Пример #10
0
        private IGAITracker SharedTracker(string webPropertyID)
        {
            if (this._tracker == null)
            {
                UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                    // v2 this._tracker = GAI.SharedInstance.TrackerWithTrackingId(webPropertyID);
                    // v3
                    this._tracker = GAI.SharedInstance.GetTracker(webPropertyID);
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "*** GANTracker.SharedTracker instance");
                    if (this._tracker == null)
                    {
                        SystemLogger.Log(SystemLogger.Module.PLATFORM, "*** Instance returned by GANTracker is NULL. Please check your assembly linking");
                    }
                });
            }

            return(GAI.SharedInstance.DefaultTracker);
        }
Пример #11
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow(UIScreen.MainScreen.Bounds);
            GAI.SharedInstance.DispatchInterval = 20;

            // Optional: automatically send uncaught exceptions to Google Analytics.
            GAI.SharedInstance.TrackUncaughtExceptions = true;

            // Initialize tracker.
                        #if LITE
            Tracker = GAI.SharedInstance.GetTracker("UA-49576326-1");
            window.RootViewController = new IADViewController(new MainViewController());
                        #else
            Tracker = GAI.SharedInstance.GetTracker("UA-49576326-2");
            window.RootViewController = new MainViewController();
                        #endif
            // make the window visible
            window.MakeKeyAndVisible();
            SoundPlayer.Init();
            return(true);
        }
Пример #12
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);
            GAI.SharedInstance.DispatchInterval = 20;

            // Optional: automatically send uncaught exceptions to Google Analytics.
            GAI.SharedInstance.TrackUncaughtExceptions = true;

            // Initialize tracker.
            #if LITE
            Tracker = GAI.SharedInstance.GetTracker ("UA-49576326-1");
            window.RootViewController = new IADViewController(new MainViewController ());
            #else
            Tracker = GAI.SharedInstance.GetTracker ("UA-49576326-2");
            window.RootViewController = new MainViewController ();
            #endif
            // make the window visible
            window.MakeKeyAndVisible ();
            SoundPlayer.Init ();
            return true;
        }
Пример #13
0
        public IGAITracker GetTracker(AnalyticsConfiguration configuration)
        {
            if (Tracker == null) {
                GAI.SharedInstance.Logger.SetLogLevel (GetLogLevel (configuration.LogLevel));
                GAI.SharedInstance.DispatchInterval = configuration.DispatchPeriod;
                GAI.SharedInstance.DryRun = configuration.DryRun;
                GAI.SharedInstance.TrackUncaughtExceptions = configuration.ReportUncaughtExceptions;

                Tracker = GAI.SharedInstance.GetTracker (configuration.TrackingId);

                Tracker.Set (GAIConstants.SampleRate, configuration.SampleFrequency.ToString ());
                Tracker.Set (GAIConstants.AnonymizeIp, configuration.AnonymizeIp.ToString ());

                if (!string.IsNullOrEmpty (configuration.AppName)) {
                    Tracker.Set (GAIConstants.AppName, configuration.AppName);
                }

                if (!string.IsNullOrEmpty (configuration.AppVersion)) {
                    Tracker.Set (GAIConstants.AppVersion, configuration.AppVersion);
                }
            }

            return Tracker;
        }
Пример #14
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            InitialTabTag = 4; //-1 was orginal

            StableSession.ApiGuid = "13e723d7763b494db92b13fc05c40214";
            StableSession.DeviceId = UIDevice.CurrentDevice.IdentifierForVendor.AsString();

            FBSettings.DefaultAppID = FacebookAppId;
            FBSettings.DefaultDisplayName = DisplayName;

#if DEBUG
            // Disable analytics when running in debug.
            GAI.SharedInstance.DryRun = true;
#endif
            GAI.SharedInstance.DispatchInterval = 20;
            GAI.SharedInstance.TrackUncaughtExceptions = true;
            GoogleTracker = GAI.SharedInstance.GetTracker(GoogleAnalyticsId);
            GoogleTracker.SetAllowIdfaCollection(true);

            Interfaces.Instance.HMAC256Interface = new HMACSHA256_iOS();
            Interfaces.Instance.FacebookInterface = new Facebook_iOS();
            Interfaces.Instance.NetworkTesterInterface = new NetworkTester_iOS();

            
            // Register for push notifications
            if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
            {
                const UIUserNotificationType notificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound;
                var settings = UIUserNotificationSettings.GetSettingsForTypes(notificationTypes, new NSSet());
                UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
            }
            else
            {
                const UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.Alert | UIRemoteNotificationType.Badge | UIRemoteNotificationType.Sound;
                UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
            }

            if (options != null)
            {
                if (options.ContainsKey(UIApplication.LaunchOptionsRemoteNotificationKey))
                {
                    NSDictionary userInfo = options[UIApplication.LaunchOptionsRemoteNotificationKey] as NSDictionary;
                    if (userInfo != null)
                    {
                        NSDictionary aps = userInfo["aps"] as NSDictionary;
                        if (aps != null)
                        {
                            if (aps.ContainsKey(new NSString("mail_id")))
                            {
                                InitialTabTag = 1;
                            }
                            else if (aps.ContainsKey(new NSString("event_id")))
                            {
                                InitialTabTag = 2;
                            }
                        }
                    }
                }
            }

            MailHelper.Instance.UnreadCountChanged += MailHelperOnUnreadCountChanged;
            CalendarHelper.Instance.PendingEventsChanged += CalendarHelperOnPendingEventsChanged;

			// Här sätter vi central navigeringsfärg för hela appen till rosa färgen och vit text
			UINavigationBar.Appearance.BarTintColor = new UIColor (0.357f, 0.812f , 0.996f, 1.00f);//...
			//			UINavigationBar.Appearance.BarTintColor = UIColor.FromRGBA (20, 54, 109, 1);
			UINavigationBar.Appearance.TintColor = UIColor.White;
			UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes()
				{

					TextColor = UIColor.White
				});
			
            return true;
        }
Пример #15
0
        //public static CouchDB db;
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            GAI.SharedInstance.DispatchInterval = 20;
            GAI.SharedInstance.TrackUncaughtExceptions = true;
            Tracker = GAI.SharedInstance.GetTracker (TrackingId);

            iRate.SharedInstance.UserDidAttemptToRateApp += (sender, e) => {
                GAI.SharedInstance.DefaultTracker.Send (GAIDictionaryBuilder.CreateEvent ("UserRating", "User is rating app now!","UsesCount", iRate.SharedInstance.UsesCount).Build ());
                Console.WriteLine ("User is rating app now!");
            };

            iRate.SharedInstance.UserDidDeclineToRateApp += (sender, e) => {
                GAI.SharedInstance.DefaultTracker.Send (GAIDictionaryBuilder.CreateEvent ("UserRating", "User does not want to rate app","UsesCount", iRate.SharedInstance.UsesCount).Build ());
                Console.WriteLine ("User does not want to rate app");
            };

            iRate.SharedInstance.UserDidRequestReminderToRateApp += (sender, e) => {
                GAI.SharedInstance.DefaultTracker.Send (GAIDictionaryBuilder.CreateEvent ("UserRating", "User will rate app later","UsesCount", iRate.SharedInstance.UsesCount).Build ());
                Console.WriteLine ("User will rate app later");
            };

            key = new KeyStorageServiceIos ();

            var documents = Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData);
            var pathToDatabase = Path.Combine(documents, "db_sqlite-net.db");

            Connection conn = new Connection (pathToDatabase);

            dao = new LagerDAO (conn,Variant);

            dao.LimitExceeded += (object sender, EventArgs e) => PleaseBuyFullVersion ();

            bl = new IndexerBuisnessService (dao, new TranslationServiceIos());
            its = new TranslationServiceIos ();

            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            Dashboard = new DashBoardViewController ();
            navController = new UINavigationController (Dashboard);
            //navController.NavigationBar.BackgroundColor = UIColor.Clear;

            //			if(MonoTouch.Foundation.isi
            //			window.TintColor = UIColor.Purple;

            window.RootViewController = navController;
            // If you have defined a root view controller, set it here:
            //this.window.RootViewController = dashboard;

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }