Beispiel #1
0
        private void InitNotificationSetting()
        {
            var notificationRecycler = FindViewById <RecyclerView>(Resource.Id.recyler_notification_settings);

            var notificationSettings = new List <NotificationSetting>();

            foreach (var topic in YawsNotification.AvailableTopics)
            {
                var setting = new NotificationSetting
                {
                    Name      = GetNotificationSettingName(topic),
                    Topic     = topic,
                    IsChecked = AppSettings.GetSwitchNotificationSetting(topic)
                };
                notificationSettings.Add(setting);
            }

            var adapter = new NotificationRecyclerAdapter(notificationSettings, AppSettings);

            notificationRecycler.SetAdapter(adapter);

            var layoutManager = new LinearLayoutManager(ApplicationContext);

            notificationRecycler.SetLayoutManager(layoutManager);

            var divider = new DividerItemDecoration(ApplicationContext, layoutManager.Orientation);

            notificationRecycler.AddItemDecoration(divider);
        }
 public void Bind(NotificationSetting model)
 {
     settingSwitch.CheckedChange -= SwitchCheckedChange;
     Model = model;
     settingSwitch.Text           = model.Name;
     settingSwitch.Checked        = model.IsChecked;
     settingSwitch.CheckedChange += SwitchCheckedChange;
 }
Beispiel #3
0
        public void OnNotificationSettingChanged(NotificationSetting model)
        {
            if (model.IsChecked)
            {
                FirebaseMessaging.Instance.SubscribeToTopic(appSettings.Platform, model.Topic);
            }
            else
            {
                FirebaseMessaging.Instance.UnsubscribeFromTopic(appSettings.Platform, model.Topic);
            }

            appSettings.SetSwitchNotificationSetting(model.Topic, model.IsChecked);
        }