Skip to content

Commit 09bf4d1

Browse files
Merge branch 'feature/OS2INDBE_265_Få_iOS_app_optimeret_til_nyeste_OS_version_generel_gennemgang_af_app' into develop
2 parents c1bd2e0 + 2d070f2 commit 09bf4d1

File tree

8 files changed

+84
-304
lines changed

8 files changed

+84
-304
lines changed

OS2Indberetning.xcodeproj/project.pbxproj

Lines changed: 5 additions & 225 deletions
Large diffs are not rendered by default.

OS2Indberetning.xcodeproj/xcshareddata/xcschemes/eIndberetning.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "0720"
3+
LastUpgradeVersion = "1010"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

eIndberetning/AppDelegate.m

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ @implementation AppDelegate
2020

2121

2222
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
23-
24-
25-
2623
return YES;
2724
}
2825

@@ -31,7 +28,6 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
3128
[self chooseFirstView];
3229

3330
[AFNetworkActivityIndicatorManager sharedManager].enabled = NO;
34-
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
3531

3632
[self.window makeKeyAndVisible];
3733

@@ -183,7 +179,7 @@ - (NSManagedObjectContext *)managedObjectContext {
183179
if (!coordinator) {
184180
return nil;
185181
}
186-
_managedObjectContext = [[NSManagedObjectContext alloc] init];
182+
_managedObjectContext = [[NSManagedObjectContext alloc] initWithConcurrencyType:NSMainQueueConcurrencyType];
187183
[_managedObjectContext setPersistentStoreCoordinator:coordinator];
188184
return _managedObjectContext;
189185
}

eIndberetning/DriveViewController.m

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#import "UserInfo.h"
1616
#import "QuestionDialogViewController.h"
1717

18-
@interface DriveViewController () <CLLocationManagerDelegate, UIAlertViewDelegate>
18+
@interface DriveViewController () <CLLocationManagerDelegate>
1919
@property (weak, nonatomic) IBOutlet UIButton *finishButton;
2020
@property (weak, nonatomic) IBOutlet UILabel *distanceDrivenLabel;
2121
@property (weak, nonatomic) IBOutlet UILabel *lastUpdatedLabel;
@@ -207,32 +207,40 @@ -(void)showGPSPermissionDenied
207207
NSString* title = @"Lokation er ikke tilgængelig";
208208
NSString *message = @"For at bruge appen, skal lokation gøres tilgængelig";
209209

210-
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
211-
message:message
212-
delegate:self
213-
cancelButtonTitle:@"Afbryd"
214-
otherButtonTitles:@"Indstillinger", nil];
215-
[alertView show];
210+
UIAlertController *alertController = [UIAlertController
211+
alertControllerWithTitle:title
212+
message:message
213+
preferredStyle:UIAlertControllerStyleAlert];
214+
215+
UIAlertAction *cancelAction = [UIAlertAction
216+
actionWithTitle:@"Afbryd"
217+
style:UIAlertActionStyleCancel
218+
handler:^(UIAlertAction *action)
219+
{
220+
[self endDrive];
221+
}];
222+
223+
UIAlertAction *settingsAction = [UIAlertAction
224+
actionWithTitle:@"Indstillinger"
225+
style:UIAlertActionStyleDefault
226+
handler:^(UIAlertAction *action)
227+
{
228+
// Send the user to the Settings for this app
229+
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
230+
[[UIApplication sharedApplication] openURL:settingsURL];
231+
}];
232+
233+
[alertController addAction:cancelAction];
234+
[alertController addAction:settingsAction];
235+
236+
[self presentViewController:alertController animated:YES completion:nil];
216237
}
217238

218239
-(void)onGoingLocationDenied{
219240
[self togglePauseResume:NO];
220241
[self showGPSPermissionDenied];
221242
}
222243

