mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-25 11:05:25 +00:00
fix: new community doesn't break persisting config if the .add request fails
This commit is contained in:
parent
f19be7d6ab
commit
05f8dc6d43
@ -551,8 +551,12 @@ open class Storage(context: Context, helper: SQLCipherOpenHelper, private val co
|
|||||||
val groupBaseCommunity = groupInfo.community
|
val groupBaseCommunity = groupInfo.community
|
||||||
if (groupBaseCommunity.fullUrl() !in existingJoinUrls) {
|
if (groupBaseCommunity.fullUrl() !in existingJoinUrls) {
|
||||||
// add it
|
// add it
|
||||||
|
try {
|
||||||
val (threadId, _) = OpenGroupManager.add(groupBaseCommunity.baseUrl, groupBaseCommunity.room, groupBaseCommunity.pubKeyHex, context)
|
val (threadId, _) = OpenGroupManager.add(groupBaseCommunity.baseUrl, groupBaseCommunity.room, groupBaseCommunity.pubKeyHex, context)
|
||||||
threadDb.setPinned(threadId, groupInfo.priority == PRIORITY_PINNED)
|
threadDb.setPinned(threadId, groupInfo.priority == PRIORITY_PINNED)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("Loki", "Failed to get Open Group Info on syncing config",e)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
val (threadId, _) = existingCommunities.entries.first { (_, v) -> v.joinURL == groupInfo.community.fullUrl() }
|
val (threadId, _) = existingCommunities.entries.first { (_, v) -> v.joinURL == groupInfo.community.fullUrl() }
|
||||||
threadDb.setPinned(threadId, groupInfo.priority == PRIORITY_PINNED)
|
threadDb.setPinned(threadId, groupInfo.priority == PRIORITY_PINNED)
|
||||||
|
Loading…
Reference in New Issue
Block a user