Skip to content

Commit

Permalink
Merge pull request #6237 from vector-im/steve/6236_bg_location
Browse files Browse the repository at this point in the history
Location sharing: Support sending location in background (PSF-1037)
  • Loading branch information
MaximeEvrard42 authored Jun 7, 2022
2 parents b381919 + feba465 commit 17f1843
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 30 deletions.
3 changes: 3 additions & 0 deletions Riot/Modules/LocationSharing/LocationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ class LocationManager: NSObject {
locationManager.desiredAccuracy = desiredLocationAccuracy
locationManager.allowsBackgroundLocationUpdates = allowsBackgroundLocationUpdates

// Indicate to change status bar appearance when the app uses location services in the background
locationManager.showsBackgroundLocationIndicator = true

self.locationManager = locationManager

super.init()
Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/LocationSharing/UserLocationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class UserLocationService: UserLocationServiceProtocol {
// MARK: - Setup

init(session: MXSession) {
self.locationManager = LocationManager(accuracy: .full, allowsBackgroundLocationUpdates: false)
self.locationManager = LocationManager(accuracy: .full, allowsBackgroundLocationUpdates: true)
self.session = session
}

Expand Down
59 changes: 30 additions & 29 deletions Riot/SupportingFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
<string>en</string>
<key>CFBundleDisplayName</key>
<string>$(BUNDLE_DISPLAY_NAME)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Mention Pills</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>im.vector.app.pills</string>
</array>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down Expand Up @@ -46,6 +61,8 @@
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand All @@ -59,19 +76,20 @@
<string>The contact book is used to send room invitation to your contacts with their emails.</string>
<key>NSFaceIDUsageDescription</key>
<string>Face ID is used to access your app.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>When you share your location to people, Element needs access to show them a map.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>When you share your location to people, Element needs access to show them a map.</string>
<key>NSMicrophoneUsageDescription</key>
<string>The microphone is used to take videos, make calls.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>The photo library is used to send photos and videos.</string>
<key>NSSiriUsageDescription</key>
<string>Siri is used to perform calls even from the lock screen.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>When you share your location to people, Element needs access to show them a map.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>When you share your location to people, Element needs access to show them a map.</string>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>location</string>
<string>remote-notification</string>
<string>voip</string>
</array>
Expand Down Expand Up @@ -108,29 +126,6 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<true/>
<key>UserDefaults</key>
<string>${PRODUCT_NAME}-Defaults</string>
<key>applicationGroupIdentifier</key>
<string>$(APPLICATION_GROUP_IDENTIFIER)</string>
<key>baseBundleIdentifier</key>
<string>$(BASE_BUNDLE_IDENTIFIER)</string>
<key>keychainAccessGroup</key>
<string>$(KEYCHAIN_ACCESS_GROUP)</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Mention Pills</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSHandlerRank</key>
<string>Owner</string>
<key>LSItemContentTypes</key>
<array>
<string>im.vector.app.pills</string>
</array>
</dict>
</array>
<key>UTExportedTypeDeclarations</key>
<array>
<dict>
Expand All @@ -144,7 +139,13 @@
<string>im.vector.app.pills</string>
</dict>
</array>
<key>LSSupportsOpeningDocumentsInPlace</key>
<false/>
<key>UserDefaults</key>
<string>${PRODUCT_NAME}-Defaults</string>
<key>applicationGroupIdentifier</key>
<string>$(APPLICATION_GROUP_IDENTIFIER)</string>
<key>baseBundleIdentifier</key>
<string>$(BASE_BUNDLE_IDENTIFIER)</string>
<key>keychainAccessGroup</key>
<string>$(KEYCHAIN_ACCESS_GROUP)</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions changelog.d/6236.wip
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Location sharing: Support sending location in background.

0 comments on commit 17f1843

Please sign in to comment.