From 33f2d45cb9f20eeb59ce1779bf1a2c8d4a460464 Mon Sep 17 00:00:00 2001 From: Andrea Busi Date: Sat, 29 Aug 2020 16:47:16 +0200 Subject: [PATCH] fix: Solve missing load of notification saved value Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/11 --- .../SettingsUserReportAlertsViewController.m | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/Sources/Earthquake Network/Controllers/Settings/SettingsUserReportAlertsViewController.m b/Sources/Earthquake Network/Controllers/Settings/SettingsUserReportAlertsViewController.m index 3af26ca..455c4fe 100644 --- a/Sources/Earthquake Network/Controllers/Settings/SettingsUserReportAlertsViewController.m +++ b/Sources/Earthquake Network/Controllers/Settings/SettingsUserReportAlertsViewController.m @@ -32,9 +32,7 @@ [[SettingItem alloc] initWithType:SettingTypeSlider title:NSLocalizedString(@"Raggio dalla tua posizione", @"") subtitle:nil icon:nil segue:nil] ]; - EQNGenericValue *distanzaPosizione = [EQNData raggioSismaFor:[EQNNotificheSegnalazioniUtente center].distanzaPosizione]; - self.currentRadius = distanzaPosizione; - [[EQNNotificheSegnalazioniUtente center] saveUserInfo]; + [self updateUI]; } #pragma mark - Private @@ -48,6 +46,17 @@ [self.tableView registerClass:[SettingSliderTableViewCell class] forCellReuseIdentifier:SettingSliderTableViewCell.Identifier]; } +- (void)updateUI +{ + self.notificationsEnabled = [EQNNotificheSegnalazioniUtente center].isAbilitato; + + EQNGenericValue *distanzaPosizione = [EQNData raggioSismaFor:[EQNNotificheSegnalazioniUtente center].distanzaPosizione]; + self.currentRadius = distanzaPosizione; + [[EQNNotificheSegnalazioniUtente center] saveUserInfo]; + + [self.tableView reloadData]; +} + - (void)updateRadius:(EQNGenericValue *)radius { self.currentRadius = radius;