refactor: Rename some constants

This commit is contained in:
Andrea Busi
2020-10-13 08:00:06 +02:00
parent e46fa0417d
commit 6135e2d38c
5 changed files with 12 additions and 11 deletions
@@ -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;
@@ -32,7 +32,7 @@
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(didReceiveDownloadCompleteNotification:)
name:NOTIFICA_DOWNLOAD_TERMINATO object:nil];
name:EQNNotificationDidDownloadData object:nil];
}
@@ -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];
+7 -6
View File
@@ -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 {
@@ -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);
}];