Update a bunch of libraries.

- Updated a bunch of libraries, fixed a couple of issues, and tested everything else worked correctly.
- Updated both compileSdkVersion and targetSdkVersion to 29 (Android 10).
master
Severiano Jaramillo 2019-09-10 18:33:49 -05:00
parent 97e7167e17
commit f6d00053db
7 changed files with 36 additions and 26 deletions

View File

@ -12,11 +12,11 @@ androidExtensions {
}
android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "cy.agorise.bitsybitshareswallet"
minSdkVersion 21
targetSdkVersion 28
targetSdkVersion 29
versionCode 9
versionName "0.13.1-beta"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@ -55,6 +55,9 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
// Gradle automatically adds 'android.test.runner' as a dependency.
useLibrary 'android.test.runner'
useLibrary 'android.test.base'
@ -65,16 +68,16 @@ android {
dependencies {
def lifecycle_version = "2.1.0"
def room_version = "2.1.0"
def rx_bindings_version = "3.0.0-alpha2"
def rx_bindings_version = '3.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':graphenejlib:graphenej')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
// AndroidX
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
// Google
implementation 'com.google.zxing:core:3.3.3'
implementation 'com.google.zxing:core:3.4.0'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.google.android.material:material:1.1.0-alpha04'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
@ -99,13 +102,13 @@ dependencies {
implementation "com.jakewharton.rxbinding3:rxbinding-material:$rx_bindings_version" // Material Components widgets
implementation "com.jakewharton.rxbinding3:rxbinding-appcompat:$rx_bindings_version" // AndroidX appcompat widgets
// Retrofit & OkHttp
implementation 'com.squareup.okhttp3:okhttp:3.12.2'
implementation 'com.squareup.retrofit2:retrofit:2.6.0'
implementation 'com.squareup.retrofit2:converter-gson:2.6.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.12.2'
implementation 'com.squareup.okhttp3:okhttp:4.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.6.1'
implementation 'com.squareup.retrofit2:converter-gson:2.6.1'
implementation 'com.squareup.okhttp3:logging-interceptor:4.2.0'
implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
//Firebase
implementation 'com.google.firebase:firebase-core:17.1.0'
implementation 'com.google.firebase:firebase-core:17.2.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
// PDF and CSV generation
implementation 'com.itextpdf:itextpdf:5.5.13'

View File

@ -275,10 +275,10 @@ class CreateAccountFragment : BaseAccountFragment() {
val sg = ServiceGenerator(Constants.FAUCET_URL)
val faucetService = sg.getService(FaucetService::class.java)
val call = faucetService.registerPrivateAccount(faucetRequest)
val call = faucetService?.registerPrivateAccount(faucetRequest)
// Execute the call asynchronously. Get a positive or negative callback.
call.enqueue(object : Callback<FaucetResponse> {
call?.enqueue(object : Callback<FaucetResponse> {
override fun onResponse(call: Call<FaucetResponse>, response: Response<FaucetResponse>) {
// The network call was a success and we got a response, obtain the info of the newly created account
// with a delay to let the nodes update their information

View File

@ -21,7 +21,11 @@ class ServiceGenerator private constructor(apiBaseUrl: String, gson: Gson) {
private val services = HashMap<Class<*>, Any>()
init {
val logging = HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)
val httpLoggingInterceptor = HttpLoggingInterceptor()
val logging =
httpLoggingInterceptor.apply {
httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY
}
httpClient = OkHttpClient.Builder().addInterceptor(logging)
builder = Retrofit.Builder()
.baseUrl(apiBaseUrl)
@ -31,7 +35,7 @@ class ServiceGenerator private constructor(apiBaseUrl: String, gson: Gson) {
constructor(apiBaseUrl: String) : this(apiBaseUrl, Gson())
fun <T> getService(serviceClass: Class<T>): T {
fun <T> getService(serviceClass: Class<T>): T? {
var service = serviceClass.cast(services[serviceClass])
if (service == null) {

View File

@ -33,7 +33,7 @@ class NodeRepository(private val nodeDao: NodeDao) {
"wss://api.bts.ai")
}
private val mBitsyWebservice: BitsyWebservice
private val mBitsyWebservice: BitsyWebservice?
init {
val sg = ServiceGenerator(Constants.BITSY_WEBSERVICE_URL)
@ -86,10 +86,10 @@ class NodeRepository(private val nodeDao: NodeDao) {
val updatePeriod = Constants.NODES_UPDATE_PERIOD
// Verify if nodes list should be updated
if (now - updatePeriod > lastUpdate) {
val response = mBitsyWebservice.getNodes()
val response = mBitsyWebservice?.getNodes()
try {
// Update the list of nodes only if we got at least MIN_NODES_SIZE nodes
if (response.isSuccessful && (response.body()?.size ?: 0) >= MIN_NODES_SIZE) {
if (response?.isSuccessful == true && (response.body()?.size ?: 0) >= MIN_NODES_SIZE) {
val nodesWS = response.body() ?: return
val nodesDB = nodesWS.map {

View File

@ -19,7 +19,10 @@ import java.text.SimpleDateFormat
import java.util.*
class TransferRepository internal constructor(context: Context) {
private val TAG = "TransferRepository"
companion object {
private const val TAG = "TransferRepository"
}
private val mTransferDao: TransferDao
private val mEquivalentValuesDao: EquivalentValueDao
private val compositeDisposable = CompositeDisposable()
@ -103,10 +106,10 @@ class TransferRepository internal constructor(context: Context) {
val dateFormat = SimpleDateFormat("dd-MM-yyyy", Locale.ROOT)
val date = Date(transfer.timestamp * 1000)
val response = sg.getService(CoingeckoService::class.java)
.getHistoricalValueSync("bitshares", dateFormat.format(date), false)
.execute()
?.getHistoricalValueSync("bitshares", dateFormat.format(date), false)
?.execute()
var equivalentFiatValue = -1L
if(response.isSuccessful){
if(response?.isSuccessful == true){
val price: Double = response.body()?.market_data?.current_price?.get(symbol) ?: -1.0
// The equivalent value is obtained by:
// 1- Dividing the base value by 100000 (BTS native precision)
@ -114,7 +117,7 @@ class TransferRepository internal constructor(context: Context) {
// 3- Multiplying the resulting value by 100 in order to express it in cents
equivalentFiatValue = Math.round(transfer.btsValue?.div(1e5)?.times(price)?.times(100) ?: -1.0)
}else{
Log.w(TAG,"Request was not successful. code: ${response.code()}")
Log.w(TAG,"Request was not successful. code: ${response?.code()}")
}
return EquivalentValue(transfer.id, equivalentFiatValue, symbol)
}

View File

@ -15,7 +15,7 @@ import cy.agorise.bitsybitshareswallet.utils.hideKeyboard
*/
class MyTextInputEditText(context: Context?, attrs: AttributeSet?) : TextInputEditText(context, attrs){
override fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection {
override fun onCreateInputConnection(outAttrs: EditorInfo): InputConnection? {
val connection = super.onCreateInputConnection(outAttrs)
val imeActions = outAttrs.imeOptions and EditorInfo.IME_MASK_ACTION
if (imeActions and EditorInfo.IME_ACTION_DONE != 0) {

View File

@ -4,8 +4,8 @@ buildscript {
ext {
kotlin_version = '1.3.50'
nav_version = '2.0.0'
version_coroutine = "1.1.0"
nav_version = '2.1.0'
version_coroutine = '1.3.1'
}
repositories {
@ -20,7 +20,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$nav_version"
classpath 'com.google.gms:google-services:4.3.0'
classpath 'com.google.gms:google-services:4.3.2'
classpath 'io.fabric.tools:gradle:1.29.0'
// NOTE: Do not place your application dependencies here; they belong