-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
*Breaking changes* - Location flow, permission flow and settings flow are now *SharedFlow*. Using *StateFlow* is conceptually wrong because it does not necessarily mean the *current* state. If you used `.value` on the previous flows, you can now use `replayCache.last()`. - `LocationFetcher.location` is now a `SharedFlow<Either<Nel<Error>, Location>>`. It now reports the errors in the left side of the `Either` value in case it failed to obtain a location. - `LocationFetcher.permissionStatus` and `LocationFetcher.settingsStatus` are now `SharedFlow<Boolean>`. The old enums `PermissionStatus` and `SettingsStatus` are now deprecated. - Removed `LocationFetcher.requestLocationPermissionOnLifecycle` and `LocationFetcher.requestEnableLocationSettingsOnLifecycle` configs from `LocationFetcher.Config`. Instead of requesting permissions and setting enablement on their own, it's now requested automatically once the location flows is subscribed to. - Removed the possibility to ask for location indefinitely. We now use (and require) a rationale for asking for location. If user denies the permission once, the rationale is shown and we ask the permission one more time. If the user denies it, we respect the user decision and don't ask again. This is in accordance with Google's best practices and policies on location fetching. The rationale is a `String` passed to the `LocationFetcher` builders. *Other changes* - Added `LocationFetcher.shouldShowRationale(): Boolean`. Should return true after user denied location permission once. It's used internally to decide whether to show a rationale to the user before asking for permission again, but it's also exposed as an API.
- Loading branch information
Showing
24 changed files
with
605 additions
and
494 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,15 +1,28 @@ | ||
buildscript { | ||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
dependencies { | ||
val kotlinVersion = "1.5.31" | ||
classpath("com.android.tools.build:gradle:7.1.0-alpha13") | ||
classpath(kotlin("gradle-plugin", version = kotlinVersion)) | ||
} | ||
plugins { | ||
id("com.android.library") version "7.1.0-beta02" apply false | ||
kotlin("android") version "1.6.0-RC2" apply false | ||
id("io.github.gradle-nexus.publish-plugin") version "1.1.0" | ||
} | ||
|
||
tasks.register("clean", Delete::class) { | ||
tasks.register<Delete>("clean") { | ||
delete(rootProject.buildDir) | ||
} | ||
|
||
apply(from = "$rootDir/scripts/publish-root.gradle.kts") | ||
|
||
// Set up Sonatype repository | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
val ossrhUsername: String by extra | ||
val ossrhPassword: String by extra | ||
val sonatypeStagingProfileId: String by extra | ||
stagingProfileId.set(sonatypeStagingProfileId) | ||
username.set(ossrhUsername) | ||
password.set(ossrhPassword) | ||
// Add these lines if using new Sonatype infra | ||
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/")) | ||
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")) | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,8 +2,14 @@ plugins { | |
id("com.android.library") | ||
kotlin("android") | ||
`maven-publish` | ||
signing | ||
} | ||
|
||
apply(from = "$rootDir/scripts/publish-root.gradle.kts") | ||
|
||
group = "app.freel" | ||
version = "8.0.0" | ||
|
||
android { | ||
compileSdk = 31 | ||
defaultConfig { | ||
|
@@ -15,46 +21,97 @@ android { | |
targetCompatibility = JavaVersion.VERSION_1_8 | ||
} | ||
kotlinOptions { | ||
freeCompilerArgs += listOf( | ||
"-Xexplicit-api=strict", | ||
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi" | ||
) | ||
jvmTarget = "1.8" | ||
languageVersion = "1.5" | ||
} | ||
} | ||
|
||
dependencies { | ||
coroutines() | ||
jetpack() | ||
implementation("com.google.android.gms:play-services-location:18.0.0") | ||
implementation("javax.inject:javax.inject:1") | ||
val sourcesJar = task<Jar>("androidSourcesJar") { | ||
archiveClassifier.set("sources") | ||
from(android.sourceSets["main"].java.srcDirs) | ||
} | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
// Creates a Maven publication called "release". | ||
register("release", MavenPublication::class) { | ||
register<MavenPublication>("release") { | ||
from(components["release"]) | ||
groupId = "app.freel" | ||
version = "8.0.0" | ||
artifactId = project.name | ||
artifact(sourcesJar).apply { | ||
classifier = "sources" | ||
} | ||
pom { | ||
name.set(project.name) | ||
description.set("Easy Location fetching for Android apps.") | ||
url.set("https://github.com/psteiger/LocationFetcher") | ||
licenses { | ||
license { | ||
name.set("MIT License") | ||
url.set("https://github.com/psteiger/LocationFetcher/blob/master/LICENSE") | ||
} | ||
} | ||
developers { | ||
developer { | ||
id.set("psteiger") | ||
name.set("Patrick Steiger") | ||
email.set("[email protected]") | ||
} | ||
} | ||
scm { | ||
connection.set("scm:git:github.com/psteiger/LocationFetcher/LocationFetcher.git") | ||
developerConnection.set("scm:git:ssh://github.com/psteiger/LocationFetcher/LocationFetcher.git") | ||
url.set("https://github.com/LocationFetcher/psteiger/tree/master") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
val signingKeyId: String by extra | ||
val signingPassword: String by extra | ||
val signingKey: String by extra | ||
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword) | ||
sign(publishing.publications) | ||
} | ||
|
||
dependencies { | ||
coroutines() | ||
jetpack() | ||
arrow() | ||
implementation("com.google.android.gms:play-services-location:18.0.0") | ||
implementation("javax.inject:javax.inject:1") | ||
} | ||
|
||
fun DependencyHandlerScope.arrow() { | ||
val version = "1.0.1" | ||
api("io.arrow-kt:arrow-core:$version") | ||
} | ||
|
||
fun DependencyHandlerScope.coroutines() { | ||
val version = "1.5.2" | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$version") | ||
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:$version") | ||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-play-services:$version") | ||
} | ||
|
||
fun DependencyHandlerScope.jetpack() { | ||
implementation("androidx.activity:activity-ktx:1.4.0-beta01") | ||
implementation("androidx.fragment:fragment-ktx:1.4.0-alpha10") | ||
implementation("androidx.appcompat:appcompat:1.4.0-beta01") | ||
implementation("androidx.core:core-ktx:1.6.0") | ||
implementation("androidx.activity:activity-ktx:1.4.0") | ||
implementation("androidx.fragment:fragment-ktx:1.4.0-rc01") | ||
implementation("androidx.appcompat:appcompat:1.4.0-rc01") | ||
implementation("androidx.core:core-ktx:1.7.0") | ||
androidxLifecycle() | ||
} | ||
|
||
fun DependencyHandlerScope.androidxLifecycle() { | ||
val lifecycleVersion = "2.4.0-rc01" | ||
val lifecycleVersion = "2.4.0" | ||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion") | ||
implementation("androidx.lifecycle:lifecycle-common:$lifecycleVersion") | ||
} |
Oops, something went wrong.