public async void SetNotificationStatus(bool notification) { NotificationStatus = notification; if (NotificationFailureCount >= 3) { SetActivityResource(showError: true, errorMessage: "Sorry, we're have a problem with notification status update, please have patience concerned person has been informed"); await DependencyService.Get <ILogServices>().WriteLog("Notification Status update problem", "Notification Status update error in SettingViewModel.cs", false); return; } var response = await _notificationServices.Update( new UserNotificationSetting() { IsSpecialOffer = NotificationStatus, IsPromotional = NotificationStatus, IsGeneralMessage = NotificationStatus, IsWeightSubmitReminder = NotificationStatus, IsVersionUpdate = NotificationStatus, Intimation = NotificationStatus }); if (response != HttpConstants.SUCCESS) { NotificationFailureCount++; NotificationStatus = notification; SetActivityResource(showError: true, errorMessage: response); } }
public async Task <bool> Update(NotifyType NotifyType, bool status) { if (NotificationFailureCount >= 3) { SetActivityResource(showError: true, errorMessage: "Sorry, we're have a problem with notification status update, please have patience concerned person has been informed"); await DependencyService.Get <ILogServices>().WriteLog("Notification Status update problem", "Notification Status update error in SettingViewModel.cs", false); GetNotificationStatus(); return(false); } Set(NotifyType, status); var response = await _notificationServices.Update(new UserNotificationSetting() { IsSpecialOffer = IsSpecialOffer, IsPromotional = IsPromotional, IsGeneralMessage = IsGeneralMessage, IsWeightSubmitReminder = IsWeightSubmitReminder, IsVersionUpdate = IsVersionUpdate }); if (response != HttpConstants.SUCCESS) { Set(NotifyType, !status); NotificationFailureCount++; SetActivityResource(showError: true, errorMessage: response); return(false); } NotificationFailureCount = 0; return(true); }