Compare commits

...

10 commits

Author SHA1 Message Date
Josephine Lim
66e1539a1e
Update changelog.md 2019-03-01 02:58:31 +10:00
Josephine Lim
721c6f9903 Versioning for v2.10.2 2019-03-01 02:57:32 +10:00
Josephine Lim
12a91c68f4 Merge branch '2.10-release' into 2.10-release-fork 2019-03-01 02:28:38 +10:00
Ashish Kumar
e90049bb31 Bug fix issue #2476 (#2526)
* Added wikidataEntityID in all db versions, handled db.execSql via method runQuery
2019-03-01 02:26:08 +10:00
Vivek Maskara
36847105e3 Fix duplicate param information (#2515) 2019-03-01 02:25:42 +10:00
Josephine Lim
89bf96953a
Update changelog.md 2019-02-21 20:47:59 +10:00
Josephine Lim
484af7f052 Versioning for v2.10.1 2019-02-21 20:45:48 +10:00
Josephine Lim
0a894dc415 Merge branch '2.10-release' into 2.10-release-fork 2019-02-21 19:21:09 +10:00
Josephine Lim
4a08a12996 Update build.gradle 2019-02-13 02:32:08 +10:00
Josephine Lim
3de1807391
Update changelog.md 2019-02-13 02:22:56 +10:00
5 changed files with 38 additions and 26 deletions

View file

@ -1,5 +1,9 @@
# Wikimedia Commons for Android
## v2.10.2
- Fixed remaining issues with date image taken
- Fixed database crash
## v2.10.1
- Fixed "stuck before category selection screen" bug
- Fixed notification taps

View file

@ -97,8 +97,8 @@ android {
defaultConfig {
applicationId 'fr.free.nrw.commons'
versionCode 226
versionName '2.10.1'
versionCode 243
versionName '2.10.2'
setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName())
minSdkVersion 15

View file

@ -25,7 +25,7 @@ import static java.lang.annotation.RetentionPolicy.SOURCE;
public class Contribution extends Media {
//{{According to EXIF data|2009-01-09}}
private static final String TEMPLATE_DATE_ACC_TO_EXIF = "|date={{According to EXIF data|%s}}";
private static final String TEMPLATE_DATE_ACC_TO_EXIF = "{{According to EXIF data|%s}}";
//{{date|2009|1|9}} 9 January 2009
private static final String TEMPLATE_DATA_OTHER_SOURCE = "{{date|%d|%d|%d}}";

View file

@ -4,19 +4,18 @@ import android.content.ContentProviderClient;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteException;
import android.net.Uri;
import android.os.RemoteException;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import fr.free.nrw.commons.settings.Prefs;
import fr.free.nrw.commons.utils.StringUtils;
import java.util.Date;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Provider;
import fr.free.nrw.commons.settings.Prefs;
import fr.free.nrw.commons.utils.StringUtils;
import timber.log.Timber;
import static fr.free.nrw.commons.contributions.ContributionDao.Table.ALL_FIELDS;
import static fr.free.nrw.commons.contributions.ContributionDao.Table.COLUMN_WIKI_DATA_ENTITY_ID;
@ -262,16 +261,20 @@ public class ContributionDao {
if (from == to) {
return;
}
//Considering the crashes we have been facing recently, lets blindly add this column to any table which has ever existed
runQuery(db,ADD_WIKI_DATA_ENTITY_ID_FIELD);
if (from == 1) {
db.execSQL(ADD_DESCRIPTION_FIELD);
db.execSQL(ADD_CREATOR_FIELD);
runQuery(db,ADD_DESCRIPTION_FIELD);
runQuery(db,ADD_CREATOR_FIELD);
from++;
onUpdate(db, from, to);
return;
}
if (from == 2) {
db.execSQL(ADD_MULTIPLE_FIELD);
db.execSQL(SET_DEFAULT_MULTIPLE);
runQuery(db, ADD_MULTIPLE_FIELD);
runQuery(db, SET_DEFAULT_MULTIPLE);
from++;
onUpdate(db, from, to);
return;
@ -290,23 +293,34 @@ public class ContributionDao {
}
if (from == 5) {
// Added width and height fields
db.execSQL(ADD_WIDTH_FIELD);
db.execSQL(SET_DEFAULT_WIDTH);
db.execSQL(ADD_HEIGHT_FIELD);
db.execSQL(SET_DEFAULT_HEIGHT);
db.execSQL(ADD_LICENSE_FIELD);
db.execSQL(SET_DEFAULT_LICENSE);
runQuery(db, ADD_WIDTH_FIELD);
runQuery(db, SET_DEFAULT_WIDTH);
runQuery(db, ADD_HEIGHT_FIELD);
runQuery(db, SET_DEFAULT_HEIGHT);
runQuery(db, ADD_LICENSE_FIELD);
runQuery(db, SET_DEFAULT_LICENSE);
from++;
onUpdate(db, from, to);
return;
}
if (from > 5) {
// Added place field
db.execSQL(ADD_WIKI_DATA_ENTITY_ID_FIELD);
from++;
from=to;
onUpdate(db, from, to);
return;
}
}
/**
* perform the db.execSQl with handled exceptions
*/
private static void runQuery(SQLiteDatabase db, String query) {
try {
db.execSQL(query);
} catch (SQLiteException e) {
Timber.e("Exception performing query: " + query + " message: " + e.getMessage());
}
}
}
}

View file

@ -78,17 +78,11 @@ class ContributionDaoTest {
@Test
fun upgradeDatabase_v3_to_v4() {
Table.onUpdate(database, 3, 4)
// No changes
verifyZeroInteractions(database)
}
@Test
fun upgradeDatabase_v4_to_v5() {
Table.onUpdate(database, 4, 5)
// No changes
verifyZeroInteractions(database)
}
@Test