diff --git a/Sources/Earthquake Network/Controllers/EQNBaseViewController.h b/Sources/Earthquake Network/Controllers/EQNBaseViewController.h index a2d4d29..29ef4c1 100644 --- a/Sources/Earthquake Network/Controllers/EQNBaseViewController.h +++ b/Sources/Earthquake Network/Controllers/EQNBaseViewController.h @@ -18,7 +18,7 @@ NS_ASSUME_NONNULL_BEGIN /// @param notification Notification fired - (void)didReceiveInAppNotification:(NSNotification *)notification; -/// Handle `NOTIFICA_DOWNLOAD_TERMINATO` notification +/// Handle `EQNNotificationDidDownloadData` notification /// @param notification Notification fired - (void)didReceiveDownloadCompleteNotification:(NSNotification *)notification; diff --git a/Sources/Earthquake Network/Controllers/EQNBaseViewController.m b/Sources/Earthquake Network/Controllers/EQNBaseViewController.m index abf92e2..d42106d 100644 --- a/Sources/Earthquake Network/Controllers/EQNBaseViewController.m +++ b/Sources/Earthquake Network/Controllers/EQNBaseViewController.m @@ -32,7 +32,7 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveDownloadCompleteNotification:) - name:NOTIFICA_DOWNLOAD_TERMINATO object:nil]; + name:EQNNotificationDidDownloadData object:nil]; } diff --git a/Sources/Earthquake Network/Controllers/SegnalazioniViewController.m b/Sources/Earthquake Network/Controllers/SegnalazioniViewController.m index b03f72e..701ee87 100644 --- a/Sources/Earthquake Network/Controllers/SegnalazioniViewController.m +++ b/Sources/Earthquake Network/Controllers/SegnalazioniViewController.m @@ -50,7 +50,7 @@ static NSString * const SegueIdentifierMap = @"ShowMap"; if ([self.userDefoult objectForKey:DATA_MESSAGE_EQN]){ NSDate *dateMessage = [self.userDefoult objectForKey:DATA_MESSAGE_EQN]; - if ([EQNUtility getDifferenceMinute:dateMessage] >= TEMPO_INVIO_COMMENTO){ + if ([EQNUtility getDifferenceMinute:dateMessage] >= EQNSendReportDelayBetweenComments){ [self.userDefoult removeObjectForKey:DATA_MESSAGE_EQN]; [self.userDefoult removeObjectForKey:CODE_MESSAGE_EQN]; } @@ -144,7 +144,7 @@ static NSString * const SegueIdentifierMap = @"ShowMap"; // check to avoid multiple consecutive reports if ([self.userDefoult objectForKey:CODE_MESSAGE_EQN]) { NSDate *dateMessage = [self.userDefoult objectForKey:DATA_MESSAGE_EQN]; - if ([EQNUtility getDifferenceMinute:dateMessage] <= TEMPO_INVIO_MESSAGGIO){ + if ([EQNUtility getDifferenceMinute:dateMessage] <= EQNSendReportDelayBetweenMessages){ NSString *message = NSLocalizedString(@"Il messaggio è già stato in viato, al momento non è possibile inviare una nuova segnalazione", @""); [self showErrorAlertWithMessage:message]; [self performSelectorOnMainThread:@selector(sincronizzazione) withObject:nil waitUntilDone:YES]; diff --git a/Sources/Earthquake Network/Costanti.h b/Sources/Earthquake Network/Costanti.h index b013839..c1a0fe2 100644 --- a/Sources/Earthquake Network/Costanti.h +++ b/Sources/Earthquake Network/Costanti.h @@ -66,14 +66,18 @@ static NSString * const EQNUserDefaultSeismicNetworkCards = @"EQNData.RetiSismic #pragma mark - NSNotification +/// Notifica di cambio stato permesso di localizzazione static NSString * const EQNNotificationDidChangeAuthorizationStatus = @"EQNNotificationDidChangeAuthorizationStatus"; +/// Notifica di completamento download dei dati +static NSString * const EQNNotificationDidDownloadData = @"EQNNotificationDidDownloadData"; #pragma mark - Other constants static NSTimeInterval const EQNSeismicDataRefreshInterval = 120.0; - -#define TEMPO_INVIO_MESSAGGIO 5 -#define TEMPO_INVIO_COMMENTO 30 +/// Tempo di attesa (minuti) tra l'invio di due segnalazioni +static NSTimeInterval const EQNSendReportDelayBetweenMessages = 5.0; +/// Tempo di attesa (minuti) per l'invio di due commenti +static NSTimeInterval const EQNSendReportDelayBetweenComments = 30.0; // colori celle tableview rete sismi #define COLORE_CELLA_MAGNITUTE_LEGGERA [UIColor colorWithRed:208.0/255.0 green:234.0/255.0 blue:201.0/255.0 alpha:1.0] @@ -123,9 +127,6 @@ typedef enum : NSInteger { #define GOOGLE_MAP_KEY @"AIzaSyDc2V2vpBmbSnAisiN18rY17Dm7lzVWNAg" -// NOTIFICHE -#define NOTIFICA_DOWNLOAD_TERMINATO @"NOTIFICA_DOWNLOAD_TERMINATO" - #define MESSAGGIO @"MESSAGGIO_ERRORE" typedef enum : NSInteger { diff --git a/Sources/Earthquake Network/model/EQNManager.m b/Sources/Earthquake Network/model/EQNManager.m index 4ce1af3..e7051be 100644 --- a/Sources/Earthquake Network/model/EQNManager.m +++ b/Sources/Earthquake Network/model/EQNManager.m @@ -158,7 +158,7 @@ [EQNUtility storeArray:array toUserDefaultForKey:EQNUserDefaultSeismicNetworkCards]; - [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICA_DOWNLOAD_TERMINATO object:nil userInfo:nil]; + [[NSNotificationCenter defaultCenter] postNotificationName:EQNNotificationDidDownloadData object:nil userInfo:nil]; } failure:^(NSError * error) { NSLog(@"[EQNManager] Download reti sismiche fallito. Errore: %@", error.localizedDescription); }];