- Update linphone

- Some work on UI for ZRTP
This commit is contained in:
Erwan Croze 2017-02-02 15:04:34 +01:00
parent d3f7bb7a83
commit d8d6017f06
7 changed files with 128 additions and 45 deletions

View file

@ -23,6 +23,7 @@ import java.util.List;
import java.util.Timer; import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import org.linphone.core.CallDirection;
import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneAddress;
import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneCall.State; import org.linphone.core.LinphoneCall.State;

View file

@ -137,6 +137,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
private boolean doNotGoToCallActivity = false; private boolean doNotGoToCallActivity = false;
private List<String> sideMenuItems; private List<String> sideMenuItems;
private boolean callTransfer = false; private boolean callTransfer = false;
private boolean isOnBackground = false;
static final boolean isInstanciated() { static final boolean isInstanciated() {
return instance != null; return instance != null;
@ -1126,6 +1127,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
lc.removeListener(mListener); lc.removeListener(mListener);
} }
callTransfer = false; callTransfer = false;
isOnBackground = true;
super.onPause(); super.onPause();
} }
@ -1385,6 +1387,7 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
} }
doNotGoToCallActivity = false; doNotGoToCallActivity = false;
isOnBackground = false;
} }
@Override @Override
@ -1463,6 +1466,10 @@ public class LinphoneActivity extends LinphoneGenericActivity implements OnClick
} }
} }
public boolean isOnBackground() {
return isOnBackground;
}
public boolean onKeyDown(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) { if (keyCode == KeyEvent.KEYCODE_BACK) {
if (currentFragment == FragmentsAvailable.DIALER if (currentFragment == FragmentsAvailable.DIALER

View file

@ -22,7 +22,6 @@ import static android.media.AudioManager.MODE_RINGTONE;
import static android.media.AudioManager.STREAM_RING; import static android.media.AudioManager.STREAM_RING;
import static android.media.AudioManager.STREAM_VOICE_CALL; import static android.media.AudioManager.STREAM_VOICE_CALL;
import java.io.ByteArrayInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -152,6 +151,7 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
private LinphoneAccountCreator accountCreator; private LinphoneAccountCreator accountCreator;
private static List<LinphoneChatMessage> mPendingChatFileMessage; private static List<LinphoneChatMessage> mPendingChatFileMessage;
private static LinphoneChatMessage mUploadPendingFileMessage; private static LinphoneChatMessage mUploadPendingFileMessage;
private boolean mAreDisplayAlertMessage = false;
public String wizardLoginViewDomain = null; public String wizardLoginViewDomain = null;
@ -1027,6 +1027,64 @@ public class LinphoneManager implements LinphoneCoreListener, LinphoneChatMessag
} }
} }
@Override
public void messageReceivedUnableToDecrypted(LinphoneCore lc, LinphoneChatRoom cr,
LinphoneChatMessage message) {
if (mServiceContext.getResources().getBoolean(R.bool.disable_chat)) {
return;
}
final LinphoneAddress from = message.getFrom();
try {
final LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(from);
if (LinphoneActivity.instance().isOnBackground()) {
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat_message_notification)) {
if (contact != null) {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), contact.getFullName()
, getString(R.string.message_cant_be_decrypted_notif));
} else {
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getUserName()
, getString(R.string.message_cant_be_decrypted_notif));
}
}
} else if (!mAreDisplayAlertMessage){
mAreDisplayAlertMessage = true;
final Dialog dialog = LinphoneActivity.instance().displayDialog(
getString(R.string.message_cant_be_decrypted).replace("%s"
, (contact != null) ? contact.getFullName() : from.getUserName()));
Button delete = (Button) dialog.findViewById(R.id.delete_button);
delete.setText(getString(R.string.call));
Button cancel = (Button) dialog.findViewById(R.id.cancel);
cancel.setText(getString(R.string.ok));
delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
LinphoneManager.getInstance().newOutgoingCall(from.asStringUriOnly()
, (contact != null) ? contact.getFullName() : from.getUserName());
dialog.dismiss();
LinphoneManager.getInstance().setAreDisplayAlertMessage(false);
}
});
cancel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
dialog.dismiss();
LinphoneManager.getInstance().setAreDisplayAlertMessage(false);
}
});
dialog.show();
}
} catch (Exception e) {
Log.e(e);
}
}
public void setAreDisplayAlertMessage(boolean b) {
mAreDisplayAlertMessage = b;
}
public String getLastLcStatusMessage() { public String getLastLcStatusMessage() {
return lastLcStatusMessage; return lastLcStatusMessage;
} }

View file

@ -958,6 +958,7 @@ public class SettingsFragment extends PreferencesListFragment {
} }
private void setEncryptionZrtp() { private void setEncryptionZrtp() {
LinphoneUtils.displayErrorAlert(getString(R.string.lime_encryption_enable_zrtp), LinphoneActivity.instance());
mPrefs.setMediaEncryption(MediaEncryption.ZRTP); mPrefs.setMediaEncryption(MediaEncryption.ZRTP);
findPreference(getString(R.string.pref_media_encryption_key)).setSummary(mPrefs.getMediaEncryption().toString()); findPreference(getString(R.string.pref_media_encryption_key)).setSummary(mPrefs.getMediaEncryption().toString());
} }

View file

@ -18,6 +18,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
import org.linphone.assistant.AssistantActivity; import org.linphone.assistant.AssistantActivity;
import org.linphone.core.CallDirection;
import org.linphone.core.LinphoneCall; import org.linphone.core.LinphoneCall;
import org.linphone.core.LinphoneContent; import org.linphone.core.LinphoneContent;
import org.linphone.core.LinphoneCore; import org.linphone.core.LinphoneCore;
@ -393,9 +394,19 @@ public class StatusFragment extends Fragment {
ZRTPdialog.setContentView(R.layout.dialog); ZRTPdialog.setContentView(R.layout.dialog);
ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT); ZRTPdialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
ZRTPdialog.getWindow().setBackgroundDrawable(d); ZRTPdialog.getWindow().setBackgroundDrawable(d);
String zrtpToRead, zrtpToListen;
if (call.getDirection().equals(CallDirection.Incoming)) {
zrtpToRead = call.getAuthenticationToken().substring(0,2);
zrtpToListen = call.getAuthenticationToken().substring(2);
} else {
zrtpToListen = call.getAuthenticationToken().substring(0,2);
zrtpToRead = call.getAuthenticationToken().substring(2);
}
TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText); TextView customText = (TextView) ZRTPdialog.findViewById(R.id.customText);
String newText = getString(R.string.zrtp_dialog).replace("%s", call.getAuthenticationToken()); String newText = getString(R.string.zrtp_dialog1).replace("%s", zrtpToRead)
+ getString(R.string.zrtp_dialog2).replace("%s", zrtpToListen);
customText.setText(newText); customText.setText(newText);
Button delete = (Button) ZRTPdialog.findViewById(R.id.delete_button); Button delete = (Button) ZRTPdialog.findViewById(R.id.delete_button);
delete.setText(R.string.accept); delete.setText(R.string.accept);

View file

@ -327,6 +327,11 @@ public class TutorialCardDavSync extends Activity implements OnClickListener, Li
} }
@Override
public void messageReceivedUnableToDecrypted(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
}
@Override @Override
public void callState(LinphoneCore lc, LinphoneCall call, State state, public void callState(LinphoneCore lc, LinphoneCall call, State state,
String message) { String message) {

@ -1 +1 @@
Subproject commit 1cf4eda4aac0fdd1fdac150f6e0592368bf93459 Subproject commit 3342ccf4abb1f3bd95053ca82d9b01508704bbc2