mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Fix assertion caused by system-initiated process death
This commit is contained in:
@@ -57,8 +57,12 @@ public class RssFeedActivity extends BriarActivity
|
||||
onBackPressed();
|
||||
}
|
||||
} else if (result == FAILED) {
|
||||
String url = viewModel.getUrlFailedImport();
|
||||
if (url == null) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
RssFeedImportFailedDialogFragment dialog =
|
||||
RssFeedImportFailedDialogFragment.newInstance();
|
||||
RssFeedImportFailedDialogFragment.newInstance(url);
|
||||
dialog.show(getSupportFragmentManager(),
|
||||
RssFeedImportFailedDialogFragment.TAG);
|
||||
} else if (result == EXISTS) {
|
||||
|
||||
@@ -25,8 +25,15 @@ public class RssFeedImportFailedDialogFragment extends DialogFragment {
|
||||
ViewModelProvider.Factory viewModelFactory;
|
||||
private RssFeedViewModel viewModel;
|
||||
|
||||
static RssFeedImportFailedDialogFragment newInstance() {
|
||||
return new RssFeedImportFailedDialogFragment();
|
||||
private static final String ARG_URL = "url";
|
||||
|
||||
static RssFeedImportFailedDialogFragment newInstance(String retryUrl) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_URL, retryUrl);
|
||||
RssFeedImportFailedDialogFragment f =
|
||||
new RssFeedImportFailedDialogFragment();
|
||||
f.setArguments(args);
|
||||
return f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -45,8 +52,8 @@ public class RssFeedImportFailedDialogFragment extends DialogFragment {
|
||||
R.style.BriarDialogTheme);
|
||||
builder.setMessage(R.string.blogs_rss_feeds_import_error);
|
||||
builder.setNegativeButton(R.string.cancel, null);
|
||||
builder.setPositiveButton(R.string.try_again_button,
|
||||
(dialog, which) -> viewModel.retryImportFeed());
|
||||
builder.setPositiveButton(R.string.try_again_button, (dialog, which) ->
|
||||
viewModel.importFeed(requireArguments().getString(ARG_URL)));
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.briarproject.briar.api.feed.Feed;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
|
||||
@@ -159,11 +159,9 @@ class RssFeedViewModel extends DbViewModel {
|
||||
});
|
||||
}
|
||||
|
||||
void retryImportFeed() {
|
||||
if (urlFailedImport == null) {
|
||||
throw new AssertionError();
|
||||
}
|
||||
importFeed(urlFailedImport);
|
||||
@Nullable
|
||||
String getUrlFailedImport() {
|
||||
return urlFailedImport;
|
||||
}
|
||||
|
||||
private boolean exists(String url) {
|
||||
|
||||
Reference in New Issue
Block a user