mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-22 13:30:36 +01:00
Added retry option on failed messages
This commit is contained in:
parent
bab5bd014e
commit
4a6dfa4a47
@ -149,6 +149,7 @@ class Messages():
|
|||||||
titlestr = "[b]Title[/b] "+msg["title"].decode("utf-8")+"\n"
|
titlestr = "[b]Title[/b] "+msg["title"].decode("utf-8")+"\n"
|
||||||
w.heading = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Failed"
|
w.heading = titlestr+"[b]Sent[/b] "+txstr+"\n[b]State[/b] Failed"
|
||||||
m["state"] = msg["state"]
|
m["state"] = msg["state"]
|
||||||
|
w.dmenu.items.append(w.dmenu.retry_item)
|
||||||
|
|
||||||
|
|
||||||
def update_widget(self):
|
def update_widget(self):
|
||||||
@ -240,6 +241,18 @@ class Messages():
|
|||||||
dialog.open()
|
dialog.open()
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
def gen_retry(mhash, mcontent, item):
|
||||||
|
def x():
|
||||||
|
self.app.root.ids.message_text.text = mcontent.decode("utf-8")
|
||||||
|
self.app.sideband.delete_message(mhash)
|
||||||
|
self.app.message_send_action()
|
||||||
|
item.dmenu.dismiss()
|
||||||
|
def cb(dt):
|
||||||
|
self.reload()
|
||||||
|
Clock.schedule_once(cb, 0.2)
|
||||||
|
|
||||||
|
return x
|
||||||
|
|
||||||
def gen_copy(msg, item):
|
def gen_copy(msg, item):
|
||||||
def x():
|
def x():
|
||||||
Clipboard.copy(msg)
|
Clipboard.copy(msg)
|
||||||
@ -346,6 +359,12 @@ class Messages():
|
|||||||
|
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
retry_item = {
|
||||||
|
"viewclass": "OneLineListItem",
|
||||||
|
"text": "Retry",
|
||||||
|
"height": dp(40),
|
||||||
|
"on_release": gen_retry(m["hash"], m["content"], item)
|
||||||
|
}
|
||||||
if m["method"] == LXMF.LXMessage.PAPER:
|
if m["method"] == LXMF.LXMessage.PAPER:
|
||||||
if RNS.vendor.platformutils.is_android():
|
if RNS.vendor.platformutils.is_android():
|
||||||
qr_save_text = "Share QR Code"
|
qr_save_text = "Share QR Code"
|
||||||
@ -411,20 +430,38 @@ class Messages():
|
|||||||
]
|
]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
dm_items = [
|
if m["state"] == LXMF.LXMessage.FAILED:
|
||||||
{
|
dm_items = [
|
||||||
"viewclass": "OneLineListItem",
|
retry_item,
|
||||||
"text": "Copy",
|
{
|
||||||
"height": dp(40),
|
"viewclass": "OneLineListItem",
|
||||||
"on_release": gen_copy(m["content"].decode("utf-8"), item)
|
"text": "Copy",
|
||||||
},
|
"height": dp(40),
|
||||||
{
|
"on_release": gen_copy(m["content"].decode("utf-8"), item)
|
||||||
"text": "Delete",
|
},
|
||||||
"viewclass": "OneLineListItem",
|
{
|
||||||
"height": dp(40),
|
"text": "Delete",
|
||||||
"on_release": gen_del(m["hash"], item)
|
"viewclass": "OneLineListItem",
|
||||||
}
|
"height": dp(40),
|
||||||
]
|
"on_release": gen_del(m["hash"], item)
|
||||||
|
}
|
||||||
|
]
|
||||||
|
else:
|
||||||
|
dm_items = [
|
||||||
|
{
|
||||||
|
"viewclass": "OneLineListItem",
|
||||||
|
"text": "Copy",
|
||||||
|
"height": dp(40),
|
||||||
|
"on_release": gen_copy(m["content"].decode("utf-8"), item)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "Delete",
|
||||||
|
"viewclass": "OneLineListItem",
|
||||||
|
"height": dp(40),
|
||||||
|
"on_release": gen_del(m["hash"], item)
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
item.dmenu = MDDropdownMenu(
|
item.dmenu = MDDropdownMenu(
|
||||||
caller=item.ids.msg_submenu,
|
caller=item.ids.msg_submenu,
|
||||||
@ -434,6 +471,7 @@ class Messages():
|
|||||||
elevation=0,
|
elevation=0,
|
||||||
radius=dp(3),
|
radius=dp(3),
|
||||||
)
|
)
|
||||||
|
item.dmenu.retry_item = retry_item
|
||||||
|
|
||||||
def callback_factory(ref):
|
def callback_factory(ref):
|
||||||
def x(sender):
|
def x(sender):
|
||||||
|
Loading…
Reference in New Issue
Block a user