Пример #1
0
 public static async Task NotifyUserWhenNotMetAppMinVer(this IAppConfigurationService configurationService, bool handleLoadConfigValidation = false, bool retrieveCached = false, string minVerKey = Constants.AppConfigurationMinVersionKey)
 {
     var metMinimumAppVer = await CheckMinimumVersion(configurationService, retrieveCached, minVerKey);
     if (!metMinimumAppVer)
     {
         //Block the app from running & alert users
         await configurationService.BlockAppFromRunning(Constants.AppConfigurationMinimumVersionNotMetUserDialogTitle, Constants.AppConfigurationMinimumVersionNotMetUserDialogBody, async () =>
         {
             await NotifyUserWhenNotMetAppMinVer(configurationService, handleLoadConfigValidation, retrieveCached, minVerKey);
         });
     }
 }
Пример #2
0
        public static async Task NotifyUserWhenNotMetAppRecommendedVer(this IAppConfigurationService configurationService, bool retrieveCached = false, Action failureHandler = null, string recommVerKey = Constants.AppConfigurationRecommVersionKey)
        {
            var metRecommendedVer = await CheckRecommendedVersion(configurationService, retrieveCached, recommVerKey);

            if (!metRecommendedVer)
            {
                if (failureHandler != null)
                {
                    //developer might have the custom action rather than displaying out alert
                    failureHandler.Invoke();
                }
                else
                {
                    //Alert users
                    await configurationService.BlockAppFromRunning(Constants.AppConfigurationRecommendedVersionNotMetUserDialogTitle, Constants.AppConfigurationRecommendedVersionNotMetUserDialogBody);
                }
            }
        }
Пример #3
0
        public static async Task HandleServiceNotification(this IAppConfigurationService configurationService, bool retrieveCached = false, Action failureHandler = null,
                                                           string serviceNotificationTitleKey = Constants.AppConfigurationServiceNotificationTitleKey,
                                                           string serviceNotificationBodyKey = Constants.AppConfigurationServiceNotificationBodyKey,
                                                           string serviceNotificationShowKey = Constants.AppConfigurationServiceNotificationDisplayingKey)
        {
            if (configurationService == null) return;

            configurationService.Mapper.EnsurePresence(serviceNotificationTitleKey);
            configurationService.Mapper.EnsurePresence(serviceNotificationBodyKey);
            configurationService.Mapper.EnsurePresence(serviceNotificationShowKey);

            var appConfig = await configurationService.LoadAppConfig(retrieveCached);

            if (appConfig == null) return;

            var showServiceNotification = appConfig.GetValueForKey<bool>(serviceNotificationShowKey);
            if (showServiceNotification)
            {
                //Alert users
                var serviceNotificationTitle = appConfig.GetValueForKey<string>(serviceNotificationTitleKey);
                var serviceNotificationBody = appConfig.GetValueForKey<string>(serviceNotificationBodyKey);
                if (!string.IsNullOrEmpty(serviceNotificationTitle) &&
                    !string.IsNullOrEmpty(serviceNotificationBody))
                {

                    if (failureHandler != null)
                    {
                        //developer might have the custom action rather than displaying out alert
                        failureHandler.Invoke();
                    }
                    else
                    {
                        await configurationService.BlockAppFromRunning(serviceNotificationBody, serviceNotificationTitle);
                    }
                }
            }
        }