Skip to content

Commit

Permalink
version 4.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronald Krueger committed Jul 18, 2016
1 parent 5ebd10f commit 7683e16
Show file tree
Hide file tree
Showing 21 changed files with 117 additions and 55 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Silent Phone is Peer-to-peer encrypted calling and video. No keys are stored.

### What's New In This Update

The sources are updated for version 4.2 of the project.
The sources are updated for version 4.2.1 of the project.

This version of the project includes Silent Contacts as a subproject.

Expand Down
4 changes: 2 additions & 2 deletions silentphone2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ android {
// Version string: major.minor or major.minor.bug-fix. When
// releasing an X.Y version, list only two digits rather than
// X.Y.Z.
versionName "4.2"
versionName "4.2.1"

// The version code (vc) computes as follows: major*1000 + minor*100 + bug-fix.
// This provides up to 100 bug-fix or small feature update releases :-)
// To create the Android 'versionCode' the script shifts this number left by 16 and adds the
// Jenkins build number.
def vc = 4200
def vc = 4201

applicationId "com.silentcircle.silentphone"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ private PhoneCallDetails getPhoneCallDetailsForUri(Uri callUri) {
throw new IllegalArgumentException("Cannot find content: " + callUri);
}

DatabaseUtils.dumpCursor(callCursor);
// DatabaseUtils.dumpCursor(callCursor);
// Read call log specifics.
String number = callCursor.getString(NUMBER_COLUMN_INDEX);
// final int numberPresentation = callCursor.getInt(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ private boolean queryContactInfo(String number, String countryIso, ContactInfo c

// Exception: Photo uris for contacts from remote sources are not cached in the call log
// cache, so we have to force a redraw for these contacts regardless.
boolean updated = (!mIsCallLog || existingInfo != ContactInfo.EMPTY) && !info.equals(existingInfo);
boolean updated = existingInfo != ContactInfo.EMPTY && !info.equals(existingInfo);

// Store the data in the cache so that the UI thread can use to display it. Store it
// even if it has not changed so that it is marked as not expired.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public Cursor query(Uri uri, String[] projection, String selection, String[] sel
final SQLiteDatabase db = mDbHelper.getDatabase(false);
final Cursor c = qb.query(db, projection, selectionBuilder.build(), selectionArgs, null, null, sortOrder, limitClause);
if (c != null) {
c.setNotificationUri(getContext().getContentResolver(), CallLog.CONTENT_URI);
c.setNotificationUri(getContext().getContentResolver(), ScCallLog.CONTENT_URI);
}
return c;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,10 @@ public void onReceive(Context context, Intent intent) {
switch (Action.from(intent)) {
case RECEIVE_MESSAGE:
case UPDATE_CONVERSATION:
/*
CharSequence conversationId = Extra.PARTNER.getCharSequence(intent);
ConversationUtils.updateUnreadMessageCount(context, conversationId);
*/
case PROGRESS:
case CANCEL:
refreshConversations(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,9 @@ private void markPacketAsRead(final EventRepository events, final String deliver
final Event event = events.findById(deliveredPacketID);
if (event instanceof Message) {
final Message message = (Message)event;
if (message.getState() == MessageStates.RECEIVED) {
decrementUnreadMessages(message);
}
message.setState(MessageStates.READ);
if (message.expires()) {
final long rrTime = readReceiptTime <= 0 ? System.currentTimeMillis() : readReceiptTime;
Expand Down Expand Up @@ -1122,6 +1125,7 @@ private void burnPacket(final Conversation conv, final EventRepository events, f
return;
}

boolean isMessageUnread = false;
/*
* Determine whether correct event is being removed, whether conversation partner
* for message does not match the conversation itself.
Expand All @@ -1130,9 +1134,12 @@ private void burnPacket(final Conversation conv, final EventRepository events, f
* in conversation id.
*/
String conversationPartner;
if (event instanceof IncomingMessage) {
if (event instanceof IncomingMessage) {
IncomingMessage message = (IncomingMessage) event;
conversationPartner = message.getSender();
if (message.getState() == MessageStates.RECEIVED) {
isMessageUnread = true;
}
}
else {
OutgoingMessage message = (OutgoingMessage) event;
Expand All @@ -1144,6 +1151,14 @@ private void burnPacket(final Conversation conv, final EventRepository events, f
return;
}

/*
* If a received message is burned and it is unread, decrement unread message count for
* conversation.
*/
if (isMessageUnread) {
decrementUnreadMessages((Message) event);
}

events.remove(event);
if (confirm)
sendBurnNoticeConfirmation((Message)event, conversationPartner);
Expand Down Expand Up @@ -1439,6 +1454,18 @@ private void processSyncReadReceipt(final Conversation conversation, final Strin
markPacketAsRead(events, msgId, dt);
}

/*
* Decrement unread message count for a conversation
*/
private void decrementUnreadMessages(Message message) {
Conversation conversation = getConversations().findById(MessageUtils.getConversationId(message));
if (conversation != null) {
int unreadMessageCount = conversation.getUnreadMessageCount();
conversation.setUnreadMessageCount(unreadMessageCount > 0 ? (unreadMessageCount - 1) : 0);
getConversations().save(conversation);
}
}

private class RegisterInBackground implements Runnable {
final int[] code = new int[1];
byte[] errorMsg;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
import android.support.annotation.Nullable;
import android.text.TextUtils;

import com.silentcircle.SilentPhoneApplication;
import com.silentcircle.common.list.ContactEntry;
import com.silentcircle.messaging.model.Conversation;
import com.silentcircle.messaging.model.MessageStates;
import com.silentcircle.messaging.model.event.Event;
import com.silentcircle.messaging.model.event.Message;
import com.silentcircle.messaging.repository.ConversationRepository;
import com.silentcircle.messaging.services.AxoMessaging;

Expand Down Expand Up @@ -109,6 +112,36 @@ public static int getUnreadMessageCount(final Context context) {
return result;
}

public static void updateUnreadMessageCount(@NonNull final Context context,
@Nullable final CharSequence conversationId) {
if (TextUtils.isEmpty(conversationId)) {
return;
}

final AxoMessaging axoMessaging = AxoMessaging.getInstance(SilentPhoneApplication.getAppContext());
boolean axoRegistered = axoMessaging.isRegistered();
if (!axoRegistered) {
return;
}

ConversationRepository repository = axoMessaging.getConversations();
Conversation conversation = repository.findById(conversationId.toString());
List<Event> events = repository.historyOf(conversation).list();

// Count messages with MessageStates.RECEIVED which represents an unread message
int unreadMessageCount = 0;
for (Event event : events) {
if (event instanceof Message) {
int state = ((Message)event).getState();
if (state == MessageStates.RECEIVED) {
unreadMessageCount += 1;
}
}
}
conversation.setUnreadMessageCount(unreadMessageCount);
repository.save(conversation);
}

@Nullable
public static ConversationRepository getConversations(Context ctx) {
AxoMessaging axoMessaging = AxoMessaging.getInstance(ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,8 @@ public void run() {
Utilities.setSubtitleColor(getResources(), mToolbar);
return;
}
if (call == null) // This may happen in case of eError, PhoneService handles this
return;
String sipMessage = call.bufMsg.toString();
if (!DialerActivity.mAutoAnswerForTesting &&
!TextUtils.isEmpty(sipMessage) && sipMessage.startsWith(TiviPhoneService.ERROR_MSG_PREFIX)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ private void selectSasType() {
popupMenu.getMenu().add(Menu.NONE, R.string.sas_char_mode, Menu.NONE, sasTypeTexts[CHAR_MODE]);
}
else {
popupMenu.getMenu().add(Menu.NONE, R.string.sas_char_mode, Menu.NONE, sasTypeTexts[WORD_MODE]);
popupMenu.getMenu().add(Menu.NONE, R.string.sas_word_mode, Menu.NONE, sasTypeTexts[WORD_MODE]);
}
}
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
*/
public class ShortcutCardsAdapter extends BaseAdapter {

public static final String AUTHORITY = "com.silentcircle.shortcuts";
public static final Uri AUTHORITY_URI = Uri.parse("content://" + AUTHORITY + "/calllog");

private class CustomDataSetObserver extends DataSetObserver {
@Override
public void onChanged() {
Expand Down Expand Up @@ -160,7 +157,6 @@ public ShortcutCardsAdapter(Context context, ListsFragment fragment, CallLogAdap
mCallLogQueryHandler = new CallLogQueryHandler(mContext.getContentResolver(), mCallLogQueryHandlerListener);

mContext.getContentResolver().registerContentObserver(ContactsContract.Contacts.CONTENT_URI, true, mChangeObserver);
mContext.getContentResolver().registerContentObserver(AUTHORITY_URI, true, mChangeObserver);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ protected void onCancelled(Cursor result) {

@Override
protected void onPostExecute(Cursor result) {
ContentResolver resolver = mCtx.getContentResolver();
resolver.notifyChange(ShortcutCardsAdapter.AUTHORITY_URI, null, false);

int count = 0;
if (result != null) {
count = result.getCount();
Expand Down
18 changes: 9 additions & 9 deletions silentphone2/src/main/res/layout/settings_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@
app:description="@string/nist_preferred"
/>

<com.silentcircle.silentphone2.views.SettingsItem
style="@style/Widget.SettingsItem"
android:id="@+id/settings_set_passphrase"
app:isCheckable="false"
app:text="@string/key_store_title"
app:description="@string/key_store_type_default"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>

<TextView
Expand Down Expand Up @@ -290,15 +299,6 @@
android:visibility="gone"
/>

<com.silentcircle.silentphone2.views.SettingsItem
style="@style/Widget.SettingsItem"
android:id="@+id/settings_set_passphrase"
app:isCheckable="false"
app:text="@string/key_store_title"
app:description="@string/key_store_type_default"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<Button
style="@style/Widget.Silent.SettingsButton"
android:id="@+id/reload_account_data"
Expand Down
3 changes: 2 additions & 1 deletion silentphone2/src/main/res/layout/widget_settings_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:maxLines="1"
android:maxLines="2"
android:duplicateParentState="true"
android:clickable="false"
android:textSize="@dimen/text_xlarge"
Expand All @@ -48,6 +48,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:duplicateParentState="true"
android:layout_gravity="top"
android:clickable="false"
/>
<!-- app:track="@drawable/btn_switch_bg_selector" -->
Expand Down
6 changes: 4 additions & 2 deletions silentphone2/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -616,8 +616,9 @@

<string name="remaining_oca_minutes_zero">Kein Minuten verbraucht. Es verbleiben: %1$d Minuten.</string>
<plurals name="remaining_oca_minutes_info">
<item quantity="one">Sie haben eine Minute von %2$d Minuten verbraucht.</item>
<item quantity="other">Sie haben %1$d Minuten von %2$d Minuten verbraucht.</item>
<item quantity="one">Sie haben eine Minute von %1$d Minuten verbraucht.</item>
<!--<item quantity="other">You used %1$d minutes of your %2$d minutes.</item>-->
<item quantity="other">Tarif: %1$d Minuten\nZur Verfügung: %2$d Minuten</item>
</plurals>


Expand Down Expand Up @@ -1110,6 +1111,7 @@
<string name="messaging_checked_only">Verglichen, nicht verifiziert</string>
<string name="messaging_checked_verified">Verifiziert</string>
<string name="wipe">Alle Silent Phone Daten löschen</string>
<string name="setting_errors_option">Geringfügige Fehler anzeigen</string>


</resources>
4 changes: 2 additions & 2 deletions silentphone2/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,14 @@
<string name="force_traversal_explanation">Usa un método de conexión más confiable, pero de menor calidad, para el audio de llamada, lo que puede ser necesario en redes particularmente defectuosas.</string>
<string name="monitor_native_calls">Preguntar si se aseguran otras llamadas</string>
<string name="monitor_native_calls_explanation">Silent Phone preguntará si quiere asegurar llamadas hechas desde afuera de Silent Phone.</string>
<string name="setting_underflow">Tone de Caida</string>
<string name="setting_underflow">Tono de Caida</string>
<string name="setting_underflow_summary">Reproduce un tono bajo si no hay paquetes llegando desde la red. Indica red lenta.</string>
<string name="setting_echo_option">Cancelador de eco</string>
<string name="setting_echo_option_summary">Control automático del cancelador de eco. Si no se selecciona, el cancelador de eco estará siempre activo.</string>
<string name="setting_errors_option_summary">Los errores menores de software que no afectan su experiencia se ocultan de forma predeterminada.</string>
<string name="setting_developer_option_summary">Si no eres un desarrollador, ¡no marques esta opción!</string>
<string name="sp_dial_helper_title">Asistente de marcado</string>
<string name="sp_dial_helper_select_explanation">Para simplificar el marcado, active Dial Assist y seleccione un
<string name="sp_dial_helper_select_explanation">Para simplificar el marcado, activar asistente de marcado y seleccione un
país. Se cambiará automáticamente el formato del número con su código de país. De lo contrario, marque \'+\' y
el código de país.</string>
<string name="sp_dial_helper_select_explanation_1">Para llamar a otros suscriptores de Silent Circle, simplemente marque su
Expand Down
36 changes: 17 additions & 19 deletions silentphone2/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -801,11 +801,11 @@
<string name="setting_echo_option">Echo canceler</string>
<string name="setting_echo_option_summary">Automatic control of echo canceler. If not selected the echo canceler is always active</string>

<string name="setting_errors_option" translatable="false">Show all errors</string>
<string name="setting_errors_option">Show all errors</string>
<string name="setting_errors_option_summary">Minor software errors that don\'t affect your experience are hidden by default.</string>

<string name="setting_developer_option" translatable="false">Enable developer menus</string>
<string name="setting_developer_option_summary">If you aren\'t a developer, don\'t check this!</string>
<string name="setting_developer_option_summary" translatable="false">If you aren\'t a developer, don\'t check this!</string>

<string name="developer_ssl_debug" translatable="false">SSL debug level</string>
<string name="developer_ssl_debug_explanation" translatable="false">Set the SSL debug level. 0 means debugging off, 4 means full verbose debugging.</string>
Expand All @@ -832,19 +832,17 @@
<string name="sp_dial_helper_00_x_explanation">Adds \'%2$s\' to dialed digits and replaces a leading \'%3$s\' with the \'+\' sign.</string>

<!-- ******* Strings for the key store management activity -->
<string name="key_store_set_pw_explanation">Enter a new password to enhance key store protection.\nYou need to enter
this password every time you start Silent Phone. You can reset to default protection at any time.</string>
<string name="key_store_set_pw_explanation">Set this password to encrypt Silent Phone. You will need to enter this password to start the application. Silent Circle cannot reset this password for you.</string>

<string name="key_store_change_pw_explanation">Change your own key store password.</string>
<string name="key_store_reset_pw_explanation">The client resets key store protection to default after you entered your password.</string>
<string name="key_store_enter_pw_explanation">Enter your key store password.</string>
<string name="key_store_change_pw_explanation">Change your encryption password.</string>
<string name="key_store_reset_pw_explanation">Stop using password encryption of Silent Phone.</string>
<string name="key_store_enter_pw_explanation">Enter your encryption password.</string>

<string name="key_store_set_pin_explanation">Enter a new PIN to enhance key store protection.\nYou need to enter
this PIN every time you start Silent Phone. You can reset to default protection at any time.</string>
<string name="key_store_set_pin_explanation">Set this PIN to encrypt Silent Phone. You will need to enter this PIN to start the application. Silent Circle cannot reset this PIN for you.</string>

<string name="key_store_change_pin_explanation">Change your own key store PIN.</string>
<string name="key_store_reset_pin_explanation">The client resets key store protection to default after you entered your PIN.</string>
<string name="key_store_enter_pin_explanation">Enter your key store PIN.</string>
<string name="key_store_change_pin_explanation">Change your encryption PIN.</string>
<string name="key_store_reset_pin_explanation">Stop using PIN encryption of Silent Phone.</string>
<string name="key_store_enter_pin_explanation">Enter your encryption PIN.</string>

<string name="pin_hint">Enter PIN</string>
<string name="pin_hint_old">Enter old PIN</string>
Expand All @@ -856,17 +854,17 @@
<string name="pin_match">PINs do not match. Please check.</string>
<string name="pin_short">PIN is too short. Enter at least %d digits </string>

<string name="key_store_title">Set passphrase/PIN</string>
<string name="key_store_type_default">Default password</string>
<string name="key_store_type_pw">User password</string>
<string name="key_store_type_pin">User PIN</string>
<string name="key_store_title">Encrypt Silent Phone</string>
<string name="key_store_type_default">Not encrypted</string>
<string name="key_store_type_pw">Password set</string>
<string name="key_store_type_pin">PIN set</string>

<string name="key_store_set_pw">Set a password</string>
<string name="key_store_set_pin">Set a PIN</string>
<string name="key_store_set_pw">Set password</string>
<string name="key_store_set_pin">Set PIN</string>

<string name="key_store_change_pin">Change PIN</string>

<string name="key_store_reset_default">Reset to default protection</string>
<string name="key_store_reset_default">Clear password/PIN</string>

<string name="re_provision">Reload account data</string>
<string name="re_provision_explanation">Reload Silent Phone\'s account and configuration data.</string>
Expand Down
Loading

0 comments on commit 7683e16

Please sign in to comment.