-
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.
- Loading branch information
Showing
23 changed files
with
436 additions
and
422 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
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-alpha01" | ||
|
||
android { | ||
compileSdk = 31 | ||
defaultConfig { | ||
|
@@ -15,46 +21,91 @@ 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") | ||
} | ||
|
||
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-alpha01" | ||
artifactId = project.name | ||
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" | ||
// implementation(platform("io.arrow-kt:arrow-stack:$version")) | ||
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") | ||
} |
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
16 changes: 9 additions & 7 deletions
16
locationfetcher/src/main/java/com/freelapp/libs/locationfetcher/LocationSource.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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
package com.freelapp.libs.locationfetcher | ||
|
||
import android.location.Location | ||
import kotlinx.coroutines.flow.StateFlow | ||
import arrow.core.Either | ||
import arrow.core.Nel | ||
import kotlinx.coroutines.flow.SharedFlow | ||
|
||
interface LocationSource { | ||
val realLocation: StateFlow<Location?> | ||
val location: StateFlow<Location?> | ||
var customLocation: Location? | ||
var locationSource: Source | ||
enum class Source { REAL, CUSTOM } | ||
public interface LocationSource { | ||
public val realLocation: SharedFlow<Either<Nel<LocationFetcher.Error>, Location>> | ||
public val location: SharedFlow<Either<Nel<LocationFetcher.Error>, Location>> | ||
public var customLocation: Location? | ||
public var locationSource: Source | ||
public enum class Source { REAL, CUSTOM } | ||
} |
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
Oops, something went wrong.