using BookAStar.Model.Workflow.Messaging; using Plugin.Settings; using Plugin.Settings.Abstractions; using System.Collections.Generic; namespace BookAStar.Settings { public static class ChatSettings { public static ISettings AppSettings { get { return CrossSettings.Current; } } private const string statusKey = "chat.status"; private const string ignoreListKey = "chat.ignoreList"; private const string denyAnonymousAccessKey = "chat.denyAnonymousAccess"; private const string denyTouristAccessKey = "chat.denyTouristAccess"; public static ChatStatus Status { get { return AppSettings.GetValueOrDefault(statusKey, ChatStatus.OffLine); } set { AppSettings.AddOrUpdateValue(statusKey, value); } } public static List IgnoreList { get { return AppSettings.GetValueOrDefault>(ignoreListKey); } } public static void Ignore(string userId) { var ignoreList = IgnoreList; ignoreList.Add(userId); AppSettings.AddOrUpdateValue(ignoreListKey, ignoreList); } public static void UnIgnore(string userId) { var ignoreList = IgnoreList; ignoreList.Remove(userId); AppSettings.AddOrUpdateValue(ignoreListKey, ignoreList); } public static void UnIgnoreAll() { var ignoreList = new List(); AppSettings.AddOrUpdateValue(ignoreListKey, ignoreList); } public static bool DenyAnonymousAccess { get { return AppSettings.GetValueOrDefault(denyAnonymousAccessKey); } set { AppSettings.AddOrUpdateValue(denyAnonymousAccessKey, value); } } public static bool DenyTouristAccess { get { return AppSettings.GetValueOrDefault(denyTouristAccessKey); } set { AppSettings.AddOrUpdateValue(denyTouristAccessKey, value); } } } }