43 lines
1.1 KiB
Objective-C
43 lines
1.1 KiB
Objective-C
//
|
|
// SettingsBaseViewController.m
|
|
// Earthquake Network
|
|
//
|
|
// Created by Busi Andrea on 30/08/2020.
|
|
// Copyright © 2020 Earthquake Network. All rights reserved.
|
|
//
|
|
|
|
#import "SettingsBaseViewController.h"
|
|
#import "ServerRequest.h"
|
|
#import "EQNGeneratoreURLServer.h"
|
|
|
|
@interface SettingsBaseViewController ()
|
|
|
|
@end
|
|
|
|
@implementation SettingsBaseViewController
|
|
|
|
#pragma mark - View Lifecycle
|
|
|
|
- (void)viewWillDisappear:(BOOL)animated
|
|
{
|
|
[super viewWillDisappear:animated];
|
|
|
|
// when controller is dismissed, save settings
|
|
if (self.isMovingFromParentViewController) {
|
|
[SettingsBaseViewController saveSettings];
|
|
}
|
|
}
|
|
|
|
#pragma mark - Private
|
|
|
|
+ (void)saveSettings
|
|
{
|
|
[[ServerRequest defaultServerConnectionSingleton] inviaInformazioniAlServerWithURL:[EQNGeneratoreURLServer urlInvioImpostazioniNotifiche] richiesta:EQNTipoChiamataImpostazioniNotifiche success:^(id result){
|
|
NSLog(@"Settings saved successfully");
|
|
} failure:^(NSError *error){
|
|
NSLog(@"Settings saved failed. Error: %@", error.localizedDescription);
|
|
}];
|
|
}
|
|
|
|
@end
|