Updates based on QA feedback
This commit is contained in:
parent
5d70a3cc38
commit
bd4631126d
@ -137,9 +137,9 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||
feedUrl = feedUrl.replaceFirst("((www.)?(subscribeonandroid.com/))", "");
|
||||
}
|
||||
if (savedInstanceState == null) {
|
||||
startFeedDownload(feedUrl, null, null, true);
|
||||
startFeedDownload(feedUrl, null, null);
|
||||
} else {
|
||||
startFeedDownload(feedUrl, savedInstanceState.getString("username"), savedInstanceState.getString("password"), true);
|
||||
startFeedDownload(feedUrl, savedInstanceState.getString("username"), savedInstanceState.getString("password"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -223,7 +223,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
private void startFeedDownload(String url, String username, String password, boolean initiatedByUser) {
|
||||
private void startFeedDownload(String url, String username, String password) {
|
||||
Log.d(TAG, "Starting feed download");
|
||||
url = URLChecker.prepareURL(url);
|
||||
feed = new Feed(url, null);
|
||||
@ -235,7 +235,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||
feed.setFile_url(fileUrl);
|
||||
final DownloadRequest request = new DownloadRequest(feed.getFile_url(),
|
||||
feed.getDownload_url(), "OnlineFeed", 0, Feed.FEEDFILETYPE_FEED, username, password,
|
||||
true, null, initiatedByUser);
|
||||
true, null, true);
|
||||
|
||||
download = Observable.fromCallable(() -> {
|
||||
feeds = DBReader.getFeedList();
|
||||
@ -589,9 +589,9 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||
resetIntent(selectedUrl, titles.get(which));
|
||||
FeedPreferences prefs = feed.getPreferences();
|
||||
if(prefs != null) {
|
||||
startFeedDownload(selectedUrl, prefs.getUsername(), prefs.getPassword(), true);
|
||||
startFeedDownload(selectedUrl, prefs.getUsername(), prefs.getPassword());
|
||||
} else {
|
||||
startFeedDownload(selectedUrl, null, null, true);
|
||||
startFeedDownload(selectedUrl, null, null);
|
||||
}
|
||||
};
|
||||
|
||||
@ -627,7 +627,7 @@ public class OnlineFeedViewActivity extends AppCompatActivity {
|
||||
|
||||
@Override
|
||||
protected void onConfirmed(String username, String password, boolean saveUsernamePassword) {
|
||||
startFeedDownload(feedUrl, username, password, true);
|
||||
startFeedDownload(feedUrl, username, password);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,11 +36,11 @@
|
||||
android:summary="@string/pref_showDownloadReport_sum"
|
||||
android:title="@string/pref_showDownloadReport_title"/>
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:enabled="true"
|
||||
android:key="prefShowAutoDownloadReport"
|
||||
android:summary="@string/pref_showAutoDownloadReport_sum"
|
||||
android:title="@string/pref_showAutoDownloadReport_title"/>
|
||||
android:defaultValue="false"
|
||||
android:enabled="true"
|
||||
android:key="prefShowAutoDownloadReport"
|
||||
android:summary="@string/pref_showAutoDownloadReport_sum"
|
||||
android:title="@string/pref_showAutoDownloadReport_title"/>
|
||||
<Preference
|
||||
android:key="prefProxy"
|
||||
android:summary="@string/pref_proxy_sum"
|
||||
|
@ -31,7 +31,7 @@ public class FeedUpdateWorker extends Worker {
|
||||
ClientConfig.initialize(getApplicationContext());
|
||||
|
||||
if (NetworkUtils.networkAvailable() && NetworkUtils.isFeedRefreshAllowed()) {
|
||||
DBTasks.refreshAllFeeds(getApplicationContext());
|
||||
DBTasks.refreshAllFeeds(getApplicationContext(), false);
|
||||
} else {
|
||||
Log.d(TAG, "Blocking automatic update: no wifi available / no mobile updates allowed");
|
||||
}
|
||||
|
@ -107,10 +107,9 @@ public class DownloadServiceNotification {
|
||||
for (DownloadStatus status : reportQueue) {
|
||||
if (status.isSuccessful()) {
|
||||
successfulDownloads++;
|
||||
createReport = createReport || showAutoDownloadReport && !status.isInitiatedByUser() && status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA;
|
||||
} else if (!status.isCancelled()) {
|
||||
failedDownloads++;
|
||||
}
|
||||
if (failedDownloads > 0 || showAutoDownloadReport && !status.isInitiatedByUser() && status.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {
|
||||
createReport = true;
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ public class DownloadStatus {
|
||||
DownloadError reason,
|
||||
boolean successful,
|
||||
boolean cancelled,
|
||||
String reasonDetailed,
|
||||
boolean initiatedByUser) {
|
||||
String reasonDetailed) {
|
||||
this(0,
|
||||
request.getTitle(),
|
||||
request.getFeedfileId(),
|
||||
@ -63,7 +62,7 @@ public class DownloadStatus {
|
||||
reason,
|
||||
new Date(),
|
||||
reasonDetailed,
|
||||
initiatedByUser);
|
||||
request.isInitiatedByUser());
|
||||
}
|
||||
|
||||
/** Constructor for creating new completed downloads. */
|
||||
|
@ -29,7 +29,7 @@ public abstract class Downloader implements Callable<Downloader> {
|
||||
this.request = request;
|
||||
this.request.setStatusMsg(R.string.download_pending);
|
||||
this.cancelled = false;
|
||||
this.result = new DownloadStatus(request, null, false, false, null, request.isInitiatedByUser());
|
||||
this.result = new DownloadStatus(request, null, false, false, null);
|
||||
}
|
||||
|
||||
protected abstract void download();
|
||||
|
@ -105,8 +105,9 @@ public final class DBTasks {
|
||||
* enqueuing Feeds for download from a previous call
|
||||
*
|
||||
* @param context Might be used for accessing the database
|
||||
* @param initiatedByUser a boolean indicating if the refresh was triggered by user action.
|
||||
*/
|
||||
public static void refreshAllFeeds(final Context context) {
|
||||
public static void refreshAllFeeds(final Context context, boolean initiatedByUser) {
|
||||
if (!isRefreshing.compareAndSet(false, true)) {
|
||||
Log.d(TAG, "Ignoring request to refresh all feeds: Refresh lock is locked");
|
||||
return;
|
||||
@ -116,7 +117,7 @@ public final class DBTasks {
|
||||
throw new IllegalStateException("DBTasks.refreshAllFeeds() must not be called from the main thread.");
|
||||
}
|
||||
|
||||
refreshFeeds(context, DBReader.getFeedList());
|
||||
refreshFeeds(context, DBReader.getFeedList(), initiatedByUser);
|
||||
isRefreshing.set(false);
|
||||
|
||||
SharedPreferences prefs = context.getSharedPreferences(PREF_NAME, MODE_PRIVATE);
|
||||
@ -134,9 +135,11 @@ public final class DBTasks {
|
||||
/**
|
||||
* @param context
|
||||
* @param feedList the list of feeds to refresh
|
||||
* @param initiatedByUser a boolean indicating if the refresh was triggered by user action.
|
||||
*/
|
||||
private static void refreshFeeds(final Context context,
|
||||
final List<Feed> feedList) {
|
||||
final List<Feed> feedList,
|
||||
boolean initiatedByUser) {
|
||||
|
||||
for (Feed feed : feedList) {
|
||||
FeedPreferences prefs = feed.getPreferences();
|
||||
@ -153,7 +156,7 @@ public final class DBTasks {
|
||||
DownloadError.ERROR_REQUEST_ERROR,
|
||||
false,
|
||||
e.getMessage(),
|
||||
false)
|
||||
initiatedByUser)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ public class AutoUpdateManager {
|
||||
public static void runImmediate(@NonNull Context context) {
|
||||
Log.d(TAG, "Run auto update immediately in background.");
|
||||
new Thread(() -> {
|
||||
DBTasks.refreshAllFeeds(context.getApplicationContext());
|
||||
DBTasks.refreshAllFeeds(context.getApplicationContext(), true);
|
||||
}, "ManualRefreshAllFeeds").start();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user