diff --git a/Sources/Earthquake Network.xcodeproj/project.pbxproj b/Sources/Earthquake Network.xcodeproj/project.pbxproj index 2cb47b2..0f0946b 100644 --- a/Sources/Earthquake Network.xcodeproj/project.pbxproj +++ b/Sources/Earthquake Network.xcodeproj/project.pbxproj @@ -49,7 +49,6 @@ 8C4E34452152B707008B0D2A /* EQMAccelerometroManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C4E34442152B707008B0D2A /* EQMAccelerometroManager.m */; }; 8C4E344B2152EE5B008B0D2A /* EQNGeneratoreURLServer.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C4E344A2152EE5B008B0D2A /* EQNGeneratoreURLServer.m */; }; 8C593E8A217BA2470008B260 /* EQNSegnalazione.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C593E89217BA2470008B260 /* EQNSegnalazione.m */; }; - 8C5C0A6E21E51F3C000B5EFD /* ManuTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C5C0A6D21E51F3C000B5EFD /* ManuTableViewController.m */; }; 8C5EA22D21763103002DC156 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8C5EA22C21763102002DC156 /* MapKit.framework */; }; 8C5EA23121764816002DC156 /* PrioritaViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C5EA23021764816002DC156 /* PrioritaViewController.m */; }; 8C5EA2342176820B002DC156 /* VersionePROViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C5EA2332176820B002DC156 /* VersionePROViewController.m */; }; @@ -129,6 +128,9 @@ 8CFA6326219A41590099EB0E /* DettagliTsunamiViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CFA6325219A41590099EB0E /* DettagliTsunamiViewController.m */; }; C89115902FEA7A0A31514912 /* Pods_Earthquake_Network.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 25A8BFFE29D46740E8A8A7A3 /* Pods_Earthquake_Network.framework */; }; DC3ADD3924CB2F3D00737919 /* alert_star_trek.wav in Resources */ = {isa = PBXBuildFile; fileRef = 8CF12CC721DE43A400613AC5 /* alert_star_trek.wav */; }; + DCAB01E324CEBFE800E8B54C /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCAB01E224CEBFE800E8B54C /* MenuViewController.swift */; }; + DCAB01E524CEC12E00E8B54C /* MenuHeaderTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCAB01E424CEC12E00E8B54C /* MenuHeaderTableViewCell.swift */; }; + DCAB01E724CEC22100E8B54C /* MenuItemTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCAB01E624CEC22100E8B54C /* MenuItemTableViewCell.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -222,8 +224,6 @@ 8C4E344A2152EE5B008B0D2A /* EQNGeneratoreURLServer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNGeneratoreURLServer.m; sourceTree = ""; }; 8C593E88217BA2470008B260 /* EQNSegnalazione.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EQNSegnalazione.h; sourceTree = ""; }; 8C593E89217BA2470008B260 /* EQNSegnalazione.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EQNSegnalazione.m; sourceTree = ""; }; - 8C5C0A6C21E51F3C000B5EFD /* ManuTableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ManuTableViewController.h; sourceTree = ""; }; - 8C5C0A6D21E51F3C000B5EFD /* ManuTableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ManuTableViewController.m; sourceTree = ""; }; 8C5EA22C21763102002DC156 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; }; 8C5EA22F21764816002DC156 /* PrioritaViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PrioritaViewController.h; sourceTree = ""; }; 8C5EA23021764816002DC156 /* PrioritaViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PrioritaViewController.m; sourceTree = ""; }; @@ -356,6 +356,9 @@ 8CFA6325219A41590099EB0E /* DettagliTsunamiViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DettagliTsunamiViewController.m; sourceTree = ""; }; C4FB0D7EEA34F8222369E1BB /* Pods-Earthquake Network.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Earthquake Network.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Earthquake Network/Pods-Earthquake Network.debug.xcconfig"; sourceTree = ""; }; DC414C0024CDA09A008D9AE4 /* CHANGELOG.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CHANGELOG.md; path = ../CHANGELOG.md; sourceTree = ""; }; + DCAB01E224CEBFE800E8B54C /* MenuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = ""; }; + DCAB01E424CEC12E00E8B54C /* MenuHeaderTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuHeaderTableViewCell.swift; sourceTree = ""; }; + DCAB01E624CEC22100E8B54C /* MenuItemTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuItemTableViewCell.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -439,6 +442,7 @@ 8C5EA22E217645C8002DC156 /* ViewController */ = { isa = PBXGroup; children = ( + DCAB01E124CEBFD500E8B54C /* Menu */, 8CCE164521E69A9300173CD9 /* impostazioniNotifiche */, 8C602247218D9DBF00C799C2 /* Dettagli mappa */, 8CF05B4A218C41E60055012B /* inputView */, @@ -568,8 +572,6 @@ 8CCE164521E69A9300173CD9 /* impostazioniNotifiche */ = { isa = PBXGroup; children = ( - 8C5C0A6C21E51F3C000B5EFD /* ManuTableViewController.h */, - 8C5C0A6D21E51F3C000B5EFD /* ManuTableViewController.m */, 8C7E945821E548A600B0B770 /* DettadliMenuTableViewController.h */, 8C7E945921E548A600B0B770 /* DettadliMenuTableViewController.m */, 8C149FA121E54E85002C44FD /* NotificheSismiTableViewController.h */, @@ -753,6 +755,16 @@ path = Storyboards; sourceTree = ""; }; + DCAB01E124CEBFD500E8B54C /* Menu */ = { + isa = PBXGroup; + children = ( + DCAB01E224CEBFE800E8B54C /* MenuViewController.swift */, + DCAB01E424CEC12E00E8B54C /* MenuHeaderTableViewCell.swift */, + DCAB01E624CEC22100E8B54C /* MenuItemTableViewCell.swift */, + ); + path = Menu; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -820,7 +832,7 @@ isa = PBXProject; attributes = { LastUpgradeCheck = 1010; - ORGANIZATIONNAME = "Luca Beretta"; + ORGANIZATIONNAME = "Earthquake Network"; TargetAttributes = { 8C4B0B7921CACE3F00AED489 = { CreatedOnToolsVersion = 9.2; @@ -1007,6 +1019,7 @@ files = ( 8CF05B54218C41FB0055012B /* TBDInputViewControllerData.m in Sources */, 8CCE166121EBA37500173CD9 /* EQNNotificheTsunami.m in Sources */, + DCAB01E524CEC12E00E8B54C /* MenuHeaderTableViewCell.swift in Sources */, 8C483CCD21FDB52500259FD2 /* MasterViewController1.swift in Sources */, 8C5EA23121764816002DC156 /* PrioritaViewController.m in Sources */, 8CCE165121E7BAEC00173CD9 /* EQNNotificeReteSismiche.m in Sources */, @@ -1037,6 +1050,7 @@ 8CD0862E218A41930000CB5E /* CellDettagliMappaTableViewCell.m in Sources */, 8CBD3DD02149B9AD0070C963 /* Earthquake_Network.xcdatamodeld in Sources */, 8C9B755F2233BFDE00F8FDEE /* FiltroEnti.m in Sources */, + DCAB01E724CEC22100E8B54C /* MenuItemTableViewCell.swift in Sources */, 8CF66059214C566B009F4314 /* Reachability.m in Sources */, 8C593E8A217BA2470008B260 /* EQNSegnalazione.m in Sources */, 8C14112E21ED2FA300A59729 /* AreaInteresseTableViewController.m in Sources */, @@ -1076,10 +1090,10 @@ 8C602246218D9DB200C799C2 /* PastquakesDettagliMappa.m in Sources */, 8CAFD7C82182648600F8BD29 /* EQNRetiSismiViewController.m in Sources */, 8CEAE3E0221214F700AF948F /* AcquistiProViewController.swift in Sources */, + DCAB01E324CEBFE800E8B54C /* MenuViewController.swift in Sources */, 8C8EBBA721540039002784BA /* EQNUser.m in Sources */, 8CADAA9421B2627D0044E256 /* LogViewController.m in Sources */, 8CCE166421EBEFBD00173CD9 /* MessaggioInformativoTableViewController.m in Sources */, - 8C5C0A6E21E51F3C000B5EFD /* ManuTableViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Sources/Earthquake Network/Costanti.h b/Sources/Earthquake Network/Costanti.h index 0194e1d..a2f4091 100644 --- a/Sources/Earthquake Network/Costanti.h +++ b/Sources/Earthquake Network/Costanti.h @@ -50,10 +50,7 @@ // informazioni menu sinistra - -#define INDIRIZZO_INGLESE @"http://wp.earthquakenetwork.it/en" -#define INDIRIZZO_ITALIANO @"http://wp.earthquakenetwork.it/it" -#define INDIRIZZO_SPAGNOLO @"http://wp.earthquakenetwork.it/es" +static NSString * const EQNWebsiteAddress = @"https://www.sismo.app"; // download reti sismiche diff --git a/Sources/Earthquake Network/Earthquake Network-Bridging-Header.h b/Sources/Earthquake Network/Earthquake Network-Bridging-Header.h index 2c44694..4ccf92d 100644 --- a/Sources/Earthquake Network/Earthquake Network-Bridging-Header.h +++ b/Sources/Earthquake Network/Earthquake Network-Bridging-Header.h @@ -4,4 +4,5 @@ #import "EQNUtility.h" #import "Costanti.h" - +#import "EQNUser.h" +#import "SWRevealViewController.h" diff --git a/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard b/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard index 0799563..68e10cf 100644 --- a/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard +++ b/Sources/Earthquake Network/Storyboards/Base.lproj/Main.storyboard @@ -25,18 +25,18 @@ - + - + - + - + @@ -70,19 +70,23 @@ + - + - + + + + - + @@ -115,6 +119,10 @@ + + + + @@ -126,7 +134,7 @@ - + @@ -262,7 +270,7 @@ - + @@ -1601,7 +1609,7 @@ - + @@ -2640,7 +2648,7 @@ - + diff --git a/Sources/Earthquake Network/ViewController/Menu/MenuHeaderTableViewCell.swift b/Sources/Earthquake Network/ViewController/Menu/MenuHeaderTableViewCell.swift new file mode 100644 index 0000000..a2908b1 --- /dev/null +++ b/Sources/Earthquake Network/ViewController/Menu/MenuHeaderTableViewCell.swift @@ -0,0 +1,40 @@ +// +// MenuHeaderTableViewCell.swift +// Earthquake Network +// +// Created by Busi Andrea on 27/07/2020. +// Copyright © 2020 Earthquake Network. All rights reserved. +// + +import UIKit + +class MenuHeaderTableViewCell: UITableViewCell { + + @IBOutlet weak var appVersionLabel: UILabel! + @IBOutlet weak var appIdLabel: UILabel! + + // MARK: - View Lifecycle + + override func awakeFromNib() { + super.awakeFromNib() + + // add a gradient for the background + let gradient = CAGradientLayer() + let blueColor = UIColor(red: 0.47, green: 0.72, blue: 0.98, alpha: 1.0) + gradient.frame = bounds + gradient.colors = [ blueColor.cgColor, UIColor.white.cgColor ] + layer.insertSublayer(gradient, at: 0) + } + + // MARK: - Public + + func updateUI() { + if let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String { + let version = NSLocalizedString("Versione", comment: "etichetta versione app") + appVersionLabel.text = "\(version): \(appVersion)" + } + + let userId = EQNUser.default().user_ID ?? "n.d." + appIdLabel.text = "ID: \(userId)" + } +} diff --git a/Sources/Earthquake Network/ViewController/Menu/MenuItemTableViewCell.swift b/Sources/Earthquake Network/ViewController/Menu/MenuItemTableViewCell.swift new file mode 100644 index 0000000..7cb75da --- /dev/null +++ b/Sources/Earthquake Network/ViewController/Menu/MenuItemTableViewCell.swift @@ -0,0 +1,43 @@ +// +// MenuItemTableViewCell.swift +// Earthquake Network +// +// Created by Busi Andrea on 27/07/2020. +// Copyright © 2020 Earthquake Network. All rights reserved. +// + +import UIKit + +class MenuItemTableViewCell: UITableViewCell { + + @IBOutlet private weak var itemIconImageView: UIImageView! + @IBOutlet private weak var itemTitleLabel: UILabel! + + var item: MenuViewController.MenuItem? { + didSet { + updateUI() + } + } + + override func awakeFromNib() { + super.awakeFromNib() + // Initialization code + } + + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + + // Configure the view for the selected state + } + + // MARK: - Private + + private func updateUI() { + guard let item = item else { return } + + if let iconName = item.icon { + itemIconImageView.image = UIImage(named: iconName) + } + itemTitleLabel.text = item.title + } +} diff --git a/Sources/Earthquake Network/ViewController/Menu/MenuViewController.swift b/Sources/Earthquake Network/ViewController/Menu/MenuViewController.swift new file mode 100644 index 0000000..2d09a08 --- /dev/null +++ b/Sources/Earthquake Network/ViewController/Menu/MenuViewController.swift @@ -0,0 +1,117 @@ +// +// MenuViewController.swift +// Earthquake Network +// +// Created by Busi Andrea on 27/07/2020. +// Copyright © 2020 Earthquake Network. All rights reserved. +// + +import UIKit +import SafariServices + + +class MenuViewController: UITableViewController { + + enum MenuItem: CaseIterable { + case header + case settings + case informations + case faq + case disclaimer + case author + case privacy + + var title: String { + switch self { + case .header: return "" + case .settings: return NSLocalizedString("Impostazioni", comment: "voce menu") + case .informations: return NSLocalizedString("Informazioni", comment: "voce menu") + case .faq: return NSLocalizedString("F.A.Q.", comment: "voce menu") + case .disclaimer: return NSLocalizedString("Disclaimer", comment: "voce menu") + case .author: return NSLocalizedString("Autore", comment: "voce menu") + case .privacy: return NSLocalizedString("Privacy", comment: "voce menu") + } + } + + var icon: String? { + switch self { + case .header: return nil + case .settings: return "ic_settings_black_24dp" + case .informations: return "ic_info_outline_black_24dp" + case .faq: return "ic_help_outline_black_24dp" + case .disclaimer: return "ic_star_border_black_24dp" + case .author: return "ic_verified_user_black_24dp" + case .privacy: return "ic_person_black_24dp" + } + } + } + + private let items = MenuItem.allCases + private static let CellIdentifierHeader = "HeaderCell" + private static let CellIdentifierItem = "MenuItemCell" + + // MARK: - View Lifecycle + + override func viewDidLoad() { + super.viewDidLoad() + } + + // MARK: - Table view data source + + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + items.count + } + + override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + let item = items[indexPath.row] + if item == .header { + return 160 + } + return 60 + } + + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let item = items[indexPath.row] + if item == .header { + let cell = tableView.dequeueReusableCell(withIdentifier: Self.CellIdentifierHeader, for: indexPath) as! MenuHeaderTableViewCell + cell.updateUI() + return cell + } + + let cell = tableView.dequeueReusableCell(withIdentifier: Self.CellIdentifierItem, for: indexPath) as! MenuItemTableViewCell + cell.item = item + return cell + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + self.revealViewController()?.revealToggle(animated: true) + + let item = items[indexPath.row] + switch item { + case .header: + break + case .settings: + NotificationCenter.default.post(name: NSNotification.Name(rawValue: NOTIFICHE_SISMI), object: nil) + default: + // open url if available + if let url = externalUrl(for: item) { + let controller = SFSafariViewController(url: url) + present(controller, animated: true, completion: nil) + } + } + } + + // MARK: - Private + + private func externalUrl(for item: MenuItem) -> URL? { + let baseUrl = EQNWebsiteAddress + switch item { + case .informations: return URL(string: "\(baseUrl)") + case .faq: return URL(string: "\(baseUrl)/f-a-q/") + case .disclaimer: return URL(string: "\(baseUrl)/terms-conditions/") + case .author: return URL(string: "\(baseUrl)/contact/") + case .privacy: return URL(string: "\(baseUrl)/privacy/") + default: return nil + } + } +} diff --git a/Sources/Earthquake Network/ViewController/impostazioniNotifiche/ManuTableViewController.h b/Sources/Earthquake Network/ViewController/impostazioniNotifiche/ManuTableViewController.h deleted file mode 100644 index 107684f..0000000 --- a/Sources/Earthquake Network/ViewController/impostazioniNotifiche/ManuTableViewController.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ManuTableViewController.h -// Earthquake Network -// -// Created by Luca Beretta on 08/01/2019. -// Copyright © 2019 Luca Beretta. All rights reserved. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ManuTableViewController : UITableViewController - -@end - -NS_ASSUME_NONNULL_END diff --git a/Sources/Earthquake Network/ViewController/impostazioniNotifiche/ManuTableViewController.m b/Sources/Earthquake Network/ViewController/impostazioniNotifiche/ManuTableViewController.m deleted file mode 100644 index 0ffb780..0000000 --- a/Sources/Earthquake Network/ViewController/impostazioniNotifiche/ManuTableViewController.m +++ /dev/null @@ -1,227 +0,0 @@ -// -// ManuTableViewController.m -// Earthquake Network -// -// Created by Luca Beretta on 08/01/2019. -// Copyright © 2019 Luca Beretta. All rights reserved. -// - -#import "ManuTableViewController.h" -#import "EQNUser.h" -#import "Costanti.h" -#import "SWRevealViewController.h" - - -@interface ManuTableViewController () - -@property (nonatomic, strong) NSArray *lista; - -@end - -@implementation ManuTableViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - - // Uncomment the following line to preserve selection between presentations. - // self.clearsSelectionOnViewWillAppear = NO; - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; - - self.lista = @[@"presentazione", - NSLocalizedString(@"Impostazioni", @"voce menu"), - NSLocalizedString(@"Informazioni", @"voce menu"), - NSLocalizedString(@"F.A.Q.", @"voce menu"), - /*NSLocalizedString(@"Lista notifiche", @"voce menu"),*/ - NSLocalizedString(@"Disclaimer", @"voce menu"), - NSLocalizedString(@"Autore", @"voce menu"), - NSLocalizedString(@"Privacy", @"voce menu")]; -} - -#pragma mark - Table view data source - - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; -} - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - - return self.lista.count; -} -- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ - - switch (indexPath.row) { - case 0: - return 160; - break; - - default: - return 61; - break; - } - -} - -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - - switch (indexPath.row) { - case 0:{ - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"presentazioneMenu" forIndexPath:indexPath]; - NSString *versioneString = NSLocalizedString(@"Versione", @"etichetta versione app"); - UILabel *versione = (UILabel *)[cell viewWithTag:1]; - versione.text = [NSString stringWithFormat:@"%@: %@", versioneString,[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]]; - UILabel *idUtente = (UILabel *)[cell viewWithTag:2]; - idUtente.text = [NSString stringWithFormat:@"ID: %@", [EQNUser defaultUser].user_ID]; - - - CAGradientLayer *gradient = [CAGradientLayer layer]; - UIColor *blueColor = [UIColor colorWithRed:0.47 green:0.72 blue:0.98 alpha:1]; - gradient.frame = cell.bounds; - gradient.colors = @[(id)blueColor.CGColor, (id)[UIColor whiteColor].CGColor]; - [cell.layer insertSublayer:gradient atIndex:0]; - - - return cell; - - } - break; - - default:{ - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"vociMenu" forIndexPath:indexPath]; - - UILabel *titolo = (UILabel *)[cell viewWithTag:1]; - titolo.text = self.lista[indexPath.row]; - UIImageView *icona = (UIImageView *)[cell viewWithTag:2]; - NSString *iconaString = @""; - switch (indexPath.row) { - case 1: - iconaString = @"ic_settings_black_24dp"; - break; - case 2: - iconaString = @"ic_info_outline_black_24dp"; - break; - case 3: - iconaString = @"ic_help_outline_black_24dp"; - break; - case 4: - iconaString = @"ic_star_border_black_24dp"; - break; - case 5: - iconaString = @"ic_verified_user_black_24dp"; - break; - case 6: - iconaString = @"ic_person_black_24dp"; - break; - case 7: - iconaString = @"ic_shield_half_full_black_24dp"; - break; - default: - break; - } - - icona.image = [UIImage imageNamed:iconaString]; - - return cell; - } - break; - } -} - --(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - - //SWRevealViewController *revealViewController = self.revealViewController; - // if ( revealViewController ) - [self.revealViewController revealToggleAnimated:YES]; - - NSString *indirizzo = @""; - NSString * language = [[NSLocale preferredLanguages] firstObject]; - language = [language substringToIndex:2]; - - - if ([language isEqualToString:@"it"]) - indirizzo = INDIRIZZO_ITALIANO; - else if ([language isEqualToString:@"es"]) - indirizzo = INDIRIZZO_SPAGNOLO; - else - indirizzo = INDIRIZZO_INGLESE; - - - switch (indexPath.row) { - case 0: - return; - break; - case 1: - [[NSNotificationCenter defaultCenter] postNotificationName:NOTIFICHE_SISMI object:nil]; - return; - break; - case 3: - indirizzo = [indirizzo stringByAppendingString:@"/f-a-q/"]; - break; - case 4: - indirizzo = [indirizzo stringByAppendingString:@"/terms-conditions/"]; - break; - case 5: - indirizzo = [indirizzo stringByAppendingString:@"/contact/"]; - break; - case 6: - indirizzo = [indirizzo stringByAppendingString:@"/privacy/"]; - break; - /* default: - [[NSNotificationCenter defaultCenter] postNotificationName:INFORMAZIONI_APP_MENU object:nil userInfo:@{@"indice" : indexPath}]; - break;*/ - } - - NSLog(@"indirizzo %@ %@", indirizzo, language); - - [[UIApplication sharedApplication] openURL:[NSURL URLWithString:indirizzo] options:@{} completionHandler:nil]; - -} - -/* -// Override to support conditional editing of the table view. -- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the specified item to be editable. - return YES; -} -*/ - -/* -// Override to support editing the table view. -- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - if (editingStyle == UITableViewCellEditingStyleDelete) { - // Delete the row from the data source - [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - } else if (editingStyle == UITableViewCellEditingStyleInsert) { - // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view - } -} -*/ - -/* -// Override to support rearranging the table view. -- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { -} -*/ - -/* -// Override to support conditional rearranging of the table view. -- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { - // Return NO if you do not want the item to be re-orderable. - return YES; -} -*/ - - -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. -} - - -@end diff --git a/Sources/Earthquake Network/model/EQNUser.h b/Sources/Earthquake Network/model/EQNUser.h index 0c467bb..f44cbe7 100644 --- a/Sources/Earthquake Network/model/EQNUser.h +++ b/Sources/Earthquake Network/model/EQNUser.h @@ -11,16 +11,17 @@ @interface EQNUser : NSObject -@property (nonatomic, strong) NSString *tokenUser; -@property (nonatomic, strong) NSString *user_ID; -@property (nonatomic, strong) CLLocation *lastPosition; +@property (nonatomic, strong, nullable) NSString *tokenUser; +@property (nonatomic, strong, nullable) NSString *user_ID; +@property (nonatomic, strong, nullable) CLLocation *lastPosition; @property (nonatomic, assign) CLLocationDistance distanza; @property (nonatomic, assign) BOOL monitorOn; @property (nonatomic, assign) BOOL inCarica; @property (nonatomic, assign) BOOL registrato; -+(EQNUser *)defaultUser; ++(nonnull EQNUser *)defaultUser; -(void)inviaPosizioneServer; -(void)saveUserInfo; -(void)removeUser; + @end