Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
WooKeyWallet committed Dec 4, 2019
1 parent 8da7d5c commit 71f7940
Show file tree
Hide file tree
Showing 36 changed files with 51 additions and 78 deletions.
32 changes: 5 additions & 27 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,12 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

def computeVersionCode() {
def cmd = 'git rev-list HEAD --first-parent --count'
def trim = cmd.execute().text.trim()
if (trim == null || trim.length() == 0) {
trim = 1
}
trim.toInteger()
103
}

def gitVersionTag() {
def cmd = 'git describe --tags'
def version = cmd.execute().text.trim()

def pattern = "-(\\d+)-g"
def matcher = version =~ pattern

if (matcher) {
version = version.substring(0, matcher.start()) + "." + matcher[0][1]
} else {
version = version + ".0"
}

return version
static def computeVersionCode() {
105
}

def computeVersionName() {
return "1.0.3"
static def computeVersionName() {
return "1.0.5"
}

android {
Expand Down Expand Up @@ -70,7 +48,7 @@ android {
variant.outputs.all { output ->
def abiName = output.getFilter(com.android.build.OutputFile.ABI)
if (abiName == null) abiName = "universal"
outputFileName = "wookey-${variant.versionName}-${variant.versionCode}-${abiName}.apk"
outputFileName = "monero-${variant.versionName}-${variant.versionCode}-${abiName}.apk"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="false"
android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning">
Expand Down
Binary file modified app/src/main/ic_launcher-web.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/src/main/java/io/wookey/wallet/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class App : Application() {
companion object {
var SYSTEM_DEFAULT_LOCALE: Locale by DelegatesExt.notNullSingleValue()
var instance: App by DelegatesExt.notNullSingleValue()
var newVersion = true
var newVersion = false
}

override fun attachBaseContext(base: Context?) {
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/io/wookey/wallet/base/BaseActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ open class BaseActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// 禁止截图
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
if (hide()) {
window.setFlags(WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE)
}
}

open fun hide(): Boolean = true

var loadingDialog: LoadingDialog? = null

open fun showLoading() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class AssetDetailViewModel : BaseViewModel() {
private fun refresh(firstBlock: Long): Long {
var firstBlockHeight = firstBlock
if (XMRWalletController.isSynchronized()) {
receiveEnabled.postValue(true)
sendEnabled.postValue(true)
synchronized.postValue(R.string.block_synchronized)
synchronizeProgress.postValue(100)
Expand All @@ -167,6 +168,7 @@ class AssetDetailViewModel : BaseViewModel() {
synchronizeProgress.postValue(x)
synchronizing.postValue(n)
} else {
receiveEnabled.postValue(true)
sendEnabled.postValue(true)
synchronized.postValue(R.string.block_synchronized)
synchronizeProgress.postValue(100)
Expand Down Expand Up @@ -215,7 +217,6 @@ class AssetDetailViewModel : BaseViewModel() {

private fun switchNode(node: Node) {

val activeWallet = AppDatabase.getInstance().walletDao().getActiveWallet() ?: return
val wallet = XMRWalletController.getWallet()
// 异常处理
if (wallet == null) {
Expand All @@ -234,6 +235,7 @@ class AssetDetailViewModel : BaseViewModel() {
uiScope.launch {
try {
withContext(Dispatchers.IO) {
val activeWallet = AppDatabase.getInstance().walletDao().getActiveWallet() ?: throw IllegalStateException()
XMRWalletController.stopRefresh()
indeterminate.postValue(null)
connecting.postValue(R.string.block_connecting)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class AssetFragment : BaseFragment() {
adapter.notifyVisibilityChanged(false)
})

viewModel.initVisible()

AppDatabase.getInstance().walletDao().loadActiveWallet().observe(this, Observer { wallet ->
wallet?.let {
centerTitle.text = it.symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ class AssetViewModel : BaseViewModel() {

private var asset: Asset? = null

fun initVisible() {
val visible = sharedPreferences().getBoolean("assetVisible", true)
if (visible) {
assetVisible.call()
} else {
assetInvisible.call()
}
}

fun onItemClick(value: Asset) {
asset = value
showPasswordDialog.call()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ import kotlinx.android.synthetic.main.activity_receive.*
class ReceiveActivity : BaseTitleSecondActivity() {

lateinit var viewModel: ReceiveViewModel
var assetId: Int = -1

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_receive)

val password = intent.getStringExtra("password")
val assetId = intent.getIntExtra("assetId", -1)
assetId = intent.getIntExtra("assetId", -1)

if (password.isNullOrBlank()) {
finish()
Expand Down Expand Up @@ -145,8 +146,12 @@ class ReceiveActivity : BaseTitleSecondActivity() {
})
}

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
viewModel.handleResult(requestCode, resultCode, data)
override fun hide(): Boolean {
return false
}

override fun onResume() {
super.onResume()
viewModel.setAssetId(assetId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ class VerifyMnemonicActivity : BaseTitleSecondActivity() {
if (mnemonic1.text.isNullOrBlank()) {
return@setOnClickListener
}
if (positionList.size != 1) {
return@setOnClickListener
}
mnemonic1.text = ""
positionList.removeAt(0)
adapter.notifyDataSetChanged()
Expand All @@ -123,6 +126,9 @@ class VerifyMnemonicActivity : BaseTitleSecondActivity() {
if (mnemonic2.text.isNullOrBlank()) {
return@setOnClickListener
}
if (positionList.size != 2) {
return@setOnClickListener
}
mnemonic2.text = ""
positionList.removeAt(1)
adapter.notifyDataSetChanged()
Expand All @@ -131,6 +137,9 @@ class VerifyMnemonicActivity : BaseTitleSecondActivity() {
if (mnemonic3.text.isNullOrBlank()) {
return@setOnClickListener
}
if (positionList.size != 3) {
return@setOnClickListener
}
mnemonic3.text = ""
positionList.removeAt(2)
adapter.notifyDataSetChanged()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package io.wookey.wallet.feature.wallet

import android.app.Activity
import android.arch.lifecycle.Observer
import android.arch.lifecycle.ViewModelProviders
import android.content.Intent
import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
Expand Down Expand Up @@ -74,8 +72,6 @@ class AddressSettingActivity : BaseTitleSecondActivity() {

viewModel.dataChanged.observe(this, Observer {
adapter.notifyDataSetChanged()
setResult(Activity.RESULT_OK, Intent().apply { putExtra("subAddress", it) })
finish()
})

viewModel.showLoading.observe(this, Observer { showLoading() })
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/java/io/wookey/wallet/support/Constant.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,5 @@ val nodeArray = arrayOf(
symbol = "XMR"
url = "uwillrunanodesoon.moneroworld.com:18089"
isSelected = false
},
Node().apply {
symbol = "XMR"
url = "124.160.224.28:18081"
isSelected = false
}
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/src/main/res/drawable-xhdpi/icon_splash_wookey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 1 addition & 9 deletions app/src/main/res/layout/activity_splash.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="204dp"
android:layout_marginTop="135dp"
android:src="@drawable/icon_splash_wookey" />

<TextView
style="@style/text_13_93D6CF"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:includeFontPadding="false"
android:text="For Privacy"/>
</LinearLayout>
11 changes: 1 addition & 10 deletions app/src/main/res/layout/activity_wallet.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/icon_wallet" />

<TextView
android:id="@+id/slogan"
style="@style/text_12_004C6D"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="6dp"
android:text="@string/slogan" />
android:src="@drawable/icon_monero_wallet" />

<Space
android:layout_width="match_parent"
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml

This file was deleted.

5 changes: 0 additions & 5 deletions app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml

This file was deleted.

Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary file not shown.
Binary file modified app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
6 changes: 3 additions & 3 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WooKey Wallet</string>
<string name="app_name">Monero Wallet</string>

<string name="slogan">为 隐 私 而 生</string>
<string name="wallet_prompt">使用 WooKey Wallet 至少需要一个钱包,您可以选择创建钱包或导入已有的钱包</string>
<string name="wallet_prompt">使用 Monero Wallet 至少需要一个钱包,您可以选择创建钱包或导入已有的钱包</string>
<string name="create_wallet">创建钱包</string>
<string name="recovery_wallet">导入钱包</string>

Expand Down Expand Up @@ -33,7 +33,7 @@
<string name="recovery_mnemonic">助记词导入</string>
<string name="recovery_private_key">私钥导入</string>
<string name="mnemonic_title">助记词</string>
<string name="mnemonic_prompt">输入助记词,用空格分割</string>
<string name="mnemonic_prompt">输入助记词,用空格分隔</string>
<string name="block_height_prompt">* 为了极大提升区块同步速度,我们强烈建议您填写区块号或近期交易时间</string>
<string name="block_height_optional">区块号(选填)</string>
<string name="transaction_date">近期交易日期(选填)</string>
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">WooKey Wallet</string>
<string name="app_name">Monero Wallet</string>

<string name="slogan">For Privacy</string>
<string name="wallet_prompt">When using WooKey Wallet you must first create a new wallet or restore an existing one.</string>
<string name="wallet_prompt">When using Monero Wallet you must first create a new wallet or restore an existing one.</string>
<string name="create_wallet">Create Wallet</string>
<string name="recovery_wallet">Restore Wallet</string>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ static public RestoreHeight getInstance() {
blockheight.put("2019-03-01", 1781681L);
blockheight.put("2019-04-01", 1803081L);
blockheight.put("2019-05-01", 1824671L);
blockheight.put("2019-06-01", 1847005L);
}

public long getHeight(String date) {
Expand Down

0 comments on commit 71f7940

Please sign in to comment.