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