Skip to content

Commit

Permalink
Merge branch 'release-50.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
UweTrottmann committed Sep 18, 2019
2 parents 4431231 + 1670d64 commit 5f0f20e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ Version 50
* 🔧 Movie release times setting also affects popular, search. Watchlist, collection, watched and
details views will start using it.

#### 50.1
*(2019-09-18)*

* 🔨 Add movies to watchlist, collection or watched in all cases when syncing with trakt or Cloud.
On updating to this version the next sync will add missing movies.

#### 50
*(2019-08-14)*

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/java/com/battlelancer/seriesguide/SgApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class SgApp : Application() {
* ListWidgetProvider alarm intent is now explicit.
*/
const val RELEASE_VERSION_40_BETA6 = 1502805
/**
* For trakt and hexagon sync movies were not added in all cases, reset sync times.
*/
const val RELEASE_VERSION_51_BETA4 = 2105103

/**
* The content authority used to identify the SeriesGuide [android.content.ContentProvider].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ public static boolean resetMoviesLastRatedAt(Context context) {
}

/**
* Reset {@link #KEY_LAST_MOVIES_WATCHED_AT} to 0 so all watched movies will be downloaded the
* Remove {@link #KEY_LAST_MOVIES_WATCHED_AT} so all watched movies will be downloaded the
* next time a sync runs.
*/
public static boolean resetMoviesLastWatchedAt(Context context) {
return PreferenceManager.getDefaultSharedPreferences(context)
.edit()
.putLong(TraktSettings.KEY_LAST_MOVIES_WATCHED_AT, 0)
.remove(KEY_LAST_MOVIES_WATCHED_AT)
.commit();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,11 @@ private void onUpgrade() {
}
// new alarm is set automatically as upgrading causes app widgets to update
}
if (lastVersion < SgApp.RELEASE_VERSION_51_BETA4) {
// Movies were not added in all cases when syncing, so ensure they are now.
TraktSettings.resetMoviesLastWatchedAt(this);
HexagonSettings.resetSyncState(this);
}

// set this as lastVersion
editor.putInt(AppSettings.KEY_VERSION, currentVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -389,17 +389,20 @@ public boolean addMovies(

movies.add(movieDetails);

// add to database in batches of at most 10
if (movies.size() == 10 || !iterator.hasNext()) {
// insert into database
// Already add to the database if we have 10 movies so UI can already update.
if (movies.size() == 10) {
context.getContentResolver().bulkInsert(SeriesGuideContract.Movies.CONTENT_URI,
buildMoviesContentValues(movies));

// start new batch
movies.clear();
movies.clear(); // Start a new batch.
}
}

// Insert remaining new movies into the database.
if (!movies.isEmpty()) {
context.getContentResolver().bulkInsert(SeriesGuideContract.Movies.CONTENT_URI,
buildMoviesContentValues(movies));
}

return true;
}

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ buildscript {
'truth': '0.44', // github.com/google/truth/releases

// version 21xxxyy -> min SDK 21, release xxx, build yy
'code': 2105007,
'name': '50',
'code': 2105008,
'name': '50.1',
]
// load some properties that should not be part of version control
if (file('secret.properties').exists()) {
Expand Down

0 comments on commit 5f0f20e

Please sign in to comment.