예제 #1
0
 private void SaveSetting(NotificationSetting setting, NotificationSettingsCollection values)
 {
     if (!values.Contains(setting.key) || values[setting.key].ToString() != setting.val.ToString())
     {
         values[setting.key] = setting.val;
         EditorUtility.SetDirty(this);
     }
 }
예제 #2
0
        public void SaveSetting(NotificationSetting setting, BuildTargetGroup target)
        {
            var collection = (target == BuildTargetGroup.Android) ? m_AndroidNotificationSettingsValues : m_iOSNotificationSettingsValues;

            if (!collection.Contains(setting.Key) || collection[setting.Key].ToString() != setting.Value.ToString())
            {
                collection[setting.Key] = setting.Value;
                SaveSettings();
            }
        }
예제 #3
0
 public void SaveSetting(NotificationSetting setting, BuildTargetGroup target)
 {
     if (target == BuildTargetGroup.Android)
     {
         this.SaveSetting(setting, AndroidNotificationSettingsValues);
     }
     else
     {
         this.SaveSetting(setting, iOSNotificationSettingsValues);
     }
 }
예제 #4
0
        private static void SetSettingValue <T>(BuildTargetGroup target, string key, T value)
        {
            var manager = NotificationSettingsManager.Initialize();

            NotificationSetting setting = GetSetting(target, key);

            if (setting != null)
            {
                setting.Value = value;
                manager.SaveSetting(setting, target);
            }
        }
예제 #5
0
        private static NotificationSetting GetSetting(BuildTargetGroup target, string key)
        {
            var manager = NotificationSettingsManager.Initialize();

            NotificationSetting setting = null;

            if (target == BuildTargetGroup.Android)
            {
                setting = manager.AndroidNotificationSettingsFlat.Find(i => i.Key == key);
            }
            else if (target == BuildTargetGroup.iOS)
            {
                setting = manager.iOSNotificationSettingsFlat.Find(i => i.Key == key);
            }

            return(setting);
        }
예제 #6
0
 // If the plist doesn't contain the key, or it's value is different, we should add/overwrite it.
 private static bool ShouldAddSettingToPlist(Unity.Notifications.NotificationSetting setting,
                                             PlistElementDict rootDict)
 {
     if (!rootDict.values.ContainsKey(setting.Key))
     {
         return(true);
     }
     else if (setting.Value.GetType() == typeof(bool))
     {
         return(!rootDict.values[setting.Key].AsBoolean().Equals((bool)setting.Value));
     }
     else if (setting.Value.GetType() == typeof(PresentationOption) || setting.Value.GetType() == typeof(AuthorizationOption))
     {
         return(!rootDict.values[setting.Key].AsInteger().Equals((int)setting.Value));
     }
     else
     {
         return(false);
     }
 }