Compare commits

..

7 Commits
v2.0 ... v2.0.1

Author SHA1 Message Date
Moxie Marlinspike
25e03b3579 Bumping version to 2.0.1 2014-02-24 21:50:33 -08:00
Moxie Marlinspike
52ff4ecfd2 Fix to make emoji work in push groups. 2014-02-24 17:01:28 -08:00
Moxie Marlinspike
43c1576aab Fix for bad database migration. 2014-02-24 17:00:52 -08:00
Jake McGinty
23c607430d fix dark text input on dark background for conversation
// FREEBIE
2014-02-24 16:12:13 -08:00
Jake McGinty
829a92d371 contact selection reactive to dark theme
// FREEBIE
2014-02-24 14:43:38 -08:00
Moxie Marlinspike
559228af5b Fix for bug modifying immutable list. 2014-02-24 14:19:43 -08:00
Moxie Marlinspike
e8a0fac05b Fix for identity key mismatch on devices with V1 identities. 2014-02-24 14:19:17 -08:00
11 changed files with 78 additions and 45 deletions

View File

@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.thoughtcrime.securesms"
android:versionCode="63"
android:versionName="2.0">
android:versionCode="64"
android:versionName="2.0.1">
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="19"/>

View File

@@ -5,6 +5,7 @@ import android.util.Log;
import org.whispersystems.textsecure.crypto.IdentityKey;
import org.whispersystems.textsecure.crypto.MasterSecret;
import org.whispersystems.textsecure.crypto.protocol.CiphertextMessage;
/**
* Helper class for generating key pairs and calculating ECDH agreements.
@@ -84,8 +85,7 @@ public class Session {
recipient.getRecipientId(),
RecipientDevice.DEFAULT_DEVICE_ID))
{
return new SessionRecordV2(context, masterSecret, recipient.getRecipientId(),
RecipientDevice.DEFAULT_DEVICE_ID).getSessionVersion();
return CiphertextMessage.CURRENT_VERSION;
} else if (SessionRecordV1.hasSession(context, recipient)) {
return new SessionRecordV1(context, masterSecret, recipient).getSessionVersion();
}

View File

@@ -338,7 +338,7 @@ public class SessionRecordV2 extends Record {
return null;
}
List<Chain.MessageKey> messageKeyList = chain.getMessageKeysList();
List<Chain.MessageKey> messageKeyList = new LinkedList<Chain.MessageKey>(chain.getMessageKeysList());
Iterator<Chain.MessageKey> messageKeyIterator = messageKeyList.iterator();
MessageKeys result = null;

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="edit_text_light_theme">#ff000000</color>
<color name="edit_text_dark_theme">#ffeeeeee</color>
</resources>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="edit_text_light_theme">#ff000000</color>
<color name="edit_text_dark_theme">#ff000000</color>
</resources>

View File

@@ -36,6 +36,11 @@
<attr name="conversation_item_sent_push_background" format="reference" />
<attr name="conversation_item_sent_push_triangle_background" format="reference" />
<attr name="contact_selection_push_user" format="reference|color" />
<attr name="contact_selection_lay_user" format="reference|color" />
<attr name="contact_selection_push_label" format="reference|color" />
<attr name="contact_selection_lay_label" format="reference|color" />
<attr name="navigation_drawer_background" format="reference|color"/>
<attr name="navigation_drawer_text_color" format="color"/>
<attr name="navigation_drawer_icons" format="reference"/>

View File

@@ -19,9 +19,14 @@
<item name="conversation_received_text_primary_color">#ff111111</item>
<item name="conversation_received_text_secondary_color">#33000000</item>
<item name="contact_selection_push_user">#ff000000</item>
<item name="contact_selection_lay_user">#a0000000</item>
<item name="contact_selection_push_label">#ff64a926</item>
<item name="contact_selection_lay_label">#99000000</item>
<item name="conversation_background">#ffdddddd</item>
<item name="conversation_editor_background">#eeeeee</item>
<item name="conversation_editor_text_color">@color/edit_text_light_theme</item>
<item name="conversation_editor_text_color">#ff111111</item>
<item name="conversation_send_button">@drawable/ic_send_holo_light</item>
<item name="conversation_send_secure_button">@drawable/ic_send_encrypted_holo_light</item>
<item name="conversation_delivered_indicator">@drawable/ic_sms_mms_delivered_light</item>
@@ -77,6 +82,11 @@
<item name="conversation_received_text_primary_color">#ffeeeeee</item>
<item name="conversation_received_text_secondary_color">#44eeeeee</item>
<item name="contact_selection_push_user">#ffdddddd</item>
<item name="contact_selection_lay_user">#ffcccccc</item>
<item name="contact_selection_push_label">#ff64a926</item>
<item name="contact_selection_lay_label">#11ffffff</item>
<item name="conversation_item_received_background">@drawable/conversation_item_received_shape_dark</item>
<item name="conversation_item_received_triangle_background">@drawable/conversation_item_received_triangle_shape_dark</item>
<item name="conversation_item_sent_background">@drawable/conversation_item_sent_shape_dark</item>
@@ -89,7 +99,7 @@
<item name="conversation_background">@color/black</item>
<item name="conversation_editor_background">#ff222222</item>
<item name="conversation_editor_text_color">@color/edit_text_dark_theme</item>
<item name="conversation_editor_text_color">#ffeeeeee</item>
<item name="conversation_send_button">@drawable/ic_send_holo_dark</item>
<item name="conversation_send_secure_button">@drawable/ic_send_holo_dark_encrypted</item>
<item name="conversation_delivered_indicator">@drawable/ic_sms_mms_delivered_dark</item>

View File

@@ -20,6 +20,7 @@ package org.thoughtcrime.securesms;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.database.MergeCursor;
import android.os.AsyncTask;
@@ -61,9 +62,15 @@ import java.util.List;
public class PushContactSelectionListFragment extends SherlockListFragment
implements LoaderManager.LoaderCallbacks<Cursor>
{
private final int STYLE_ATTRIBUTES[] = new int[]{R.attr.contact_selection_push_user,
R.attr.contact_selection_lay_user,
R.attr.contact_selection_push_label,
R.attr.contact_selection_lay_label};
private final HashMap<Long, ContactData> selectedContacts = new HashMap<Long, ContactData>();
private static LayoutInflater li;
private TypedArray drawables;
@Override
public void onActivityCreated(Bundle icicle) {
@@ -88,8 +95,12 @@ public class PushContactSelectionListFragment extends SherlockListFragment
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_select_all: handleSelectAll(); return true;
case R.id.menu_unselect_all: handleUnselectAll(); return true;
case R.id.menu_select_all:
handleSelectAll();
return true;
case R.id.menu_unselect_all:
handleUnselectAll();
return true;
}
super.onOptionsItemSelected(item);
@@ -105,7 +116,7 @@ public class PushContactSelectionListFragment extends SherlockListFragment
private void handleUnselectAll() {
selectedContacts.clear();
((CursorAdapter)getListView().getAdapter()).notifyDataSetChanged();
((CursorAdapter) getListView().getAdapter()).notifyDataSetChanged();
}
private void handleSelectAll() {
@@ -119,16 +130,16 @@ public class PushContactSelectionListFragment extends SherlockListFragment
while (cursor != null && cursor.moveToNext()) {
ContactData contactData = ContactAccessor.getInstance().getContactData(getActivity(), cursor);
if (contactData.numbers.isEmpty()) continue;
if (contactData.numbers.isEmpty()) continue;
else if (contactData.numbers.size() == 1) addSingleNumberContact(contactData);
else addMultipleNumberContact(contactData, null, null);
else addMultipleNumberContact(contactData, null, null);
}
} finally {
if (cursor != null)
cursor.close();
}
((CursorAdapter)getListView().getAdapter()).notifyDataSetChanged();
((CursorAdapter) getListView().getAdapter()).notifyDataSetChanged();
}
private void addSingleNumberContact(ContactData contactData) {
@@ -162,6 +173,7 @@ public class PushContactSelectionListFragment extends SherlockListFragment
private void initializeResources() {
this.getListView().setFocusable(true);
this.drawables = getActivity().obtainStyledAttributes(STYLE_ATTRIBUTES);
}
@Override
@@ -244,13 +256,13 @@ public class PushContactSelectionListFragment extends SherlockListFragment
this.pushSupport = pushContactData.pushSupport;
if (!pushSupport) {
this.name.setTextColor(0xa0000000);
this.number.setTextColor(0xa0000000);
this.pushLabel.setBackgroundColor(0x99000000);
this.name.setTextColor(drawables.getColor(1, 0xff000000));
this.number.setTextColor(drawables.getColor(1, 0xff000000));
this.pushLabel.setBackgroundColor(drawables.getColor(3, 0x99000000));
} else {
this.name.setTextColor(0xff000000);
this.number.setTextColor(0xff000000);
this.pushLabel.setBackgroundColor(0xff64a926);
this.name.setTextColor(drawables.getColor(0, 0xa0000000));
this.number.setTextColor(drawables.getColor(0, 0xa0000000));
this.pushLabel.setBackgroundColor(drawables.getColor(2, 0xff64a926));
}
if (selectedContacts.containsKey(contactData.id))

View File

@@ -20,6 +20,7 @@ package org.thoughtcrime.securesms;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.TypedArray;
import android.database.Cursor;
import android.database.MergeCursor;
import android.os.Bundle;
@@ -55,11 +56,15 @@ import java.util.HashMap;
public class SingleContactSelectionListFragment extends SherlockListFragment
implements LoaderManager.LoaderCallbacks<Cursor>
{
private final String TAG = SingleContactSelectionListFragment.class.getSimpleName();
private final String TAG = SingleContactSelectionListFragment.class.getSimpleName();
private final int STYLE_ATTRIBUTES[] = new int[]{R.attr.contact_selection_push_user,
R.attr.contact_selection_lay_user,
R.attr.contact_selection_push_label,
R.attr.contact_selection_lay_label};
private final HashMap<Long, ContactData> selectedContacts = new HashMap<Long, ContactData>();
private static LayoutInflater li;
private OnContactSelectedListener onContactSelectedListener;
private static LayoutInflater li;
private OnContactSelectedListener onContactSelectedListener;
private TypedArray drawables;
@Override
public void onActivityCreated(Bundle icicle) {
@@ -86,7 +91,7 @@ public class SingleContactSelectionListFragment extends SherlockListFragment
private void addMultipleNumberContact(ContactData contactData, TextView textView) {
String[] options = new String[contactData.numbers.size()];
int i = 0;
int i = 0;
for (NumberData option : contactData.numbers) {
options[i++] = option.type + " " + option.number;
@@ -108,6 +113,7 @@ public class SingleContactSelectionListFragment extends SherlockListFragment
private void initializeResources() {
this.getListView().setFocusable(true);
this.drawables = getActivity().obtainStyledAttributes(STYLE_ATTRIBUTES);
}
@Override
@@ -181,13 +187,13 @@ public class SingleContactSelectionListFragment extends SherlockListFragment
this.pushSupport = pushContactData.pushSupport;
if (!pushSupport) {
this.name.setTextColor(0xa0000000);
this.number.setTextColor(0xa0000000);
this.pushLabel.setBackgroundColor(0x99000000);
this.name.setTextColor(drawables.getColor(1, 0xff000000));
this.number.setTextColor(drawables.getColor(1, 0xff000000));
this.pushLabel.setBackgroundColor(drawables.getColor(3, 0x99000000));
} else {
this.name.setTextColor(0xff000000);
this.number.setTextColor(0xff000000);
this.pushLabel.setBackgroundColor(0xff64a926);
this.name.setTextColor(drawables.getColor(0, 0xa0000000));
this.number.setTextColor(drawables.getColor(0, 0xa0000000));
this.pushLabel.setBackgroundColor(drawables.getColor(2, 0xff64a926));
}
this.name.setText(contactData.name);

View File

@@ -53,7 +53,8 @@ public class DatabaseFactory {
private static final int INTRODUCED_TOFU_IDENTITY_VERSION = 9;
private static final int INTRODUCED_PUSH_DATABASE_VERSION = 10;
private static final int INTRODUCED_GROUP_DATABASE_VERSION = 11;
private static final int DATABASE_VERSION = 11;
private static final int INTRODUCED_PUSH_FIX_VERSION = 12;
private static final int DATABASE_VERSION = 12;
private static final String DATABASE_NAME = "messages.db";
private static final Object lock = new Object();
@@ -649,6 +650,15 @@ public class DatabaseFactory {
db.execSQL("ALTER TABLE mms ADD COLUMN address_device_id INTEGER DEFAULT 1;");
}
if (oldVersion < INTRODUCED_PUSH_FIX_VERSION) {
db.execSQL("CREATE TEMPORARY table push_backup (_id INTEGER PRIMARY KEY, type INTEGER, source, TEXT, destinations TEXT, body TEXT, timestamp INTEGER, device_id INTEGER DEFAULT 1);");
db.execSQL("INSERT INTO push_backup(_id, type, source, body, timestamp, device_id) SELECT _id, type, source, body, timestamp, device_id FROM push;");
db.execSQL("DROP TABLE push");
db.execSQL("CREATE TABLE push (_id INTEGER PRIMARY KEY, type INTEGER, source TEXT, body TEXT, timestamp INTEGER, device_id INTEGER DEFAULT 1);");
db.execSQL("INSERT INTO push (_id, type, source, body, timestamp, device_id) SELECT _id, type, source, body, timestamp, device_id FROM push_backup;");
db.execSQL("DROP TABLE push_backup;");
}
db.setTransactionSuccessful();
db.endTransaction();
}

View File

@@ -79,8 +79,8 @@ public class TextSlide extends Slide {
PduPart part = new PduPart();
try {
part.setData(message.getBytes(CharacterSets.MIMENAME_ISO_8859_1));
part.setData(message.getBytes(CharacterSets.MIMENAME_UTF_8));
if (part.getData().length == 0)
throw new AssertionError("Part data should not be zero!");
@@ -88,8 +88,8 @@ public class TextSlide extends Slide {
Log.w("TextSlide", "ISO_8859_1 must be supported!", e);
part.setData("Unsupported character set!".getBytes());
}
part.setCharset(CharacterSets.ISO_8859_1);
part.setCharset(CharacterSets.UTF_8);
part.setContentType(ContentType.TEXT_PLAIN.getBytes());
part.setContentId((System.currentTimeMillis()+"").getBytes());
part.setName(("Text"+System.currentTimeMillis()).getBytes());