diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a2289f354..3171cd432 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,10 +16,10 @@ jobs:
steps:
- name: Fetch Sources
uses: actions/checkout@v2
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v2
with:
- java-version: '11'
+ java-version: '17'
distribution: 'adopt'
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
@@ -49,10 +49,10 @@ jobs:
steps:
- name: Fetch Sources
uses: actions/checkout@v2
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v2
with:
- java-version: '11'
+ java-version: '17'
distribution: 'adopt'
- name: Setup Gradle Dependencies Cache
uses: actions/cache@v2
diff --git a/.github/workflows/release-automated.yml b/.github/workflows/release-automated.yml
index f28d3202a..978b8c04f 100644
--- a/.github/workflows/release-automated.yml
+++ b/.github/workflows/release-automated.yml
@@ -9,10 +9,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v2
with:
- java-version: '11'
+ java-version: '17'
distribution: 'adopt'
- name: Generate Javadoc
run: javadoc @.javadoc || true
diff --git a/.github/workflows/release-manual-docs.yml b/.github/workflows/release-manual-docs.yml
index eae133ce2..a4344fbe0 100644
--- a/.github/workflows/release-manual-docs.yml
+++ b/.github/workflows/release-manual-docs.yml
@@ -11,10 +11,10 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v2
with:
- java-version: '11'
+ java-version: '17'
distribution: 'adopt'
- name: Generate Javadoc
run: javadoc @.javadoc || true
diff --git a/bolts-tasks/build.gradle b/bolts-tasks/build.gradle
index 79f4aefa0..c30998e83 100644
--- a/bolts-tasks/build.gradle
+++ b/bolts-tasks/build.gradle
@@ -18,12 +18,13 @@ java {
javadoc.options.addStringOption('Xdoclint:none', '-quiet')
-task sourcesJar(type: Jar) {
+tasks.register('sourcesJar', Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allJava
}
-task javadocJar(type: Jar, dependsOn: javadoc) {
+tasks.register('javadocJar', Jar) {
+ dependsOn javadoc
archiveClassifier.set('javadoc')
from javadoc.destinationDir
}
@@ -39,7 +40,7 @@ afterEvaluate {
publishing {
publications {
boltsPublication(MavenPublication) {
- from components.java
+ from components.findByName('java')
}
}
}
@@ -55,8 +56,8 @@ jacocoTestReport {
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
reports {
- xml.enabled true
- html.enabled true
+ xml { enabled true }
+ html { enabled true }
}
}
diff --git a/bolts-tasks/src/main/java/com/parse/boltsinternal/AndroidExecutors.java b/bolts-tasks/src/main/java/com/parse/boltsinternal/AndroidExecutors.java
index 2dcc65f11..5cdde6816 100644
--- a/bolts-tasks/src/main/java/com/parse/boltsinternal/AndroidExecutors.java
+++ b/bolts-tasks/src/main/java/com/parse/boltsinternal/AndroidExecutors.java
@@ -35,6 +35,7 @@
/* package */ static final long KEEP_ALIVE_TIME = 1L;
private static final AndroidExecutors INSTANCE = new AndroidExecutors();
+
/**
* Nexus 5: Quad-Core Moto X: Dual-Core
*
@@ -43,6 +44,7 @@
*
https://github.com/android/platform_frameworks_base/commit/719c44e03b97e850a46136ba336d729f5fbd1f47
*/
private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors();
+
/* package */ static final int CORE_POOL_SIZE = CPU_COUNT + 1;
/* package */ static final int MAX_POOL_SIZE = CPU_COUNT * 2 + 1;
private final Executor uiThread;
diff --git a/bolts-tasks/src/main/java/com/parse/boltsinternal/CancellationTokenSource.java b/bolts-tasks/src/main/java/com/parse/boltsinternal/CancellationTokenSource.java
index 2ca4a19f9..210eae9cf 100644
--- a/bolts-tasks/src/main/java/com/parse/boltsinternal/CancellationTokenSource.java
+++ b/bolts-tasks/src/main/java/com/parse/boltsinternal/CancellationTokenSource.java
@@ -46,7 +46,9 @@ public boolean isCancellationRequested() {
}
}
- /** @return the token that can be passed to asynchronous method to control cancellation. */
+ /**
+ * @return the token that can be passed to asynchronous method to control cancellation.
+ */
public CancellationToken getToken() {
synchronized (lock) {
throwIfClosed();
diff --git a/bolts-tasks/src/main/java/com/parse/boltsinternal/Task.java b/bolts-tasks/src/main/java/com/parse/boltsinternal/Task.java
index 8e73588b2..4cb36b396 100644
--- a/bolts-tasks/src/main/java/com/parse/boltsinternal/Task.java
+++ b/bolts-tasks/src/main/java/com/parse/boltsinternal/Task.java
@@ -28,8 +28,10 @@
public class Task {
/** An {@link java.util.concurrent.Executor} that executes tasks in parallel. */
public static final ExecutorService BACKGROUND_EXECUTOR = BoltsExecutors.background();
+
/** An {@link java.util.concurrent.Executor} that executes tasks on the UI thread. */
public static final Executor UI_THREAD_EXECUTOR = AndroidExecutors.uiThread();
+
/**
* An {@link java.util.concurrent.Executor} that executes tasks in the current thread unless the
* stack runs too deep, at which point it will delegate to {@link Task#BACKGROUND_EXECUTOR} in
@@ -541,28 +543,36 @@ public boolean isCompleted() {
}
}
- /** @return {@code true} if the task was cancelled, {@code false} otherwise. */
+ /**
+ * @return {@code true} if the task was cancelled, {@code false} otherwise.
+ */
public boolean isCancelled() {
synchronized (lock) {
return cancelled;
}
}
- /** @return {@code true} if the task has an error, {@code false} otherwise. */
+ /**
+ * @return {@code true} if the task has an error, {@code false} otherwise.
+ */
public boolean isFaulted() {
synchronized (lock) {
return getError() != null;
}
}
- /** @return The result of the task, if set. {@code null} otherwise. */
+ /**
+ * @return The result of the task, if set. {@code null} otherwise.
+ */
public TResult getResult() {
synchronized (lock) {
return result;
}
}
- /** @return The error for the task, if set. {@code null} otherwise. */
+ /**
+ * @return The error for the task, if set. {@code null} otherwise.
+ */
public Exception getError() {
synchronized (lock) {
if (error != null) {
diff --git a/bolts-tasks/src/main/java/com/parse/boltsinternal/TaskCompletionSource.java b/bolts-tasks/src/main/java/com/parse/boltsinternal/TaskCompletionSource.java
index 4406cefbd..4513b76d6 100644
--- a/bolts-tasks/src/main/java/com/parse/boltsinternal/TaskCompletionSource.java
+++ b/bolts-tasks/src/main/java/com/parse/boltsinternal/TaskCompletionSource.java
@@ -24,7 +24,9 @@ public TaskCompletionSource() {
task = new Task<>();
}
- /** @return the Task associated with this TaskCompletionSource. */
+ /**
+ * @return the Task associated with this TaskCompletionSource.
+ */
public Task getTask() {
return task;
}
diff --git a/build.gradle b/build.gradle
index 04721faf7..783c39f09 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,23 +1,23 @@
buildscript {
- ext.kotlin_version = "1.7.10"
+ ext.kotlin_version = "1.9.20"
ext.jacocoVersion = '0.8.12'
+ ext.spotlessVersion = '6.25.0'
+
repositories {
google()
mavenCentral()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.1.3'
+ classpath 'com.android.tools.build:gradle:8.5.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
- classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
- classpath "com.dicedmelon.gradle:jacoco-android:0.1.5"
- classpath "io.freefair.gradle:android-gradle-plugins:4.2.0-m1"
- classpath "com.diffplug.spotless:spotless-plugin-gradle:5.17.1"
+ classpath "io.freefair.gradle:android-gradle-plugins:7.2.0-m1"
+ classpath "com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion"
}
}
plugins {
id "com.github.ben-manes.versions" version "0.28.0"
- id "com.diffplug.spotless" version "5.17.1"
+ id "com.diffplug.spotless" version "$spotlessVersion"
}
allprojects {
@@ -39,7 +39,7 @@ allprojects {
}
kotlin {
target '**/*.kt'
- ktlint().userData(["disabled_rules": "no-wildcard-imports"])
+ ktlint()
trimTrailingWhitespace()
indentWithSpaces()
endWithNewline()
diff --git a/coroutines/build.gradle b/coroutines/build.gradle
index bf4bce59c..c1ede84be 100644
--- a/coroutines/build.gradle
+++ b/coroutines/build.gradle
@@ -5,7 +5,8 @@ apply plugin: "io.freefair.android-javadoc-jar"
apply plugin: "io.freefair.android-sources-jar"
android {
- compileSdkVersion rootProject.ext.compileSdkVersion
+ namespace 'com.parse.coroutines'
+ compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
@@ -37,6 +38,10 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
+
+ buildFeatures {
+ buildConfig true
+ }
}
ext {
@@ -54,7 +59,7 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
- from components.release
+ from components.findByName('release')
}
}
}
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseCloudCoroutinesExtensions.kt b/coroutines/src/main/java/com/parse/coroutines/ParseCloudCoroutinesExtensions.kt
index 7e774c5d8..c01bbe6c8 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseCloudCoroutinesExtensions.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseCloudCoroutinesExtensions.kt
@@ -7,11 +7,17 @@ import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
-suspend fun callCloudFunction(functionName: String, params: Map): T {
+suspend fun callCloudFunction(
+ functionName: String,
+ params: Map,
+): T {
return suspendCoroutine { continuation ->
ParseCloud.callFunctionInBackground(functionName, params) { result, e ->
- if (e == null) continuation.resume(result)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(result)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesExtensions.kt b/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesExtensions.kt
index 210148d99..bfef47f91 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesExtensions.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesExtensions.kt
@@ -11,8 +11,11 @@ suspend fun ParseObject.suspendFetch(): T {
return suspendCoroutine { continuation ->
fetchInBackground { obj, e ->
- if (e == null) continuation.resume(obj)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(obj)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
@@ -21,8 +24,11 @@ suspend fun ParseObject.suspendFetchIfNeeded(): T {
return suspendCoroutine { continuation ->
fetchIfNeededInBackground { obj, e ->
- if (e == null) continuation.resume(obj)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(obj)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
@@ -31,8 +37,11 @@ suspend fun ParseObject.fetchFromLocal(): T {
return suspendCoroutine { continuation ->
fetchFromLocalDatastoreInBackground { obj, e ->
- if (e == null) continuation.resume(obj)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(obj)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesWriteExtensions.kt b/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesWriteExtensions.kt
index ce3512c0c..061feba86 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesWriteExtensions.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseObjectCoroutinesWriteExtensions.kt
@@ -10,8 +10,11 @@ import kotlin.coroutines.suspendCoroutine
suspend fun ParseObject.suspendSave() {
return suspendCoroutine { continuation ->
saveInBackground {
- if (it == null) continuation.resume(Unit)
- else continuation.resumeWithException(it)
+ if (it == null) {
+ continuation.resume(Unit)
+ } else {
+ continuation.resumeWithException(it)
+ }
}
}
}
@@ -19,8 +22,11 @@ suspend fun ParseObject.suspendSave() {
suspend fun ParseObject.suspendPin() {
return suspendCoroutine { continuation ->
pinInBackground {
- if (it == null) continuation.resume(Unit)
- else continuation.resumeWithException(it)
+ if (it == null) {
+ continuation.resume(Unit)
+ } else {
+ continuation.resumeWithException(it)
+ }
}
}
}
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesBuilder.kt b/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesBuilder.kt
index 8b2d30988..478456f43 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesBuilder.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesBuilder.kt
@@ -13,7 +13,7 @@ import kotlin.coroutines.EmptyCoroutineContext
fun CoroutineScope.launchQuery(
query: ParseQuery,
context: CoroutineContext = EmptyCoroutineContext,
- block: suspend ParseQueryOperation.() -> Unit
+ block: suspend ParseQueryOperation.() -> Unit,
): Job {
return launch(context) {
block.invoke(ParseQueryOperationImpl(query))
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesExtensions.kt b/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesExtensions.kt
index a0749d22f..b8bbb85b4 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesExtensions.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseQueryCoroutinesExtensions.kt
@@ -19,8 +19,11 @@ internal suspend fun ParseQuery.findInternal(): List {
}
findInBackground { objects, e ->
- if (e == null) continuation.resume(objects)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(objects)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
@@ -36,8 +39,11 @@ internal suspend fun ParseQuery.getInternal(id: String): T
}
getInBackground(id) { obj, e ->
- if (e == null) continuation.resume(obj)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(obj)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
@@ -53,8 +59,11 @@ internal suspend fun ParseQuery.firstInternal(): T {
}
getFirstInBackground { obj, e ->
- if (e == null) continuation.resume(obj)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(obj)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
@@ -70,8 +79,11 @@ internal suspend fun ParseQuery.countInternal(): Int {
}
countInBackground { count, e ->
- if (e == null) continuation.resume(count)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(count)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperation.kt b/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperation.kt
index 8f0ecc642..44c6366c7 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperation.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperation.kt
@@ -2,7 +2,10 @@ package com.parse.coroutines
interface ParseQueryOperation {
suspend fun find(): List
+
suspend fun get(id: String): T
+
suspend fun first(): T
+
suspend fun count(): Int
}
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperationImpl.kt b/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperationImpl.kt
index cdf41b612..0cb5c7556 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperationImpl.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseQueryOperationImpl.kt
@@ -5,7 +5,6 @@ import com.parse.ParseQuery
class ParseQueryOperationImpl(private val query: ParseQuery) :
ParseQueryOperation {
-
override suspend fun find(): List = query.findInternal()
override suspend fun get(id: String): T = query.getInternal(id)
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseTaskExtensions.kt b/coroutines/src/main/java/com/parse/coroutines/ParseTaskExtensions.kt
index 061f2b5ed..336244dbc 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseTaskExtensions.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseTaskExtensions.kt
@@ -12,19 +12,27 @@ import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
@Suppress("BlockingMethodInNonBlockingContext")
-suspend fun Task.suspendGet(dispatcher: CoroutineDispatcher = Dispatchers.IO) = withContext(dispatcher) {
- return@withContext suspendCoroutine { continuation ->
- waitForCompletion()
- if (isFaulted) continuation.resumeWithException(error)
- else continuation.resume(result)
+suspend fun Task.suspendGet(dispatcher: CoroutineDispatcher = Dispatchers.IO) =
+ withContext(dispatcher) {
+ return@withContext suspendCoroutine { continuation ->
+ waitForCompletion()
+ if (isFaulted) {
+ continuation.resumeWithException(error)
+ } else {
+ continuation.resume(result)
+ }
+ }
}
-}
@Suppress("BlockingMethodInNonBlockingContext")
-suspend fun Task.suspendRun(dispatcher: CoroutineDispatcher = Dispatchers.IO) = withContext(dispatcher) {
- return@withContext suspendCoroutine { continuation ->
- waitForCompletion()
- if (isFaulted) continuation.resumeWithException(error)
- else continuation.resume(Unit)
+suspend fun Task.suspendRun(dispatcher: CoroutineDispatcher = Dispatchers.IO) =
+ withContext(dispatcher) {
+ return@withContext suspendCoroutine { continuation ->
+ waitForCompletion()
+ if (isFaulted) {
+ continuation.resumeWithException(error)
+ } else {
+ continuation.resume(Unit)
+ }
+ }
}
-}
diff --git a/coroutines/src/main/java/com/parse/coroutines/ParseUserCoroutinesExtensions.kt b/coroutines/src/main/java/com/parse/coroutines/ParseUserCoroutinesExtensions.kt
index 09606e80e..bf8cc0b85 100644
--- a/coroutines/src/main/java/com/parse/coroutines/ParseUserCoroutinesExtensions.kt
+++ b/coroutines/src/main/java/com/parse/coroutines/ParseUserCoroutinesExtensions.kt
@@ -10,17 +10,26 @@ import kotlin.coroutines.suspendCoroutine
suspend fun ParseUser.suspendSignUp(): ParseUser {
return suspendCoroutine { continuation ->
signUpInBackground { e ->
- if (e == null) continuation.resume(this)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(this)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
-suspend fun parseLogIn(username: String, password: String): ParseUser {
+suspend fun parseLogIn(
+ username: String,
+ password: String,
+): ParseUser {
return suspendCoroutine { continuation ->
ParseUser.logInInBackground(username, password) { user, e ->
- if (e == null) continuation.resume(user)
- else continuation.resumeWithException(e)
+ if (e == null) {
+ continuation.resume(user)
+ } else {
+ continuation.resumeWithException(e)
+ }
}
}
}
diff --git a/facebook/build.gradle b/facebook/build.gradle
index 89ed422f8..b4daf4c5e 100644
--- a/facebook/build.gradle
+++ b/facebook/build.gradle
@@ -4,7 +4,8 @@ apply plugin: "io.freefair.android-javadoc-jar"
apply plugin: "io.freefair.android-sources-jar"
android {
- compileSdkVersion rootProject.ext.compileSdkVersion
+ namespace 'com.parse.facebook'
+ compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
@@ -32,6 +33,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+
+ buildFeatures {
+ buildConfig true
+ }
}
dependencies {
@@ -48,7 +53,7 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
- from components.release
+ from components.findByName('release')
}
}
}
diff --git a/facebook/src/main/java/com/parse/facebook/FacebookController.java b/facebook/src/main/java/com/parse/facebook/FacebookController.java
index f353ca4d0..a2fc2a946 100644
--- a/facebook/src/main/java/com/parse/facebook/FacebookController.java
+++ b/facebook/src/main/java/com/parse/facebook/FacebookController.java
@@ -40,6 +40,7 @@ class FacebookController {
// Used as default activityCode. From FacebookSdk.java.
public static final int DEFAULT_AUTH_ACTIVITY_CODE = 0xface;
+
/** Precise date format required for auth expiration data. */
private static final DateFormat PRECISE_DATE_FORMAT =
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US);
diff --git a/fcm/build.gradle b/fcm/build.gradle
index c8542a26b..1ac303e1b 100644
--- a/fcm/build.gradle
+++ b/fcm/build.gradle
@@ -4,7 +4,8 @@ apply plugin: "io.freefair.android-javadoc-jar"
apply plugin: "io.freefair.android-sources-jar"
android {
- compileSdkVersion rootProject.ext.compileSdkVersion
+ namespace 'com.parse.fcm'
+ compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
@@ -33,6 +34,9 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
+ buildFeatures {
+ buildConfig true
+ }
}
dependencies {
@@ -44,7 +48,7 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
- from components.release
+ from components.findByName('release')
}
}
}
diff --git a/google/build.gradle b/google/build.gradle
index b4ab74106..b5fdc26ec 100644
--- a/google/build.gradle
+++ b/google/build.gradle
@@ -5,7 +5,8 @@ apply plugin: "io.freefair.android-javadoc-jar"
apply plugin: "io.freefair.android-sources-jar"
android {
- compileSdkVersion rootProject.ext.compileSdkVersion
+ namespace 'com.parse.google'
+ compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
@@ -37,6 +38,10 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
+
+ buildFeatures {
+ buildConfig true
+ }
}
dependencies {
@@ -51,7 +56,7 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
- from components.release
+ from components.findByName('release')
}
}
}
diff --git a/google/src/main/java/com/parse/google/ParseGoogleUtils.kt b/google/src/main/java/com/parse/google/ParseGoogleUtils.kt
index d9bad72e0..01920d795 100644
--- a/google/src/main/java/com/parse/google/ParseGoogleUtils.kt
+++ b/google/src/main/java/com/parse/google/ParseGoogleUtils.kt
@@ -21,7 +21,6 @@ import com.parse.boltsinternal.TaskCompletionSource
*/
@Suppress("MemberVisibilityCanBePrivate", "unused")
object ParseGoogleUtils {
-
private const val AUTH_TYPE = "google"
private lateinit var clientId: String
@@ -70,7 +69,11 @@ object ParseGoogleUtils {
* }
*/
@JvmStatic
- fun logIn(activity: Activity, launcher: ActivityResultLauncher, callback: LogInCallback) {
+ fun logIn(
+ activity: Activity,
+ launcher: ActivityResultLauncher,
+ callback: LogInCallback,
+ ) {
checkInitialization()
this.currentCallback = callback
val googleSignInClient = buildGoogleSignInClient(activity)
@@ -86,7 +89,10 @@ object ParseGoogleUtils {
* @return true if the result could be handled.
*/
@JvmStatic
- fun onActivityResult(resultCode: Int, data: Intent?): Boolean {
+ fun onActivityResult(
+ resultCode: Int,
+ data: Intent?,
+ ): Boolean {
if (resultCode != Activity.RESULT_OK) {
return false
}
@@ -108,7 +114,10 @@ object ParseGoogleUtils {
* @return A task that will be resolved when linking is complete.
*/
@JvmStatic
- fun unlinkInBackground(user: ParseUser, callback: SaveCallback): Task {
+ fun unlinkInBackground(
+ user: ParseUser,
+ callback: SaveCallback,
+ ): Task {
return callbackOnMainThreadAsync(unlinkInBackground(user), callback, false)
}
@@ -133,7 +142,10 @@ object ParseGoogleUtils {
* @return A task that will be resolved when linking is complete.
*/
@JvmStatic
- fun linkInBackground(user: ParseUser, account: GoogleSignInAccount): Task {
+ fun linkInBackground(
+ user: ParseUser,
+ account: GoogleSignInAccount,
+ ): Task {
return user.linkWithInBackground(AUTH_TYPE, getAuthData(account))
}
@@ -182,21 +194,26 @@ object ParseGoogleUtils {
return authData
}
- private fun onSignInCallbackResult(user: ParseUser?, exception: Exception?) {
- val exceptionToThrow = when (exception) {
- is ParseException -> exception
- null -> null
- else -> ParseException(exception)
- }
+ private fun onSignInCallbackResult(
+ user: ParseUser?,
+ exception: Exception?,
+ ) {
+ val exceptionToThrow =
+ when (exception) {
+ is ParseException -> exception
+ null -> null
+ else -> ParseException(exception)
+ }
currentCallback?.done(user, exceptionToThrow)
}
private fun buildGoogleSignInClient(context: Context): GoogleSignInClient {
- val signInOptions = GoogleSignInOptions.Builder()
- .requestId()
- .requestEmail()
- .requestIdToken(clientId)
- .build()
+ val signInOptions =
+ GoogleSignInOptions.Builder()
+ .requestId()
+ .requestEmail()
+ .requestIdToken(clientId)
+ .build()
return GoogleSignIn.getClient(context, signInOptions)
}
@@ -207,7 +224,7 @@ object ParseGoogleUtils {
private fun callbackOnMainThreadAsync(
task: Task,
callback: SaveCallback,
- reportCancellation: Boolean
+ reportCancellation: Boolean,
): Task {
return callbackOnMainThreadInternalAsync(task, callback, reportCancellation)
}
@@ -220,7 +237,7 @@ object ParseGoogleUtils {
private fun callbackOnMainThreadInternalAsync(
task: Task,
callback: Any?,
- reportCancellation: Boolean
+ reportCancellation: Boolean,
): Task {
if (callback == null) {
return task
@@ -242,7 +259,8 @@ object ParseGoogleUtils {
callback.done(error as? ParseException)
} else if (callback is LogInCallback) {
callback.done(
- task2.result as? ParseUser, error as? ParseException
+ task2.result as? ParseUser,
+ error as? ParseException,
)
}
} finally {
@@ -260,7 +278,7 @@ object ParseGoogleUtils {
}
}
null
- }
+ },
)
return tcs.task
}
diff --git a/gradle.properties b/gradle.properties
index 5582f05c9..756ba2f83 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,4 @@
version = 4.3.0
android.enableJetifier = true
android.useAndroidX = true
+org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index f2026a82a..1baee4355 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Sat Apr 16 09:27:50 CEST 2022
+#Thu Aug 15 20:11:31 GST 2024
distributionBase=GRADLE_USER_HOME
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionPath=wrapper/dists
-zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/ktx/build.gradle b/ktx/build.gradle
index 14b773df4..cf2353f63 100644
--- a/ktx/build.gradle
+++ b/ktx/build.gradle
@@ -5,7 +5,8 @@ apply plugin: "io.freefair.android-javadoc-jar"
apply plugin: "io.freefair.android-sources-jar"
android {
- compileSdkVersion rootProject.ext.compileSdkVersion
+ namespace 'com.parse.ktx'
+ compileSdk rootProject.ext.compileSdkVersion
defaultConfig {
minSdkVersion rootProject.ext.minSdkVersion
@@ -38,6 +39,10 @@ android {
kotlinOptions {
jvmTarget = "1.8"
}
+
+ buildFeatures {
+ buildConfig true
+ }
}
dependencies {
@@ -49,7 +54,7 @@ afterEvaluate {
publishing {
publications {
release(MavenPublication) {
- from components.release
+ from components.findByName('release')
}
}
}
diff --git a/ktx/src/main/java/com/parse/ktx/ParseObject.kt b/ktx/src/main/java/com/parse/ktx/ParseObject.kt
index 61fba1b63..27adae8aa 100644
--- a/ktx/src/main/java/com/parse/ktx/ParseObject.kt
+++ b/ktx/src/main/java/com/parse/ktx/ParseObject.kt
@@ -30,7 +30,10 @@ inline fun ParseObject.getAsOrNull(key: String): T? {
/**
* [ParseObject.put] the value, doing nothing if the value is null
*/
-inline fun ParseObject.putOrIgnore(key: String, value: Any?) {
+inline fun ParseObject.putOrIgnore(
+ key: String,
+ value: Any?,
+) {
if (value != null) {
put(key, value)
}
@@ -39,7 +42,10 @@ inline fun ParseObject.putOrIgnore(key: String, value: Any?) {
/**
* [ParseObject.put] the value, or [ParseObject.remove] it if the value is null
*/
-inline fun ParseObject.putOrRemove(key: String, value: Any?) {
+inline fun ParseObject.putOrRemove(
+ key: String,
+ value: Any?,
+) {
if (value == null) {
remove(key)
} else {
diff --git a/ktx/src/main/java/com/parse/ktx/ParseQuery.kt b/ktx/src/main/java/com/parse/ktx/ParseQuery.kt
index b1242acc9..4ee2e7845 100644
--- a/ktx/src/main/java/com/parse/ktx/ParseQuery.kt
+++ b/ktx/src/main/java/com/parse/ktx/ParseQuery.kt
@@ -1,4 +1,5 @@
@file:Suppress("NOTHING_TO_INLINE", "unused")
+
package com.parse.ktx
import com.parse.ParseException
@@ -76,7 +77,7 @@ fun ParseQuery.selectKeys(keys: Collection>
*/
inline fun ParseQuery.whereContainedIn(
key: KProperty,
- values: Collection
+ values: Collection,
): ParseQuery {
return whereContainedIn(key.name, values)
}
@@ -86,7 +87,7 @@ inline fun ParseQuery.whereContainedIn(
*/
inline fun ParseQuery.whereContains(
key: KProperty,
- substring: String
+ substring: String,
): ParseQuery {
return whereContains(key.name, substring)
}
@@ -96,7 +97,7 @@ inline fun ParseQuery.whereContains(
*/
inline fun ParseQuery.whereContainsAll(
key: KProperty,
- values: Collection
+ values: Collection,
): ParseQuery {
return whereContainsAll(key.name, values)
}
@@ -106,7 +107,7 @@ inline fun ParseQuery.whereContainsAll(
*/
inline fun ParseQuery.whereContainsAllStartsWith(
key: KProperty,
- values: Collection
+ values: Collection,
): ParseQuery {
return whereContainsAllStartsWith(key.name, values)
}
@@ -124,7 +125,7 @@ inline fun ParseQuery.whereDoesNotExist(key: KProperty ParseQuery.whereDoesNotMatchKeyInQuery(
key: KProperty,
keyInQuery: KProperty,
- query: ParseQuery
+ query: ParseQuery,
): ParseQuery {
return whereDoesNotMatchKeyInQuery(key.name, keyInQuery.name, query)
}
@@ -134,7 +135,7 @@ inline fun ParseQuery.whereDoesNotMatchKeyInQuery(
*/
inline fun ParseQuery.whereDoesNotMatchQuery(
key: KProperty,
- query: ParseQuery
+ query: ParseQuery,
): ParseQuery {
return whereDoesNotMatchQuery(key.name, query)
}
@@ -144,7 +145,7 @@ inline fun ParseQuery.whereDoesNotMatchQuery(
*/
inline fun ParseQuery.whereEndsWith(
key: KProperty,
- suffix: String
+ suffix: String,
): ParseQuery {
return whereEndsWith(key.name, suffix)
}
@@ -154,7 +155,7 @@ inline fun ParseQuery.whereEndsWith(
*/
inline fun ParseQuery.whereEqualTo(
key: KProperty,
- value: Any?
+ value: Any?,
): ParseQuery {
return whereEqualTo(key.name, value)
}
@@ -171,7 +172,7 @@ inline fun ParseQuery.whereExists(key: KProperty): Pa
*/
inline fun ParseQuery.whereFullText(
key: KProperty,
- text: String
+ text: String,
): ParseQuery {
return whereFullText(key.name, text)
}
@@ -181,7 +182,7 @@ inline fun ParseQuery.whereFullText(
*/
inline fun ParseQuery.whereGreaterThan(
key: KProperty,
- value: Any
+ value: Any,
): ParseQuery {
return whereGreaterThan(key.name, value)
}
@@ -191,7 +192,7 @@ inline fun ParseQuery.whereGreaterThan(
*/
inline fun ParseQuery.whereGreaterThanOrEqualTo(
key: KProperty,
- value: Any
+ value: Any,
): ParseQuery {
return whereGreaterThanOrEqualTo(key.name, value)
}
@@ -201,7 +202,7 @@ inline fun ParseQuery.whereGreaterThanOrEqualTo(
*/
inline fun ParseQuery.whereLessThan(
key: KProperty,
- value: Any
+ value: Any,
): ParseQuery {
return whereLessThan(key.name, value)
}
@@ -211,7 +212,7 @@ inline fun ParseQuery.whereLessThan(
*/
inline fun ParseQuery.whereLessThanOrEqualTo(
key: KProperty,
- value: Any
+ value: Any,
): ParseQuery {
return whereLessThanOrEqualTo(key.name, value)
}
@@ -221,7 +222,7 @@ inline fun ParseQuery.whereLessThanOrEqualTo(
*/
inline fun ParseQuery.whereMatches(
key: KProperty,
- regex: String
+ regex: String,
): ParseQuery {
return whereMatches(key.name, regex)
}
@@ -232,7 +233,7 @@ inline fun ParseQuery.whereMatches(
inline fun ParseQuery.whereMatches(
key: KProperty,
regex: String,
- modifiers: String
+ modifiers: String,
): ParseQuery {
return whereMatches(key.name, regex, modifiers)
}
@@ -243,7 +244,7 @@ inline fun ParseQuery.whereMatches(
inline fun ParseQuery.whereMatchesKeyInQuery(
key: KProperty,
keyInQuery: KProperty,
- query: ParseQuery
+ query: ParseQuery,
): ParseQuery {
return whereMatchesKeyInQuery(key.name, keyInQuery.name, query)
}
@@ -253,7 +254,7 @@ inline fun ParseQuery.whereMatchesKeyInQuery(
*/
inline fun ParseQuery.whereMatchesQuery(
key: KProperty,
- query: ParseQuery
+ query: ParseQuery,
): ParseQuery {
return whereMatchesQuery(key.name, query)
}
@@ -263,7 +264,7 @@ inline fun ParseQuery.whereMatchesQuery(
*/
inline fun ParseQuery.whereNear(
key: KProperty,
- point: ParseGeoPoint
+ point: ParseGeoPoint,
): ParseQuery {
return whereNear(key.name, point)
}
@@ -273,7 +274,7 @@ inline fun ParseQuery.whereNear(
*/
inline fun ParseQuery.whereNotContainedIn(
key: KProperty,
- values: Collection
+ values: Collection,
): ParseQuery {
return whereNotContainedIn(key.name, values)
}
@@ -283,7 +284,7 @@ inline fun ParseQuery.whereNotContainedIn(
*/
inline fun ParseQuery.whereNotEqualTo(
key: KProperty,
- value: Any?
+ value: Any?,
): ParseQuery {
return whereNotEqualTo(key.name, value)
}
@@ -293,7 +294,7 @@ inline fun ParseQuery.whereNotEqualTo(
*/
inline fun ParseQuery.wherePolygonContains(
key: KProperty,
- point: ParseGeoPoint
+ point: ParseGeoPoint,
): ParseQuery {
return wherePolygonContains(key.name, point)
}
@@ -303,7 +304,7 @@ inline fun ParseQuery.wherePolygonContains(
*/
inline fun ParseQuery.whereStartsWith(
key: KProperty,
- prefix: String
+ prefix: String,
): ParseQuery {
return whereStartsWith(key.name, prefix)
}
@@ -314,7 +315,7 @@ inline fun ParseQuery.whereStartsWith(
inline fun ParseQuery.whereWithinGeoBox(
key: KProperty,
southwest: ParseGeoPoint,
- northeast: ParseGeoPoint
+ northeast: ParseGeoPoint,
): ParseQuery {
return whereWithinGeoBox(key.name, southwest, northeast)
}
@@ -325,7 +326,7 @@ inline fun ParseQuery.whereWithinGeoBox(
inline fun ParseQuery.whereWithinKilometers(
key: KProperty,
point: ParseGeoPoint,
- maxDistance: Double
+ maxDistance: Double,
): ParseQuery {
return whereWithinKilometers(key.name, point, maxDistance)
}
@@ -336,7 +337,7 @@ inline fun ParseQuery.whereWithinKilometers(
inline fun ParseQuery.whereWithinMiles(
key: KProperty,
point: ParseGeoPoint,
- maxDistance: Double
+ maxDistance: Double,
): ParseQuery {
return whereWithinMiles(key.name, point, maxDistance)
}
@@ -346,7 +347,7 @@ inline fun ParseQuery.whereWithinMiles(
*/
inline fun ParseQuery.whereWithinPolygon(
key: KProperty,
- points: List
+ points: List,
): ParseQuery {
return whereWithinPolygon(key.name, points)
}
@@ -356,7 +357,7 @@ inline fun ParseQuery.whereWithinPolygon(
*/
inline fun ParseQuery.whereWithinPolygon(
key: KProperty,
- polygon: ParsePolygon
+ polygon: ParsePolygon,
): ParseQuery {
return whereWithinPolygon(key.name, polygon)
}
@@ -367,7 +368,7 @@ inline fun ParseQuery.whereWithinPolygon(
inline fun ParseQuery.whereWithinRadians(
key: KProperty,
point: ParseGeoPoint,
- maxDistance: Double
+ maxDistance: Double,
): ParseQuery {
return whereWithinRadians(key.name, point, maxDistance)
}
diff --git a/ktx/src/main/java/com/parse/ktx/delegates/BooleanParseDelegate.kt b/ktx/src/main/java/com/parse/ktx/delegates/BooleanParseDelegate.kt
index 04d784548..909562123 100644
--- a/ktx/src/main/java/com/parse/ktx/delegates/BooleanParseDelegate.kt
+++ b/ktx/src/main/java/com/parse/ktx/delegates/BooleanParseDelegate.kt
@@ -9,12 +9,18 @@ import kotlin.reflect.KProperty
* A [Boolean] property delegation for [ParseObject].
*/
class BooleanParseDelegate(private val name: String?) {
-
- operator fun getValue(parseObject: ParseObject, property: KProperty<*>): Boolean {
+ operator fun getValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ ): Boolean {
return parseObject.getBoolean(name ?: property.name)
}
- operator fun setValue(parseObject: ParseObject, property: KProperty<*>, value: Boolean) {
+ operator fun setValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ value: Boolean,
+ ) {
parseObject.put(name ?: property.name, value)
}
}
diff --git a/ktx/src/main/java/com/parse/ktx/delegates/BytesParseDelegate.kt b/ktx/src/main/java/com/parse/ktx/delegates/BytesParseDelegate.kt
index 8e39ed1bc..d5eb474fb 100644
--- a/ktx/src/main/java/com/parse/ktx/delegates/BytesParseDelegate.kt
+++ b/ktx/src/main/java/com/parse/ktx/delegates/BytesParseDelegate.kt
@@ -10,12 +10,18 @@ import kotlin.reflect.KProperty
* A [ByteArray] property delegation for [ParseObject].
*/
class BytesParseDelegate(private val name: String?) {
-
- operator fun getValue(parseObject: ParseObject, property: KProperty<*>): ByteArray? {
+ operator fun getValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ ): ByteArray? {
return parseObject.getBytes(name ?: property.name)
}
- operator fun setValue(parseObject: ParseObject, property: KProperty<*>, value: ByteArray?) {
+ operator fun setValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ value: ByteArray?,
+ ) {
parseObject.putOrIgnore(name ?: property.name, value)
}
}
diff --git a/ktx/src/main/java/com/parse/ktx/delegates/DoubleParseDelegate.kt b/ktx/src/main/java/com/parse/ktx/delegates/DoubleParseDelegate.kt
index 8a79d3a71..bcec820f7 100644
--- a/ktx/src/main/java/com/parse/ktx/delegates/DoubleParseDelegate.kt
+++ b/ktx/src/main/java/com/parse/ktx/delegates/DoubleParseDelegate.kt
@@ -9,12 +9,18 @@ import kotlin.reflect.KProperty
* A [Double] property delegation for [ParseObject].
*/
class DoubleParseDelegate(private val name: String?) {
-
- operator fun getValue(parseObject: ParseObject, property: KProperty<*>): Double {
+ operator fun getValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ ): Double {
return parseObject.getDouble(name ?: property.name)
}
- operator fun setValue(parseObject: ParseObject, property: KProperty<*>, value: Double) {
+ operator fun setValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ value: Double,
+ ) {
parseObject.put(name ?: property.name, value)
}
}
diff --git a/ktx/src/main/java/com/parse/ktx/delegates/EnumParseDelegate.kt b/ktx/src/main/java/com/parse/ktx/delegates/EnumParseDelegate.kt
index 9f45ec6c0..e659615fc 100644
--- a/ktx/src/main/java/com/parse/ktx/delegates/EnumParseDelegate.kt
+++ b/ktx/src/main/java/com/parse/ktx/delegates/EnumParseDelegate.kt
@@ -14,21 +14,27 @@ import kotlin.reflect.KProperty
class EnumParseDelegate>(
private val name: String?,
private val default: T?,
- private val enumClass: Class
+ private val enumClass: Class,
) {
-
- operator fun getValue(parseObject: ParseObject, property: KProperty<*>): T {
+ operator fun getValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ ): T {
return try {
java.lang.Enum.valueOf(
enumClass,
- parseObject.getString(name ?: property.name)!!.uppercase()
+ parseObject.getString(name ?: property.name)!!.uppercase(),
)
} catch (e: Exception) {
default ?: throw e
}
}
- operator fun setValue(parseObject: ParseObject, property: KProperty<*>, t: T) {
+ operator fun setValue(
+ parseObject: ParseObject,
+ property: KProperty<*>,
+ t: T,
+ ) {
parseObject.put(name ?: property.name, t.name.lowercase())
}
}
@@ -37,12 +43,13 @@ class EnumParseDelegate>(
* Returns a [Enum] property delegate for [ParseObject]s. This uses custom implementation for get
* to retrieve a local version of the your enum and [ParseObject.put].
*/
-inline fun > enumAttribute(default: T? = null) =
- EnumParseDelegate(null, default, T::class.java)
+inline fun > enumAttribute(default: T? = null) = EnumParseDelegate(null, default, T::class.java)
/**
* Returns a [Enum] property delegate for [ParseObject]s. This uses custom implementation for get
* to retrieve a local version of the your enum and [ParseObject.put].
*/
-inline fun > enumAttribute(name: String? = null, default: T? = null) =
- EnumParseDelegate(name, default, T::class.java)
+inline fun