Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'org.sonarqube'
// TODO: Uncomment this to enable Firebase Crashlytics
// apply plugin: 'com.google.firebase.crashlytics'
apply plugin: 'com.google.firebase.crashlytics'

static def getKey(String env, String key) {
Properties props = new Properties()
Expand All @@ -24,8 +24,8 @@ android {
applicationId "ro.code4.monitorizarevot"
minSdkVersion 21
targetSdkVersion 33
versionCode 42
versionName "2.1.1"
versionCode 49
versionName "2.1.8"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true

Expand Down Expand Up @@ -105,10 +105,10 @@ ext {
koinVersion = '2.0.1'
parcelerVersion = "1.1.13"
roomVersion = '2.4.3'
firebaseAnalyticsVersion = '17.4.3'
firebaseCrashlyticsVersion = '17.1.0'
firebaseMessagingVersion = "20.2.0"
firebaseConfigVersion = "19.1.4"
firebaseAnalyticsVersion = '21.3.0'
firebaseCrashlyticsVersion = '18.4.3'
firebaseMessagingVersion = "23.2.1"
firebaseConfigVersion = "21.4.1"
adapterDelegatesVersion = "4.2.0"
}

Expand Down Expand Up @@ -185,4 +185,4 @@ sonarqube {
}

// TODO: Uncomment this to enable FirebaseAnalytics and Crashlytics
//apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.gms.google-services'
2 changes: 2 additions & 0 deletions app/src/main/java/ro/code4/monitorizarevot/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ro.code4.monitorizarevot

import android.app.Application
import android.content.Context
import com.google.firebase.FirebaseApp
import com.sylversky.fontreplacer.FontReplacer
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
Expand All @@ -26,6 +27,7 @@ class App : Application() {
modules(listOf(appModule, apiModule, dbModule, viewModelsModule, analyticsModule))
}
replaceFonts()
FirebaseApp.initializeApp(this);
}

private fun replaceFonts() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ fun SharedPreferences.clearUserPrefs() = run {

private fun SharedPreferences.removeCurrentLocationPrefs() {
val editor = edit()
editor.remove(PREFS_PROVINCE_CODE)
editor.remove(PREFS_COUNTY_CODE)
editor.remove(PREFS_MUNICIPALITY_CODE)
editor.remove(PREFS_POLLING_STATION_NUMBER)
editor.apply()
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ abstract class BaseFormViewModel : BaseViewModel() {
fun setTitle(title: String) = titleLiveData.postValue(title)

init {
provinceCode = preferences.getProvinceCode()!!
countyCode = preferences.getCountyCode()!!
municipalityCode = preferences.getMunicipalityCode()!!
provinceCode = preferences.getProvinceCode().orEmpty()
countyCode = preferences.getCountyCode().orEmpty()
municipalityCode = preferences.getMunicipalityCode().orEmpty()
pollingStationNumber = preferences.getPollingStationNumber()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.os.Bundle
import android.text.TextWatcher
import androidx.lifecycle.Observer
import com.google.android.material.snackbar.Snackbar
import com.google.firebase.FirebaseApp
import kotlinx.android.synthetic.main.activity_login.*
import org.koin.android.viewmodel.ext.android.viewModel
import ro.code4.monitorizarevot.BuildConfig
Expand Down Expand Up @@ -68,6 +69,7 @@ class LoginActivity : BaseAnalyticsActivity<LoginViewModel>() {
}

loginButton.isEnabled = false
FirebaseApp.initializeApp(this);
viewModel.login(phone.text.toString(), password.text.toString())
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package ro.code4.monitorizarevot.ui.login
import android.content.SharedPreferences
import androidx.lifecycle.LiveData
import com.google.firebase.analytics.FirebaseAnalytics
import com.google.firebase.iid.FirebaseInstanceId
import com.google.firebase.messaging.FirebaseMessaging
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import org.koin.core.inject
Expand Down Expand Up @@ -46,8 +46,8 @@ class LoginViewModel : BaseViewModel() {

private fun getFirebaseToken(phone: String, password: String) {
try {
FirebaseInstanceId.getInstance().instanceId.addOnCompleteListener {
val firebaseToken = it.result?.token
FirebaseMessaging.getInstance().token.addOnCompleteListener {
val firebaseToken = it.result
if (it.isSuccessful && firebaseToken != null) {
login(phone, password, firebaseToken)
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values-pl-rPL/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@

<string name="sync_info">Wygląda na to, że część pytań nie udało się zsynchronizować.naciśnij przycisk niżej, by wysłać wiadomości ponownie</string>
<string name="sync_info_success">Wszystkie odpowiedzi i notatki zostały zsynchronizowane</string>
<string name="sync_manual">Wymuś cję</string>
<string name="sync_manual">Wymuś synchronizację</string>

<string name="form_sync_no_internet">Musisz mieć połączenie z internetem, żeby móc zsynchronizować dane!</string>

Expand Down