mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Fixed a couple of minor bugs
Fixed a bug where the volatile info would remain after removing the conversation Fixed a bug where sending a message wasn't correctly jumping to the bottom of the conversation
This commit is contained in:
parent
a6699f0c58
commit
8f39fe6972
5 changed files with 75 additions and 9 deletions
|
@ -826,11 +826,16 @@ final class ConversationVC: BaseVC, ConversationSearchControllerDelegate, UITabl
|
|||
self.viewModel.updateInteractionData(updatedData)
|
||||
self.tableView.reloadData()
|
||||
|
||||
// We need to dispatch to the next run loop because it seems trying to scroll immediately after
|
||||
// triggering a 'reloadData' doesn't work
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.scrollToBottom(isAnimated: false)
|
||||
|
||||
// Note: The scroll button alpha won't get set correctly in this case so we forcibly set it to
|
||||
// have an alpha of 0 to stop it appearing buggy
|
||||
self.scrollToBottom(isAnimated: false)
|
||||
self.scrollButton.alpha = 0
|
||||
self.unreadCountView.alpha = scrollButton.alpha
|
||||
self?.scrollButton.alpha = 0
|
||||
self?.unreadCountView.alpha = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -72,10 +72,7 @@ public enum SyncPushTokensJob: JobExecutor {
|
|||
PushRegistrationManager.shared.requestPushTokens()
|
||||
.subscribe(on: queue)
|
||||
.flatMap { (pushToken: String, voipToken: String) -> AnyPublisher<Void, Error> in
|
||||
let lastPushToken: String? = Storage.shared[.lastRecordedPushToken]
|
||||
let lastVoipToken: String? = Storage.shared[.lastRecordedVoipToken]
|
||||
|
||||
return Deferred {
|
||||
Deferred {
|
||||
Future<Void, Error> { resolver in
|
||||
SyncPushTokensJob.registerForPushNotifications(
|
||||
pushToken: pushToken,
|
||||
|
|
|
@ -223,6 +223,8 @@ internal extension SessionUtil {
|
|||
db,
|
||||
Profile.Columns.nickname.set(to: nil)
|
||||
)
|
||||
|
||||
try SessionUtil.remove(db, volatileContactIds: contactIdsToRemove)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -288,6 +288,52 @@ internal extension SessionUtil {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
static func remove(_ db: Database, volatileContactIds: [String]) throws {
|
||||
try SessionUtil.performAndPushChange(
|
||||
db,
|
||||
for: .convoInfoVolatile,
|
||||
publicKey: getUserHexEncodedPublicKey(db)
|
||||
) { conf in
|
||||
volatileContactIds.forEach { contactId in
|
||||
var cSessionId: [CChar] = contactId.cArray
|
||||
|
||||
// Don't care if the data doesn't exist
|
||||
convo_info_volatile_erase_1to1(conf, &cSessionId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func remove(_ db: Database, volatileLegacyGroupIds: [String]) throws {
|
||||
try SessionUtil.performAndPushChange(
|
||||
db,
|
||||
for: .convoInfoVolatile,
|
||||
publicKey: getUserHexEncodedPublicKey(db)
|
||||
) { conf in
|
||||
volatileLegacyGroupIds.forEach { legacyGroupId in
|
||||
var cLegacyGroupId: [CChar] = legacyGroupId.cArray
|
||||
|
||||
// Don't care if the data doesn't exist
|
||||
convo_info_volatile_erase_legacy_group(conf, &cLegacyGroupId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static func remove(_ db: Database, volatileCommunityInfo: [OpenGroupUrlInfo]) throws {
|
||||
try SessionUtil.performAndPushChange(
|
||||
db,
|
||||
for: .convoInfoVolatile,
|
||||
publicKey: getUserHexEncodedPublicKey(db)
|
||||
) { conf in
|
||||
volatileCommunityInfo.forEach { urlInfo in
|
||||
var cBaseUrl: [CChar] = urlInfo.server.cArray
|
||||
var cRoom: [CChar] = urlInfo.roomToken.cArray
|
||||
|
||||
// Don't care if the data doesn't exist
|
||||
convo_info_volatile_erase_community(conf, &cBaseUrl, &cRoom)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - External Outgoing Changes
|
||||
|
|
|
@ -516,6 +516,19 @@ public extension SessionUtil {
|
|||
// Don't care if the community doesn't exist
|
||||
user_groups_erase_community(conf, &cBaseUrl, &cRoom)
|
||||
}
|
||||
|
||||
// Remove the volatile info as well
|
||||
try SessionUtil.remove(
|
||||
db,
|
||||
volatileCommunityInfo: [
|
||||
OpenGroupUrlInfo(
|
||||
threadId: OpenGroup.idFor(roomToken: roomToken, server: server),
|
||||
server: server,
|
||||
roomToken: roomToken,
|
||||
publicKey: ""
|
||||
)
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: -- Legacy Group Changes
|
||||
|
@ -634,6 +647,9 @@ public extension SessionUtil {
|
|||
user_groups_erase_legacy_group(conf, &cGroupId)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove the volatile info as well
|
||||
try SessionUtil.remove(db, volatileLegacyGroupIds: legacyGroupIds)
|
||||
}
|
||||
|
||||
// MARK: -- Group Changes
|
||||
|
|
Loading…
Reference in a new issue