223-
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
224-
{
225-
if (buttonIndex == 1) {
226-
// Send the user to the Settings for this app
227-
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
228-
[[UIApplication sharedApplication] openURL:settingsURL];
229-
}
230-
else
231-
{
232-
[self endDrive];
233-
}
234-
}
235-
236244
-(void)didUpdatePrecision:(float)precision
237245
{
238246
if(!self.shouldWaitForGPSSettle){

eIndberetning/GPSManager.m

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,15 @@ - (BOOL)requestAuthorization
113113
// The user has not enabled any location services. Request background authorization.
114114
else if (status == kCLAuthorizationStatusNotDetermined) {
115115
NSLog(@"Not determined status number: %i", status);
116-
float version = [[UIDevice currentDevice] systemVersion].floatValue;
117-
if (version >= 8.0)
118-
{
119-
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
120-
[self.locationManager requestAlwaysAuthorization];
121-
}
122-
}
123-
else
124-
{
125-
[self.locationManager startUpdatingLocation];
116+
117+
if ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
118+
[self.locationManager requestAlwaysAuthorization];
126119
}
120+
127121
return NO;
128-
}else if(status == kCLAuthorizationStatusAuthorized){
129-
NSLog(@"Authorized status number: %i", status);
130-
}else if(status == kCLAuthorizationStatusAuthorizedAlways){
122+
} else if (status == kCLAuthorizationStatusAuthorizedAlways) {
131123
NSLog(@"Auth Always status number: %i", status);
132-
}else if(status == kCLAuthorizationStatusRestricted){
124+
} else if(status == kCLAuthorizationStatusRestricted) {
133125
NSLog(@"Restricted status number: %i", status);
134126
}
135127

eIndberetning/Info.plist

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@
2828
<true/>
2929
</dict>
3030
<key>NSLocationAlwaysUsageDescription</key>
31-
<string>Lokations tracking er nødvendig for at opmåle ruter.</string>
31+
<string>Lokations-tracking er nødvendig for at opmåle ruter.</string>
32+
<key>NSLocationWhenInUseUsageDescription</key>
33+
<string>Lokations-tracking er nødvendig for at opmåle ruter.</string>
34+
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
35+
<string>Lokations-tracking er nødvendig for at opmåle ruter.</string>
3236
<key>UIBackgroundModes</key>
3337
<array>
3438
<string>location</string>
@@ -44,6 +48,8 @@
4448
</array>
4549
<key>UIStatusBarHidden</key>
4650
<false/>
51+
<key>UIStatusBarStyle</key>
52+
<string>UIStatusBarStyleLightContent</string>
4753
<key>UISupportedInterfaceOrientations</key>
4854
<array>
4955
<string>UIInterfaceOrientationPortrait</string>

eIndberetning/StartDriveTableViewController.m

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -390,44 +390,34 @@ -(void)didFinishSyncWithProfile:(Profile*)profile AndRate:(NSArray*)rates;
390390
-(void)showGPSPermissionDenied
391391
{
392392
NSString* title = @"Lokation er ikke tilgængelig";
393-
394-
float version = [[UIDevice currentDevice] systemVersion].floatValue;
395-
if (version >= 8.0)
396-
{
397-
398-
NSString *message = @"For at bruge appen, skal lokation gøres tilgængelig";
399-
400-
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
401-
message:message
402-
delegate:self
403-
cancelButtonTitle:@"Afbryd"
404-
otherButtonTitles:@"Indstillinger", nil];
405-
[alertView show];
406-
}
407-
else
408-
{
409-
NSString *message = @"For at bruge appen, skal lokation gøres tilgængelig, gå derfor ind i indstillinger først";
410-
411-
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:title
412-
message:message
413-
delegate:self
414-
cancelButtonTitle:@"Ok"
415-
otherButtonTitles:nil, nil];
416-
[alertView show];
417-
}
418-
}
419-
420-
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
421-
{
422-
if (buttonIndex == 1) {
423-
// Send the user to the Settings for this app
424-
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
425-
[[UIApplication sharedApplication] openURL:settingsURL];
426-
}
427-
else
428-
{
429-
[self.navigationController popToRootViewControllerAnimated:true];
430-
}
393+
NSString *message = @"For at bruge appen, skal lokation gøres tilgængelig";
394+
395+
UIAlertController *alertController = [UIAlertController
396+
alertControllerWithTitle:title
397+
message:message
398+
preferredStyle:UIAlertControllerStyleAlert];
399+
400+
UIAlertAction *cancelAction = [UIAlertAction
401+
actionWithTitle:@"Afbryd"
402+
style:UIAlertActionStyleCancel
403+
handler:^(UIAlertAction *action)
404+
{
405+
[self.navigationController popToRootViewControllerAnimated:true];
406+
}];
407+
408+
UIAlertAction *settingsAction = [UIAlertAction
409+
actionWithTitle:@"Indstillinger"
410+
style:UIAlertActionStyleDefault
411+
handler:^(UIAlertAction *action)
412+
{
413+
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
414+
[[UIApplication sharedApplication] openURL:settingsURL];
415+
}];
416+
417+
[alertController addAction:cancelAction];
418+
[alertController addAction:settingsAction];
419+
420+
[self presentViewController:alertController animated:YES completion:nil];
431421
}
432422

433423
-(void)gotNewGPSCoordinate:(CLLocation *)location

0 commit comments

Comments
 (0)