1
0

qml: defer intent handling at startup, otherwise it gets lost as the app is not handling the signal yet.

Also defer intent handling until a wallet is opened.
This commit is contained in:
Sander van Grieken
2023-02-27 12:20:51 +01:00
parent 65abb90049
commit 6a6982cdae
2 changed files with 30 additions and 4 deletions

View File

@@ -56,8 +56,6 @@ class QEAppController(BaseCrashReporter, QObject):
sendingBugreportSuccess = pyqtSignal(str)
sendingBugreportFailure = pyqtSignal(str)
_crash_user_text = ''
def __init__(self, qedaemon, plugins):
BaseCrashReporter.__init__(self, None, None, None)
QObject.__init__(self)
@@ -65,6 +63,10 @@ class QEAppController(BaseCrashReporter, QObject):
self._qedaemon = qedaemon
self._plugins = plugins
self._crash_user_text = ''
self._app_started = False
self._intent = ''
# set up notification queue and notification_timer
self.user_notification_queue = queue.Queue()
self.user_notification_last_time = 0
@@ -142,15 +144,23 @@ class QEAppController(BaseCrashReporter, QObject):
self.logger.error(f'unable to bind intent: {repr(e)}')
def on_new_intent(self, intent):
if not self._app_started:
self._intent = intent
return
data = str(intent.getDataString())
self.logger.debug(f'received intent: {repr(data)}')
scheme = str(intent.getScheme()).lower()
if scheme == BITCOIN_BIP21_URI_SCHEME or scheme == LIGHTNING_URI_SCHEME:
self.uriReceived.emit(data)
def startupFinished(self):
self._app_started = True
if self._intent:
self.on_new_intent(self._intent)
@pyqtSlot(str, str)
def doShare(self, data, title):
#if platform != 'android':
#return
try:
from jnius import autoclass, cast
except ImportError:
@@ -352,6 +362,7 @@ class ElectrumQmlApplication(QGuiApplication):
if object is None:
self._valid = False
self.engine.objectCreated.disconnect(self.objectCreated)
self.appController.startupFinished()
def message_handler(self, line, funct, file):
# filter out common harmless messages