diff --git a/Classes/LinphoneAppDelegate.h b/Classes/LinphoneAppDelegate.h index c4aa09e09..c34ad8775 100644 --- a/Classes/LinphoneAppDelegate.h +++ b/Classes/LinphoneAppDelegate.h @@ -24,11 +24,13 @@ #import "ProviderDelegate.h" #import #import +#import -@interface LinphoneAppDelegate : NSObject { +@interface LinphoneAppDelegate : NSObject { @private UIBackgroundTaskIdentifier bgStartId; BOOL startedInBackground; + CLLocationManager* locationManager; } - (void)registerForNotifications; diff --git a/Classes/LinphoneAppDelegate.m b/Classes/LinphoneAppDelegate.m index 6be0de45e..88967b9b5 100644 --- a/Classes/LinphoneAppDelegate.m +++ b/Classes/LinphoneAppDelegate.m @@ -248,6 +248,24 @@ //init logs asap [Log enableLogs:[[LinphoneManager instance] lpConfigIntForKey:@"debugenable_preference"]]; + //Starting with iOS 13, the CNCopyCurrentNetworkInfo API will no longer return valid Wi-Fi SSID and BSSID information. + //Use the CoreLocation API to request the user’s consent to access location information. + if (@available(iOS 13.0, *)) { + CLAuthorizationStatus status = [CLLocationManager authorizationStatus]; + switch(status) { + case kCLAuthorizationStatusNotDetermined: + locationManager = [[CLLocationManager alloc]init]; + locationManager.delegate = self; + [locationManager requestWhenInUseAuthorization]; + break; + case kCLAuthorizationStatusRestricted: + case kCLAuthorizationStatusDenied: + [[[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Warning", nil) message:NSLocalizedString(@"Location Authorization is Denied or RestricTed.", nil) delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", nil) otherButtonTitles:nil, nil] show]; + default: + break; + } + } + BOOL background_mode = [instance lpConfigBoolForKey:@"backgroundmode_preference"]; BOOL start_at_boot = [instance lpConfigBoolForKey:@"start_at_boot_preference"]; [self registerForNotifications]; // Register for notifications must be done ASAP to give a chance for first SIP register to be done with right token. Specially true in case of remote provisionning or re-install with new type of signing certificate, like debug to release. diff --git a/linphone-Info.plist b/linphone-Info.plist index 0a5b4b4cb..05c16286e 100644 --- a/linphone-Info.plist +++ b/linphone-Info.plist @@ -90,6 +90,8 @@ Share photos with your friends and customize avatars NSContactsUsageDescription Make calls with your friends + NSLocationWhenInUseUsageDescription + Your location will used to detect the change of wifi NSMicrophoneUsageDescription Use microphone to make audio calls NSPhotoLibraryAddUsageDescription diff --git a/linphone.xcodeproj/project.pbxproj b/linphone.xcodeproj/project.pbxproj index 0e02d07fe..cc889f567 100644 --- a/linphone.xcodeproj/project.pbxproj +++ b/linphone.xcodeproj/project.pbxproj @@ -132,6 +132,7 @@ 61AEBECC2191E4A300F35E7F /* chevron_list_open@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 61AEBECB2191E4A300F35E7F /* chevron_list_open@2x.png */; }; 61CCC3DF21933B580060EDEA /* UIDeviceCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 61CCC3DE21933B580060EDEA /* UIDeviceCell.m */; }; 61CCC3E121933B660060EDEA /* UIDeviceCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 61CCC3E021933B660060EDEA /* UIDeviceCell.xib */; }; + 61DD7E1F2372E88F001BDD01 /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61DD7E1E2372E88F001BDD01 /* CoreLocation.framework */; }; 61F1997520C6B1D5006B069A /* AVKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 61F1996E20C6B1D5006B069A /* AVKit.framework */; }; 630589E71B4E810900EFAE36 /* ChatTester.m in Sources */ = {isa = PBXBuildFile; fileRef = 630589DF1B4E810900EFAE36 /* ChatTester.m */; }; 630589E81B4E810900EFAE36 /* ContactsTester.m in Sources */ = {isa = PBXBuildFile; fileRef = 630589E11B4E810900EFAE36 /* ContactsTester.m */; }; @@ -1081,6 +1082,7 @@ 61CCC3D721933B380060EDEA /* UIDeviceCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UIDeviceCell.h; sourceTree = ""; }; 61CCC3DE21933B580060EDEA /* UIDeviceCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UIDeviceCell.m; sourceTree = ""; }; 61CCC3E021933B660060EDEA /* UIDeviceCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = UIDeviceCell.xib; sourceTree = ""; }; + 61DD7E1E2372E88F001BDD01 /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; 61F1996E20C6B1D5006B069A /* AVKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVKit.framework; path = System/Library/Frameworks/AVKit.framework; sourceTree = SDKROOT; }; 620DFD020AC0182319853127 /* Pods-linphoneExtension.distributionadhoc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-linphoneExtension.distributionadhoc.xcconfig"; path = "Pods/Target Support Files/Pods-linphoneExtension/Pods-linphoneExtension.distributionadhoc.xcconfig"; sourceTree = ""; }; 630589DE1B4E810900EFAE36 /* ChatTester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChatTester.h; sourceTree = ""; }; @@ -2015,6 +2017,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 61DD7E1F2372E88F001BDD01 /* CoreLocation.framework in Frameworks */, 6180D6FE21EE41A800AD9CB6 /* QuickLook.framework in Frameworks */, 61AEBEA321906AFC00F35E7F /* (null) in Frameworks */, D37DC7181594AF3400B2A5EB /* MessageUI.framework in Frameworks */, @@ -2441,6 +2444,7 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 61DD7E1E2372E88F001BDD01 /* CoreLocation.framework */, 6180D6FD21EE41A800AD9CB6 /* QuickLook.framework */, 22B5F03410CE6B2F00777D97 /* AddressBook.framework */, 22B5EFA210CE50BD00777D97 /* AddressBookUI.framework */,