diff --git a/CHANGELOG.md b/CHANGELOG.md index ddd22bea..13388d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,20 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.7.8] 2019-10-28 +## CHANGED +- Changed the blockEq banner message. + +## [2.0.7.7] 2019-10-25 +## Removed +- removed set inflation feature. +## Changed +- fixing a typo in the stellarx message. + +## [2.0.7.6] 2019-10-23 +## Added +- Added the banner of StellarX to recommend the users to move to stellarX and keep blockEQ as open source for learning porpoises. + ## [2.0.7.5] 2019-02-11 ## Added - Major refactor to keep PinActivity with single responsibility, moved the overall logic to activity of result contract in WalletManagementActivity: diff --git a/README.md b/README.md index 6bcc0b0b..2066f419 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ - [Introduction](#introduction) - [Features](#features) - [Feedback](#feedback) -- [Contributors](#contributors) +- [Contributing](./CONTRIBUTING.md) - [Development](#development) - [Getting Started](#getting-started) - [Building the Project](#building-the-project) diff --git a/app/build.gradle b/app/build.gradle index 7157d571..8ef6e57e 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -10,8 +10,8 @@ android { applicationId "com.blockeq.stellarwallet" minSdkVersion 19 targetSdkVersion 29 - versionCode 36 - versionName "2.0.7.5" + versionCode 39 + versionName "2.0.7.8" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" multiDexEnabled true @@ -77,11 +77,12 @@ dependencies { kapt "android.arch.lifecycle:compiler:$lifecycleVersion" implementation "com.google.android:flexbox:$flexboxVersion" - implementation 'com.jakewharton.threetenabp:threetenabp:1.1.0' +// implementation 'com.jakewharton.threetenabp:threetenabp:1.3.0' implementation "io.github.novacrypto:BIP39:$novaCryptoVersion" implementation "com.andrognito.pinlockview:pinlockview:$pinlockviewVersion" implementation "com.toptoche.searchablespinner:searchablespinnerlibrary:$searchablespinnerVersion" implementation "com.journeyapps:zxing-android-embedded:$zxingAndroidVersion" + //noinspection GradleDependency implementation "com.github.davidmigloz:number-keyboard:$numberKeyBoardVersion" implementation "com.brandongogetap:stickyheaders:$stickyheadersVersion" testImplementation "junit:junit:$junitVersion" @@ -148,6 +149,5 @@ dependencies { implementation 'com.github.mancj:MaterialSearchBar:0.8.1' implementation 'com.github.abdularis:CircularImageView:v1.2' - implementation 'com.google.android.gms:play-services-wearable:16.0.1' implementation 'commons-lang:commons-lang:2.6' } diff --git a/app/lint.xml b/app/lint.xml index dbaec081..86709ed8 100644 --- a/app/lint.xml +++ b/app/lint.xml @@ -23,6 +23,7 @@ + diff --git a/app/src/main/java/com/blockeq/stellarwallet/BlockEqWallet.kt b/app/src/main/java/com/blockeq/stellarwallet/BlockEqWallet.kt index b1231b9a..da8105c9 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/BlockEqWallet.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/BlockEqWallet.kt @@ -74,7 +74,7 @@ class BlockEqWallet(private val localStore: LocalStore) : WalletStore { if (assetCode == null) { assetCode = "LMX" } else { - issuer = that.assetIssuer.accountId + issuer = that.assetIssuer } simpleBalances.add(BasicBalance(that.balance, that.assetType, assetCode, issuer)) } diff --git a/app/src/main/java/com/blockeq/stellarwallet/activities/AddAssetActivity.kt b/app/src/main/java/com/blockeq/stellarwallet/activities/AddAssetActivity.kt index 97c54af1..168c9edb 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/activities/AddAssetActivity.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/activities/AddAssetActivity.kt @@ -33,7 +33,7 @@ class AddAssetActivity : BaseActivity() { val asset : Asset try { asset = Asset.createNonNativeAsset(assetCodeEditText.text.toString().toUpperCase(), - KeyPair.fromAccountId(addressEditText.text.toString().toUpperCase())) + KeyPair.fromAccountId(addressEditText.text.toString().toUpperCase()).accountId) } catch (e: Exception) { Toast.makeText(applicationContext, "Invalid input for code or issuer", Toast.LENGTH_SHORT).show() diff --git a/app/src/main/java/com/blockeq/stellarwallet/activities/AssetsActivity.kt b/app/src/main/java/com/blockeq/stellarwallet/activities/AssetsActivity.kt index dbd0d54f..1ca92bb8 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/activities/AssetsActivity.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/activities/AssetsActivity.kt @@ -31,6 +31,8 @@ import org.stellar.sdk.requests.ErrorResponse import org.stellar.sdk.responses.AccountResponse import retrofit2.Call import retrofit2.Callback +import java.util.* +import kotlin.collections.ArrayList class AssetsActivity : BaseActivity(), ChangeTrustlineListener { @@ -120,16 +122,16 @@ class AssetsActivity : BaseActivity(), ChangeTrustlineListener { list[0].amount = it.balance return@map null } - supportedAssetsMap.containsKey(it.assetCode.toLowerCase()) -> { - val asset = supportedAssetsMap[it.assetCode.toLowerCase()]!! + supportedAssetsMap.containsKey(it.assetCode.toLowerCase(Locale.getDefault())) -> { + val asset = supportedAssetsMap[it.assetCode.toLowerCase(Locale.getDefault())]!! asset.amount = it.balance asset.type = SupportedAssetType.ADDED asset.asset = it.asset return@map asset } else -> { - val asset = SupportedAsset(0, it.assetCode.toLowerCase(), "", - it.assetIssuer.accountId, it.limit, it.assetCode, "", + val asset = SupportedAsset(0, it.assetCode.toLowerCase(Locale.getDefault()), "", + it.assetIssuer, it.limit, it.assetCode, "", "", it.balance, SupportedAssetType.ADDED, it.asset) return@map asset } @@ -146,7 +148,7 @@ class AssetsActivity : BaseActivity(), ChangeTrustlineListener { private fun getFilteredSupportedAssets(map: Map): List { return map.values.filter { - it.code.toUpperCase() !in WalletApplication.wallet.getBalances().map { it.assetCode } + it.code.toUpperCase(Locale.getDefault()) !in WalletApplication.wallet.getBalances().map { it.assetCode } } } diff --git a/app/src/main/java/com/blockeq/stellarwallet/activities/PinActivity.kt b/app/src/main/java/com/blockeq/stellarwallet/activities/PinActivity.kt index 9fc0105b..36872228 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/activities/PinActivity.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/activities/PinActivity.kt @@ -10,7 +10,6 @@ import android.view.animation.Animation import android.view.animation.AnimationUtils import com.blockeq.stellarwallet.R import com.blockeq.stellarwallet.interfaces.OnPinLockCompleteListener -import com.blockeq.stellarwallet.utils.GlobalGraphHelper import kotlinx.android.synthetic.main.activity_pin.* import timber.log.Timber @@ -24,6 +23,7 @@ class PinActivity : AppCompatActivity() { companion object { private const val INTENT_ARG_MESSAGE: String = "INTENT_ARG_MESSAGE" private const val INTENT_ARG_PIN: String = "INTENT_ARG_PIN" + const val RESULT_MAX_ATTEMPT_REACH = -2 /** * New Instance of Intent to launch a {@link PinActivity} @@ -41,7 +41,7 @@ class PinActivity : AppCompatActivity() { } intent.putExtra(INTENT_ARG_PIN, pin) } else { - throw IllegalStateException("pin ahs to contain 4 characters, found = '${pin.length}") + throw IllegalStateException("pin has to contain 4 characters, found = '${pin.length}") } } return intent @@ -66,8 +66,7 @@ class PinActivity : AppCompatActivity() { val intent = Intent() intent.putExtra(INTENT_ARG_PIN, pin) setResult(Activity.RESULT_OK, intent) - overridePendingTransition(R.anim.stay, R.anim.slide_out_down) - finish() + finishWithTransition() } else { processIncorrectPin() } @@ -99,8 +98,8 @@ class PinActivity : AppCompatActivity() { customMessageTextView.text = resources.getQuantityString(R.plurals.attempts_template, MAX_ATTEMPTS - numAttempts, MAX_ATTEMPTS - numAttempts) if (numAttempts == MAX_ATTEMPTS) { - //TODO move this to WalletManager - GlobalGraphHelper.wipeAndRestart(this@PinActivity) + setResult(RESULT_MAX_ATTEMPT_REACH) + finishWithTransition() } } }) @@ -117,5 +116,10 @@ class PinActivity : AppCompatActivity() { super.onBackPressed() overridePendingTransition(R.anim.stay, R.anim.slide_out_down) } + + private fun finishWithTransition(){ + overridePendingTransition(R.anim.stay, R.anim.slide_out_down) + finish() + } //endregion } \ No newline at end of file diff --git a/app/src/main/java/com/blockeq/stellarwallet/activities/WalletManagerActivity.kt b/app/src/main/java/com/blockeq/stellarwallet/activities/WalletManagerActivity.kt index 15a63611..80bbb911 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/activities/WalletManagerActivity.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/activities/WalletManagerActivity.kt @@ -9,6 +9,7 @@ import com.blockeq.stellarwallet.R import com.blockeq.stellarwallet.WalletApplication import com.blockeq.stellarwallet.encryption.KeyStoreWrapper import com.blockeq.stellarwallet.utils.AccountUtils +import com.blockeq.stellarwallet.utils.GlobalGraphHelper import java.lang.IllegalStateException class WalletManagerActivity : AppCompatActivity() { @@ -107,82 +108,86 @@ class WalletManagerActivity : AppCompatActivity() { override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) - when (requestCode) { - ActionType.ENTER_PIN.ordinal -> { - if (resultCode == Activity.RESULT_OK && data != null) { - val pin = PinActivity.getPinFromIntent(data) - startActivityForResult(PinActivity.newInstance(this, pin, getString(R.string.please_reenter_your_pin)), ActionType.REENTER_PIN.ordinal) - return + if (resultCode == PinActivity.RESULT_MAX_ATTEMPT_REACH) { + GlobalGraphHelper.wipeAndRestart(this) + } else { + when (requestCode) { + ActionType.ENTER_PIN.ordinal -> { + if (resultCode == Activity.RESULT_OK && data != null) { + val pin = PinActivity.getPinFromIntent(data) + startActivityForResult(PinActivity.newInstance(this, pin, getString(R.string.please_reenter_your_pin)), ActionType.REENTER_PIN.ordinal) + return + } } - } - ActionType.REENTER_PIN.ordinal -> { - if (resultCode == Activity.RESULT_OK) { - if (actionType == ActionType.NEW_WALLET || actionType == ActionType.RESTORE_WALLET) { - val phrase = intent.getStringExtra(INTENT_PHRASE) - if (generateWallet(data, phrase)) { - setResult(Activity.RESULT_OK) - finish() - return + ActionType.REENTER_PIN.ordinal -> { + if (resultCode == Activity.RESULT_OK) { + if (actionType == ActionType.NEW_WALLET || actionType == ActionType.RESTORE_WALLET) { + val phrase = intent.getStringExtra(INTENT_PHRASE) + if (generateWallet(data, phrase)) { + setResult(Activity.RESULT_OK) + finish() + return + } } } } - } - ActionType.VERIFY_PIN.ordinal -> { - val pin = PinActivity.getPinFromIntent(data) - if (resultCode == Activity.RESULT_OK && data != null && pin != null) { - WalletApplication.userSession.setPin(pin) - setResult(Activity.RESULT_OK) - finish() - return - } - } - ActionType.DISPLAY_MNEMONIC.ordinal -> { - if (resultCode == Activity.RESULT_OK && data != null) { + ActionType.VERIFY_PIN.ordinal -> { val pin = PinActivity.getPinFromIntent(data) - if (pin != null) { - val masterKey = AccountUtils.getPinMasterKey(applicationContext, pin) - if (masterKey != null) { - val encryptedPhrase = WalletApplication.wallet.getEncryptedPhrase()!! - WalletApplication.wallet.getEncryptedPassphrase() - val encryptedPassphrase = WalletApplication.wallet.getEncryptedPassphrase() - var passphrase: String?= null - if (encryptedPassphrase != null) { - passphrase = AccountUtils.getDecryptedString(encryptedPassphrase, masterKey) + if (resultCode == Activity.RESULT_OK && data != null && pin != null) { + WalletApplication.userSession.setPin(pin) + setResult(Activity.RESULT_OK) + finish() + return + } + } + ActionType.DISPLAY_MNEMONIC.ordinal -> { + if (resultCode == Activity.RESULT_OK && data != null) { + val pin = PinActivity.getPinFromIntent(data) + if (pin != null) { + val masterKey = AccountUtils.getPinMasterKey(applicationContext, pin) + if (masterKey != null) { + val encryptedPhrase = WalletApplication.wallet.getEncryptedPhrase()!! + WalletApplication.wallet.getEncryptedPassphrase() + val encryptedPassphrase = WalletApplication.wallet.getEncryptedPassphrase() + var passphrase: String?= null + if (encryptedPassphrase != null) { + passphrase = AccountUtils.getDecryptedString(encryptedPassphrase, masterKey) + } + val decryptedPhrase = AccountUtils.getDecryptedString(encryptedPhrase, masterKey) + setResultData(decryptedPhrase, passphrase) + return } - val decryptedPhrase = AccountUtils.getDecryptedString(encryptedPhrase, masterKey) - setResultData(decryptedPhrase, passphrase) - return } } } - } - ActionType.DECRYPT_SECRET_SEED.ordinal -> { - if (resultCode == Activity.RESULT_OK && data != null) { - val pin = PinActivity.getPinFromIntent(data) - if (pin != null) { - val masterKey = AccountUtils.getPinMasterKey(applicationContext, pin) - if (masterKey != null) { - val encryptedPhrase = WalletApplication.wallet.getEncryptedPhrase()!! - val phrase = AccountUtils.getDecryptedString(encryptedPhrase, masterKey) - - val encryptedPassphrase = WalletApplication.wallet.getEncryptedPassphrase() - var passphrase: String?= null - if (encryptedPassphrase != null) { - passphrase = AccountUtils.getDecryptedString(encryptedPassphrase, masterKey) + ActionType.DECRYPT_SECRET_SEED.ordinal -> { + if (resultCode == Activity.RESULT_OK && data != null) { + val pin = PinActivity.getPinFromIntent(data) + if (pin != null) { + val masterKey = AccountUtils.getPinMasterKey(applicationContext, pin) + if (masterKey != null) { + val encryptedPhrase = WalletApplication.wallet.getEncryptedPhrase()!! + val phrase = AccountUtils.getDecryptedString(encryptedPhrase, masterKey) + + val encryptedPassphrase = WalletApplication.wallet.getEncryptedPassphrase() + var passphrase: String?= null + if (encryptedPassphrase != null) { + passphrase = AccountUtils.getDecryptedString(encryptedPassphrase, masterKey) + } + val keyPair = AccountUtils.getStellarKeyPair(phrase, passphrase) + val secretSeed = keyPair.secretSeed.joinToString("") + + setResultData(secretSeed) + return } - val keyPair = AccountUtils.getStellarKeyPair(phrase, passphrase) - val secretSeed = keyPair.secretSeed.joinToString("") - - setResultData(secretSeed) - return } } } } - } - setResult(Activity.RESULT_CANCELED) - finish() + setResult(Activity.RESULT_CANCELED) + finish() + } } private fun setResultData(resultData : String, resultExtraData : String? = null) { diff --git a/app/src/main/java/com/blockeq/stellarwallet/adapters/AssetsRecyclerViewAdapter.kt b/app/src/main/java/com/blockeq/stellarwallet/adapters/AssetsRecyclerViewAdapter.kt index 2f4da67a..ef4c4d37 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/adapters/AssetsRecyclerViewAdapter.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/adapters/AssetsRecyclerViewAdapter.kt @@ -26,6 +26,8 @@ import com.blockeq.stellarwallet.utils.StringFormat import com.squareup.picasso.Picasso import org.stellar.sdk.Asset import org.stellar.sdk.KeyPair +import java.util.* +import kotlin.collections.ArrayList class AssetsRecyclerViewAdapter(var context: Context, private var listener: ChangeTrustlineListener, private var items : ArrayList) : RecyclerView.Adapter() { companion object { @@ -114,7 +116,7 @@ class AssetsRecyclerViewAdapter(var context: Context, private var listener: Chan viewHolder.assetButton.visibility = View.VISIBLE viewHolder.assetName.text = asset.name viewHolder.assetAmount.text = String.format(context.getString(R.string.balance_template), - StringFormat.truncateDecimalPlaces(asset.amount), asset.code.toUpperCase()) + StringFormat.truncateDecimalPlaces(asset.amount), asset.code.toUpperCase(Locale.getDefault())) if (asset.image.isNotEmpty()) { viewHolder.defaultImage.visibility = View.GONE @@ -127,6 +129,9 @@ class AssetsRecyclerViewAdapter(var context: Context, private var listener: Chan } if (asset.code == Constants.LUMENS_ASSET_CODE) { + //TODO: disabling inflation since in protocol 12 will be removed. + viewHolder.assetButton.visibility = View.GONE + viewHolder.assetButton.text = context.getString(R.string.set_inflation_message) viewHolder.assetButton.setBackgroundColor(ContextCompat.getColor(context, R.color.mantis)) viewHolder.assetButton.setOnClickListener { @@ -151,7 +156,7 @@ class AssetsRecyclerViewAdapter(var context: Context, private var listener: Chan if (asset.code == Constants.LUMENS_ASSET_CODE) { WalletApplication.userSession.setSessionAsset(DefaultAsset()) } else { - WalletApplication.userSession.setSessionAsset(SessionAssetImpl(asset.code.toUpperCase(), asset.name, asset.issuer)) + WalletApplication.userSession.setSessionAsset(SessionAssetImpl(asset.code.toUpperCase(Locale.getDefault()), asset.name, asset.issuer)) } (context as Activity).finish() } @@ -164,10 +169,10 @@ class AssetsRecyclerViewAdapter(var context: Context, private var listener: Chan private fun configureSupportedAssetViewHolder(viewHolder: SupportedAssetViewHolder, position: Int) { val asset = items[position] as SupportedAsset - val trustLineAsset = Asset.createNonNativeAsset(asset.code.toUpperCase(), KeyPair.fromAccountId(asset.issuer)) + val trustLineAsset = Asset.createNonNativeAsset(asset.code.toUpperCase(Locale.getDefault()), KeyPair.fromAccountId(asset.issuer).accountId) viewHolder.assetName.text = String.format(context.getString(R.string.asset_template), - asset.name, asset.code.toUpperCase()) + asset.name, asset.code.toUpperCase(Locale.getDefault())) viewHolder.assetAmount.visibility = View.GONE viewHolder.defaultImage.visibility = View.GONE diff --git a/app/src/main/java/com/blockeq/stellarwallet/fragments/ContactsFragment.kt b/app/src/main/java/com/blockeq/stellarwallet/fragments/ContactsFragment.kt index 541c31b1..9c23879c 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/fragments/ContactsFragment.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/fragments/ContactsFragment.kt @@ -26,6 +26,8 @@ import timber.log.Timber import android.net.Uri import android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS import com.blockeq.stellarwallet.R +import java.util.* +import kotlin.collections.ArrayList /** * Fragment that holds the RecyclerView @@ -218,7 +220,7 @@ class ContactsFragment : Fragment() { val filterList : ArrayList = ArrayList() currentContactList.forEach { it.name.let { name -> - if (name.toLowerCase().contains(input.toLowerCase())) { + if (name.toLowerCase(Locale.getDefault()).contains(input.toLowerCase(Locale.getDefault()))) { filterList.add(it) } } diff --git a/app/src/main/java/com/blockeq/stellarwallet/fragments/WalletFragment.kt b/app/src/main/java/com/blockeq/stellarwallet/fragments/WalletFragment.kt index 8097baa6..f2f2fb32 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/fragments/WalletFragment.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/fragments/WalletFragment.kt @@ -5,7 +5,9 @@ import android.arch.lifecycle.Observer import android.arch.lifecycle.ViewModelProviders import android.content.Context import android.content.Intent +import android.graphics.* import android.os.Bundle +import android.support.v4.content.ContextCompat.getColor import android.support.v7.widget.LinearLayoutManager import android.view.LayoutInflater import android.view.View @@ -17,7 +19,10 @@ import com.blockeq.stellarwallet.activities.BalanceSummaryActivity import com.blockeq.stellarwallet.activities.ReceiveActivity import com.blockeq.stellarwallet.activities.StellarAddressActivity import com.blockeq.stellarwallet.adapters.WalletRecyclerViewAdapter +import com.blockeq.stellarwallet.models.* +import com.blockeq.stellarwallet.mvvm.effects.WalletViewModelPolling import com.blockeq.stellarwallet.mvvm.effects.WalletViewState +import com.blockeq.stellarwallet.utils.DebugPreferencesHelper import com.google.zxing.BarcodeFormat import com.journeyapps.barcodescanner.BarcodeEncoder import kotlinx.android.synthetic.main.fragment_wallet.* @@ -25,12 +30,7 @@ import org.jetbrains.anko.doAsync import org.jetbrains.anko.support.v4.runOnUiThread import org.stellar.sdk.responses.effects.EffectResponse import timber.log.Timber -import android.support.v4.content.ContextCompat.getColor -import android.graphics.* -import com.blockeq.stellarwallet.models.* -import com.blockeq.stellarwallet.mvvm.effects.EffectsRepository -import com.blockeq.stellarwallet.mvvm.effects.WalletViewModelPolling -import com.blockeq.stellarwallet.utils.DebugPreferencesHelper + class WalletFragment : BaseFragment() { private lateinit var appContext : Context @@ -57,6 +57,7 @@ class WalletFragment : BaseFragment() { } } + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) diff --git a/app/src/main/java/com/blockeq/stellarwallet/models/AssetUtil.kt b/app/src/main/java/com/blockeq/stellarwallet/models/AssetUtil.kt index 00cd9597..1d4fd470 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/models/AssetUtil.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/models/AssetUtil.kt @@ -34,11 +34,11 @@ class AssetUtil { dataAsset = when (assetType) { AssetType.ASSET_TYPE_CREDIT_ALPHANUM12 -> { val concreteAsset = asset as AssetTypeCreditAlphaNum12 - DataAsset(concreteAsset.type, concreteAsset.code, concreteAsset.issuer.accountId) + DataAsset(concreteAsset.type, concreteAsset.code, concreteAsset.issuer) } AssetType.ASSET_TYPE_CREDIT_ALPHANUM4 -> { val concreteAsset = asset as AssetTypeCreditAlphaNum4 - DataAsset(concreteAsset.type, concreteAsset.code, concreteAsset.issuer.accountId) + DataAsset(concreteAsset.type, concreteAsset.code, concreteAsset.issuer) } AssetType.ASSET_TYPE_NATIVE -> { val concreteAsset = asset as AssetTypeNative diff --git a/app/src/main/java/com/blockeq/stellarwallet/models/BalanceAvailabilityImpl.kt b/app/src/main/java/com/blockeq/stellarwallet/models/BalanceAvailabilityImpl.kt index 627e15c6..134913b0 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/models/BalanceAvailabilityImpl.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/models/BalanceAvailabilityImpl.kt @@ -21,7 +21,7 @@ class BalanceAvailabilityImpl(private val account: AccountResponse, } override fun getAccountId(): String { - return account.keypair.accountId + return account.accountId } private val nativeBalance: NativeAssetAvailability @@ -94,7 +94,7 @@ class BalanceAvailabilityImpl(private val account: AccountResponse, } is AssetTypeCreditAlphaNum -> { if (assetCode == asset.code - && issuer == asset.issuer.accountId) { + && issuer == asset.issuer) { postedForTrade += it.amount.toFloat() } } @@ -108,7 +108,7 @@ class BalanceAvailabilityImpl(private val account: AccountResponse, balances.add(getNativeAssetAvailability()) account.balances.forEach { if (it.assetType != "native") { - balances.add(getAssetAvailability(it.assetCode, it.assetIssuer.accountId)) + balances.add(getAssetAvailability(it.assetCode, it.assetIssuer)) } } return balances diff --git a/app/src/main/java/com/blockeq/stellarwallet/models/BasicStellarAccount.kt b/app/src/main/java/com/blockeq/stellarwallet/models/BasicStellarAccount.kt index ab84ef29..9de2cae9 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/models/BasicStellarAccount.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/models/BasicStellarAccount.kt @@ -8,7 +8,7 @@ open class BasicStellarAccount(private val accountId:String?, private val inflat private val sequenceNumber:Long, private val subEntryCount:Int?): StellarAccount { override fun getAccountResponse(): AccountResponse { - return AccountResponse(KeyPair.fromAccountId(accountId), sequenceNumber) + return AccountResponse(KeyPair.fromAccountId(accountId).accountId, sequenceNumber) } override fun getAccountId(): String? { diff --git a/app/src/main/java/com/blockeq/stellarwallet/models/StellarAccountImpl.kt b/app/src/main/java/com/blockeq/stellarwallet/models/StellarAccountImpl.kt index 70f5634a..ca6024c6 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/models/StellarAccountImpl.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/models/StellarAccountImpl.kt @@ -5,7 +5,7 @@ import org.stellar.sdk.responses.AccountResponse data class StellarAccountImpl(private val accountResponse: AccountResponse) : StellarAccount { override fun getAccountId() : String { - return accountResponse.keypair.accountId + return accountResponse.accountId } override fun getInflationDestination() : String? { diff --git a/app/src/main/java/com/blockeq/stellarwallet/mvvm/effects/EffectsRepository.kt b/app/src/main/java/com/blockeq/stellarwallet/mvvm/effects/EffectsRepository.kt index e27c5182..0da9f3b4 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/mvvm/effects/EffectsRepository.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/mvvm/effects/EffectsRepository.kt @@ -7,6 +7,7 @@ import com.blockeq.stellarwallet.mvvm.effects.remote.RemoteRepository import org.stellar.sdk.requests.EventListener import org.stellar.sdk.requests.SSEStream import org.stellar.sdk.responses.effects.EffectResponse +import shadow.com.google.common.base.Optional import timber.log.Timber class EffectsRepository private constructor(private val remoteRepository: RemoteRepository) { @@ -82,10 +83,16 @@ class EffectsRepository private constructor(private val remoteRepository: Remote if (ENABLE_STREAM) { closeStream() Timber.d("Opening the stream") - eventSource = remoteRepository.registerForEffects("now", EventListener { - Timber.d("Stream response {$it}, created at: ${it.createdAt}") - effectsList.add(0, it) - notifyLiveData(effectsList) + eventSource = remoteRepository.registerForEffects("now", object:EventListener { + override fun onEvent(effect: EffectResponse?) { + Timber.d("Stream response {$effect}, created at: ${effect!!.createdAt}") + effectsList.add(0, effect) + notifyLiveData(effectsList) + } + + override fun onFailure(p0: Optional?, p1: Optional?) { + + } }) } currentCursor = cursor diff --git a/app/src/main/java/com/blockeq/stellarwallet/remote/Horizon.kt b/app/src/main/java/com/blockeq/stellarwallet/remote/Horizon.kt index 37285573..870552c4 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/remote/Horizon.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/remote/Horizon.kt @@ -25,21 +25,26 @@ import java.util.concurrent.TimeUnit object Horizon : HorizonTasks { private lateinit var HORIZON_SERVER : Server + private lateinit var serverNetwork : Network override fun init(server: ServerType) { var serverAddress = "" when(server) { ServerType.PROD -> { serverAddress = "https://horizon.stellar.org" - Network.usePublicNetwork() + serverNetwork = Network.PUBLIC } ServerType.TEST_NET -> { serverAddress = "https://horizon-testnet.stellar.org" - Network.useTestNetwork() + serverNetwork = Network.TESTNET } } HORIZON_SERVER = createServer(serverAddress) } + public fun getServerNetwork():Network { + return serverNetwork + } + override fun getLoadEffectsTask(cursor: String, limit: Int, listener: OnLoadEffects): AsyncTask?> { return LoadEffectsTask(cursor, limit, listener) } @@ -63,13 +68,13 @@ object Horizon : HorizonTasks { override fun deleteOffer(id:Long, secretSeed : CharArray, selling: Asset, buying: Asset, price: String, listener: Horizon.OnMarketOfferListener) { AsyncTask.execute { val server = getServer() - val offerOperation = ManageOfferOperation.Builder(selling, buying, "0", price).setOfferId(id).build() + val offerOperation = ManageSellOfferOperation.Builder(selling, buying, "0", price).setOfferId(id).build() val sourceKeyPair = KeyPair.fromSecretSeed(secretSeed) try { - val sourceAccount = server.accounts().account(sourceKeyPair) + val sourceAccount = server.accounts().account(sourceKeyPair.accountId) - val transaction = Transaction.Builder(sourceAccount).setTimeout(TIMEOUT_INFINITE).addOperation(offerOperation).build() + val transaction = Transaction.Builder(sourceAccount, getServerNetwork()).setTimeout(TIMEOUT_INFINITE).addOperation(offerOperation).build() transaction.sign(sourceKeyPair) val response = server.submitTransaction(transaction) @@ -103,7 +108,7 @@ object Horizon : HorizonTasks { return server.effects() .cursor(cursor) .order(RequestBuilder.Order.ASC) - .forAccount(sourceKeyPair).stream(listener) + .forAccount(sourceKeyPair.accountId).stream(listener) } catch (error : Exception) { Timber.e(error.message.toString()) } @@ -113,11 +118,11 @@ object Horizon : HorizonTasks { override fun getCreateMarketOffer(listener: OnMarketOfferListener, secretSeed: CharArray, sellingAsset: Asset, buyingAsset: Asset, amount: String, price: String) { AsyncTask.execute { val server = getServer() - val managedOfferOperation = ManageOfferOperation.Builder(sellingAsset, buyingAsset, amount, price).build() + val managedOfferOperation = ManageSellOfferOperation.Builder(sellingAsset, buyingAsset, amount, price).build() val sourceKeyPair = KeyPair.fromSecretSeed(secretSeed) - val sourceAccount = server.accounts().account(sourceKeyPair) + val sourceAccount = server.accounts().account(sourceKeyPair.accountId) - val transaction = Transaction.Builder(sourceAccount).setTimeout(TIMEOUT_INFINITE).addOperation(managedOfferOperation).build() + val transaction = Transaction.Builder(sourceAccount, getServerNetwork()).setTimeout(TIMEOUT_INFINITE).addOperation(managedOfferOperation).build() transaction.sign(sourceKeyPair) val response = server.submitTransaction(transaction) Handler(Looper.getMainLooper()).post { @@ -166,7 +171,7 @@ object Horizon : HorizonTasks { val server = getServer() try { val sourceKeyPair = KeyPair.fromAccountId(WalletApplication.wallet.getStellarAccountId()) - val response = server.offers().forAccount(sourceKeyPair).execute() + val response = server.offers().forAccount(sourceKeyPair.accountId).execute() if(response != null) { list = response.records } @@ -198,7 +203,7 @@ object Horizon : HorizonTasks { val sourceKeyPair = KeyPair.fromAccountId(WalletApplication.wallet.getStellarAccountId()) var account : AccountResponse? = null try { - account = server.accounts().account(sourceKeyPair) + account = server.accounts().account(sourceKeyPair.accountId) } catch (error : Exception) { Timber.d(error.message.toString()) @@ -228,7 +233,7 @@ object Horizon : HorizonTasks { effectResults = server.effects().order(RequestBuilder.Order.DESC) .cursor(cursor) .limit(limit) - .forAccount(sourceKeyPair).execute() + .forAccount(sourceKeyPair.accountId).execute() } catch (error : Exception) { Timber.e(error.message.toString()) errorMessage = error.message.toString() @@ -261,7 +266,7 @@ object Horizon : HorizonTasks { try { try { - server.accounts().account(destKeyPair) + server.accounts().account(destKeyPair.accountId) } catch (error : Exception) { Timber.e(error.message.toString()) if (error is ErrorResponse && error.code == 404) { @@ -273,13 +278,13 @@ object Horizon : HorizonTasks { } } - val sourceAccount = server.accounts().account(sourceKeyPair) + val sourceAccount = server.accounts().account(sourceKeyPair.accountId) - val transactionBuilder = Transaction.Builder(sourceAccount).setTimeout(TIMEOUT_INFINITE) + val transactionBuilder = Transaction.Builder(sourceAccount, getServerNetwork()).setTimeout(TIMEOUT_INFINITE) if (isCreateAccount) { - transactionBuilder.addOperation(CreateAccountOperation.Builder(destKeyPair, amount).build()) + transactionBuilder.addOperation(CreateAccountOperation.Builder(destKeyPair.accountId, amount).build()) } else { - transactionBuilder.addOperation(PaymentOperation.Builder(destKeyPair, getCurrentAsset(), amount).build()) + transactionBuilder.addOperation(PaymentOperation.Builder(destKeyPair.accountId, getCurrentAsset(), amount).build()) } if (memo.isNotEmpty()) { @@ -325,11 +330,11 @@ object Horizon : HorizonTasks { val destKeyPair = KeyPair.fromAccountId(inflationDest) try { - val sourceAccount = server.accounts().account(sourceKeyPair) + val sourceAccount = server.accounts().account(sourceKeyPair.accountId) - val transaction = Transaction.Builder(sourceAccount).setTimeout(TIMEOUT_INFINITE) + val transaction = Transaction.Builder(sourceAccount, getServerNetwork()).setTimeout(TIMEOUT_INFINITE) .addOperation(SetOptionsOperation.Builder() - .setInflationDestination(destKeyPair) + .setInflationDestination(destKeyPair.accountId) .build()) .build() @@ -371,9 +376,9 @@ object Horizon : HorizonTasks { val limit = if (removeTrust) "0.0000000" else Constants.MAX_ASSET_STRING_VALUE try { - val sourceAccount = server.accounts().account(sourceKeyPair) + val sourceAccount = server.accounts().account(sourceKeyPair.accountId) - val transaction = Transaction.Builder(sourceAccount).setTimeout(TIMEOUT_INFINITE) + val transaction = Transaction.Builder(sourceAccount, getServerNetwork()).setTimeout(TIMEOUT_INFINITE) .addOperation(ChangeTrustOperation.Builder(asset, limit).build()) .build() @@ -426,7 +431,7 @@ object Horizon : HorizonTasks { return if (assetCode == Constants.LUMENS_ASSET_TYPE) { AssetTypeNative() } else { - Asset.createNonNativeAsset(assetCode, KeyPair.fromAccountId(assetIssuer)) + Asset.createNonNativeAsset(assetCode, KeyPair.fromAccountId(assetIssuer).accountId) } } diff --git a/app/src/main/java/com/blockeq/stellarwallet/utils/DiagnosticUtils.kt b/app/src/main/java/com/blockeq/stellarwallet/utils/DiagnosticUtils.kt index 571966a2..d75aa7cf 100644 --- a/app/src/main/java/com/blockeq/stellarwallet/utils/DiagnosticUtils.kt +++ b/app/src/main/java/com/blockeq/stellarwallet/utils/DiagnosticUtils.kt @@ -10,7 +10,7 @@ class DiagnosticUtils { fun getDeviceName(): String { val manufacturer = Build.MANUFACTURER val model = Build.MODEL - return if (model.toLowerCase().startsWith(manufacturer.toLowerCase())) { + return if (model.toLowerCase(Locale.getDefault()).startsWith(manufacturer.toLowerCase(Locale.getDefault()))) { StringFormat.capitalize(model) } else { StringFormat.capitalize(manufacturer) + " " + model diff --git a/app/src/main/res/drawable-xxhdpi/stellarx.png b/app/src/main/res/drawable-xxhdpi/stellarx.png new file mode 100644 index 00000000..10ff2f54 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/stellarx.png differ diff --git a/app/src/main/res/drawable/bg_rounded_stellarx.xml b/app/src/main/res/drawable/bg_rounded_stellarx.xml new file mode 100644 index 00000000..48a655a3 --- /dev/null +++ b/app/src/main/res/drawable/bg_rounded_stellarx.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_pin.xml b/app/src/main/res/layout/activity_pin.xml index 2dcbd344..6a61c717 100644 --- a/app/src/main/res/layout/activity_pin.xml +++ b/app/src/main/res/layout/activity_pin.xml @@ -1,12 +1,16 @@ - + + + android:layout_width="match_parent" + android:layout_height="wrap_content"> + android:layout_marginTop="@dimen/margin_padding_size_large" + android:layout_marginBottom="@dimen/margin_padding_size_large"> - - - + android:layout_height="wrap_content" + android:layout_marginStart="@dimen/margin_padding_size_medium_large" + android:layout_marginEnd="@dimen/margin_padding_size_medium_large" + app:keypadButtonSize="@dimen/margin_padding_size_xxxlarge" + app:keypadDeleteButtonPressedColor="@color/deletePressedColor" + app:keypadDeleteButtonSize="@dimen/margin_padding_size_medium_large" + app:keypadHorizontalSpacing="@dimen/margin_padding_size_xxlarge" + app:keypadShowDeleteButton="true" + app:keypadTextColor="@color/white" + app:keypadTextSize="@dimen/keypad_size" + app:keypadVerticalSpacing="@dimen/keybadSpacing" + app:pinLength="4" /> - - \ No newline at end of file + \ No newline at end of file diff --git a/app/src/main/res/layout/content_receive.xml b/app/src/main/res/layout/content_receive.xml index 3b72046f..bb085896 100644 --- a/app/src/main/res/layout/content_receive.xml +++ b/app/src/main/res/layout/content_receive.xml @@ -17,71 +17,82 @@ app:titleTextColor="@color/colorPrimaryDark" android:theme="@style/ToolbarTheme" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> - - + android:layout_height="match_parent"> - + - + - + - + - + - + - + - + + + - + + + + + diff --git a/app/src/main/res/layout/fragment_wallet.xml b/app/src/main/res/layout/fragment_wallet.xml index c477f127..55a0e3a6 100644 --- a/app/src/main/res/layout/fragment_wallet.xml +++ b/app/src/main/res/layout/fragment_wallet.xml @@ -1,12 +1,12 @@ - Not now This account requires activation. Send at least 1 XLM to fund and activate the account Fetching account transactions, please wait + BlockEQ is now deprecated and will remain available to the open source community; we recommend you export your account to our friends at StellarX! + Download Now diff --git a/build.gradle b/build.gradle index 628694c2..22f02aa2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,13 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlinVersion = '1.3.11' + ext.kotlinVersion = '1.3.50' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.3.1' + classpath 'com.android.tools.build:gradle:3.5.1' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion" // NOTE: Do not place your application dependencies here; they belong @@ -44,6 +44,6 @@ ext { anko_version='0.10.8' // this two following libraries are // depending on the version of the okhttp - stellarVersion = '0.4.1' + stellarVersion = '0.21.1' retrofit = '2.4.0' } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 85bd9d2f..d4cd4c94 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Nov 02 16:06:35 EDT 2018 +#Tue Oct 22 21:55:31 EDT 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip