mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
error handling if something goes wrong when creating a group
This commit is contained in:
parent
91c3ec6c7d
commit
ff50d2f1fd
@ -12,6 +12,7 @@ import android.view.View
|
|||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import kotlinx.android.synthetic.main.activity_create_closed_group.*
|
import kotlinx.android.synthetic.main.activity_create_closed_group.*
|
||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
|
import nl.komponents.kovenant.ui.failUi
|
||||||
import nl.komponents.kovenant.ui.successUi
|
import nl.komponents.kovenant.ui.successUi
|
||||||
import org.session.libsession.messaging.sending_receiving.MessageSender
|
import org.session.libsession.messaging.sending_receiving.MessageSender
|
||||||
import org.session.libsession.messaging.sending_receiving.groupSizeLimit
|
import org.session.libsession.messaging.sending_receiving.groupSizeLimit
|
||||||
@ -123,7 +124,10 @@ class CreateClosedGroupActivity : PassphraseRequiredActionBarActivity(), LoaderM
|
|||||||
openConversationActivity(this, threadID, Recipient.from(this, Address.fromSerialized(groupID), false))
|
openConversationActivity(this, threadID, Recipient.from(this, Address.fromSerialized(groupID), false))
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
|
}.failUi {
|
||||||
|
loaderContainer.fadeOut()
|
||||||
|
isLoading = false
|
||||||
|
Toast.makeText(this, it.message, Toast.LENGTH_LONG).show()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -54,9 +54,12 @@ fun MessageSender.create(name: String, members: Collection<String>): Promise<Str
|
|||||||
for (member in members) {
|
for (member in members) {
|
||||||
val closedGroupControlMessage = ClosedGroupControlMessage(closedGroupUpdateKind)
|
val closedGroupControlMessage = ClosedGroupControlMessage(closedGroupUpdateKind)
|
||||||
closedGroupControlMessage.sentTimestamp = sentTime
|
closedGroupControlMessage.sentTimestamp = sentTime
|
||||||
retryIfNeeded(30) {
|
try {
|
||||||
sendNonDurably(closedGroupControlMessage, Address.fromSerialized(member))
|
sendNonDurably(closedGroupControlMessage, Address.fromSerialized(member)).get()
|
||||||
}.get()
|
} catch (e: Exception) {
|
||||||
|
deferred.reject(e)
|
||||||
|
return@queue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the group to the user's set of public keys to poll for
|
// Add the group to the user's set of public keys to poll for
|
||||||
|
Loading…
Reference in New Issue
Block a user