-
-
Notifications
You must be signed in to change notification settings - Fork 95
/
Copy pathWifiZoneViewController.m
64 lines (53 loc) · 2.24 KB
/
WifiZoneViewController.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//
// WifiZoneViewController.m
// Overland
//
// Created by Aaron Parecki on 3/2/19.
// Copyright © 2019 Aaron Parecki. All rights reserved.
//
#import "WifiZoneViewController.h"
#import "GLManager.h"
@interface WifiZoneViewController ()
@end
@implementation WifiZoneViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)viewWillAppear:(BOOL)animated {
if([GLManager sharedManager].wifiZoneName == nil) {
self.wifiNameField.text = [GLManager currentWifiHotSpotName];
if([GLManager sharedManager].lastLocation) {
CLLocation *loc = [GLManager sharedManager].lastLocation;
self.latitudeField.text = [NSString stringWithFormat:@"%.5f", loc.coordinate.latitude];
self.longitudeField.text = [NSString stringWithFormat:@"%.5f", loc.coordinate.longitude];
}
[self.resetButton setTitle:@"Cancel" forState:UIControlStateNormal];
} else {
self.wifiNameField.text = [GLManager sharedManager].wifiZoneName;
self.latitudeField.text = [GLManager sharedManager].wifiZoneLatitude;
self.longitudeField.text = [GLManager sharedManager].wifiZoneLongitude;
[self.resetButton setTitle:@"Clear" forState:UIControlStateNormal];
}
}
- (IBAction)saveButtonWasTapped:(UIButton *)sender {
if([@"" isEqualToString:self.wifiNameField.text]) {
[[GLManager sharedManager] saveNewWifiZone:nil withLatitude:nil andLongitude:nil];
} else {
[[GLManager sharedManager] saveNewWifiZone:self.wifiNameField.text withLatitude:self.latitudeField.text andLongitude:self.longitudeField.text];
}
[self dismissViewControllerAnimated:YES completion:nil];
}
- (IBAction)resetButtonWasTapped:(UIButton *)sender {
[[GLManager sharedManager] saveNewWifiZone:nil withLatitude:nil andLongitude:nil];
[self dismissViewControllerAnimated:YES completion:nil];
}
/*
#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