Beispiel #1
0
        protected override void InitializeApp(IMvxPluginManager pluginManager, IMvxApplication app)
        {
            const string clientName                  = "Giskard";
            var          packageInfo                 = ApplicationContext.PackageManager.GetPackageInfo(ApplicationContext.PackageName, 0);
            var          version                     = packageInfo.VersionName;
            var          sharedPreferences           = ApplicationContext.GetSharedPreferences(clientName, FileCreationMode.Private);
            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 mailService       = new MailService(ApplicationContext);
            var dialogService     = new DialogService();
            var platformConstants = new PlatformConstants();
            var keyValueStorage   = new SharedPreferencesStorage(sharedPreferences);
            var settingsStorage   = new SettingsStorage(appVersion, keyValueStorage);
            var feedbackService   = new FeedbackService(userAgent, mailService, dialogService, platformConstants);
            var schedulerProvider = new AndroidSchedulerProvider();

            var foundation =
                TogglFoundation
                .ForClient(userAgent, appVersion)
                .WithDatabase(database)
                .WithScheduler(scheduler)
                .WithTimeService(timeService)
                .WithMailService(mailService)
                .WithApiEnvironment(environment)
                .WithGoogleService <GoogleService>()
                .WithRatingService <RatingService>()
                .WithLicenseProvider <LicenseProvider>()
                .WithAnalyticsService(analyticsService)
                .WithSchedulerProvider(schedulerProvider)
                .WithPlatformConstants(platformConstants)
                .WithRemoteConfigService <RemoteConfigService>()
                .WithApiFactory(new ApiFactory(environment, userAgent))
                .WithBackgroundService(new BackgroundService(timeService))
                .WithSuggestionProviderContainer(suggestionProviderContainer)
                .WithApplicationShortcutCreator(new ApplicationShortcutCreator(ApplicationContext))

                .StartRegisteringPlatformServices()
                .WithDialogService(dialogService)
                .WithFeedbackService(feedbackService)
                .WithLastTimeUsageStorage(settingsStorage)
                .WithBrowserService <BrowserService>()
                .WithKeyValueStorage(keyValueStorage)
                .WithUserPreferences(settingsStorage)
                .WithOnboardingStorage(settingsStorage)
                .WithNavigationService(navigationService)
                .WithAccessRestrictionStorage(settingsStorage)
                .WithErrorHandlingService(new ErrorHandlingService(navigationService, settingsStorage))
                .Build();

            foundation.RevokeNewUserIfNeeded().Initialize();

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

            const string clientName                  = "Giskard";
            var          packageInfo                 = ApplicationContext.PackageManager.GetPackageInfo(ApplicationContext.PackageName, 0);
            var          version                     = packageInfo.VersionName;
            var          sharedPreferences           = ApplicationContext.GetSharedPreferences(clientName, FileCreationMode.Private);
            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 SharedPreferencesStorage(sharedPreferences);
            var settingsStorage = new SettingsStorage(Version.Parse(version), keyValueStorage);

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

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