Bump targetSdk and compileSdk to 30.
This commit is contained in:
parent
f302c1346f
commit
ec54ed0620
7 changed files with 30 additions and 28 deletions
|
@ -7,11 +7,12 @@ apply plugin: 'com.google.gms.google-services'
|
|||
apply plugin: 'com.google.firebase.crashlytics'
|
||||
|
||||
android {
|
||||
compileSdkVersion 29
|
||||
compileSdk 30
|
||||
|
||||
defaultConfig {
|
||||
applicationId "cy.agorise.bitsybitshareswallet"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
minSdk 21
|
||||
targetSdk 30
|
||||
versionCode 15
|
||||
versionName "0.17.2-beta"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
|
@ -55,10 +56,6 @@ android {
|
|||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
// Gradle automatically adds 'android.test.runner' as a dependency.
|
||||
useLibrary 'android.test.runner'
|
||||
useLibrary 'android.test.base'
|
||||
useLibrary 'android.test.mock'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
|
|
@ -342,7 +342,7 @@ class MerchantsFragment : Fragment(), OnMapReadyCallback, SearchView.OnSuggestio
|
|||
try {
|
||||
mMap?.animateCamera(CameraUpdateFactory.newLatLngZoom(LatLng(lat, lon), 15f))
|
||||
} catch (e: Exception) {
|
||||
Log.d(TAG, e.message)
|
||||
Log.d(TAG, e.message ?: "onSuggestionClick unknown error")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package cy.agorise.bitsybitshareswallet.models.coingecko
|
|||
import com.google.gson.JsonDeserializationContext
|
||||
import com.google.gson.JsonDeserializer
|
||||
import com.google.gson.JsonElement
|
||||
import junit.framework.Assert
|
||||
import java.lang.reflect.Type
|
||||
|
||||
class MarketDataDeserializer : JsonDeserializer<MarketData> {
|
||||
|
|
|
@ -14,14 +14,14 @@ import cy.agorise.graphenej.stats.ExponentialMovingAverage
|
|||
* The basic idea here is to keep track of the sequence of activity life cycle callbacks so that we
|
||||
* can infer when the user has left the app and the node connection can be salfely shut down.
|
||||
*/
|
||||
class NetworkServiceManager(nodes: List<String>) :
|
||||
ActivityLifecycleCallbacks {
|
||||
class NetworkServiceManager(nodes: List<String>) : ActivityLifecycleCallbacks {
|
||||
/**
|
||||
* Handler instance used to schedule tasks back to the main thread
|
||||
*/
|
||||
private val mHandler = Handler()
|
||||
private var mNetworkService: NetworkService? = null
|
||||
private val mNodeUrls: Array<String> = nodes.toTypedArray()
|
||||
|
||||
/**
|
||||
* Runnable used to schedule a service disconnection once the app is not visible to the user for
|
||||
* more than DISCONNECT_DELAY milliseconds.
|
||||
|
@ -33,9 +33,25 @@ class NetworkServiceManager(nodes: List<String>) :
|
|||
}
|
||||
}
|
||||
|
||||
fun onApplicationCreated() {
|
||||
startService()
|
||||
}
|
||||
|
||||
override fun onActivityCreated(activity: Activity, bundle: Bundle?) {}
|
||||
override fun onActivityStarted(activity: Activity) {}
|
||||
override fun onActivityResumed(activity: Activity?) {
|
||||
override fun onActivityResumed(activity: Activity) {
|
||||
startService()
|
||||
}
|
||||
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
mHandler.postDelayed(mDisconnectRunnable, DISCONNECT_DELAY)
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: Activity) {}
|
||||
override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {}
|
||||
override fun onActivityDestroyed(activity: Activity) {}
|
||||
|
||||
private fun startService() {
|
||||
mHandler.removeCallbacks(mDisconnectRunnable)
|
||||
if (mNetworkService == null) {
|
||||
mNetworkService = NetworkService.getInstance()
|
||||
|
@ -43,17 +59,6 @@ class NetworkServiceManager(nodes: List<String>) :
|
|||
}
|
||||
}
|
||||
|
||||
override fun onActivityPaused(activity: Activity) {
|
||||
mHandler.postDelayed(
|
||||
mDisconnectRunnable,
|
||||
DISCONNECT_DELAY.toLong()
|
||||
)
|
||||
}
|
||||
|
||||
override fun onActivityStopped(activity: Activity) {}
|
||||
override fun onActivitySaveInstanceState(activity: Activity, bundle: Bundle) {}
|
||||
override fun onActivityDestroyed(activity: Activity) {}
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Constant used to specify how long will the app wait for another activity to go through its starting life
|
||||
|
@ -61,7 +66,7 @@ class NetworkServiceManager(nodes: List<String>) :
|
|||
*
|
||||
* This is used as a means to detect whether or not the user has left the app.
|
||||
*/
|
||||
private const val DISCONNECT_DELAY = 1500
|
||||
private const val DISCONNECT_DELAY = 1500L
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,7 @@ class BitsyApplication : Application() {
|
|||
// Add RxJava error handler to avoid crashes when an error occurs on a RxJava operation, but still log the
|
||||
// exception to Crashlytics so that we can fix the issues
|
||||
RxJavaPlugins.setErrorHandler { throwable ->
|
||||
Log.e("RxJava Error", throwable.message)
|
||||
Log.e("RxJava Error", throwable.message ?: "Unknown RxJava error")
|
||||
FirebaseCrashlytics.getInstance().recordException(throwable)
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,8 @@ class BitsyApplication : Application() {
|
|||
// Fake call to onActivityResumed, because BiTSy is using a single activity and at the moment
|
||||
// onActivityResumed is called the first time the app starts, the NetworkServiceManager has not
|
||||
// been configured yet, thus causing the NetworkService to never connect.
|
||||
networkManager.onActivityResumed(null)
|
||||
// TODO try using ProcessLifecycleObserver
|
||||
networkManager.onApplicationCreated()
|
||||
}
|
||||
|
||||
override fun onTerminate() {
|
||||
|
|
|
@ -44,7 +44,7 @@ class ReceiveTransactionViewModel(application: Application) : AndroidViewModel(a
|
|||
try {
|
||||
_qrCodeBitmap.value = encodeAsBitmap(Invoice.toQrCode(invoice), "#139657", size) // PalmPay green
|
||||
} catch (e: Exception) {
|
||||
Log.d("ReceiveTransactionVM", e.message)
|
||||
Log.d("ReceiveTransactionVM", e.message ?: "Unknown error in updateInvoice")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ class MarketDataDeserializerTest {
|
|||
val str = "{\"current_price\": {\"aed\": 0.14139359620401012,\"ars\": 1.476552955052185,\"aud\": 0.05410080634896981,\"bch\": 0.0003021370317928406,\"bdt\": 3.2298217535732276,\"bhd\": 0.01451147244444769,\"bmd\": 0.03849350092032233,\"bnb\": 0.007113127493734956,\"brl\": 0.15000509277539803,\"btc\": 0.00001043269732289735,\"cad\": 0.051866143140042266,\"chf\": 0.03825734329217614,\"clp\": 26.587581916766037,\"cny\": 0.2652895096426772,\"czk\": 0.8706365729081245,\"dkk\": 0.25236393094264586,\"eos\": 0.01566778197589746,\"eth\": 0.0003870069548974383,\"eur\": 0.033804376612212375,\"gbp\": 0.030484350651335475,\"hkd\": 0.3012660745118239,\"huf\": 10.909058160819312,\"idr\": 558.1942568455942,\"ils\": 0.14452962323048843,\"inr\": 2.721290348862006,\"jpy\": 4.327150672205728,\"krw\": 43.47379006939362,\"kwd\": 0.011703102097803801,\"lkr\": 6.939897047172613,\"ltc\": 0.0013225337650442446,\"mmk\": 60.56217136246436,\"mxn\": 0.7738105980956592,\"myr\": 0.1608450935955668,\"nok\": 0.335428517669597,\"nzd\": 0.056803550529088344,\"php\": 2.046274976098886,\"pkr\": 5.3730315641051885,\"pln\": 0.1449376543402434,\"rub\": 2.596498268228413,\"sar\": 0.1444545609036934,\"sek\": 0.3498212376637053,\"sgd\": 0.05281188996415366,\"thb\": 1.2598922851221481,\"try\": 0.20393883733037357,\"twd\": 1.1869880579631216,\"usd\": 0.03849350092032233,\"vef\": 9565.159285292651,\"xag\": 0.002632124388265174,\"xau\": 0.00003094261577979185,\"xdr\": 0.02769368731511483,\"xlm\": 0.3411570542267162,\"xrp\": 0.11074614753363282,\"zar\": 0.5534635980499906}}"
|
||||
val gson = GsonBuilder().registerTypeAdapter(MarketData::class.java, MarketDataDeserializer())
|
||||
.create()
|
||||
val marketData = gson.fromJson<MarketData>(str, MarketData::class.java)
|
||||
val marketData = gson.fromJson(str, MarketData::class.java)
|
||||
Assert.assertEquals(0.03849350092032233, marketData.current_price["usd"])
|
||||
Assert.assertEquals(0.033804376612212375, marketData.current_price["eur"])
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue