refactor: Improve style in WaitViewController

This commit is contained in:
Andrea Busi
2020-07-24 16:03:33 +02:00
parent 479e326492
commit 60a2fda1b5
2 changed files with 25 additions and 34 deletions
@@ -2,8 +2,8 @@
// WaitViewController.h
// Earthquake Network
//
// Created by Luca Beretta on 15/10/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
// Refactored by Andrea Busi on 24/07/20.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import <UIKit/UIKit.h>
@@ -2,52 +2,43 @@
// WaitViewController.m
// Earthquake Network
//
// Created by Luca Beretta on 15/10/18.
// Copyright © 2018 Luca Beretta. All rights reserved.
// Refactored by Andrea Busi on 24/07/20.
// Copyright © 2020 Earthquake Network. All rights reserved.
//
#import "WaitViewController.h"
#import "Costanti.h"
@interface WaitViewController ()
@interface WaitViewController ()
@end
@implementation WaitViewController
- (void)viewDidLoad {
#pragma mark - View Lifecycle
- (void)viewDidLoad
{
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(chiudi:) name:NOTIFICA_DOWNLOAD_TERMINATO object:nil];
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(chiudi:) userInfo:nil repeats:NO];
// Do any additional setup after loading the view.
}
-(void)chiudi:(NSNotification *)notifica{
dispatch_async(dispatch_get_main_queue(), ^{
[self dismissViewControllerAnimated:NO completion:nil];
});
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)dealloc{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(downloadCompletedNotification:) name:NOTIFICA_DOWNLOAD_TERMINATO object:nil];
[NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(closeController) userInfo:nil repeats:NO];
}
/*
#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.
#pragma mark - Notifications
- (void)downloadCompletedNotification:(NSNotification *)notifica
{
dispatch_async(dispatch_get_main_queue(), ^{
[self closeController];
});
}
#pragma mark - Private
- (void)closeController
{
[self dismissViewControllerAnimated:NO completion:nil];
}
*/
@end