Compare commits

...

6 Commits

Author SHA1 Message Date
Andrea Busi f768b15916 release: Increase version for release 2020-10-03 12:10:24 +02:00
Andrea Busi a07480f90a fix: Handle seismic date as nullable parameter to avoid crashes 2020-10-03 12:09:47 +02:00
Andrea Busi 4e5e93e3f1 refactor: Rename method to convert server string into date 2020-10-03 12:09:31 +02:00
Andrea Busi 68c9eb9bbc feat: Show alert when weather data are not available 2020-10-03 12:09:06 +02:00
Andrea Busi ba2fbfaa60 feat: Handle weather code as nullable parameter 2020-10-03 12:01:17 +02:00
Andrea Busi e194731bc8 refactor: Rename NSDictionary extension and improve code 2020-10-03 11:58:15 +02:00
18 changed files with 126 additions and 83 deletions
+6
View File
@@ -1,5 +1,11 @@
# Changelog
## Versione 2.3.1
### Build (35)
- Aggiunto controllo su data in schede sismi per evitare crash
- Aggiunta gestione dati meteo non disponibili
## Versione 2.3
### Build (34)
@@ -43,7 +43,7 @@
8C602246218D9DB200C799C2 /* PastquakesDettagliMappa.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C602245218D9DB200C799C2 /* PastquakesDettagliMappa.m */; };
8C60224A218EDBE200C799C2 /* PastquakesAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C602249218EDBE200C799C2 /* PastquakesAnnotation.m */; };
8C6CBAE521597E79005C426A /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 8C6CBAE421597E79005C426A /* GoogleService-Info.plist */; };
8C7A3B66225A5EA40045B266 /* NSDictionary+BVJSONString.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C7A3B64225A5EA30045B266 /* NSDictionary+BVJSONString.m */; };
8C7A3B66225A5EA40045B266 /* NSDictionary+EQNExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C7A3B64225A5EA30045B266 /* NSDictionary+EQNExtensions.m */; };
8C7CD64821F7D0F800835812 /* ReteSismicaAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CD08637218B3BEE0000CB5E /* ReteSismicaAnnotation.m */; };
8C7CD64921F7D11700835812 /* ReteSismicaAnnotation.m in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CD08637218B3BEE0000CB5E /* ReteSismicaAnnotation.m */; };
8C7CD64A21F7D11700835812 /* ReteSismicaAnnotation.h in Frameworks */ = {isa = PBXBuildFile; fileRef = 8CD08636218B3BEE0000CB5E /* ReteSismicaAnnotation.h */; };
@@ -215,8 +215,8 @@
8C602248218EDBE200C799C2 /* PastquakesAnnotation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PastquakesAnnotation.h; sourceTree = "<group>"; };
8C602249218EDBE200C799C2 /* PastquakesAnnotation.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PastquakesAnnotation.m; sourceTree = "<group>"; };
8C6CBAE421597E79005C426A /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
8C7A3B64225A5EA30045B266 /* NSDictionary+BVJSONString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+BVJSONString.m"; sourceTree = "<group>"; };
8C7A3B65225A5EA40045B266 /* NSDictionary+BVJSONString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+BVJSONString.h"; sourceTree = "<group>"; };
8C7A3B64225A5EA30045B266 /* NSDictionary+EQNExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDictionary+EQNExtensions.m"; sourceTree = "<group>"; };
8C7A3B65225A5EA40045B266 /* NSDictionary+EQNExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+EQNExtensions.h"; sourceTree = "<group>"; };
8C8EBBA521540039002784BA /* EQNUser.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNUser.h; sourceTree = "<group>"; };
8C8EBBA621540039002784BA /* EQNUser.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNUser.m; sourceTree = "<group>"; };
8CA46B9F2194532E00C63C16 /* SismaAnnotation.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SismaAnnotation.h; sourceTree = "<group>"; };
@@ -553,6 +553,8 @@
isa = PBXGroup;
children = (
DC105640251E7ECE002579BB /* UIFont+Extensions.swift */,
8C7A3B65225A5EA40045B266 /* NSDictionary+EQNExtensions.h */,
8C7A3B64225A5EA30045B266 /* NSDictionary+EQNExtensions.m */,
);
path = Extensions;
sourceTree = "<group>";
@@ -621,8 +623,6 @@
DC10563F251E7EC0002579BB /* Extensions */,
8CF66054214C566A009F4314 /* Reachability.h */,
8CF66056214C566A009F4314 /* Reachability.m */,
8C7A3B65225A5EA40045B266 /* NSDictionary+BVJSONString.h */,
8C7A3B64225A5EA30045B266 /* NSDictionary+BVJSONString.m */,
);
path = Libs;
sourceTree = "<group>";
@@ -1094,7 +1094,7 @@
8CBD3DD82149B9AD0070C963 /* main.m in Sources */,
8CF05B57218C93BA0055012B /* EQNUtility.m in Sources */,
8C4E34422152B5E8008B0D2A /* EQNRilevamento.m in Sources */,
8C7A3B66225A5EA40045B266 /* NSDictionary+BVJSONString.m in Sources */,
8C7A3B66225A5EA40045B266 /* NSDictionary+EQNExtensions.m in Sources */,
8CF66053214C12DC009F4314 /* EQNMath.m in Sources */,
DCF4A54524F8DB8300B17326 /* SettingDateTableViewCell.swift in Sources */,
8C60224A218EDBE200C799C2 /* PastquakesAnnotation.m in Sources */,
@@ -1202,12 +1202,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationService/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 2.3;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -1224,12 +1224,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationService/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 2.3;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -1362,14 +1362,14 @@
CODE_SIGN_ENTITLEMENTS = "Earthquake Network/Earthquake Network.entitlements";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = WJA4MR4CPC;
GCC_PREFIX_HEADER = "Earthquake Network/Earthquake Network-Prefix.pch";
INFOPLIST_FILE = "Earthquake Network/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.3;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
@@ -1390,13 +1390,13 @@
CODE_SIGN_ENTITLEMENTS = "Earthquake Network/Earthquake Network.entitlements";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = WJA4MR4CPC;
GCC_PREFIX_HEADER = "Earthquake Network/Earthquake Network-Prefix.pch";
INFOPLIST_FILE = "Earthquake Network/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 2.3;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
@@ -1412,12 +1412,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationContent/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 2.3;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationContent;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -1434,12 +1434,12 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 34;
CURRENT_PROJECT_VERSION = 35;
DEVELOPMENT_TEAM = WJA4MR4CPC;
INFOPLIST_FILE = EQNNotificationContent/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
MARKETING_VERSION = 2.3;
MARKETING_VERSION = 2.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.finazzi.distquake.EQNNotificationContent;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "Earthquake Network Extensions - Development";
@@ -14,7 +14,7 @@ protocol SeismicNetworkTableViewCellDelegate: class {
func seismicNetworkCellDidTapShare(_ cell: SeismicNetworkTableViewCell)
func seismicNetworkCellDidTapMap(_ cell: SeismicNetworkTableViewCell)
func seismicNetworkCellDidTapMapDetail(_ cell: SeismicNetworkTableViewCell)
func seismicNetworkCellDidTapWeather(_ cell: SeismicNetworkTableViewCell)
func seismicNetworkCellDidTapWeather(_ cell: SeismicNetworkTableViewCell, hasValidWeatherData: Bool)
func seismicNetworkCellDidTapCalendar(_ cell: SeismicNetworkTableViewCell)
func seismicNetworkCellDidTapSettings(_ cell: SeismicNetworkTableViewCell)
func seismicNetworkCellDidTapClose(_ cell: SeismicNetworkTableViewCell)
@@ -433,10 +433,16 @@ class SeismicNetworkTableViewCell: UITableViewCell {
depthLabel.text = String(format: "%@: %.1f km", NSLocalizedString("Profondità", comment: ""), seismic.depth.doubleValue)
}
let formattedDate = Self.dateFormatter.string(from: seismic.date)
let timeSuffix = seismic.timeDifference > 60 ? NSLocalizedString("ore fa", comment: "") : NSLocalizedString("minuti fa", comment: "")
let timeRounded = seismic.timeDifference > 60 ? Int(round(seismic.timeDifference / 60)) : Int(seismic.timeDifference)
timeLabel.text = "🕗 \(formattedDate) - \(timeRounded) \(timeSuffix)"
// we need to check agains null values, because sometimes WS returns invalid dates
if let date = seismic.date {
let formattedDate = Self.dateFormatter.string(from: date)
let timeSuffix = seismic.timeDifference > 60 ? NSLocalizedString("ore fa", comment: "") : NSLocalizedString("minuti fa", comment: "")
let timeRounded = seismic.timeDifference > 60 ? Int(round(seismic.timeDifference / 60)) : Int(seismic.timeDifference)
timeLabel.text = "🕗 \(formattedDate) - \(timeRounded) \(timeSuffix)"
} else {
timeLabel.text = "🕗 no time available"
}
let distanceRounded = Int(round(seismic.userDistance))
distanceLabel.text = "📐 \(distanceRounded) km \(NSLocalizedString("dalla tua posizione", comment: ""))"
let coordinateText = coordinateString(coordinate: seismic.coordinate.coordinate)
@@ -537,7 +543,8 @@ class SeismicNetworkTableViewCell: UITableViewCell {
@objc func weatherTapped(_ sender: UIButton) {
if displayType != .weatherExpanded {
delegate?.seismicNetworkCellDidTapWeather(self)
let validData = seismic?.weatherCode != nil
delegate?.seismicNetworkCellDidTapWeather(self, hasValidWeatherData: validData)
}
}
@@ -250,9 +250,18 @@ extension SeismicNetworksViewController: SeismicNetworkTableViewCellDelegate {
present(controller, animated: true)
}
func seismicNetworkCellDidTapWeather(_ cell: SeismicNetworkTableViewCell) {
func seismicNetworkCellDidTapWeather(_ cell: SeismicNetworkTableViewCell, hasValidWeatherData: Bool) {
guard let index = tableView?.indexPath(for: cell) else { return }
if !hasValidWeatherData {
let alert = UIAlertController(title: NSLocalizedString("Attenzione", comment: ""),
message: NSLocalizedString("weather_nodata", comment: ""),
preferredStyle: .alert)
alert.addAction(UIAlertAction(title: NSLocalizedString("OK", comment: ""), style: .default))
present(alert, animated: true)
return
}
let indexToReloads = [openMapIndexPath, openWeatherIndexPath, index].compactMap { $0 }
openWeatherIndexPath = index
@@ -0,0 +1,25 @@
//
// NSDictionary+EQNExtensions.h
// Earthquake Network
//
// Created by Andrea Busi on 03/10/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSDictionary (EQNExtensions)
/// Returns a string representation of the current dictionary
/// @param prettyPrint If YES, uses white space and indentation to make the output more readable.
- (NSString *)eqn_jsonStringWithPrettyPrint:(BOOL)prettyPrint;
/// Returns the value associated with a given key if exists, nil otherwise.
/// @param aKey The key for which to return the corresponding value
- (nullable id)eqn_safeObjectForKey:(id)aKey;
@end
NS_ASSUME_NONNULL_END
@@ -0,0 +1,36 @@
//
// NSDictionary+EQNExtensions.h
// Earthquake Network
//
// Created by Andrea Busi on 03/10/2020.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import "NSDictionary+EQNExtensions.h"
@implementation NSDictionary (BVJSONString)
#pragma mark - Public
- (NSString *)eqn_jsonStringWithPrettyPrint:(BOOL)prettyPrint
{
NSError *error;
NSJSONWritingOptions options = prettyPrint ? NSJSONWritingPrettyPrinted : 0;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self options:options error:&error];
if (!jsonData) {
return @"{}";
}
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
- (id)eqn_safeObjectForKey:(id)aKey
{
NSObject *object = [self objectForKey:aKey];
if (object == [NSNull null]) {
return nil;
}
return object;
}
@end
@@ -1,18 +0,0 @@
//
// NSDictionary+BVJSONString.h
// Smash
//
// Created by Luca Beretta on 24/03/2019.
// Copyright © 2019 Luca Beretta. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSDictionary (BVJSONString)
-(NSString*) bv_jsonStringWithPrettyPrint:(BOOL) prettyPrint;
@end
NS_ASSUME_NONNULL_END
@@ -1,25 +0,0 @@
//
// NSDictionary+BVJSONString.m
// Smash
//
// Created by Luca Beretta on 24/03/2019.
// Copyright © 2019 Luca Beretta. All rights reserved.
//
#import "NSDictionary+BVJSONString.h"
@implementation NSDictionary (BVJSONString)
-(NSString*) bv_jsonStringWithPrettyPrint:(BOOL) prettyPrint {
NSError *error;
NSData *jsonData = [NSJSONSerialization dataWithJSONObject:self
options:(NSJSONWritingOptions) (prettyPrint ? NSJSONWritingPrettyPrinted : 0)
error:&error];
if (! jsonData) {
NSLog(@"%s: error: %@", __func__, error.localizedDescription);
return @"{}";
} else {
return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
}
@end
+2 -2
View File
@@ -26,14 +26,14 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, strong) NSString *place;
@property (nonatomic, strong) NSString *provider;
/// Date of the seismic
@property (nonatomic, strong) NSDate *date;
@property (nonatomic, strong, nullable) NSDate *date;
/// Difference between seismic and user time (ex. 1 hour ago)
@property (nonatomic) NSTimeInterval timeDifference;
@property (nonatomic, strong) NSNumber *magnitudeRange;
@property (nonatomic, strong) NSNumber *preliminary;
@property (nonatomic, strong) NSNumber *smartphoneNumber;
@property (nonatomic, strong) NSNumber *userNumber;
@property (nonatomic, strong) NSString *weatherCode;
@property (nonatomic, strong, nullable) NSString *weatherCode;
@property (nonatomic, strong) NSString *weatherIcon;
@property (nonatomic, strong) NSNumber *weatherCloud;
@property (nonatomic, strong) NSNumber *weatherWindSpeed;
+3 -2
View File
@@ -9,6 +9,7 @@
#import "EQNSisma.h"
#import "EQNUser.h"
#import "EQNUtility.h"
#import "NSDictionary+EQNExtensions.h"
@implementation EQNSisma
@@ -34,7 +35,7 @@
self.intensity = info[@"it"];
self.place = info[@"pl"];
self.provider = info[@"pr"];
self.date = [EQNUtility getDataFromString:info[@"dt"]];
self.date = [EQNUtility getDateFromString:info[@"dt"]];
self.timeDifference = [info[@"di"] doubleValue];
self.magnitudeRange = info[@"mr"];
@@ -42,7 +43,7 @@
self.smartphoneNumber = info[@"sm"];
self.userNumber = info[@"rp"];
self.weatherCode = info[@"wc"];
self.weatherCode = [info eqn_safeObjectForKey:@"wc"];
self.weatherIcon = info[@"ic"];
self.weatherCloud = info[@"cl"];
self.weatherWindSpeed = info[@"ws"];
+2 -2
View File
@@ -10,7 +10,7 @@
#import "Reachability.h"
#import "Costanti.h"
#import "EQNUtility.h"
#import "NSDictionary+BVJSONString.h"
#import "NSDictionary+EQNExtensions.h"
@interface ServerRequest ()
@@ -162,7 +162,7 @@
{
NSString *jsonObjectString = [ricevuta base64EncodedStringWithOptions:0];
NSDictionary *params = @{@"ricevuta" :jsonObjectString};
NSString *parametri = [params bv_jsonStringWithPrettyPrint:YES];
NSString *parametri = [params eqn_jsonStringWithPrettyPrint:YES];
NSMutableURLRequest * urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@""]];
[urlRequest setHTTPMethod:@"POST"];
@@ -714,6 +714,7 @@
"weather_windspeed" = "Wind speed: %@m/s";
"weather_humidity" = "Humidity: %@%%";
"weather_clouds" = "Cloud cover: %@%%";
"weather_nodata" = "No weather data are available for this quake";
"official_prelimiary" = "Preliminary";
"calendar_description_nogeo_km" = "Earthquake M%@, depth %@ km.";
"filter_empty" = "Based on the filters and seismic networks enabled, there are no earthquakes in the last 24 hours. To change the filters click on the purple bar at the bottom. To enable other seismic networks click on the world icon at the top.";
@@ -709,6 +709,7 @@
"weather_windspeed" = "Velocidad viento: %@m/s";
"weather_humidity" = "Humedad: %@%%";
"weather_clouds" = "Cubierta de nubes: %@%%";
"weather_nodata" = "Los datos del tiempo no están disponible para este sismo";
"official_prelimiary" = "Preliminar";
"calendar_description_nogeo_km" = "Sismo M%@, profundidad %@ km.";
"filter_empty" = "Según los filtros y las redes sísmicas habilitadas, no hay sismos en las últimas 24 horas. Para cambiar los filtros, haga clic en la barra en la parte inferior. Para habilitar otras redes sísmicas, haga clic en el icono en forma de mundo en la parte superior.";
@@ -702,6 +702,7 @@
"weather_windspeed" = "Velocità vento: %@m/s";
"weather_humidity" = "Umidità: %@%%";
"weather_clouds" = "Copertura nuvolosa: %@%%";
"weather_nodata" = "I dati meteo non sono disponibili per questo sisma";
"official_prelimiary" = "Preliminare";
"calendar_description_nogeo_km" = "Sisma M%@, profondità %@ km.";
"filter_empty" = "In base ai filtri ed alle reti sismiche abilitate, non ci sono sismi nelle ultime 24 ore. Per modificare i filtri clicca sulla barra in basso. Per abilitare altre reti sismiche clicca sull\'icona a forma di mondo in alto.";
@@ -20,7 +20,7 @@
_users = info[@"users"];
_state = info[@"state"];
_code = info[@"code"];
_date = [EQNUtility getDataFromString:info[@"date"]];
_date = [EQNUtility getDateFromString:info[@"date"]];
_differencePas = info[@"difference"];
_intensity = info[@"intensity"];
}
@@ -19,8 +19,7 @@
_ban = info[@"ban"];
_code = info[@"code"];
// NSDate *dateServer = [dataFormatter dateFromString:info[@"data"]];
_date = [EQNUtility getDataFromString:info[@"date"]];
_date = [EQNUtility getDateFromString:info[@"date"]];
_differenceSeg = info[@"difference"];
_latitude = info[@"latitude"];
_longitude = info[@"longitude"];
@@ -17,7 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface EQNUtility : NSObject
+(NSDate *)getDataFromString:(NSString *)stringData;
+ (nullable NSDate *)getDateFromString:(NSString *)dateString;
+(NSArray *)applicaFiltroWithTime:(EQNFiltriMappa )filtro withList:(NSArray *)list;
+(void)writeArrayWithCustomObjToUserDefaults:(NSString *)keyName withArray:(NSArray *)myArray;
+(void)writeArrayWithCustomObjToUserDefaults:(NSString *)keyName withDict:(NSDictionary *)myDict;
@@ -14,11 +14,11 @@
@implementation EQNUtility
+(NSDate *)getDataFromString:(NSString *)stringData{
NSDateFormatter *dataFormatter = [[NSDateFormatter alloc] init];
[dataFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
return [dataFormatter dateFromString:stringData];
+ (NSDate *)getDateFromString:(NSString *)dateString
{
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
return [formatter dateFromString:dateString];
}
+(NSDate *)impostaFiltroWithTime:(EQNFiltriMappa )filtro{