mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-26 07:10:37 +01:00
Improved announce handling and announce UI
This commit is contained in:
parent
2c577df27f
commit
19c3c7b562
@ -881,21 +881,27 @@ class SidebandCore():
|
|||||||
db = sqlite3.connect(self.db_path)
|
db = sqlite3.connect(self.db_path)
|
||||||
dbc = db.cursor()
|
dbc = db.cursor()
|
||||||
|
|
||||||
|
query = "delete from announce where id is NULL or id not in (select id from announce order by received desc limit "+str(self.MAX_ANNOUNCES)+")"
|
||||||
|
dbc.execute(query)
|
||||||
|
|
||||||
query = "delete from announce where (source=:source);"
|
query = "delete from announce where (source=:source);"
|
||||||
dbc.execute(query, {"source": destination_hash})
|
dbc.execute(query, {"source": destination_hash})
|
||||||
|
|
||||||
query = "INSERT INTO announce (received, source, data, dest_type) values (?, ?, ?, ?)"
|
now = time.time()
|
||||||
|
hash_material = str(time).encode("utf-8")+destination_hash+app_data+dest_type.encode("utf-8")
|
||||||
|
announce_hash = RNS.Identity.full_hash(hash_material)
|
||||||
|
|
||||||
|
query = "INSERT INTO announce (id, received, source, data, dest_type) values (?, ?, ?, ?, ?)"
|
||||||
data = (
|
data = (
|
||||||
time.time(),
|
announce_hash,
|
||||||
|
now,
|
||||||
destination_hash,
|
destination_hash,
|
||||||
app_data,
|
app_data,
|
||||||
dest_type,
|
dest_type,
|
||||||
)
|
)
|
||||||
|
|
||||||
dbc.execute(query, data)
|
dbc.execute(query, data)
|
||||||
|
db.commit()
|
||||||
query = "delete from announce where id not in (select id from announce order by received desc limit "+str(self.MAX_ANNOUNCES)+")"
|
|
||||||
dbc.execute(query)
|
|
||||||
|
|
||||||
db.commit()
|
db.commit()
|
||||||
db.close()
|
db.close()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import time
|
import time
|
||||||
import RNS
|
import RNS
|
||||||
|
|
||||||
from kivy.metrics import dp
|
from kivy.metrics import dp,sp
|
||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.properties import StringProperty, BooleanProperty
|
from kivy.properties import StringProperty, BooleanProperty
|
||||||
from kivymd.uix.list import MDList, IconLeftWidget, IconRightWidget, OneLineAvatarIconListItem
|
from kivymd.uix.list import MDList, IconLeftWidget, IconRightWidget, OneLineAvatarIconListItem
|
||||||
@ -10,7 +10,7 @@ from kivy.uix.gridlayout import GridLayout
|
|||||||
from kivy.uix.boxlayout import BoxLayout
|
from kivy.uix.boxlayout import BoxLayout
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
|
||||||
from kivymd.uix.button import MDFlatButton
|
from kivymd.uix.button import MDFlatButton, MDRectangleFlatButton
|
||||||
from kivymd.uix.dialog import MDDialog
|
from kivymd.uix.dialog import MDDialog
|
||||||
|
|
||||||
if RNS.vendor.platformutils.get_platform() == "android":
|
if RNS.vendor.platformutils.get_platform() == "android":
|
||||||
@ -128,15 +128,12 @@ class Announces():
|
|||||||
|
|
||||||
def gen_del(dest, item):
|
def gen_del(dest, item):
|
||||||
def x():
|
def x():
|
||||||
yes_button = MDFlatButton(
|
yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
|
||||||
text="Yes",
|
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||||
)
|
|
||||||
no_button = MDFlatButton(
|
|
||||||
text="No",
|
|
||||||
)
|
|
||||||
dialog = MDDialog(
|
dialog = MDDialog(
|
||||||
text="Delete announce?",
|
title="Delete announce?",
|
||||||
buttons=[ yes_button, no_button ],
|
buttons=[ yes_button, no_button ],
|
||||||
|
padding=[0,0,dp(32),0]
|
||||||
# elevation=0,
|
# elevation=0,
|
||||||
)
|
)
|
||||||
def dl_yes(s):
|
def dl_yes(s):
|
||||||
|
Loading…
Reference in New Issue
Block a user