mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-22 05:20:36 +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)
|
||||
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);"
|
||||
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 = (
|
||||
time.time(),
|
||||
announce_hash,
|
||||
now,
|
||||
destination_hash,
|
||||
app_data,
|
||||
dest_type,
|
||||
)
|
||||
|
||||
dbc.execute(query, data)
|
||||
|
||||
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()
|
||||
|
@ -1,7 +1,7 @@
|
||||
import time
|
||||
import RNS
|
||||
|
||||
from kivy.metrics import dp
|
||||
from kivy.metrics import dp,sp
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.properties import StringProperty, BooleanProperty
|
||||
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.clock import Clock
|
||||
|
||||
from kivymd.uix.button import MDFlatButton
|
||||
from kivymd.uix.button import MDFlatButton, MDRectangleFlatButton
|
||||
from kivymd.uix.dialog import MDDialog
|
||||
|
||||
if RNS.vendor.platformutils.get_platform() == "android":
|
||||
@ -128,15 +128,12 @@ class Announces():
|
||||
|
||||
def gen_del(dest, item):
|
||||
def x():
|
||||
yes_button = MDFlatButton(
|
||||
text="Yes",
|
||||
)
|
||||
no_button = MDFlatButton(
|
||||
text="No",
|
||||
)
|
||||
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)
|
||||
no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
|
||||
dialog = MDDialog(
|
||||
text="Delete announce?",
|
||||
title="Delete announce?",
|
||||
buttons=[ yes_button, no_button ],
|
||||
padding=[0,0,dp(32),0]
|
||||
# elevation=0,
|
||||
)
|
||||
def dl_yes(s):
|
||||
|
Loading…
Reference in New Issue
Block a user