示例#1
0
        protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
        {
#if !USE_PRODUCTION_API
            System.Net.ServicePointManager.ServerCertificateValidationCallback
                += (sender, certificate, chain, sslPolicyErrors) => true;
#endif

            const string clientName  = "Daneel";
            var          version     = NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"].ToString();
            var          database    = new Database();
            var          scheduler   = Scheduler.Default;
            var          timeService = new TimeService(scheduler);
            var          suggestionProviderContainer = new SuggestionProviderContainer(
                new MostUsedTimeEntrySuggestionProvider(database, timeService, maxNumberOfSuggestions)
                );

            var appVersion      = Version.Parse(version);
            var userAgent       = new UserAgent(clientName, version);
            var keyValueStorage = new UserDefaultsStorage();
            var settingsStorage = new SettingsStorage(Version.Parse(version), keyValueStorage);

            var foundation =
                TogglFoundation
                .ForClient(userAgent, appVersion)
                .WithDatabase(database)
                .WithScheduler(scheduler)
                .WithTimeService(timeService)
                .WithApiEnvironment(environment)
                .WithGoogleService <GoogleService>()
                .WithLicenseProvider <LicenseProvider>()
                .WithAnalyticsService(analyticsService)
                .WithPlatformConstants <PlatformConstants>()
                .WithApiFactory(new ApiFactory(environment, userAgent))
                .WithBackgroundService(new BackgroundService(timeService))
                .WithApplicationShortcutCreator <ApplicationShortcutCreator>()
                .WithSuggestionProviderContainer(suggestionProviderContainer)
                .WithMailService(new MailService((ITopViewControllerProvider)Presenter))

                .StartRegisteringPlatformServices()
                .WithBrowserService <BrowserService>()
                .WithKeyValueStorage(keyValueStorage)
                .WithUserPreferences(settingsStorage)
                .WithOnboardingStorage(settingsStorage)
                .WithNavigationService(navigationService)
                .WithAccessRestrictionStorage(settingsStorage)
                .WithPasswordManagerService <OnePasswordService>()
                .WithDialogService(new DialogService((ITopViewControllerProvider)Presenter))
                .WithApiErrorHandlingService(new ApiErrorHandlingService(navigationService, settingsStorage))
                .Build();

            foundation.RevokeNewUserIfNeeded().Initialize();

            base.InitializeApp(pluginManager, app);
        }
示例#2
0
        protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
        {
            base.InitializeApp(pluginManager, app);

#if !USE_PRODUCTION_API
            System.Net.ServicePointManager.ServerCertificateValidationCallback
                += (sender, certificate, chain, sslPolicyErrors) => true;
#endif

            const string clientName  = "Daneel";
            var          version     = NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"].ToString();
            var          database    = new Database();
            var          scheduler   = Scheduler.Default;
            var          timeService = new TimeService(scheduler);
            var          suggestionProviderContainer = new SuggestionProviderContainer(
                new MostUsedTimeEntrySuggestionProvider(database, timeService, maxNumberOfSuggestions)
                );

            var keyValueStorage = new UserDefaultsStorage();
            var settingsStorage = new SettingsStorage(Version.Parse(version), keyValueStorage);

            var foundation = Foundation.Foundation.Create(
                clientName,
                version,
                database,
                timeService,
                scheduler,
                new MailService((ITopViewControllerProvider)Presenter),
                new GoogleService(),
                environment,
                new LicenseProvider(),
                analyticsService,
                new PlatformConstants(),
                new ApplicationShortcutCreator(),
                suggestionProviderContainer
                );

            foundation
            .RegisterServices(
                new DialogService((ITopViewControllerProvider)Presenter),
                new BrowserService(),
                keyValueStorage,
                settingsStorage,
                settingsStorage,
                settingsStorage,
                navigationService,
                new OnePasswordService())
            .RevokeNewUserIfNeeded()
            .Initialize(app as App, Scheduler.Default);
        }