Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
Mario Danic 2018-08-07 22:46:14 +02:00
parent 8c45893bbe
commit f50f3a8db7
3 changed files with 30 additions and 2 deletions

View File

@ -132,6 +132,14 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
menuItems.add(new MenuItem(getResources().getString(R.string.nc_configure_room), 0, null));
}
if (conversation.isPinned()) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_unpin), 97, getResources()
.getDrawable(R.drawable.ic_unpin_grey600_24px)));
} else {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_pin_to_top), 98, getResources()
.getDrawable(R.drawable.ic_pin_grey600_24px)));
}
if (conversation.isNameEditable()) {
menuItems.add(new MenuItem(getResources().getString(R.string.nc_rename), 2, getResources().getDrawable(R.drawable
.ic_pencil_grey600_24dp)));
@ -202,7 +210,7 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
conversation.setPassword("");
}
if (tag > 0 && tag < 10) {
if (tag > 0 && tag < 11) {
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, tag);
if (tag != 2 && tag != 4 && tag != 6 && tag != 7) {
eventBus.post(new BottomSheetLockEvent(false, 0, false, false));

View File

@ -163,7 +163,7 @@ public class OperationsMenuController extends BaseController {
currentUser = userUtils.getCurrentUser();
OperationsObserver operationsObserver = new OperationsObserver();
if (!TextUtils.isEmpty(callUrl)) {
if (!TextUtils.isEmpty(callUrl) ) {
conversationToken = callUrl.substring(callUrl.lastIndexOf("/") + 1, callUrl.length());
if (callUrl.contains("/index.php")) {
baseUrl = callUrl.substring(0, callUrl.indexOf("/index.php"));
@ -316,6 +316,24 @@ public class OperationsMenuController extends BaseController {
});
break;
case 97:
case 98:
if (operationCode == 97) {
ncApi.unpinConversation(credentials, ApiUtils.getUrlForConversationPin(currentUser.getBaseUrl(),
conversation.getToken()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.retry(1)
.subscribe(operationsObserver);
} else {
ncApi.pinConversation(credentials, ApiUtils.getUrlForConversationPin(currentUser.getBaseUrl(),
conversation.getToken()))
.subscribeOn(Schedulers.newThread())
.observeOn(AndroidSchedulers.mainThread())
.retry(1)
.subscribe(operationsObserver);
}
break;
case 99:
ncApi.joinRoom(credentials, ApiUtils.getUrlForSettingMyselfAsActiveParticipant(baseUrl, conversationToken),
callPassword)

View File

@ -102,6 +102,8 @@
<string name="nc_new_conversation">New conversation</string>
<string name="nc_join_via_link">Join via link</string>
<string name="nc_join_via_web">Join via web</string>
<string name="nc_pin_to_top">Pin to top</string>
<string name="nc_unpin">Unpin</string>
<!-- Contacts -->
<string name="nc_select_contacts">Select contacts</string>