Added boolean to disable chat message notification + fix copy/paste in chat if using liblinphone storage
This commit is contained in:
parent
d18ba33e44
commit
aaf4af3b26
4 changed files with 11 additions and 4 deletions
|
@ -61,6 +61,7 @@
|
|||
<bool name="allow_edit_in_dialer">true</bool>
|
||||
<bool name="forbid_self_call">false</bool>
|
||||
<bool name="disable_chat">false</bool>
|
||||
<bool name="disable_chat__message_notification">false</bool>
|
||||
<bool name="disable_chat_send_file">false</bool>
|
||||
<bool name="use_linphone_chat_storage">false</bool>
|
||||
|
||||
|
|
|
@ -606,7 +606,7 @@ public class ChatFragment extends Fragment implements OnClickListener, LinphoneC
|
|||
}
|
||||
|
||||
private void copyTextMessageToClipboard(int id) {
|
||||
String msg = LinphoneActivity.instance().getChatStorage().getTextMessageForId(id);
|
||||
String msg = LinphoneActivity.instance().getChatStorage().getTextMessageForId(chatRoom, id);
|
||||
if (msg != null) {
|
||||
Compatibility.copyTextToClipboard(getActivity(), msg);
|
||||
LinphoneActivity.instance().displayCustomToast(getString(R.string.text_copied_to_clipboard), Toast.LENGTH_SHORT);
|
||||
|
|
|
@ -295,11 +295,15 @@ public class ChatStorage {
|
|||
return chatMessages;
|
||||
}
|
||||
|
||||
public String getTextMessageForId(int id) {
|
||||
public String getTextMessageForId(LinphoneChatRoom chatroom, int id) {
|
||||
String message = null;
|
||||
|
||||
if (useNativeAPI) {
|
||||
//TODO
|
||||
LinphoneChatMessage[] history = chatroom.getHistory();
|
||||
if (history.length > id-1) {
|
||||
LinphoneChatMessage msg = history[id-1];
|
||||
message = msg.getText();
|
||||
}
|
||||
} else {
|
||||
Cursor c = db.query(TABLE_NAME, null, "id LIKE " + id, null, null, null, null);
|
||||
|
||||
|
|
|
@ -1152,7 +1152,9 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
try {
|
||||
LinphoneUtils.findUriPictureOfContactAndSetDisplayName(from, mServiceContext.getContentResolver());
|
||||
//LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getDisplayName(), notificationText);
|
||||
if (!mServiceContext.getResources().getBoolean(R.bool.disable_chat__message_notification)) {
|
||||
LinphoneService.instance().displayMessageNotification(from.asStringUriOnly(), from.getDisplayName(), textMessage);
|
||||
}
|
||||
} catch (Exception e) { }
|
||||
|
||||
for (LinphoneSimpleListener listener : getSimpleListeners(LinphoneOnMessageReceivedListener.class)) {
|
||||
|
|
Loading…
Reference in a new issue