Implemented methods needed for chan support (no GUI yet, though)
This commit is contained in:
parent
59f0bc7b74
commit
0ecfbd3fb8
@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
|
|||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 23
|
compileSdkVersion 23
|
||||||
buildToolsVersion "23.0.2"
|
buildToolsVersion "23.0.3"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "ch.dissem.apps.abit"
|
applicationId "ch.dissem.apps.abit"
|
||||||
@ -29,12 +29,12 @@ android {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.jabitVersion = '1.0.1'
|
ext.jabitVersion = '1.1.0-SNAPSHOT'
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
compile 'com.android.support:appcompat-v7:23.1.1'
|
compile 'com.android.support:appcompat-v7:23.3.0'
|
||||||
compile 'com.android.support:support-v4:23.1.1'
|
compile 'com.android.support:support-v4:23.3.0'
|
||||||
compile 'com.android.support:design:23.1.1'
|
compile 'com.android.support:design:23.3.0'
|
||||||
|
|
||||||
compile "ch.dissem.jabit:jabit-core:$jabitVersion"
|
compile "ch.dissem.jabit:jabit-core:$jabitVersion"
|
||||||
compile "ch.dissem.jabit:jabit-networking:$jabitVersion"
|
compile "ch.dissem.jabit:jabit-networking:$jabitVersion"
|
||||||
@ -58,6 +58,9 @@ dependencies {
|
|||||||
compile 'io.github.yavski:fab-speed-dial:1.0.2'
|
compile 'io.github.yavski:fab-speed-dial:1.0.2'
|
||||||
|
|
||||||
compile 'com.github.amlcurran.showcaseview:library:5.4.0'
|
compile 'com.github.amlcurran.showcaseview:library:5.4.0'
|
||||||
|
|
||||||
|
testCompile 'junit:junit:4.12'
|
||||||
|
testCompile 'org.mockito:mockito-core:1.10.19'
|
||||||
}
|
}
|
||||||
|
|
||||||
idea.module {
|
idea.module {
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE Address ADD COLUMN chan BIT NOT NULL DEFAULT '0';
|
@ -52,6 +52,7 @@ public class AndroidAddressRepository implements AddressRepository {
|
|||||||
private static final String COLUMN_PUBLIC_KEY = "public_key";
|
private static final String COLUMN_PUBLIC_KEY = "public_key";
|
||||||
private static final String COLUMN_PRIVATE_KEY = "private_key";
|
private static final String COLUMN_PRIVATE_KEY = "private_key";
|
||||||
private static final String COLUMN_SUBSCRIBED = "subscribed";
|
private static final String COLUMN_SUBSCRIBED = "subscribed";
|
||||||
|
private static final String COLUMN_CHAN = "chan";
|
||||||
|
|
||||||
private final SqlHelper sql;
|
private final SqlHelper sql;
|
||||||
|
|
||||||
@ -88,6 +89,11 @@ public class AndroidAddressRepository implements AddressRepository {
|
|||||||
return find("private_key IS NOT NULL");
|
return find("private_key IS NOT NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BitmessageAddress> getChans() {
|
||||||
|
return find("chan = '1'");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BitmessageAddress> getSubscriptions() {
|
public List<BitmessageAddress> getSubscriptions() {
|
||||||
return find("subscribed = '1'");
|
return find("subscribed = '1'");
|
||||||
@ -117,7 +123,8 @@ public class AndroidAddressRepository implements AddressRepository {
|
|||||||
COLUMN_ALIAS,
|
COLUMN_ALIAS,
|
||||||
COLUMN_PUBLIC_KEY,
|
COLUMN_PUBLIC_KEY,
|
||||||
COLUMN_PRIVATE_KEY,
|
COLUMN_PRIVATE_KEY,
|
||||||
COLUMN_SUBSCRIBED
|
COLUMN_SUBSCRIBED,
|
||||||
|
COLUMN_CHAN
|
||||||
};
|
};
|
||||||
|
|
||||||
SQLiteDatabase db = sql.getReadableDatabase();
|
SQLiteDatabase db = sql.getReadableDatabase();
|
||||||
@ -150,6 +157,7 @@ public class AndroidAddressRepository implements AddressRepository {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
address.setAlias(c.getString(c.getColumnIndex(COLUMN_ALIAS)));
|
address.setAlias(c.getString(c.getColumnIndex(COLUMN_ALIAS)));
|
||||||
|
address.setChan(c.getInt(c.getColumnIndex(COLUMN_CHAN)) == 1);
|
||||||
address.setSubscribed(c.getInt(c.getColumnIndex(COLUMN_SUBSCRIBED)) == 1);
|
address.setSubscribed(c.getInt(c.getColumnIndex(COLUMN_SUBSCRIBED)) == 1);
|
||||||
|
|
||||||
result.add(address);
|
result.add(address);
|
||||||
@ -199,6 +207,7 @@ public class AndroidAddressRepository implements AddressRepository {
|
|||||||
if (address.getPrivateKey() != null) {
|
if (address.getPrivateKey() != null) {
|
||||||
values.put(COLUMN_PRIVATE_KEY, Encode.bytes(address.getPrivateKey()));
|
values.put(COLUMN_PRIVATE_KEY, Encode.bytes(address.getPrivateKey()));
|
||||||
}
|
}
|
||||||
|
values.put(COLUMN_CHAN, address.isChan());
|
||||||
values.put(COLUMN_SUBSCRIBED, address.isSubscribed());
|
values.put(COLUMN_SUBSCRIBED, address.isSubscribed());
|
||||||
|
|
||||||
int update = db.update(TABLE_NAME, values, "address = '" + address.getAddress() +
|
int update = db.update(TABLE_NAME, values, "address = '" + address.getAddress() +
|
||||||
@ -227,6 +236,7 @@ public class AndroidAddressRepository implements AddressRepository {
|
|||||||
values.put(COLUMN_PUBLIC_KEY, (byte[]) null);
|
values.put(COLUMN_PUBLIC_KEY, (byte[]) null);
|
||||||
}
|
}
|
||||||
values.put(COLUMN_PRIVATE_KEY, Encode.bytes(address.getPrivateKey()));
|
values.put(COLUMN_PRIVATE_KEY, Encode.bytes(address.getPrivateKey()));
|
||||||
|
values.put(COLUMN_CHAN, address.isChan());
|
||||||
values.put(COLUMN_SUBSCRIBED, address.isSubscribed());
|
values.put(COLUMN_SUBSCRIBED, address.isSubscribed());
|
||||||
|
|
||||||
long insert = db.insert(TABLE_NAME, null, values);
|
long insert = db.insert(TABLE_NAME, null, values);
|
||||||
|
@ -26,7 +26,7 @@ import ch.dissem.apps.abit.util.Assets;
|
|||||||
*/
|
*/
|
||||||
public class SqlHelper extends SQLiteOpenHelper {
|
public class SqlHelper extends SQLiteOpenHelper {
|
||||||
// If you change the database schema, you must increment the database version.
|
// If you change the database schema, you must increment the database version.
|
||||||
public static final int DATABASE_VERSION = 2;
|
public static final int DATABASE_VERSION = 3;
|
||||||
public static final String DATABASE_NAME = "jabit.db";
|
public static final String DATABASE_NAME = "jabit.db";
|
||||||
|
|
||||||
protected final Context ctx;
|
protected final Context ctx;
|
||||||
@ -51,6 +51,8 @@ public class SqlHelper extends SQLiteOpenHelper {
|
|||||||
case 1:
|
case 1:
|
||||||
// executeMigration(db, "V2.0__Update_table_message");
|
// executeMigration(db, "V2.0__Update_table_message");
|
||||||
executeMigration(db, "V2.1__Create_table_POW");
|
executeMigration(db, "V2.1__Create_table_POW");
|
||||||
|
case 2:
|
||||||
|
executeMigration(db, "V3.0__Update_table_address");
|
||||||
default:
|
default:
|
||||||
// Nothing to do. Let's assume we won't upgrade from a version that's newer than DATABASE_VERSION.
|
// Nothing to do. Let's assume we won't upgrade from a version that's newer than DATABASE_VERSION.
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:1.5.0'
|
classpath 'com.android.tools.build:gradle:2.0.0'
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Wed Apr 10 15:27:10 PDT 2013
|
#Mon Apr 11 14:09:13 CEST 2016
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
|
||||||
|
Loading…
Reference in New Issue
Block a user