Skip to content

Commit 3ddf66e

Browse files
Merge pull request #1370 from session-foundation/fix/store-crashes-07-25
Fixing store issues
2 parents ded7c46 + aa645a2 commit 3ddf66e

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

app/src/main/java/org/thoughtcrime/securesms/MediaPreviewActivity.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import androidx.core.view.WindowCompat
4444
import androidx.core.view.WindowInsetsCompat
4545
import androidx.core.view.updatePadding
4646
import androidx.lifecycle.Observer
47+
import androidx.lifecycle.lifecycleScope
4748
import androidx.loader.app.LoaderManager
4849
import androidx.loader.content.Loader
4950
import androidx.recyclerview.widget.LinearLayoutManager
@@ -53,6 +54,9 @@ import com.bumptech.glide.Glide
5354
import com.bumptech.glide.RequestManager
5455
import com.squareup.phrase.Phrase
5556
import dagger.hilt.android.AndroidEntryPoint
57+
import kotlinx.coroutines.Dispatchers
58+
import kotlinx.coroutines.launch
59+
import kotlinx.coroutines.withContext
5660
import network.loki.messenger.R
5761
import network.loki.messenger.databinding.MediaPreviewActivityBinding
5862
import network.loki.messenger.databinding.MediaViewPageBinding
@@ -455,7 +459,7 @@ class MediaPreviewActivity : ScreenLockActionBarActivity(), RecipientModifiedLis
455459

456460
// If we have an attachment then we can take the filename from it, otherwise we have to take the
457461
// more expensive route of looking up or synthesizing a filename from the MediaItem's Uri.
458-
var mediaFilename = ""
462+
var mediaFilename: String? = null
459463
if (mediaItem.attachment != null) {
460464
mediaFilename = mediaItem.attachment.filename
461465
}
@@ -529,8 +533,10 @@ class MediaPreviewActivity : ScreenLockActionBarActivity(), RecipientModifiedLis
529533
}
530534

531535
DeleteMediaPreviewDialog.show(this){
532-
AttachmentUtil.deleteAttachment(applicationContext, mediaItem.attachment)
533-
finish()
536+
lifecycleScope.launch(Dispatchers.Default) {
537+
AttachmentUtil.deleteAttachment(applicationContext, mediaItem.attachment)
538+
withContext(Dispatchers.Main){ finish() }
539+
}
534540
}
535541
}
536542

app/src/main/java/org/thoughtcrime/securesms/notifications/PushRegistrationHandler.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ constructor(
6565
preferences.pushEnabled,
6666
tokenFetcher.token,
6767
) { _, myAccountId, enabled, token ->
68-
if (!enabled || myAccountId == null || token.isNullOrEmpty()) {
68+
if (!enabled || myAccountId == null || storage.getUserED25519KeyPair() == null || token.isNullOrEmpty()) {
6969
return@combine emptySet<SubscriptionKey>()
7070
}
7171

0 commit comments

Comments
 (0)