Skip to content

Commit 569f4b0

Browse files
authored
Merge pull request #4652 from owncloud/fix/transfer_list_fragment_crash_from_play_console
[FIX] Crash in TransferListFragment (Play Console)
2 parents faeb671 + 20a4314 commit 569f4b0

4 files changed

Lines changed: 32 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,20 @@ ownCloud admins and users.
3737

3838
## Summary
3939

40+
* Bugfix - Crash from Google Play Console in TransferListFragment: [#4650](https://github.com/owncloud/android/issues/4650)
4041
* Bugfix - Mini-fab for creating new document not always available: [#7277](https://github.com/owncloud/enterprise/issues/7277)
4142

4243
## Details
4344

45+
* Bugfix - Crash from Google Play Console in TransferListFragment: [#4650](https://github.com/owncloud/android/issues/4650)
46+
47+
In order to prevent app crashes, the account parameter from TransferListFragment
48+
has been removed and the newInstance method has been created to pass parameters
49+
safely.
50+
51+
https://github.com/owncloud/android/issues/4650
52+
https://github.com/owncloud/android/pull/4652
53+
4454
* Bugfix - Mini-fab for creating new document not always available: [#7277](https://github.com/owncloud/enterprise/issues/7277)
4555

4656
The productName property has been made nullable to handle cases where it is not

changelog/unreleased/4652

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Bugfix: Crash from Google Play Console in TransferListFragment
2+
3+
In order to prevent app crashes, the account parameter from TransferListFragment has
4+
been removed and the newInstance method has been created to pass parameters safely.
5+
6+
https://github.com/owncloud/android/issues/4650
7+
https://github.com/owncloud/android/pull/4652

owncloudApp/src/main/java/com/owncloud/android/presentation/transfers/TransferListFragment.kt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,12 @@ import org.koin.androidx.viewmodel.ext.android.viewModel
4747
import org.koin.core.parameter.parametersOf
4848
import java.io.File
4949

50-
class TransferListFragment(
51-
private val account: Account
52-
) : Fragment() {
50+
class TransferListFragment : Fragment() {
5351

5452
private val transfersViewModel by viewModel<TransfersViewModel>()
5553
private val capabilityViewModel: CapabilityViewModel by viewModel {
5654
parametersOf(
57-
account.name,
55+
requireArguments().getString(ARG_ACCOUNT_NAME),
5856
)
5957
}
6058

@@ -141,4 +139,16 @@ class TransferListFragment(
141139
}
142140
transfersAdapter.setData(transfersWithSpace)
143141
}
142+
143+
companion object {
144+
private const val ARG_ACCOUNT_NAME = "ACCOUNT_NAME"
145+
146+
@JvmStatic
147+
fun newInstance(account: Account): TransferListFragment {
148+
val args = Bundle().apply {
149+
putString(ARG_ACCOUNT_NAME, account.name)
150+
}
151+
return TransferListFragment().apply { arguments = args }
152+
}
153+
}
144154
}

owncloudApp/src/main/java/com/owncloud/android/ui/activity/UploadListActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected void onCreate(Bundle savedInstanceState) {
9494

9595
private void createUploadListFragment() {
9696
//UploadListFragment uploadList = new UploadListFragment();
97-
TransferListFragment uploadList = new TransferListFragment(getAccount());
97+
TransferListFragment uploadList = TransferListFragment.newInstance(getAccount());
9898
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
9999
transaction.add(R.id.left_fragment_container, uploadList, TAG_UPLOAD_LIST_FRAGMENT);
100100
transaction.commit();

0 commit comments

Comments
 (0)