mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-26 18:15:20 +01:00
wip
This commit is contained in:
@@ -18,12 +18,11 @@ public class PushDatabase extends Database {
|
||||
public static final String ID = "_id";
|
||||
public static final String TYPE = "type";
|
||||
public static final String SOURCE = "source";
|
||||
public static final String DESTINATIONS = "destinations";
|
||||
public static final String BODY = "body";
|
||||
public static final String TIMESTAMP = "timestamp";
|
||||
|
||||
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" + ID + " INTEGER PRIMARY KEY, " +
|
||||
TYPE + " INTEGER, " + SOURCE + " TEXT, " + DESTINATIONS + " TEXT, " + BODY + " TEXT, " + TIMESTAMP + " INTEGER);";
|
||||
TYPE + " INTEGER, " + SOURCE + " TEXT, " + BODY + " TEXT, " + TIMESTAMP + " INTEGER);";
|
||||
|
||||
public PushDatabase(Context context, SQLiteOpenHelper databaseHelper) {
|
||||
super(context, databaseHelper);
|
||||
@@ -33,7 +32,6 @@ public class PushDatabase extends Database {
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(TYPE, message.getType());
|
||||
values.put(SOURCE, message.getSource());
|
||||
values.put(DESTINATIONS, Util.join(message.getDestinations(), ","));
|
||||
values.put(BODY, Base64.encodeBytes(message.getBody()));
|
||||
values.put(TIMESTAMP, message.getTimestampMillis());
|
||||
|
||||
@@ -66,11 +64,10 @@ public class PushDatabase extends Database {
|
||||
|
||||
int type = cursor.getInt(cursor.getColumnIndexOrThrow(TYPE));
|
||||
String source = cursor.getString(cursor.getColumnIndexOrThrow(SOURCE));
|
||||
List<String> destinations = Util.split(cursor.getString(cursor.getColumnIndexOrThrow(DESTINATIONS)), ",");
|
||||
byte[] body = Base64.decode(cursor.getString(cursor.getColumnIndexOrThrow(BODY)));
|
||||
long timestamp = cursor.getLong(cursor.getColumnIndexOrThrow(TIMESTAMP));
|
||||
|
||||
return new IncomingPushMessage(type, source, destinations, body, timestamp);
|
||||
return new IncomingPushMessage(type, source, body, timestamp);
|
||||
} catch (IOException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user