Skip to content

Commit a8480fb

Browse files
committed
Merge branch 'release/5.42.1'
2 parents a422f63 + 127555f commit a8480fb

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

app/src/main/java/com/duckduckgo/app/browser/BrowserActivity.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,8 @@ import kotlinx.coroutines.*
5151
import org.jetbrains.anko.longToast
5252
import timber.log.Timber
5353
import javax.inject.Inject
54-
import kotlin.coroutines.CoroutineContext
5554

56-
class BrowserActivity : DuckDuckGoActivity(), CoroutineScope {
57-
58-
override val coroutineContext: CoroutineContext
59-
get() = job + Dispatchers.Main
55+
class BrowserActivity : DuckDuckGoActivity(), CoroutineScope by MainScope() {
6056

6157
@Inject
6258
lateinit var clearPersonalDataAction: ClearPersonalDataAction
@@ -70,8 +66,6 @@ class BrowserActivity : DuckDuckGoActivity(), CoroutineScope {
7066
@Inject
7167
lateinit var playStoreUtils: PlayStoreUtils
7268

73-
private val job = SupervisorJob()
74-
7569
private var currentTab: BrowserTabFragment? = null
7670

7771
private val viewModel: BrowserViewModel by bindViewModel()
@@ -84,6 +78,8 @@ class BrowserActivity : DuckDuckGoActivity(), CoroutineScope {
8478

8579
private lateinit var renderer: BrowserStateRenderer
8680

81+
private var openMessageInNewTabJob: Job? = null
82+
8783
@SuppressLint("MissingSuperCall")
8884
override fun onCreate(savedInstanceState: Bundle?) {
8985
super.daggerInject()
@@ -104,7 +100,7 @@ class BrowserActivity : DuckDuckGoActivity(), CoroutineScope {
104100
}
105101

106102
override fun onStop() {
107-
job.cancel()
103+
openMessageInNewTabJob?.cancel()
108104
super.onStop()
109105
}
110106

@@ -302,7 +298,7 @@ class BrowserActivity : DuckDuckGoActivity(), CoroutineScope {
302298
}
303299

304300
fun openMessageInNewTab(message: Message) {
305-
launch {
301+
openMessageInNewTabJob = launch {
306302
val tabId = viewModel.onNewTabRequested()
307303
val fragment = openNewTab(tabId, null, false)
308304
fragment.messageFromPreviousTab = message

app/version/version.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION=5.42.0
1+
VERSION=5.42.1

0 commit comments

Comments
 (0)