refactor: Improve code in EQNManager and remove dead code
This commit is contained in:
@@ -142,7 +142,7 @@ class SubscriptionsViewController: UITableViewController {
|
||||
}
|
||||
|
||||
private func checkDiscountPrice() -> Bool {
|
||||
let downloaded = EQNManager.default().rete_smartphone?.subscriptionsDiscounted
|
||||
let downloaded = EQNManager.manager().rete_smartphone?.subscriptionsDiscounted
|
||||
return downloaded ?? false
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,6 @@ static NSString * const EQNServerUrlDownloadRetiSismiche = @"https://srv.earthqu
|
||||
#define URL_SERVER_PAST_QUAKES @"http://srv.earthquakenetwork.it/distquake_download_pastquakes.php"
|
||||
// download Utenti disponibili
|
||||
#define URL_SERVER_UTENTI_DISPONIBILI @"http://srv.earthquakenetwork.it/distquake_count_top_redis.php"
|
||||
// download tempo disponibili passare a Pro
|
||||
#define URL_SERVER_TEMPO_DISPONIBILI @"http://srv.earthquakenetwork.it/distquake_download_offer_status.php"
|
||||
// download segnalazioni
|
||||
#define URL_SERVER_DOWNLOAD_SEGNALAZIONI_UTENTE @"http://srv.earthquakenetwork.it/distquake_download_manual.php"
|
||||
// Invio segnalazione
|
||||
@@ -56,18 +54,9 @@ static NSString * const EQNServerUrlDownloadRetiSismiche = @"https://srv.earthqu
|
||||
|
||||
#define URL_SERVER_UPLOAD_IMPOSTAZIONI @"http://srv.earthquakenetwork.it/distquake_upload_settings9.php"
|
||||
|
||||
#define URL_LINK_MESSAGGIO @"http://www.finazzieng.it/mysql/distquake_download_message.php"
|
||||
|
||||
#define TEMPO_INVIO_MESSAGGIO 5
|
||||
#define TEMPO_INVIO_COMMENTO 30
|
||||
|
||||
|
||||
// Tsunami
|
||||
#define URL_SERVER_DOWNLOAD_TSUNAMI @"http://srv.earthquakenetwork.it/distquake_download_tsunami.php"
|
||||
|
||||
// colori navigation bar
|
||||
#define COLORE_BARRA_NAVIGAZIONE [UIColor colorWithRed:198.0/255.0 green:213.0/255.0 blue:247.0/255.0 alpha:1.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]
|
||||
#define COLORE_CELLA_MAGNITUTE_LEGGERA_ETI [UIColor colorWithRed:215.0/255.0 green:253.0/255.0 blue:210.0/255.0 alpha:1.0]
|
||||
@@ -149,15 +138,6 @@ typedef enum : NSInteger {
|
||||
offerTimeRemaining
|
||||
} EQNTipoChiamata;
|
||||
|
||||
// Manager
|
||||
#define MANAGER_DATA_RETE_SMARTPHONE @"MANAGER_DATA_RETE_SMARTPHONE"
|
||||
#define MANAGER_DATA_AREA_CHECK @"MANAGER_DATA_AREA_CHECK"
|
||||
#define MANAGER_DATA_DATI_GRAFICO_UTENTI @"MANAGER_DATA_DATI_GRAFICO_UTENTI"
|
||||
#define MANAGER_DATA_DATI_PASTQUAKES @"MANAGER_DATA_DATI_PASTQUAKES"
|
||||
#define MANAGER_DATA_ELENCO_SEGNALAZIONI_MANUALI @"MANAGER_DATA_ELENCO_SEGNALAZIONI_MANUALI"
|
||||
#define MANAGER_DATA_RETI_SISMICHE @"MANAGER_DATA_RETI_SISMICHE"
|
||||
#define MANAGER_DATA_LISTA_TSUNAMI @"MANAGER_DATA_LISTA_TSUNAMI"
|
||||
|
||||
|
||||
// chiavi rMax e rMin
|
||||
#define rMax @"rMax"
|
||||
|
||||
@@ -32,8 +32,6 @@
|
||||
textForNavi.text = NSLocalizedString(@"Rilevatore Terremoti", @"titolo navigation bar");
|
||||
[viewNavigationBar addSubview:textForNavi];
|
||||
self.navigationItem.titleView = viewNavigationBar;
|
||||
[[UINavigationBar appearance] setBarTintColor:COLORE_BARRA_NAVIGAZIONE];
|
||||
[[UINavigationBar appearance] setTranslucent:NO];
|
||||
|
||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"back"]
|
||||
style:UIBarButtonItemStyleDone
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
+(NSURL *)urlDownloadDati;
|
||||
+(NSURL *)urlRegistrazione;
|
||||
+(NSURL *)urlPosizione;
|
||||
+(NSURL *)urlTempoDisponibile;
|
||||
+(NSURL *)urlMessagioStatoSmartPhone:(EQNCalibrazione *)calibrazione rilevamento:(EQNRilevamento *)rilevamento;
|
||||
+(NSURL *)urlInvioMessagioTerremoto:(NSInteger )magnitudo withAdress:(NSString *)address;
|
||||
+(NSURL *)urlInvioCommentoTerremoto:(NSString *)commento codeMessage:(NSString *)code;
|
||||
|
||||
@@ -45,13 +45,6 @@
|
||||
return [NSURL URLWithString:stringUrl];
|
||||
}
|
||||
|
||||
+(NSURL *)urlTempoDisponibile{
|
||||
|
||||
NSString *stringUrl = [NSString stringWithFormat:@"%@?u_id=%@",URL_SERVER_TEMPO_DISPONIBILI, [EQNUser defaultUser].user_ID];
|
||||
|
||||
return [NSURL URLWithString:stringUrl];
|
||||
}
|
||||
|
||||
+(NSURL *)urlMessagioStatoSmartPhone:(EQNCalibrazione *)calibrazione rilevamento:(EQNRilevamento *)rilevamento{
|
||||
|
||||
NSString *e_t = @"0";
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "EQNReteSmartphone.h"
|
||||
#import "EQNAreaCheck.h"
|
||||
#import "EQNSegnalazione.h"
|
||||
|
||||
@interface EQNManager : NSObject
|
||||
|
||||
@property (nonatomic, assign) BOOL isBackground;
|
||||
@property (nonatomic, strong, nullable) EQNReteSmartphone *rete_smartphone;
|
||||
@property (nonatomic, strong, nullable) EQNAreaCheck *area_check;
|
||||
@@ -19,14 +19,12 @@
|
||||
@property (nonatomic, strong, nullable) NSArray *datiPastQuakes;
|
||||
@property (nonatomic, strong, nullable) NSArray *elencoSelagnazioniManuali;
|
||||
@property (nonatomic, strong, nullable) NSArray *retiSismiche;
|
||||
@property (nonatomic, strong, nullable) NSArray *listaTsunami;
|
||||
|
||||
|
||||
+(nonnull EQNManager *) defaultManager;
|
||||
-(void)avviaManager;
|
||||
-(void)stopManager;
|
||||
-(void)controllaStatoApplicazione;
|
||||
-(void)sincronizza;
|
||||
-(void)recuperaDati;
|
||||
+ (nonnull instancetype)defaultManager NS_SWIFT_NAME(manager());
|
||||
- (void)avviaManager;
|
||||
- (void)stopManager;
|
||||
- (void)controllaStatoApplicazione;
|
||||
- (void)sincronizza;
|
||||
|
||||
@end
|
||||
|
||||
@@ -20,242 +20,144 @@
|
||||
#import "EQNSegnalazione.h"
|
||||
#import "EQNSisma.h"
|
||||
#import "EQNUtility.h"
|
||||
#import "Tsunami.h"
|
||||
//#import <CoreLocation/CoreLocation.h>
|
||||
|
||||
@interface EQNManager()
|
||||
|
||||
@property (nonatomic, strong) EQNCalibrazione *calibrazione;
|
||||
|
||||
@property (nonatomic, strong) NSDate *timeStamp;
|
||||
@property (nonatomic, assign) BOOL inCalibrazione;
|
||||
@property (nonatomic, assign) BOOL inRilevamento;
|
||||
|
||||
@end
|
||||
|
||||
@implementation EQNManager
|
||||
|
||||
static EQNManager *_sharedInstance = nil;
|
||||
#pragma mark - Singleton
|
||||
|
||||
+(EQNManager *) defaultManager{
|
||||
+ (instancetype)defaultManager
|
||||
{
|
||||
static EQNManager *instance = nil;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
instance = [[self alloc]init];
|
||||
[instance recuperaDati];
|
||||
// [instance scaricaDatiGrafico];
|
||||
// [instance scaricaAreaCheck];
|
||||
// [instance scaricaPastquakes];
|
||||
|
||||
instance = [[self alloc] init];
|
||||
});
|
||||
return instance;
|
||||
}
|
||||
|
||||
-(void)sincronizza{
|
||||
|
||||
[self scaricaDatiReteSmartphone];
|
||||
|
||||
}
|
||||
#pragma mark - Private
|
||||
|
||||
-(void)scaricaDatiReteSmartphone{
|
||||
|
||||
- (void)scaricaDatiReteSmartphone
|
||||
{
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:URL_SERVER_DOWNLOAD] richiesta:downloadDati success:^(id result) {
|
||||
|
||||
NSLog(@"%@\nresult segnalazioni %@",[NSURL URLWithString:URL_SERVER_DOWNLOAD] ,result);
|
||||
self.rete_smartphone = [[EQNReteSmartphone alloc] initWithInfo:result];
|
||||
|
||||
[self performSelectorOnMainThread:@selector(scaricaDatiGrafico) withObject:nil waitUntilDone:YES];
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
// NSLog(@"Errore scaricaDatiReteSmartphone %@", error);
|
||||
|
||||
NSLog(@"[EQNManager] Download dati rete smartphone fallito. Errore: %@", error.localizedDescription);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)scaricaDatiGrafico{
|
||||
|
||||
- (void)scaricaDatiGrafico
|
||||
{
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:URL_SERVER_GEAFICO_UTENTI] richiesta:graficoSmartPhone success:^(id result) {
|
||||
|
||||
NSMutableArray *arryTemp = [NSMutableArray array];
|
||||
for (NSDictionary *dic in result)
|
||||
for (NSDictionary *dic in result) {
|
||||
[arryTemp addObject:[[EQNDatoGrafico alloc] initWithInfo:dic]];
|
||||
|
||||
}
|
||||
self.datiGraficoUtente = arryTemp;
|
||||
|
||||
// NSLog(@"result scaricaDatiGrafico %@", result);
|
||||
|
||||
[self performSelectorOnMainThread:@selector(scaricaAreaCheck) withObject:nil waitUntilDone:YES];
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
// NSLog(@"Errore scaricaDatiGrafico %@", error);
|
||||
|
||||
|
||||
NSLog(@"[EQNManager] Download dati grafico fallito. Errore: %@", error.localizedDescription);
|
||||
}];
|
||||
|
||||
}
|
||||
|
||||
-(void)scaricaAreaCheck{
|
||||
|
||||
- (void)scaricaAreaCheck
|
||||
{
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?lat=%f&lon=%f", URL_SERVER_AREA_CHECK, [EQNUser defaultUser].lastPosition.coordinate.latitude, [EQNUser defaultUser].lastPosition.coordinate.longitude]] richiesta:areaCheck success:^(id result) {
|
||||
|
||||
self.area_check = [[EQNAreaCheck alloc] initWithInfo:result];
|
||||
|
||||
NSLog(@"%@ \nresult scaricaAreaCheck %@",[NSString stringWithFormat:@"%@?lat%f&lon=%f", URL_SERVER_AREA_CHECK, [EQNUser defaultUser].lastPosition.coordinate.latitude, [EQNUser defaultUser].lastPosition.coordinate.longitude] ,result);
|
||||
|
||||
[self performSelectorOnMainThread:@selector(scaricaPastquakes) withObject:nil waitUntilDone:YES];
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
// NSLog(@"Errore scaricaAreaCheck %@", error);
|
||||
NSLog(@"[EQNManager] Download area check fallito. Errore: %@", error.localizedDescription);
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)scaricaPastquakes{
|
||||
|
||||
- (void)scaricaPastquakes
|
||||
{
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:URL_SERVER_PAST_QUAKES] richiesta:pastquakes success:^(id result) {
|
||||
|
||||
NSMutableArray *arryTemp = [NSMutableArray array];
|
||||
for (NSDictionary *dic in result)
|
||||
[arryTemp addObject:[[EQNPastquakes alloc] initWithInfo:dic]];
|
||||
for (NSDictionary *dic in result) {
|
||||
[arryTemp addObject:[[EQNPastquakes alloc] initWithInfo:dic]];
|
||||
}
|
||||
self.datiPastQuakes = arryTemp;
|
||||
|
||||
// NSLog(@"result scaricaPastquakes %@", result);
|
||||
|
||||
[self performSelectorOnMainThread:@selector(scaricaSegnalazioniManuali) withObject:nil waitUntilDone:YES];
|
||||
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
// NSLog(@"Errore scaricaPastquakes %@", error);
|
||||
|
||||
|
||||
NSLog(@"[EQNManager] Download pastquakes fallito. Errore: %@", error.localizedDescription);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)scaricaSegnalazioniManuali{
|
||||
|
||||
- (void)scaricaSegnalazioniManuali
|
||||
{
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:URL_SERVER_DOWNLOAD_SEGNALAZIONI_UTENTE] richiesta:segnalazioneManuale success:^(id result) {
|
||||
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
NSArray *tempArray = (NSArray *)result;
|
||||
for (NSDictionary *dict in tempArray) {
|
||||
|
||||
[array addObject:[[EQNSegnalazione alloc] initWithInfo:dict]];
|
||||
|
||||
}
|
||||
|
||||
self.elencoSelagnazioniManuali = [NSArray arrayWithArray:array];
|
||||
|
||||
[self performSelectorOnMainThread:@selector(scaricaReteSismica) withObject:nil waitUntilDone:YES];
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
// NSLog(@"Errore scaricaSegnalazioniManuali %@", error);
|
||||
|
||||
NSLog(@"[EQNManager] Download segnalazioni manuali. Errore: %@", error.localizedDescription);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
-(void)scaricaReteSismica{
|
||||
|
||||
- (void)scaricaReteSismica
|
||||
{
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:EQNServerUrlDownloadRetiSismiche] richiesta:downloadDati success:^(id result) {
|
||||
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
for (NSDictionary *dic in result)
|
||||
for (NSDictionary *dic in result) {
|
||||
[array addObject:[[EQNSisma alloc] initWithInfo:dic]];
|
||||
|
||||
}
|
||||
self.retiSismiche = [NSArray arrayWithArray:array];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICA_DOWNLOAD_TERMINATO object:nil userInfo:nil];
|
||||
|
||||
|
||||
[self performSelectorOnMainThread:@selector(scaricaTsunami) withObject:nil waitUntilDone:YES];
|
||||
[self salvaDati];
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
// NSLog(@"Errore scaricaReteSismica %@", error);
|
||||
|
||||
NSLog(@"[EQNManager] Download reti sismiche fallito. Errore: %@", error.localizedDescription);
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)scaricaTsunami{
|
||||
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:URL_SERVER_DOWNLOAD_TSUNAMI] richiesta:segnalazioneManuale success:^(id result) {
|
||||
|
||||
NSMutableArray *array = [NSMutableArray array];
|
||||
NSArray *tempArray = (NSArray *)result;
|
||||
for (NSDictionary *dict in tempArray) {
|
||||
[array addObject:[[Tsunami alloc] initWithInfo:dict]];
|
||||
}
|
||||
#pragma mark - Public
|
||||
|
||||
// NSLog(@"result scaricaTsunami %@", result);
|
||||
|
||||
self.listaTsunami = [NSArray arrayWithArray:array];
|
||||
|
||||
[self performSelectorOnMainThread:@selector(scaricaTempoDisponibile) withObject:nil waitUntilDone:YES];
|
||||
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
// NSLog(@"Errore scaricaTsunami %@", error);
|
||||
|
||||
}];
|
||||
- (void)sincronizza
|
||||
{
|
||||
[self scaricaDatiReteSmartphone];
|
||||
}
|
||||
|
||||
-(void)scaricaTempoDisponibile{
|
||||
|
||||
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[EQNGeneratoreURLServer urlTempoDisponibile] richiesta:tempoDisponibile success:^(id result) {
|
||||
|
||||
NSLog(@"%@", result);
|
||||
NSLog(@"result scaricaTempoDisponibile %@", result);
|
||||
|
||||
// [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICA_DOWNLOAD_TERMINATO object:nil userInfo:nil];
|
||||
|
||||
} failure:^(NSError * error) {
|
||||
|
||||
NSLog(@"Errore scaricaTempoDisponibile %@", error);
|
||||
|
||||
|
||||
}];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
-(void)registerforDeviceLockNotif {
|
||||
|
||||
//Alert notification
|
||||
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(),
|
||||
NULL, // observer
|
||||
displayStatusChanged, // callback
|
||||
CFSTR("com.apple.springboard.showingAlertItem"), // event name
|
||||
NULL, // object
|
||||
CFNotificationSuspensionBehaviorDeliverImmediately);
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
-(void)avviaManager{
|
||||
|
||||
- (void)avviaManager
|
||||
{
|
||||
self.isBackground = YES;
|
||||
self.timeStamp = [NSDate date];
|
||||
|
||||
}
|
||||
-(void)stopManager{
|
||||
|
||||
self.isBackground = NO;;
|
||||
self.timeStamp = nil;
|
||||
|
||||
}
|
||||
|
||||
-(void)controllaStatoApplicazione{
|
||||
|
||||
- (void)stopManager
|
||||
{
|
||||
self.isBackground = NO;;
|
||||
self.timeStamp = nil;
|
||||
}
|
||||
|
||||
- (void)controllaStatoApplicazione
|
||||
{
|
||||
[[UIDevice currentDevice] setBatteryMonitoringEnabled:YES];
|
||||
|
||||
switch ([[UIDevice currentDevice] batteryState]) {
|
||||
@@ -278,19 +180,12 @@ static EQNManager *_sharedInstance = nil;
|
||||
NSLog(@"Loanciato controllo batteria ");
|
||||
|
||||
if ([EQNUser defaultUser].inCarica){
|
||||
|
||||
// NSLog(@"Tempo Manager %f", [[NSDate date] timeIntervalSinceDate:self.timeStamp]);
|
||||
|
||||
NSTimeInterval timer = [[NSDate date] timeIntervalSinceDate:self.timeStamp];
|
||||
NSLog(@"Timer %f", timer);
|
||||
|
||||
//[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"timer %f ", timer]}];
|
||||
|
||||
if (!self.calibrazione) {
|
||||
if (!self.inCalibrazione) {
|
||||
|
||||
if(timer > TEMPO_LATENZA_CALIBRAZIONE){
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": @"Avvio Calibrazione"}];
|
||||
|
||||
NSLog(@"Avvio Calibrazione");
|
||||
@@ -298,7 +193,7 @@ static EQNManager *_sharedInstance = nil;
|
||||
[self avviaCalibrazione];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
if(timer > TEMPO_RIPETIZIONE_CALIBRAZIONE){
|
||||
[self annullaCalibrazione];
|
||||
self.inCalibrazione = YES;
|
||||
@@ -311,18 +206,16 @@ static EQNManager *_sharedInstance = nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
else {
|
||||
[self annullaCalibrazione];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
-(void)avviaCalibrazione{
|
||||
|
||||
- (void)avviaCalibrazione
|
||||
{
|
||||
[EQNCalibrazione startCalibrazione:^(EQNCalibrazione *cal) {
|
||||
self.calibrazione = cal;
|
||||
|
||||
// [self iniviaMessaggioAlServer:nil];
|
||||
NSLog(@"Media %f stato %li", cal.media, (long)cal.stato );
|
||||
[self performSelectorOnMainThread:@selector(iniviaMessaggioAlServer:)
|
||||
withObject:nil
|
||||
@@ -348,17 +241,16 @@ static EQNManager *_sharedInstance = nil;
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)annullaCalibrazione{
|
||||
|
||||
- (void)annullaCalibrazione
|
||||
{
|
||||
self.calibrazione = nil;
|
||||
self.inRilevamento = NO;
|
||||
self.inCalibrazione = NO;
|
||||
self.timeStamp = [NSDate date];
|
||||
|
||||
}
|
||||
|
||||
-(void)avviaRilevamento{
|
||||
|
||||
- (void)avviaRilevamento
|
||||
{
|
||||
if (self.calibrazione) {
|
||||
self.inRilevamento = YES;
|
||||
[EQNRilevamento startRilevamentoWithCalibrazione:self.calibrazione result:^(EQNRilevamento *ril) {
|
||||
@@ -397,14 +289,15 @@ static EQNManager *_sharedInstance = nil;
|
||||
}
|
||||
}
|
||||
|
||||
-(void)riavviaRilevamento{
|
||||
|
||||
if (self.calibrazione)
|
||||
- (void)riavviaRilevamento
|
||||
{
|
||||
if (self.calibrazione) {
|
||||
[self avviaRilevamento];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)iniviaMessaggioAlServer:(EQNRilevamento *)anRilevamento{
|
||||
|
||||
- (void)iniviaMessaggioAlServer:(EQNRilevamento *)anRilevamento
|
||||
{
|
||||
EQNTipoChiamata tipo = calibrazione;
|
||||
EQNCalibrazione *anCalibrazione = [self.calibrazione copy];
|
||||
if (anRilevamento.rilievo == positivo){
|
||||
@@ -417,47 +310,9 @@ static EQNManager *_sharedInstance = nil;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"invio informazione al server tipo %ld inviato ", (long)tipo]}];
|
||||
|
||||
} failure:^(NSError *error) {
|
||||
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"AGGIORNA_LOG" object:nil userInfo:@{@"messaggio": [NSString stringWithFormat:@"invio informazione al server tipo %ld fallito ", (long)tipo]}];
|
||||
}];
|
||||
}
|
||||
|
||||
// Salvataggio dati
|
||||
|
||||
-(void)salvaDati{
|
||||
|
||||
/*
|
||||
[EQNUtility saveCustomObject:self.retiSismiche key:MANAGER_DATA_RETE_SMARTPHONE];
|
||||
[EQNUtility saveCustomObject:self.area_check key:MANAGER_DATA_AREA_CHECK];
|
||||
|
||||
[EQNUtility writeArrayWithCustomObjToUserDefaults:MANAGER_DATA_DATI_GRAFICO_UTENTI withArray:self.datiGraficoUtente];
|
||||
[EQNUtility writeArrayWithCustomObjToUserDefaults:MANAGER_DATA_DATI_PASTQUAKES withArray:self.datiPastQuakes];
|
||||
[EQNUtility writeArrayWithCustomObjToUserDefaults:MANAGER_DATA_ELENCO_SEGNALAZIONI_MANUALI withArray:self.elencoSelagnazioniManuali];
|
||||
[EQNUtility writeArrayWithCustomObjToUserDefaults:MANAGER_DATA_RETI_SISMICHE withArray:self.retiSismiche];
|
||||
[EQNUtility writeArrayWithCustomObjToUserDefaults:MANAGER_DATA_LISTA_TSUNAMI withArray:self.listaTsunami];
|
||||
*/
|
||||
}
|
||||
|
||||
-(void)recuperaDati{
|
||||
/*
|
||||
self.retiSismiche = [EQNUtility readArrayWithCustomObjFromUserDefaults:MANAGER_DATA_RETI_SISMICHE];
|
||||
|
||||
self.datiGraficoUtente = [EQNUtility readArrayWithCustomObjFromUserDefaults:MANAGER_DATA_DATI_GRAFICO_UTENTI];
|
||||
|
||||
self.datiPastQuakes = [EQNUtility readArrayWithCustomObjFromUserDefaults:MANAGER_DATA_DATI_PASTQUAKES];
|
||||
|
||||
self.elencoSelagnazioniManuali = [EQNUtility readArrayWithCustomObjFromUserDefaults:MANAGER_DATA_ELENCO_SEGNALAZIONI_MANUALI];
|
||||
|
||||
self.listaTsunami = [EQNUtility readArrayWithCustomObjFromUserDefaults:MANAGER_DATA_LISTA_TSUNAMI];
|
||||
|
||||
self.rete_smartphone = (EQNReteSmartphone *)[EQNUtility loadCustomObjectWithKey:MANAGER_DATA_RETE_SMARTPHONE];
|
||||
|
||||
self.area_check = (EQNAreaCheck *)[EQNUtility loadCustomObjectWithKey:MANAGER_DATA_AREA_CHECK];
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICA_DOWNLOAD_TERMINATO object:nil userInfo:nil];
|
||||
*/
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@@ -77,26 +77,6 @@ static EQNUser *_sharedInstance = nil;
|
||||
self.tokenUser = nil;
|
||||
}
|
||||
|
||||
/*
|
||||
-(void)writeArrayWithCustomObjToUserDefaults:(NSString *)keyName withArray:(NSArray *)myArray
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myArray];
|
||||
[defaults setObject:data forKey:keyName];
|
||||
[defaults synchronize];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
}
|
||||
|
||||
-(NSArray *)readArrayWithCustomObjFromUserDefaults:(NSString*)keyName
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSData *data = [defaults objectForKey:keyName];
|
||||
NSArray *myArray = [NSKeyedUnarchiver unarchiveObjectWithData:data];
|
||||
[defaults synchronize];
|
||||
return myArray;
|
||||
}
|
||||
*/
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
{
|
||||
if([keyPath isEqualToString:@"currentLocation"]) {
|
||||
|
||||
@@ -27,7 +27,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
+(id )loadCustomObjectWithKey:(NSString *)key;
|
||||
+(NSString *)clearStringMessaggi:(NSString *)messaggio;
|
||||
+(NSInteger )getDifferenceMinute:(NSDate *)date;
|
||||
+ (NSArray<NSString *> *)arrayRaggioSismi;
|
||||
+(UIViewController *)shareFileWithPath:(id)path;
|
||||
|
||||
|
||||
|
||||
@@ -180,11 +180,6 @@
|
||||
|
||||
}
|
||||
|
||||
+ (NSArray<NSString *> *)arrayRaggioSismi
|
||||
{
|
||||
return @[@"50", @"100", @"200", @"300", @"400", @"500", @"600", @"800", @"1000", @"2000", @"4000", NSLocalizedString(@"Qualsiasi distanza", @"voce elenco raggio sismi")];
|
||||
}
|
||||
|
||||
+ (GADBannerView *)ottieniBannerWithController:(UIViewController *)controller position:(BOOL)isButton
|
||||
{
|
||||
if ([EQNPurchaseUtility isProVersionEnabled]) {
|
||||
|
||||
Reference in New Issue
Block a user