Merge remote-tracking branch 'pserwylo/cmorgner-master'
This commit is contained in:
commit
0c0342b12f
@ -169,14 +169,12 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
+ "maxage integer not null default 0, "
|
+ "maxage integer not null default 0, "
|
||||||
+ "version integer not null default 0, "
|
+ "version integer not null default 0, "
|
||||||
+ "lastetag text, "
|
+ "lastetag text, "
|
||||||
+ "lastUpdated string,"
|
+ "lastUpdated string);";
|
||||||
+ "username string, password string"
|
|
||||||
+ ");";
|
|
||||||
|
|
||||||
db.execSQL(createTableDdl);
|
db.execSQL(createTableDdl);
|
||||||
|
|
||||||
String nonIdFields = "address, name, description, inuse, priority, " +
|
String nonIdFields = "address, name, description, inuse, priority, " +
|
||||||
"pubkey, fingerprint, maxage, version, lastetag, lastUpdated, username, password";
|
"pubkey, fingerprint, maxage, version, lastetag, lastUpdated";
|
||||||
|
|
||||||
String insertSql = "INSERT INTO " + TABLE_REPO +
|
String insertSql = "INSERT INTO " + TABLE_REPO +
|
||||||
"(_id, " + nonIdFields + " ) " +
|
"(_id, " + nonIdFields + " ) " +
|
||||||
@ -285,11 +283,11 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
populateRepoNames(db, oldVersion);
|
populateRepoNames(db, oldVersion);
|
||||||
if (oldVersion < 43) createInstalledApp(db);
|
if (oldVersion < 43) createInstalledApp(db);
|
||||||
addIsSwapToRepo(db, oldVersion);
|
addIsSwapToRepo(db, oldVersion);
|
||||||
addCredentialsToRepo(db, oldVersion);
|
|
||||||
addChangelogToApp(db, oldVersion);
|
addChangelogToApp(db, oldVersion);
|
||||||
addIconUrlLargeToApp(db, oldVersion);
|
addIconUrlLargeToApp(db, oldVersion);
|
||||||
updateIconUrlLarge(db, oldVersion);
|
updateIconUrlLarge(db, oldVersion);
|
||||||
recreateInstalledCache(db, oldVersion);
|
recreateInstalledCache(db, oldVersion);
|
||||||
|
addCredentialsToRepo(db, oldVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,11 +423,16 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void addCredentialsToRepo(SQLiteDatabase db, int oldVersion) {
|
private void addCredentialsToRepo(SQLiteDatabase db, int oldVersion) {
|
||||||
if (oldVersion < 52 && !columnExists(db, TABLE_REPO, "username") && !columnExists(db, TABLE_REPO, "password")) {
|
if (oldVersion < 52) {
|
||||||
Utils.debugLog(TAG, "Adding username field to " + TABLE_REPO + " table in db.");
|
if (!columnExists(db, TABLE_REPO, "username")) {
|
||||||
db.execSQL("alter table " + TABLE_REPO + " add column username string;");
|
Utils.debugLog(TAG, "Adding username field to " + TABLE_REPO + " table in db.");
|
||||||
Utils.debugLog(TAG, "Adding password field to " + TABLE_REPO + " table in db.");
|
db.execSQL("alter table " + TABLE_REPO + " add column username string;");
|
||||||
db.execSQL("alter table " + TABLE_REPO + " add column password string;");
|
}
|
||||||
|
|
||||||
|
if (!columnExists(db, TABLE_REPO, "password")) {
|
||||||
|
Utils.debugLog(TAG, "Adding password field to " + TABLE_REPO + " table in db.");
|
||||||
|
db.execSQL("alter table " + TABLE_REPO + " add column password string;");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
// create repo without username/password
|
// create repo without username/password
|
||||||
createNewRepo(newAddress, fingerprint, null, null);
|
createNewRepo(newAddress, fingerprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -564,7 +564,7 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
// or their internet is playing up, then you'd have to wait for several
|
// or their internet is playing up, then you'd have to wait for several
|
||||||
// connection timeouts before being able to proceed.
|
// connection timeouts before being able to proceed.
|
||||||
|
|
||||||
createNewRepo(originalAddress, fingerprint, null, null);
|
createNewRepo(originalAddress, fingerprint);
|
||||||
checker.cancel(false);
|
checker.cancel(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -600,6 +600,13 @@ public class ManageReposActivity extends ActionBarActivity {
|
|||||||
path, uri.getQuery(), uri.getFragment()).toString();
|
path, uri.getQuery(), uri.getFragment()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a repository without a username or password.
|
||||||
|
*/
|
||||||
|
private void createNewRepo(String address, String fingerprint) {
|
||||||
|
createNewRepo(address, fingerprint, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
private void createNewRepo(String address, String fingerprint, final String username, final String password) {
|
private void createNewRepo(String address, String fingerprint, final String username, final String password) {
|
||||||
try {
|
try {
|
||||||
address = normalizeUrl(address);
|
address = normalizeUrl(address);
|
||||||
|
@ -390,7 +390,7 @@ public class RepoDetailsActivity extends ActionBarActivity {
|
|||||||
final String name = nameInput.getText().toString();
|
final String name = nameInput.getText().toString();
|
||||||
final String password = passwordInput.getText().toString();
|
final String password = passwordInput.getText().toString();
|
||||||
|
|
||||||
if (name != null && !name.isEmpty()) {
|
if (!TextUtils.isEmpty(name)) {
|
||||||
|
|
||||||
final ContentValues values = new ContentValues(2);
|
final ContentValues values = new ContentValues(2);
|
||||||
values.put(RepoProvider.DataColumns.USERNAME, name);
|
values.put(RepoProvider.DataColumns.USERNAME, name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user