99 lines
2.9 KiB
Objective-C
99 lines
2.9 KiB
Objective-C
//
|
|
// DettadliMenuTableViewController.m
|
|
// Earthquake Network
|
|
//
|
|
// Created by Luca Beretta on 08/01/2019.
|
|
// Copyright © 2019 Luca Beretta. All rights reserved.
|
|
//
|
|
|
|
#import "DettadliMenuTableViewController.h"
|
|
#import "ServerRequest.h"
|
|
#import "EQNGeneratoreURLServer.h"
|
|
|
|
@interface DettadliMenuTableViewController ()
|
|
|
|
@end
|
|
|
|
@implementation DettadliMenuTableViewController
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
|
|
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:NSLocalizedString(@"Chiudi", @"pulsante chiudi impostazioni") style:UIBarButtonItemStyleDone target:self action:@selector(chiudi:)];
|
|
|
|
self.lista = @[NSLocalizedString(@"Notifiche sismi", @"voce menu"), NSLocalizedString(@"Notifiche tsunami", @"voce menu"), NSLocalizedString(@"Allerta in tempo reale", @"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;
|
|
}
|
|
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"vociDettagli" forIndexPath:indexPath];
|
|
|
|
// Configure the cell...
|
|
|
|
UILabel *titolo = (UILabel *)[cell viewWithTag:1];
|
|
titolo.text = self.lista[indexPath.row];
|
|
UIImageView *icona = (UIImageView *)[cell viewWithTag:2];
|
|
NSString *iconaString = @"";
|
|
|
|
switch (indexPath.row) {
|
|
case 0:
|
|
iconaString = @"";
|
|
break;
|
|
case 1:
|
|
iconaString = @"";
|
|
break;
|
|
case 2:
|
|
iconaString = @"";
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
icona.image = [UIImage imageNamed:iconaString];
|
|
|
|
return cell;
|
|
}
|
|
|
|
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
|
|
|
|
switch (indexPath.row) {
|
|
case 0:
|
|
[self performSegueWithIdentifier:@"notificheSismi" sender:nil];
|
|
break;
|
|
case 1:
|
|
[self performSegueWithIdentifier:@"notificheTsunami" sender:nil];
|
|
break;
|
|
case 2:
|
|
[self performSegueWithIdentifier:@"allertaSiksmica" sender:nil];
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
- (void)chiudi:(id)sender
|
|
{
|
|
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[EQNGeneratoreURLServer urlInvioImpostazioniNotifiche] richiesta:impostazioniNotifiche success:^(id result){
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
});
|
|
} failure:^(NSError *error){
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
[self dismissViewControllerAnimated:YES completion:nil];
|
|
});
|
|
}];
|
|
}
|
|
|
|
@end
|