Add PlayLocationProvider

pull/1369/head
Alex Baker 5 years ago
parent a57040119b
commit f86963244d

@ -201,13 +201,13 @@ dependencies {
implementation("com.google.auth:google-auth-library-oauth2-http:0.23.0")
implementation("androidx.work:work-runtime:${Versions.work}")
implementation("androidx.work:work-runtime-ktx:${Versions.work}")
implementation("com.mapbox.mapboxsdk:mapbox-android-core:3.1.1")
implementation("com.mapbox.mapboxsdk:mapbox-sdk-services:5.8.0")
implementation("com.etesync:journalmanager:1.1.1")
implementation("com.etebase:client:2.3.2")
implementation("com.github.QuadFlask:colorpicker:0.0.15")
implementation("com.github.openid:AppAuth-Android:27b62d5")
genericImplementation("com.mapbox.mapboxsdk:mapbox-android-core:3.1.1")
genericImplementation("org.osmdroid:osmdroid-android:6.1.10@aar")
googleplayImplementation("com.google.firebase:firebase-crashlytics:${Versions.crashlytics}")

@ -108,13 +108,6 @@
license: The Apache Software License, Version 2.0
licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
url: http://developer.android.com/tools/extras/support-library.html
- artifact: com.mapbox.mapboxsdk:mapbox-android-core:+
name: Mapbox Android Core Library
copyrightHolder: Mapbox
license: MIT License
licenseUrl: http://www.opensource.org/licenses/mit-license.php
url: https://github.com/mapbox/mapbox-events-android
forceGenerate: true
- artifact: androidx.lifecycle:lifecycle-livedata:+
name: Android Lifecycle LiveData
copyrightHolder: Android Open Source Project

@ -36,7 +36,7 @@ internal class LocationModule {
@Provides
@ActivityScoped
fun getLocationProvider(@ApplicationContext context: Context): LocationProvider =
MapboxLocationProvider(context)
PlayLocationProvider(context)
@Provides
@ActivityScoped

@ -0,0 +1,21 @@
package org.tasks.location
import android.annotation.SuppressLint
import android.content.Context
import com.google.android.gms.location.LocationServices
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import kotlin.coroutines.suspendCoroutine
class PlayLocationProvider(private val context: Context) : LocationProvider {
@SuppressLint("MissingPermission")
override suspend fun currentLocation(): MapPosition = withContext(Dispatchers.IO) {
suspendCoroutine { cont ->
LocationServices.getFusedLocationProviderClient(context).lastLocation
.addOnSuccessListener {
cont.resumeWith(Result.success(MapPosition(it.latitude, it.longitude)))
}
.addOnFailureListener { cont.resumeWith(Result.failure(it)) }
}
}
}

@ -261,20 +261,6 @@
"url": "http://developer.android.com/tools/extras/support-library.html",
"libraryName": "Android Support Library View Pager"
},
{
"artifactId": {
"name": "mapbox-android-core",
"group": "com.mapbox.mapboxsdk",
"version": "+"
},
"copyrightHolder": "Mapbox",
"copyrightStatement": "Copyright © Mapbox. All rights reserved.",
"license": "MIT License",
"licenseUrl": "http://www.opensource.org/licenses/mit-license.php",
"normalizedLicense": "mit",
"url": "https://github.com/mapbox/mapbox-events-android",
"libraryName": "Mapbox Android Core Library"
},
{
"artifactId": {
"name": "lifecycle-livedata",

@ -15,6 +15,7 @@
++--- androidx.databinding:databinding-adapters:4.1.2
+| +--- androidx.databinding:databinding-common:4.1.2
+| \--- androidx.databinding:databinding-runtime:4.1.2 (*)
++--- com.mapbox.mapboxsdk:mapbox-android-core:3.1.1
++--- org.osmdroid:osmdroid-android:6.1.10
++--- com.gitlab.bitfireAT:dav4jvm:2.1.1
+| +--- org.jetbrains.kotlin:kotlin-stdlib:1.3.72 -> 1.4.30
@ -348,7 +349,6 @@
+| +--- androidx.work:work-runtime:2.5.0 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.21 -> 1.4.30 (*)
+| \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1 (*)
++--- com.mapbox.mapboxsdk:mapbox-android-core:3.1.1
++--- com.mapbox.mapboxsdk:mapbox-sdk-services:5.8.0
+| +--- com.mapbox.mapboxsdk:mapbox-sdk-core:5.8.0
+| | +--- com.google.code.gson:gson:2.8.6

@ -478,7 +478,6 @@
+| +--- androidx.work:work-runtime:2.5.0 (*)
+| +--- org.jetbrains.kotlin:kotlin-stdlib:1.4.21 -> 1.4.30 (*)
+| \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1 (*)
++--- com.mapbox.mapboxsdk:mapbox-android-core:3.1.1
++--- com.mapbox.mapboxsdk:mapbox-sdk-services:5.8.0
+| +--- com.mapbox.mapboxsdk:mapbox-sdk-core:5.8.0
+| | +--- com.google.code.gson:gson:2.8.6

Loading…
Cancel
Save