wip
This commit is contained in:
parent
61ec1b841e
commit
09d3a6e606
|
@ -33,6 +33,7 @@ extension Message {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to recognize if message is omemo-encoded and decode it
|
// Try to recognize if message is omemo-encoded and decode it
|
||||||
|
var secure = false
|
||||||
if let omemo = context?.module(.omemo) {
|
if let omemo = context?.module(.omemo) {
|
||||||
let decodingResult = omemo.decode(message: martinMessage)
|
let decodingResult = omemo.decode(message: martinMessage)
|
||||||
switch decodingResult {
|
switch decodingResult {
|
||||||
|
@ -46,6 +47,7 @@ extension Message {
|
||||||
remotePath: oob
|
remotePath: oob
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
|
secure = true
|
||||||
|
|
||||||
case .successTransportKey:
|
case .successTransportKey:
|
||||||
break
|
break
|
||||||
|
@ -76,7 +78,8 @@ extension Message {
|
||||||
body: martinMessage.body,
|
body: martinMessage.body,
|
||||||
subject: martinMessage.subject,
|
subject: martinMessage.subject,
|
||||||
thread: martinMessage.thread,
|
thread: martinMessage.thread,
|
||||||
oobUrl: martinMessage.oob
|
oobUrl: martinMessage.oob,
|
||||||
|
secure: secure
|
||||||
)
|
)
|
||||||
return msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,8 @@ struct Message: DBStorable, Equatable {
|
||||||
var subject: String?
|
var subject: String?
|
||||||
var thread: String?
|
var thread: String?
|
||||||
var oobUrl: String?
|
var oobUrl: String?
|
||||||
|
|
||||||
|
var secure: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
extension Message {
|
extension Message {
|
||||||
|
@ -97,7 +99,8 @@ extension Message {
|
||||||
body: nil,
|
body: nil,
|
||||||
subject: nil,
|
subject: nil,
|
||||||
thread: nil,
|
thread: nil,
|
||||||
oobUrl: nil
|
oobUrl: nil,
|
||||||
|
secure: false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,14 +94,9 @@ extension Database {
|
||||||
table.primaryKey(["account", "id"], onConflict: .replace)
|
table.primaryKey(["account", "id"], onConflict: .replace)
|
||||||
}
|
}
|
||||||
|
|
||||||
// try db.alter(table: "chats") { table in
|
try db.alter(table: "messages") { table in
|
||||||
// table.add(column: "encryption", .text)
|
table.add(column: "secure", .boolean).notNull().defaults(to: false)
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// try db.alter(table: "messages") { table in
|
|
||||||
// table.add(column: "encryption", .integer)
|
|
||||||
// table.add(column: "fingerprint", .text)
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
migrator.registerMigration("Add settings table") { db in
|
migrator.registerMigration("Add settings table") { db in
|
||||||
|
|
|
@ -29,6 +29,7 @@ extension MessagesStore {
|
||||||
msg.from = roster.bareJid
|
msg.from = roster.bareJid
|
||||||
msg.to = roster.contactBareJid
|
msg.to = roster.contactBareJid
|
||||||
msg.body = message
|
msg.body = message
|
||||||
|
msg.secure = true
|
||||||
|
|
||||||
// store as pending on db, and send
|
// store as pending on db, and send
|
||||||
do {
|
do {
|
||||||
|
|
|
@ -41,6 +41,10 @@ struct MessageAttr: View {
|
||||||
Image(systemName: "clock")
|
Image(systemName: "clock")
|
||||||
.font(.body3)
|
.font(.body3)
|
||||||
.foregroundColor(.Material.Shape.separator)
|
.foregroundColor(.Material.Shape.separator)
|
||||||
|
} else if message.secure {
|
||||||
|
Image(systemName: "lock")
|
||||||
|
.font(.body3)
|
||||||
|
.foregroundColor(.Material.Shape.separator)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue