feat: Use cache endpoint and round values to use server cache

Resolves: https://gitlab.steamware.net/eqn/eqn.ios/-/issues/90
This commit is contained in:
Andrea Busi
2025-04-30 09:45:45 +02:00
parent 9ee3a478f0
commit 9cf9ef8a64
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ static NSString * const EQNServerUrlCalibration = @"https://srv.earthquakenetwor
// download rete smartphone
static NSString * const EQNServerUrlDownloadSmartphoneNetwork = @"https://cache.earthquakenetwork.it/distquake_count_redis3.php";
// download area check
static NSString * const EQNServerUrlDownloadAreaCheck = @"https://srv.earthquakenetwork.it/distquake_download_areacheck.php";
static NSString * const EQNServerUrlDownloadAreaCheck = @"https://cache.earthquakenetwork.it/distquake_download_areacheck.php";
// download pastquakes
static NSString * const EQNServerUrlDownloadPastQuakes = @"https://srv.earthquakenetwork.it/distquake_download_pastquakes.php";
// download segnalazioni
@@ -78,7 +78,12 @@
- (void)scaricaAreaCheck
{
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?lat=%f&lon=%f", EQNServerUrlDownloadAreaCheck, [EQNUser defaultUser].lastPosition.coordinate.latitude, [EQNUser defaultUser].lastPosition.coordinate.longitude]] richiesta:EQNTipoChiamataAreaCheck success:^(id result) {
// Quantizziamo le coordinate, in modo che venga sfruttata la cache lato server
CLLocation *lastPosition = [EQNUser defaultUser].lastPosition;
double latitude = round(lastPosition.coordinate.latitude * 5.0) / 5.0;
double longitude = round(lastPosition.coordinate.longitude * 5.0) / 5.0;
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@?lat=%f&lon=%f", EQNServerUrlDownloadAreaCheck, latitude, longitude]] richiesta:EQNTipoChiamataAreaCheck success:^(id result) {
self.area_check = [[EQNAreaCheck alloc] initWithInfo:result];