From 4a98a93cc0f94f4dfe0f7228b115161345fa41f3 Mon Sep 17 00:00:00 2001 From: Dmytro Turskyi Date: Fri, 19 Jul 2024 22:39:49 -0400 Subject: [PATCH] Update API level to target Android 14 (API level 34). (#26) * changed home background * add datastore to save if user signed in * add ExpandableSearchBar.kt to TravellersActivity.kt * fix fab on travellers activity * Fix uploading photo to firestore and set sdk_version = 32 * update CI/CD * update CI/CD * update gradle and README.md * update gradle and dependencies * remove deprecated on back pressed and replaced with a new approach * remove deprecated on back pressed and replaced with a new approach * replaced deprecated getParcelable and getPackageInfo methods * upgraded koin and okhttp version * upgraded firebase_bom_version * Fix updating the the number of visited countries * upgrade koin version * add org.gradle.unsafe.configuration-cache-problems=warn * increment version to 2.0.8(21) * increment java version to 17 in ci/cd * Update dependencies * Add onion architecture pattern to README.md * Add link on the original documentation of the onion architecture in the README.md * Add link to app center build * Move di component to presentation component and allow admin to see all users * increment version to 2.1.0 (23) * :sparkles: chore(README): update build status badge and add Google Play badge - Update build status badge in README.md - Add Google Play badge to README.md - Update build.gradle to version 2.1.1 - Update Gradle wrapper distributionUrl to version 8.2-all.zip - Refactor FirestoreDatabaseSourceImpl.kt for better readability - Update GitHub Actions workflow to ignore master branch for pushes Signed-off-by: Dmytro Turskyi * :rocket: chore(android_ci): Update JDK version to 17 and fix capitalization in workflow steps Updated the JDK version to 17 in the workflow setup and corrected capitalization in the steps for generating and uploading the release APK. Also added the serviceCredentialsFile for Firebase App Distribution. Signed-off-by: Dmytro Turskyi * Attempt to fix CI Signed-off-by: Dmytro Turskyi * Attempt to fix ci Signed-off-by: Dmytro Turskyi --------- Signed-off-by: Dmytro Turskyi --- .github/workflows/android_ci.yml | 18 ++++----- README.md | 31 +++++++++------ build.gradle | 10 ++--- .../firestore/FirestoreDatabaseSourceImpl.kt | 38 +++++++++++-------- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 57 insertions(+), 42 deletions(-) diff --git a/.github/workflows/android_ci.yml b/.github/workflows/android_ci.yml index 6421efe..c031558 100644 --- a/.github/workflows/android_ci.yml +++ b/.github/workflows/android_ci.yml @@ -2,8 +2,8 @@ name: Build & upload to Firebase App Distribution on: push: - branches: - - dev + branches-ignore: + - master jobs: build: @@ -12,19 +12,17 @@ jobs: steps: - uses: actions/checkout@v2.3.3 - - - name: Set up JDK environment(JDK 11) - uses: actions/setup-java@v1.4.3 + - name: Set up JDK environment (JDK 17) + uses: actions/setup-java@v2 with: - java-version: 17 - + java-version: '17' + distribution: 'temurin' # Eclipse Temurin https://adoptium.net/ - name: Generate Release APK run: ./gradlew assembleRelease - - - name: upload artifact to Firebase App Distribution + - name: Upload artifact to Firebase App Distribution uses: wzieba/Firebase-Distribution-Github-Action@v1 with: - appId: ${{secrets.FIREBASE_ANDROID_APPID}} + appId: ${{ secrets.FIREBASE_ANDROID_APPID }} token: ${{secrets.FIREBASE_TOKEN}} groups: testers releaseNotes: "Travelling Pro App Build" diff --git a/README.md b/README.md index a498029..1dc67ca 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua) +[![Build status](https://build.appcenter.ms/v0.1/apps/add3e42d-20e7-466d-9300-e42abf3e6b76/branches/master/badge)](https://appcenter.ms) +[![Build & upload to Firebase App Distribution](https://github.com/Turskyi/travelling_pro/actions/workflows/android_ci.yml/badge.svg?event=push)](https://github.com/Turskyi/travelling_pro/actions/workflows/android_ci.yml) +GitHub commit activity -# Travelling Pro [![Build status](https://build.appcenter.ms/v0.1/apps/add3e42d-20e7-466d-9300-e42abf3e6b76/branches/master/badge)](https://appcenter.ms) +# Travelling Pro An Android mobile application to help collect all countries that you have visited and see how many countries visited other members of the app. @@ -79,17 +82,23 @@ release app bundle to **Google Play** after every push to **master** branch; • Screenshots: - - - - - - - - - - +screenshot +screenshot +screenshot +screenshot +screenshot +screenshot +screenshot +screenshot +screenshot +screenshot • **Code Readability:** code is easily readable with no unnecessary blank lines, no unused variables or methods, and no commented-out code, all variables, methods, and resource IDs are descriptively named such that another developer reading the code can easily understand their function. + +## Download + + +google play badge + diff --git a/build.gradle b/build.gradle index ce33950..42eab0c 100644 --- a/build.gradle +++ b/build.gradle @@ -4,14 +4,14 @@ buildscript { ext { // sdk versions - compile_sdk_version = 33 + compile_sdk_version = 34 skd_preview = "UpsideDownCake" build_tools_version = "30.0.3" min_sdk_version = 21 - target_sdk_version = 33 + target_sdk_version = 34 // last version is here [https://play.google.com/console/u/0/developers/6867856033872987263/app/4972072127034375090/releases/overview] - version_code = 23 - version_name = "2.1.0" + version_code = 24 + version_name = "2.1.1" } repositories { google() @@ -19,7 +19,7 @@ buildscript { maven { url "https://jitpack.io" } } dependencies { - classpath 'com.android.tools.build:gradle:8.0.2' + classpath 'com.android.tools.build:gradle:8.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.21" // Google Services plugin (used with firebase) classpath "com.google.gms:google-services:$google_services_version" diff --git a/data/src/main/java/io/github/turskyi/data/datasources/local/firestore/FirestoreDatabaseSourceImpl.kt b/data/src/main/java/io/github/turskyi/data/datasources/local/firestore/FirestoreDatabaseSourceImpl.kt index 42098d0..e6f59ea 100644 --- a/data/src/main/java/io/github/turskyi/data/datasources/local/firestore/FirestoreDatabaseSourceImpl.kt +++ b/data/src/main/java/io/github/turskyi/data/datasources/local/firestore/FirestoreDatabaseSourceImpl.kt @@ -1011,21 +1011,29 @@ class FirestoreDatabaseSourceImpl( visitedCountriesRef.get() .addOnSuccessListener { queryDocumentSnapshots: QuerySnapshot -> val countOfVisitedCountries: Int = queryDocumentSnapshots.size() - // getting total number of all users - usersRef.get().addOnSuccessListener { snapshots: QuerySnapshot -> - val userCount: Int = snapshots.size() - // getting number of users with bigger counter - usersRef.whereGreaterThan(KEY_COUNTER, countOfVisitedCountries).get() - .addOnSuccessListener { documents: QuerySnapshot -> - val countOfTopTravellers: Int = documents.size() - /* getting percent of travellers who visited more countries - * than current user */ - onSuccess(countOfTopTravellers * 100 / userCount) - }.addOnFailureListener { exception: java.lang.Exception -> - onError.invoke(exception) - } - }.addOnFailureListener { exception: java.lang.Exception -> - onError.invoke(exception) + if (countOfVisitedCountries == 0) { + onSuccess(100) + } else { + // getting total number of all users + usersRef.get().addOnSuccessListener { snapshots: QuerySnapshot -> + val userCount: Int = snapshots.size() + // getting number of users with bigger counter + usersRef.whereGreaterThan(KEY_COUNTER, countOfVisitedCountries).get() + .addOnSuccessListener { documents: QuerySnapshot -> + if (userCount == 0) { + onSuccess(100) + } else { + val countOfTopTravellers: Int = documents.size() + /* getting percent of travellers who visited more countries + * than current user */ + onSuccess(countOfTopTravellers * 100 / userCount) + } + }.addOnFailureListener { exception: java.lang.Exception -> + onError.invoke(exception) + } + }.addOnFailureListener { exception: java.lang.Exception -> + onError.invoke(exception) + } } }.addOnFailureListener { exception: java.lang.Exception -> onError.invoke(exception) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5dc1839..6e0f463 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip