electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit ccff1c2a88d019c1b02c1e3fc87b6a2c3b8f507a
parent 881694d39d29b746eab01862189ff0a6fa7ec2a4
Author: ThomasV <thomasv@electrum.org>
Date:   Thu, 11 Feb 2016 08:34:40 +0100

kivy: add intent filter for bitcoin scheme

Diffstat:
Mgui/kivy/main_window.py | 19+++++++++++--------
Agui/kivy/tools/bitcoin_intent.xml | 7+++++++
Mgui/kivy/tools/buildozer.spec | 2+-
3 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -66,6 +66,12 @@ class ElectrumWindow(App): language = StringProperty('en') + def on_new_intent(self, intent): + if intent.getScheme() != 'bitcoin': + return + uri = intent.getDataString() + self.uri = uri + def on_language(self, instance, language): Logger.info('language: {}'.format(language)) _.switch_lang(language) @@ -234,7 +240,7 @@ class ElectrumWindow(App): def on_uri(self, instance, uri): if uri: - Logger.info("on uri:", uri) + Logger.info("on uri:" + uri) self.switch_to('send') self.set_URI(uri) @@ -323,6 +329,10 @@ class ElectrumWindow(App): self.uri = self.electrum_config.get('url') # default tab self.switch_to('send' if self.uri else 'history') + # bind intent for bitcoin: URI scheme + if platform == 'android': + from android import activity + activity.bind(on_new_intent=self.on_new_intent) def load_wallet_by_name(self, wallet_path): if not wallet_path: @@ -543,8 +553,6 @@ class ElectrumWindow(App): Logger.Error('Notification: needs plyer; `sudo pip install plyer`') def on_pause(self): - ''' - ''' # pause nfc if self.qrscanner: self.qrscanner.stop() @@ -553,8 +561,6 @@ class ElectrumWindow(App): return True def on_resume(self): - ''' - ''' if self.qrscanner and qrscanner.get_parent_window(): self.qrscanner.start() if self.nfcscanner: @@ -564,9 +570,6 @@ class ElectrumWindow(App): width, height = value self._orientation = 'landscape' if width > height else 'portrait' self._ui_mode = 'tablet' if min(width, height) > inch(3.51) else 'phone' - #Logger.info("size: {} {}".format(width, height)) - #Logger.info('orientation: {}'.format(self._orientation)) - #Logger.info('ui_mode: {}'.format(self._ui_mode)) def set_send(self, address, amount, label, message): self.send_payment(address, amount=amount, label=label, message=message) diff --git a/gui/kivy/tools/bitcoin_intent.xml b/gui/kivy/tools/bitcoin_intent.xml @@ -0,0 +1,7 @@ +<intent-filter > + <action android:name="android.intent.action.VIEW" /> + <action android:name="android.nfc.action.NDEF_DISCOVERED"/> + <category android:name="android.intent.category.DEFAULT" /> + <category android:name="android.intent.category.BROWSABLE" /> + <data android:scheme="bitcoin" /> +</intent-filter> diff --git a/gui/kivy/tools/buildozer.spec b/gui/kivy/tools/buildozer.spec @@ -101,7 +101,7 @@ android.private_storage = True #android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png # (str) XML file to include as an intent filters in <activity> tag -#android.manifest.intent_filters = nfc_filter.xml +android.manifest.intent_filters = gui/kivy/tools/bitcoin_intent.xml # (list) Android additionnal libraries to copy into libs/armeabi #android.add_libs_armeabi = lib/android/*.so