-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a separate product flavor to publish on F-Droid
- Loading branch information
Showing
18 changed files
with
127 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
app/src/fdroid/kotlin/xyz/malkki/neostumbler/location/LocationSourceProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package xyz.malkki.neostumbler.location | ||
|
||
import android.content.Context | ||
|
||
|
||
class LocationSourceProvider(private val context: Context) { | ||
fun getLocationSource(): LocationSource { | ||
return PlatformLocationSource(context) | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
app/src/fdroid/kotlin/xyz/malkki/neostumbler/ui/screens/settings/SettingsScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package xyz.malkki.neostumbler.ui.screens.settings | ||
|
||
|
||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.Spacer | ||
import androidx.compose.foundation.layout.height | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import xyz.malkki.neostumbler.ui.composables.ExportDataButton | ||
import xyz.malkki.neostumbler.ui.composables.ReportReuploadButton | ||
|
||
@Composable | ||
fun SettingsScreen() { | ||
Column { | ||
ExportDataButton() | ||
Spacer(modifier = Modifier.height(8.dp)) | ||
ReportReuploadButton() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools"> | ||
|
||
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" tools:node="merge" /> | ||
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" tools:node="merge"/> | ||
|
||
<application tools:node="merge"> | ||
|
||
<receiver | ||
android:name=".scanner.autoscan.LocationReceiver" | ||
android:enabled="true" | ||
android:exported="true" | ||
tools:node="merge" /> | ||
|
||
<receiver | ||
android:name=".scanner.autoscan.RescheduleReceiver" | ||
android:enabled="true" | ||
android:exported="true" | ||
tools:node="merge"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" /> | ||
</intent-filter> | ||
<intent-filter> | ||
<action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<receiver | ||
android:name=".scanner.autoscan.ActivityTransitionReceiver" | ||
android:enabled="true" | ||
android:exported="true" | ||
tools:node="merge" /> | ||
</application> | ||
</manifest> |
14 changes: 14 additions & 0 deletions
14
app/src/full/kotlin/xyz/malkki/neostumbler/extensions/contextExtensionsFull.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package xyz.malkki.neostumbler.extensions | ||
|
||
import android.content.Context | ||
import com.google.android.gms.common.ConnectionResult | ||
import com.google.android.gms.common.GoogleApiAvailability | ||
|
||
/** | ||
* Checks if Google APIs are available | ||
* | ||
* @return true is Google APIs are available, false if not | ||
*/ | ||
fun Context.isGoogleApisAvailable(): Boolean { | ||
return GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(applicationContext) == ConnectionResult.SUCCESS | ||
} |
File renamed without changes.
31 changes: 31 additions & 0 deletions
31
app/src/full/kotlin/xyz/malkki/neostumbler/location/LocationSourceProvider.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package xyz.malkki.neostumbler.location | ||
|
||
import android.content.Context | ||
import androidx.datastore.preferences.core.booleanPreferencesKey | ||
import kotlinx.coroutines.flow.firstOrNull | ||
import kotlinx.coroutines.flow.map | ||
import kotlinx.coroutines.runBlocking | ||
import timber.log.Timber | ||
import xyz.malkki.neostumbler.StumblerApplication | ||
import xyz.malkki.neostumbler.constants.PreferenceKeys | ||
import xyz.malkki.neostumbler.extensions.isGoogleApisAvailable | ||
|
||
class LocationSourceProvider(private val context: Context) { | ||
private val settingsStore = (context.applicationContext as StumblerApplication).settingsStore | ||
|
||
private fun preferFusedLocation(): Boolean = runBlocking { | ||
settingsStore.data | ||
.map { it[booleanPreferencesKey(PreferenceKeys.PREFER_FUSED_LOCATION)] } | ||
.firstOrNull() ?: true | ||
} | ||
|
||
fun getLocationSource(): LocationSource { | ||
return if (preferFusedLocation() && context.isGoogleApisAvailable()) { | ||
Timber.i("Using fused location source") | ||
FusedLocationSource(context) | ||
} else { | ||
Timber.i("Using platform location source") | ||
PlatformLocationSource(context) | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<resources> | ||
<string name="prefer_fused_location">Prefer fused location provider</string> | ||
<string name="autoscan_when_moving">Automatic scanning while moving</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters