fixes for android
This commit is contained in:
@@ -23,7 +23,7 @@ from __future__ import absolute_import
|
|||||||
import android
|
import android
|
||||||
|
|
||||||
from electrum import SimpleConfig, Wallet, WalletStorage, format_satoshis
|
from electrum import SimpleConfig, Wallet, WalletStorage, format_satoshis
|
||||||
from electrum.bitcoin import is_valid
|
from electrum.bitcoin import is_address
|
||||||
from electrum import util
|
from electrum import util
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
import datetime, re
|
import datetime, re
|
||||||
@@ -445,7 +445,7 @@ def update_layout():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def pay_to(recipient, amount, fee, label):
|
def pay_to(recipient, amount, label):
|
||||||
|
|
||||||
if wallet.use_encryption:
|
if wallet.use_encryption:
|
||||||
password = droid.dialogGetPassword('Password').result
|
password = droid.dialogGetPassword('Password').result
|
||||||
@@ -457,7 +457,7 @@ def pay_to(recipient, amount, fee, label):
|
|||||||
droid.dialogShow()
|
droid.dialogShow()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tx = wallet.mktx( [(recipient, amount)], password, fee)
|
tx = wallet.mktx( [('address', recipient, amount)], password)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
modal_dialog('error', e.message)
|
modal_dialog('error', e.message)
|
||||||
droid.dialogDismiss()
|
droid.dialogDismiss()
|
||||||
@@ -489,7 +489,7 @@ def make_new_contact():
|
|||||||
if data:
|
if data:
|
||||||
if re.match('^bitcoin:', data):
|
if re.match('^bitcoin:', data):
|
||||||
address, _, _, _, _ = util.parse_URI(data)
|
address, _, _, _, _ = util.parse_URI(data)
|
||||||
elif is_valid(data):
|
elif is_address(data):
|
||||||
address = data
|
address = data
|
||||||
else:
|
else:
|
||||||
address = None
|
address = None
|
||||||
@@ -594,7 +594,7 @@ def payto_loop():
|
|||||||
label = droid.fullQueryDetail("label").result.get('text')
|
label = droid.fullQueryDetail("label").result.get('text')
|
||||||
amount = droid.fullQueryDetail('amount').result.get('text')
|
amount = droid.fullQueryDetail('amount').result.get('text')
|
||||||
|
|
||||||
if not is_valid(recipient):
|
if not is_address(recipient):
|
||||||
modal_dialog('Error','Invalid Bitcoin address')
|
modal_dialog('Error','Invalid Bitcoin address')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -604,7 +604,7 @@ def payto_loop():
|
|||||||
modal_dialog('Error','Invalid amount')
|
modal_dialog('Error','Invalid amount')
|
||||||
continue
|
continue
|
||||||
|
|
||||||
result = pay_to(recipient, amount, wallet.fee, label)
|
result = pay_to(recipient, amount, label)
|
||||||
if result:
|
if result:
|
||||||
out = 'main'
|
out = 'main'
|
||||||
|
|
||||||
@@ -616,7 +616,7 @@ def payto_loop():
|
|||||||
code = droid.scanBarcode()
|
code = droid.scanBarcode()
|
||||||
r = code.result
|
r = code.result
|
||||||
if r:
|
if r:
|
||||||
data = str(r['extras']['SCAN_RESULT'])
|
data = str(r['extras']['SCAN_RESULT']).strip()
|
||||||
if data:
|
if data:
|
||||||
if re.match('^bitcoin:', data):
|
if re.match('^bitcoin:', data):
|
||||||
payto, amount, label, _, _ = util.parse_URI(data)
|
payto, amount, label, _, _ = util.parse_URI(data)
|
||||||
@@ -624,7 +624,7 @@ def payto_loop():
|
|||||||
droid.fullSetProperty("recipient", "text", payto)
|
droid.fullSetProperty("recipient", "text", payto)
|
||||||
droid.fullSetProperty("amount", "text", amount)
|
droid.fullSetProperty("amount", "text", amount)
|
||||||
droid.fullSetProperty("label", "text", label)
|
droid.fullSetProperty("label", "text", label)
|
||||||
elif bitcoin.is_address(data):
|
elif is_address(data):
|
||||||
droid.fullSetProperty("recipient", "text", data)
|
droid.fullSetProperty("recipient", "text", data)
|
||||||
else:
|
else:
|
||||||
modal_dialog('Error','cannot parse QR code\n'+data)
|
modal_dialog('Error','cannot parse QR code\n'+data)
|
||||||
|
|||||||
Reference in New Issue
Block a user