Skip to content

Commit

Permalink
2.0.6 (#19)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Turskyi authored Dec 10, 2022
1 parent 78f8611 commit fc7535a
Show file tree
Hide file tree
Showing 24 changed files with 108 additions and 84 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ after every push to the **dev** branch,
release app bundle to **Google Play** after every push to **master** branch;

• Architectural pattern: [MVVM](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel)
wrapped with
and
[Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html);

• Architecture Components:
Expand All @@ -37,16 +37,16 @@ wrapped with

• Database: [Firestore](https://firebase.google.com/docs/firestore);

• Dependency injection: [Koin](https://insert-koin.io/docs/reference/introduction);

• Asynchronous programming: [Coroutines](https://developer.android.com/kotlin/coroutines);

• Object storage service: [Cloud Storage for Firebase](https://firebase.google.com/docs/storage);

• Authentication: [FirebaseUI for Auth](https://firebase.google.com/docs/auth/android/firebaseui);

• Cloud services: [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging);

• Dependency injection: [Koin](https://insert-koin.io/docs/reference/introduction);

• Asynchronous programming: [Coroutines](https://developer.android.com/kotlin/coroutines);

• HTTP client: [Retrofit](https://square.github.io/retrofit/);

• Google Play services: [Location](https://developer.android.com/training/location);
Expand Down
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@
buildscript {
ext {
// sdk versions
compile_sdk_version = 32
compile_sdk_version = 33
build_tools_version = "30.0.3"
min_sdk_version = 21
target_sdk_version = 32
target_sdk_version = 33
// last version is here [https://play.google.com/console/u/0/developers/6867856033872987263/app/4972072127034375090/releases/overview]
version_code = 18
version_name = "2.0.5"
version_code = 19
version_name = "2.0.6"
}
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Google Services plugin (used with firebase)
classpath "com.google.gms:google-services:$google_services_version"
Expand Down
4 changes: 2 additions & 2 deletions data/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ dependencies {
implementation project(':domain')

// Koin for Android
api ("io.insert-koin:koin-android:$insert_koin_version")
api("io.insert-koin:koin-android:$koin_android_version")
// Koin core features
api ("io.insert-koin:koin-core:$insert_koin_version")
api("io.insert-koin:koin-core:$koin_core_version")

// network
api "com.squareup.okhttp3:okhttp:$okhttp_version"
Expand Down
2 changes: 1 addition & 1 deletion di/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dependencies {
implementation project(path: ':data')

// Koin core features
api "io.insert-koin:koin-core:$insert_koin_version"
api "io.insert-koin:koin-core:$koin_core_version"

// test
testImplementation "junit:junit:$junit_version"
Expand Down
2 changes: 1 addition & 1 deletion domain/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ java {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// Koin core features
api "io.insert-koin:koin-core:$insert_koin_version"
api "io.insert-koin:koin-core:$koin_core_version"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.turskyi.domain.models

@Suppress("unused")
sealed class Result<out T : Any> {

data class Success<out T : Any>(val data: T? = null, val responseCode: Int? = null) :
Expand Down
23 changes: 12 additions & 11 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,25 @@ android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# global dependency versions
activity_version=1.6.1
appcompat_version=1.5.1
multidexVersion=2.0.1
insert_koin_version=3.2.0
koin_android_version=3.3.0
koin_core_version=3.2.2
coroutines_version=1.4.0
kotlin_version=1.7.10
kotlin_version=1.7.20
retrofit_version=2.9.0
paging_version=2.1.2
appcompat_version=1.5.0
material_version=1.6.1
fragment_version=1.5.2
activity_version=1.5.1
material_version=1.7.0
fragment_version=1.5.4
okhttp_version=4.9.3
junit_version=4.13.2
ext_junit_version=1.1.3
espresso_version=3.4.0
gson_version=2.9.1
jwt_version=4.0.0
ext_junit_version=1.1.4
espresso_version=3.5.0
gson_version=2.10
jwt_version=4.2.1
firebase_bom_version=28.3.0
firebase_ui_auth_version=8.0.1
firebase_ui_auth_version=8.0.2
play_services_basement_version=17.6.0
firebase_crashlytics_gradle_version=2.7.0
firebase_perf_version=1.4.1
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
28 changes: 14 additions & 14 deletions presentation/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//noinspection UnusedResources
//file:noinspection GrUnresolvedAccess
plugins {
id 'com.android.application'
Expand All @@ -21,9 +22,8 @@ android {
versionName rootProject.version_name

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

// to ensure that the translations of Firebase library are relevant to the application
resConfigs "en"
resConfigs 'en'
}
signingConfigs {
production {
Expand Down Expand Up @@ -85,11 +85,11 @@ dependencies {

// android
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.core:core-ktx:1.9.0'

// firebase
implementation 'com.google.firebase:firebase-crashlytics:18.2.12'
implementation('com.google.firebase:firebase-analytics:21.1.0') {
implementation 'com.google.firebase:firebase-crashlytics:18.3.2'
implementation('com.google.firebase:firebase-analytics:21.2.0') {
// remove advertising dependency
exclude module: "play-services-ads-identifier"
exclude module: "play-services-measurement"
Expand All @@ -98,13 +98,13 @@ dependencies {
// To show authentication page with pre-implemented authentication
implementation "com.firebaseui:firebase-ui-auth:$firebase_ui_auth_version"
// performance tracing
implementation 'com.google.firebase:firebase-perf:20.1.0'
implementation 'com.google.firebase:firebase-perf:20.3.0'
// to send notifications across devices from firebase console
implementation 'com.google.firebase:firebase-messaging:23.0.7'
implementation 'com.google.android.gms:play-services-cast-framework:21.1.0'
implementation 'com.google.firebase:firebase-messaging:23.1.0'
implementation 'com.google.android.gms:play-services-cast-framework:21.2.0'

// Glide (Image caching and management)
def glideVersion = "4.13.2"
def glideVersion = "4.14.2"
kapt "com.github.bumptech.glide:compiler:$glideVersion"
implementation "com.github.bumptech.glide:glide:$glideVersion"

Expand Down Expand Up @@ -137,10 +137,10 @@ dependencies {
implementation 'com.github.chrisbanes:PhotoView:2.3.0'

// Location
implementation "com.google.android.gms:play-services-location:20.0.0"
implementation "com.google.android.gms:play-services-location:21.0.1"

// Facebook SDK
def facebookVersion = "14.1.0"
def facebookVersion = "15.1.0"
implementation "com.facebook.android:facebook-android-sdk:$facebookVersion"
implementation "com.facebook.android:facebook-share:$facebookVersion"
implementation "com.facebook.android:facebook-applinks:$facebookVersion"
Expand All @@ -151,17 +151,17 @@ dependencies {
implementation "com.airbnb.android:lottie:$lottieVersion"

// Koin for Android
implementation("io.insert-koin:koin-android:$insert_koin_version")
implementation("io.insert-koin:koin-android:$koin_android_version")

// Koin core features
implementation("io.insert-koin:koin-core:$insert_koin_version")
implementation("io.insert-koin:koin-core:$koin_core_version")

// test
testImplementation "junit:junit:$junit_version"
androidTestImplementation "androidx.test.ext:junit:$ext_junit_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"

def jupiter_version = "5.9.0"
def jupiter_version = "5.9.1"
testImplementation "org.junit.jupiter:junit-jupiter-api:$jupiter_version"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$jupiter_version"
}
1 change: 0 additions & 1 deletion presentation/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission
android:name="com.google.android.gms.permission.AD_ID"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.github.turskyi.travellingpro.features.flags.view.fragments

import android.content.Context
import android.graphics.Color.TRANSPARENT
import android.graphics.drawable.Drawable
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
Expand All @@ -10,7 +11,12 @@ import android.view.View
import android.view.View.*
import android.view.ViewGroup
import android.webkit.WebViewClient
import androidx.core.content.res.ResourcesCompat
import androidx.fragment.app.Fragment
import com.bumptech.glide.Priority
import com.bumptech.glide.RequestBuilder
import com.bumptech.glide.request.RequestOptions
import com.github.twocoffeesoneteam.glidetovectoryou.GlideApp
import com.github.twocoffeesoneteam.glidetovectoryou.GlideToVectorYou
import com.github.twocoffeesoneteam.glidetovectoryou.GlideToVectorYouListener
import io.github.turskyi.travellingpro.R
Expand Down Expand Up @@ -108,9 +114,19 @@ open class BaseFlagFragment : Fragment() {
ivEnlargedFlag.visibility = VISIBLE
wvFlag.visibility = GONE
}
com.github.twocoffeesoneteam.glidetovectoryou.GlideApp.with(this@BaseFlagFragment)
val thumbnailBuilder: RequestBuilder<Drawable> =
GlideApp.with(binding.ivEnlargedFlag.context)
.asDrawable()
.sizeMultiplier(ResourcesCompat.getFloat(resources, R.dimen.thumbnail))
GlideApp.with(this@BaseFlagFragment)
.load(countries[position].selfie)
.placeholder(R.drawable.anim_loading)
.thumbnail(thumbnailBuilder)
.apply(
RequestOptions()
.placeholder(R.drawable.anim_loading)
.error(R.drawable.ic_broken_image)
.priority(Priority.IMMEDIATE)
)
.into(binding.ivEnlargedFlag)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,16 @@ class FlagFragment : BaseFlagFragment() {
}
}
viewModel.visibilityLoader.observe(this) { currentVisibility: Int ->
flagsActivityViewListener!!.setLoaderVisibility(currentVisibility)
if (flagsActivityViewListener != null) {
flagsActivityViewListener!!.setLoaderVisibility(currentVisibility)
}
}
val visitedCountriesObserver: Observer<List<VisitedCountry>> =
Observer<List<VisitedCountry>> { countries: List<VisitedCountry> ->
val position: Int = this.requireArguments().getInt(EXTRA_POSITION)
mChangeFlagListener!!.onChangeToolbarTitle(countries[position].title)
if (mChangeFlagListener != null) {
mChangeFlagListener!!.onChangeToolbarTitle(countries[position].title)
}
if (countries[position].selfie.isEmpty()) {
showTheFlag(countries, position)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class FlagsFragmentViewModel(private val interactor: CountriesInteractor) : View

override fun onStateChanged(source: LifecycleOwner, event: Lifecycle.Event) {
if (event == Lifecycle.Event.ON_CREATE) {
getVisitedCountries()
setVisitedCountries()
}
}

Expand Down Expand Up @@ -59,7 +59,7 @@ class FlagsFragmentViewModel(private val interactor: CountriesInteractor) : View
}
}

private fun getVisitedCountries() {
private fun setVisitedCountries() {
viewModelScope.launch {
interactor.setVisitedCountries(
onSuccess = { countries: List<VisitedCountryModel> ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class AddCityDialogFragment : DialogFragment() {
} else if (!isOnline()) {
toastLong(R.string.dialog_no_internet)
} else {
addCityTo(etCity)
insertCityIntoAnEmptyField(etCity)
}
}

Expand Down Expand Up @@ -179,7 +179,7 @@ class AddCityDialogFragment : DialogFragment() {
) {
if (requestCode == resources.getInteger(R.integer.location_access_request_code)) {
if (grantResults.first() == PackageManager.PERMISSION_GRANTED) {
addCityTo(etCity)
insertCityIntoAnEmptyField(etCity)
} else {
toast(R.string.msg_gps_permission_denied)
}
Expand Down Expand Up @@ -224,18 +224,21 @@ class AddCityDialogFragment : DialogFragment() {
}
}

private fun addCityTo(editText: LinedEditText) {
private fun insertCityIntoAnEmptyField(editText: LinedEditText) {
checkPermission(
onPermissionGranted = {
@SuppressLint("MissingPermission")
val findLastLocationTask: Task<Location> = fusedLocationClient.lastLocation
findLastLocationTask.addOnSuccessListener { location: Location? ->
if (location != null) {
addLastLocation(location, editText)
setCityName(location, editText)
} else {
toastLong(R.string.dialog_hold_on)
addChangedLocation(editText)
}
}.addOnFailureListener { exception: java.lang.Exception ->
toastLong(exception.localizedMessage ?: exception.stackTraceToString())
addChangedLocation(editText)
}
},
)
Expand All @@ -245,17 +248,7 @@ class AddCityDialogFragment : DialogFragment() {
private fun addChangedLocation(editText: LinedEditText) {
try {
val locationListener: LocationListener = object : LocationListener {
override fun onLocationChanged(location: Location) {
val geoCoder = Geocoder(requireContext(), Locale.getDefault())
val addressesChanged: MutableList<Address>? = geoCoder.getFromLocation(
location.latitude,
location.longitude, 1
)

val cityChanged: String? = addressesChanged?.first()?.locality
editText.setText(cityChanged)
}

override fun onLocationChanged(location: Location) = setCityName(location, editText)
override fun onProviderEnabled(provider: String) {}
override fun onProviderDisabled(provider: String) {}
}
Expand All @@ -275,18 +268,20 @@ class AddCityDialogFragment : DialogFragment() {
}
}

private fun addLastLocation(
private fun setCityName(
location: Location,
editText: LinedEditText
) {
val geoCoder = Geocoder(requireContext(), Locale.getDefault())
try {
val addresses: MutableList<Address> = geoCoder.getFromLocation(
@Suppress("DEPRECATION")
val addresses: MutableList<Address>? = geoCoder.getFromLocation(
location.latitude,
location.longitude, 1
location.longitude,
1,
)

val cityName: String = addresses.first().locality
val cityName: String? = addresses?.first()?.locality
editText.setText(cityName)
} catch (exception: IOException) {
toastLong(exception.localizedMessage ?: exception.stackTraceToString())
Expand Down
Loading

0 comments on commit fc7535a

Please sign in to comment.