Skip to content

Commit ec844c8

Browse files
committed
Remove duplicate lines from location perm requests
Both branches of an if/else had the same last line so I could DRY things up by moving the line outside the conditional statement.
1 parent 8951f0d commit ec844c8

3 files changed

Lines changed: 3 additions & 9 deletions

File tree

OpenTreeMap/src/OTM/Controllers/OTMInstanceSelectTableViewController.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,8 @@ - (void)startLoadingNearbyInstances
133133
[self.activityIndicatorView startAnimating];
134134
if ([[SharedAppDelegate locationManager] respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
135135
[[SharedAppDelegate locationManager] requestWhenInUseAuthorization];
136-
[self startUpdatingLocation];
137-
} else {
138-
[self startUpdatingLocation];
139136
}
137+
[self startUpdatingLocation];
140138
}
141139
}
142140

OpenTreeMap/src/OTM/Controllers/OTMMapViewController.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,8 @@ - (void)viewWillAppear:(BOOL)animated
190190
if ([CLLocationManager locationServicesEnabled]) {
191191
if ([[SharedAppDelegate locationManager] respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
192192
[[SharedAppDelegate locationManager] requestWhenInUseAuthorization];
193-
[self startUpdatingLocation];
194-
} else {
195-
[self startUpdatingLocation];
196193
}
194+
[self startUpdatingLocation];
197195
}
198196

199197
if (self.mode == Select) {

OpenTreeMap/src/OTM/Controllers/OTMNearbyTreesViewController.m

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,8 @@ - (void)viewWillAppear:(BOOL)animated {
9696
// Required to get iOS8 location services to run.
9797
if ([[SharedAppDelegate locationManager] respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
9898
[[SharedAppDelegate locationManager] requestWhenInUseAuthorization];
99-
[self startUpdatingLocation];
100-
} else {
101-
[self startUpdatingLocation];
10299
}
100+
[self startUpdatingLocation];
103101
}
104102

105103
[self reloadBackground];

0 commit comments

Comments
 (0)