From 8245f835b6e5711b3363851ef70e156ae001bda3 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 1 Jan 2019 17:21:26 -0500 Subject: Close channels after destroy, resolves #1292 --- README.md | 2 +- .../kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt | 4 ++-- .../main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt | 6 +++++- app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt | 2 +- docs/Privacy.md | 4 ++-- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b9a7cff9..b78c1684 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ [Join the Slack Workspace](https://frost-slack.allanwang.ca) **Note** Some keystores are public for the sake of automatic builds and consistent signing across devices. -This means that others can build apps with the same signature. The only valid download sources are through my github releases. +This means that others can build apps with the same signature. The only valid download sources are through my github releases and F-Droid. Frost is a third party Facebook wrapper geared towards design and functionality. It contains many features, including: diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt index 13253bcf..0f3a1e52 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -485,10 +485,10 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, } override fun onDestroy() { - fragmentChannel.close() - headerBadgeChannel.close() controlWebview?.destroy() super.onDestroy() + fragmentChannel.close() + headerBadgeChannel.close() } override fun collapseAppBar() { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt index 9a0c6270..230c1a55 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt @@ -66,7 +66,11 @@ class MainActivity : BaseMainActivity() { } } }) - viewPager.post { fragmentChannel.offer(0); lastPosition = 0 } //trigger hook so title is set + viewPager.post { + if (!fragmentChannel.isClosedForSend) + fragmentChannel.offer(0) + lastPosition = 0 + } //trigger hook so title is set } private fun setupTabs() { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt index ea549026..0000195c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt @@ -209,11 +209,11 @@ abstract class BaseFragment : Fragment(), CoroutineScope, FragmentContract, Dyna } override fun onDestroyView() { + super.onDestroyView() L.i { "Fragment on destroy $position ${hashCode()}" } content?.destroy() content = null detachMainObservable() - super.onDestroyView() } override fun onDestroy() { diff --git a/docs/Privacy.md b/docs/Privacy.md index 9a407cc4..1772eb4b 100644 --- a/docs/Privacy.md +++ b/docs/Privacy.md @@ -4,5 +4,5 @@ Each user is assigned a random id when they install the app, which is used when If you wish, you may disable automatic bug reports in the app settings. Note that Frost still depends on Facebook's mobile site, so you may want to review Facebook's privacy policy before continuing. -Locally, Frost will store your cookie in an app specific folder, which allows for features like multi user accounts. -This is never shared beyond the app itself, \ No newline at end of file +Locally, Frost will store your cookie in an app specific folder, as well as your Facebook user id, which allows for features like multi user accounts. +This is never shared beyond the app itself. \ No newline at end of file -- cgit v1.2.3