diff --git a/app/build.gradle b/app/build.gradle
index 4e7094f..01ba6f9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -29,6 +29,7 @@ dependencies {
compile 'ch.dissem.jabit:jabit-domain:0.2.1-SNAPSHOT'
compile 'ch.dissem.jabit:jabit-networking:0.2.1-SNAPSHOT'
compile 'ch.dissem.jabit:jabit-security-spongy:0.2.1-SNAPSHOT'
+ compile 'ch.dissem.jabit:jabit-extensions:0.2.1-SNAPSHOT'
compile 'org.slf4j:slf4j-android:1.7.12'
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f0fbceb..979915d 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -18,7 +18,7 @@
android:label="@string/app_name"
android:theme="@style/AppTheme">
@@ -29,28 +29,28 @@
+ android:value=".MainActivity" />
+ android:value=".MainActivity" />
+ android:parentActivityName=".MainActivity">
+ android:value=".MainActivity" />
@@ -79,7 +79,7 @@
+ android:parentActivityName=".MainActivity">
diff --git a/app/src/main/assets/db/migration/V1.2__Create_table_message.sql b/app/src/main/assets/db/migration/V1.2__Create_table_message.sql
index 79e32f2..ae72a6f 100644
--- a/app/src/main/assets/db/migration/V1.2__Create_table_message.sql
+++ b/app/src/main/assets/db/migration/V1.2__Create_table_message.sql
@@ -8,6 +8,7 @@ CREATE TABLE Message (
sent INTEGER,
received INTEGER,
status VARCHAR(20) NOT NULL,
+ initial_hash BINARY(64) UNIQUE,
FOREIGN KEY (sender) REFERENCES Address (address),
FOREIGN KEY (recipient) REFERENCES Address (address)
diff --git a/app/src/main/assets/db/migration/V2.0__Update_table_message.sql b/app/src/main/assets/db/migration/V2.0__Update_table_message.sql
new file mode 100644
index 0000000..2b39a6e
--- /dev/null
+++ b/app/src/main/assets/db/migration/V2.0__Update_table_message.sql
@@ -0,0 +1,7 @@
+-- This is done in V1.2, as SQLite doesn't support ADD CONSTRAINT and a proper migration
+-- wasn't really necessary yet.
+--
+-- This file is here to reduce confusion regarding to the original migration files.
+
+--ALTER TABLE Message ADD COLUMN initial_hash BINARY(64);
+--ALTER TABLE Message ADD CONSTRAINT initial_hash_unique UNIQUE(initial_hash);
\ No newline at end of file
diff --git a/app/src/main/assets/db/migration/V2.1__Create_table_POW.sql b/app/src/main/assets/db/migration/V2.1__Create_table_POW.sql
new file mode 100644
index 0000000..b39c6c5
--- /dev/null
+++ b/app/src/main/assets/db/migration/V2.1__Create_table_POW.sql
@@ -0,0 +1,7 @@
+CREATE TABLE POW (
+ initial_hash BINARY(64) PRIMARY KEY,
+ data BLOB NOT NULL,
+ version BIGINT NOT NULL,
+ nonce_trials_per_byte BIGINT NOT NULL,
+ extra_bytes BIGINT NOT NULL
+);
diff --git a/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java b/app/src/main/java/ch/dissem/apps/abit/MainActivity.java
similarity index 88%
rename from app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java
rename to app/src/main/java/ch/dissem/apps/abit/MainActivity.java
index b21acb1..5d7bee8 100644
--- a/app/src/main/java/ch/dissem/apps/abit/MessageListActivity.java
+++ b/app/src/main/java/ch/dissem/apps/abit/MainActivity.java
@@ -42,12 +42,16 @@ import org.slf4j.LoggerFactory;
import java.io.Serializable;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
import ch.dissem.apps.abit.listener.ActionBarListener;
import ch.dissem.apps.abit.listener.ListSelectionListener;
import ch.dissem.apps.abit.service.BitmessageService;
import ch.dissem.apps.abit.service.Singleton;
import ch.dissem.apps.abit.synchronization.Authenticator;
+import ch.dissem.apps.abit.synchronization.SyncAdapter;
+import ch.dissem.apps.abit.util.Preferences;
import ch.dissem.bitmessage.entity.BitmessageAddress;
import ch.dissem.bitmessage.entity.Plaintext;
import ch.dissem.bitmessage.entity.valueobject.Label;
@@ -77,13 +81,12 @@ import static ch.dissem.apps.abit.synchronization.StubProvider.AUTHORITY;
* to listen for item selections.
*
*/
-public class MessageListActivity extends AppCompatActivity
+public class MainActivity extends AppCompatActivity
implements ListSelectionListener, ActionBarListener {
public static final String EXTRA_SHOW_MESSAGE = "ch.dissem.abit.ShowMessage";
public static final String ACTION_SHOW_INBOX = "ch.dissem.abit.ShowInbox";
- private static final Logger LOG = LoggerFactory.getLogger(MessageListActivity.class);
- private static final long SYNC_FREQUENCY = 15 * 60; // seconds
+ private static final Logger LOG = LoggerFactory.getLogger(MainActivity.class);
private static final int ADD_IDENTITY = 1;
/**
@@ -99,8 +102,8 @@ public class MessageListActivity extends AppCompatActivity
private static ServiceConnection connection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
- MessageListActivity.service = new Messenger(service);
- MessageListActivity.bound = true;
+ MainActivity.service = new Messenger(service);
+ MainActivity.bound = true;
}
@Override
@@ -121,8 +124,10 @@ public class MessageListActivity extends AppCompatActivity
super.onCreate(savedInstanceState);
messageRepo = Singleton.getMessageRepository(this);
addressRepo = Singleton.getAddressRepository(this);
-
- selectedLabel = messageRepo.getLabels().get(0);
+ List