mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Secure delete full-text fields
This commit is contained in:
parent
8963691778
commit
49cea099b3
@ -1773,8 +1773,14 @@ public final class SqliteValueBox: ValueBox {
|
||||
statement.reset()
|
||||
}
|
||||
|
||||
public func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String) {
|
||||
public func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String, secure: Bool) {
|
||||
if let _ = self.fullTextTables[table.id] {
|
||||
if secure != self.secureDeleteEnabled {
|
||||
self.secureDeleteEnabled = secure
|
||||
let result = database.execute("PRAGMA secure_delete=\(secure ? 1 : 0)")
|
||||
precondition(result)
|
||||
}
|
||||
|
||||
guard let itemIdData = itemId.data(using: .utf8) else {
|
||||
return
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ public protocol ValueBox {
|
||||
func removeRange(_ table: ValueBoxTable, start: ValueBoxKey, end: ValueBoxKey)
|
||||
func fullTextSet(_ table: ValueBoxFullTextTable, collectionId: String, itemId: String, contents: String, tags: String)
|
||||
func fullTextMatch(_ table: ValueBoxFullTextTable, collectionId: String?, query: String, tags: String?, values: (String, String) -> Bool)
|
||||
func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String)
|
||||
func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String, secure: Bool)
|
||||
func removeAllFromTable(_ table: ValueBoxTable)
|
||||
func removeTable(_ table: ValueBoxTable)
|
||||
func renameTable(_ table: ValueBoxTable, to toTable: ValueBoxTable)
|
||||
|
@ -1380,7 +1380,7 @@ final class MessageHistoryTable: Table {
|
||||
}
|
||||
}
|
||||
|
||||
self.valueBox.remove(self.table, key: self.key(index), secure: false)
|
||||
self.valueBox.remove(self.table, key: self.key(index), secure: true)
|
||||
|
||||
let updatedIndex = message.index
|
||||
|
||||
|
@ -66,7 +66,7 @@ final class MessageHistoryTextIndexTable {
|
||||
}
|
||||
|
||||
func remove(messageId: MessageId) {
|
||||
self.valueBox.fullTextRemove(self.table, itemId: itemId(messageId))
|
||||
self.valueBox.fullTextRemove(self.table, itemId: itemId(messageId), secure: true)
|
||||
}
|
||||
|
||||
func search(peerId: PeerId?, text: String, tags: MessageTags?) -> [MessageId] {
|
||||
|
@ -1764,8 +1764,14 @@ public final class SqliteValueBox: ValueBox {
|
||||
statement.reset()
|
||||
}
|
||||
|
||||
public func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String) {
|
||||
public func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String, secure: Bool) {
|
||||
if let _ = self.fullTextTables[table.id] {
|
||||
if secure != self.secureDeleteEnabled {
|
||||
self.secureDeleteEnabled = secure
|
||||
let result = database.execute("PRAGMA secure_delete=\(secure ? 1 : 0)")
|
||||
precondition(result)
|
||||
}
|
||||
|
||||
guard let itemIdData = itemId.data(using: .utf8) else {
|
||||
return
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public protocol ValueBox {
|
||||
func removeRange(_ table: ValueBoxTable, start: ValueBoxKey, end: ValueBoxKey)
|
||||
func fullTextSet(_ table: ValueBoxFullTextTable, collectionId: String, itemId: String, contents: String, tags: String)
|
||||
func fullTextMatch(_ table: ValueBoxFullTextTable, collectionId: String?, query: String, tags: String?, values: (String, String) -> Bool)
|
||||
func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String)
|
||||
func fullTextRemove(_ table: ValueBoxFullTextTable, itemId: String, secure: Bool)
|
||||
func removeAllFromTable(_ table: ValueBoxTable)
|
||||
func removeTable(_ table: ValueBoxTable)
|
||||
func renameTable(_ table: ValueBoxTable, to toTable: ValueBoxTable)
|
||||
|
Loading…
x
Reference in New Issue
Block a user