mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-21 12:39:58 +01:00
parent
8b67f2aad5
commit
4bc726fa23
@ -1072,7 +1072,7 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
localAudioTrack = null;
|
localAudioTrack = null;
|
||||||
localVideoTrack = null;
|
localVideoTrack = null;
|
||||||
|
|
||||||
if (!dueToNetworkChange && credentials != null) {
|
if (!dueToNetworkChange) {
|
||||||
hangupNetworkCalls();
|
hangupNetworkCalls();
|
||||||
} else {
|
} else {
|
||||||
finish();
|
finish();
|
||||||
|
@ -324,7 +324,7 @@ public class CallsListController extends BaseController implements SearchView.On
|
|||||||
new Handler().postDelayed(() -> {
|
new Handler().postDelayed(() -> {
|
||||||
bottomSheet.setCancelable(true);
|
bottomSheet.setCancelable(true);
|
||||||
if (bottomSheet.isShowing()) {
|
if (bottomSheet.isShowing()) {
|
||||||
bottomSheet.dismiss();
|
bottomSheet.cancel();
|
||||||
}
|
}
|
||||||
}, 2500);
|
}, 2500);
|
||||||
}
|
}
|
||||||
@ -428,7 +428,7 @@ public class CallsListController extends BaseController implements SearchView.On
|
|||||||
} else {
|
} else {
|
||||||
bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
|
bottomSheet.setCancelable(bottomSheetLockEvent.isCancelable());
|
||||||
if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
|
if (bottomSheet.isShowing() && bottomSheetLockEvent.isCancel()) {
|
||||||
bottomSheet.dismiss();
|
bottomSheet.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -464,10 +464,10 @@ public class CallsListController extends BaseController implements SearchView.On
|
|||||||
|
|
||||||
if (bottomSheet == null) {
|
if (bottomSheet == null) {
|
||||||
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
|
bottomSheet = new BottomSheet.Builder(getActivity()).setView(view).create();
|
||||||
} else if (bottomSheet.getWindow() != null) {
|
|
||||||
bottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bottomSheet.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
|
||||||
|
|
||||||
bottomSheet.show();
|
bottomSheet.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ public class CallMenuController extends BaseController implements FlexibleAdapte
|
|||||||
private Intent shareIntent;
|
private Intent shareIntent;
|
||||||
|
|
||||||
private UserEntity currentUser;
|
private UserEntity currentUser;
|
||||||
|
|
||||||
public CallMenuController(Bundle args) {
|
public CallMenuController(Bundle args) {
|
||||||
super(args);
|
super(args);
|
||||||
this.room = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_ROOM));
|
this.room = Parcels.unwrap(args.getParcelable(BundleKeys.KEY_ROOM));
|
||||||
|
@ -25,6 +25,7 @@ import android.content.Intent;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
|
import android.text.InputType;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
@ -39,7 +40,6 @@ import com.nextcloud.talk.R;
|
|||||||
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
import com.nextcloud.talk.application.NextcloudTalkApplication;
|
||||||
import com.nextcloud.talk.controllers.base.BaseController;
|
import com.nextcloud.talk.controllers.base.BaseController;
|
||||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
|
||||||
import com.nextcloud.talk.models.json.rooms.Room;
|
import com.nextcloud.talk.models.json.rooms.Room;
|
||||||
import com.nextcloud.talk.utils.ApplicationWideMessageHolder;
|
import com.nextcloud.talk.utils.ApplicationWideMessageHolder;
|
||||||
import com.nextcloud.talk.utils.ShareUtils;
|
import com.nextcloud.talk.utils.ShareUtils;
|
||||||
@ -81,6 +81,7 @@ public class EntryMenuController extends BaseController {
|
|||||||
private Intent shareIntent;
|
private Intent shareIntent;
|
||||||
private String packageName;
|
private String packageName;
|
||||||
private String name;
|
private String name;
|
||||||
|
private String callUrl;
|
||||||
|
|
||||||
public EntryMenuController(Bundle args) {
|
public EntryMenuController(Bundle args) {
|
||||||
super(args);
|
super(args);
|
||||||
@ -95,6 +96,7 @@ public class EntryMenuController extends BaseController {
|
|||||||
|
|
||||||
this.name = args.getString(BundleKeys.KEY_APP_ITEM_NAME, "");
|
this.name = args.getString(BundleKeys.KEY_APP_ITEM_NAME, "");
|
||||||
this.packageName = args.getString(BundleKeys.KEY_APP_ITEM_PACKAGE_NAME, "");
|
this.packageName = args.getString(BundleKeys.KEY_APP_ITEM_PACKAGE_NAME, "");
|
||||||
|
this.callUrl = args.getString(BundleKeys.KEY_CALL_URL, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -120,18 +122,15 @@ public class EntryMenuController extends BaseController {
|
|||||||
public void onProceedButtonClick() {
|
public void onProceedButtonClick() {
|
||||||
Bundle bundle;
|
Bundle bundle;
|
||||||
if (operationCode == 99) {
|
if (operationCode == 99) {
|
||||||
UserEntity userEntity = userUtils.getCurrentUser();
|
|
||||||
|
|
||||||
if (userEntity != null) {
|
|
||||||
eventBus.post(new BottomSheetLockEvent(false, 0, false, false));
|
eventBus.post(new BottomSheetLockEvent(false, 0, false, false));
|
||||||
bundle = new Bundle();
|
bundle = new Bundle();
|
||||||
bundle.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(room));
|
bundle.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(room));
|
||||||
|
bundle.putString(BundleKeys.KEY_CALL_URL, callUrl);
|
||||||
bundle.putString(BundleKeys.KEY_CALL_PASSWORD, editText.getText().toString());
|
bundle.putString(BundleKeys.KEY_CALL_PASSWORD, editText.getText().toString());
|
||||||
|
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, operationCode);
|
||||||
getRouter().pushController(RouterTransaction.with(new OperationsMenuController(bundle))
|
getRouter().pushController(RouterTransaction.with(new OperationsMenuController(bundle))
|
||||||
.pushChangeHandler(new HorizontalChangeHandler())
|
.pushChangeHandler(new HorizontalChangeHandler())
|
||||||
.popChangeHandler(new HorizontalChangeHandler()));
|
.popChangeHandler(new HorizontalChangeHandler()));
|
||||||
}
|
|
||||||
|
|
||||||
} else if (operationCode != 7 && operationCode != 10) {
|
} else if (operationCode != 7 && operationCode != 10) {
|
||||||
eventBus.post(new BottomSheetLockEvent(false, 0, false, false));
|
eventBus.post(new BottomSheetLockEvent(false, 0, false, false));
|
||||||
bundle = new Bundle();
|
bundle = new Bundle();
|
||||||
@ -246,12 +245,14 @@ public class EntryMenuController extends BaseController {
|
|||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
labelText = getResources().getString(R.string.nc_new_password);
|
labelText = getResources().getString(R.string.nc_new_password);
|
||||||
|
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
case 7:
|
case 7:
|
||||||
case 99:
|
case 99:
|
||||||
// 99 is joining a room via password
|
// 99 is joining a room via password
|
||||||
labelText = getResources().getString(R.string.nc_password);
|
labelText = getResources().getString(R.string.nc_password);
|
||||||
|
editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_PASSWORD);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
labelText = getResources().getString(R.string.nc_conversation_link);
|
labelText = getResources().getString(R.string.nc_conversation_link);
|
||||||
|
@ -24,6 +24,7 @@ import android.content.Intent;
|
|||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -32,6 +33,8 @@ import android.widget.ImageView;
|
|||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import com.bluelinelabs.conductor.RouterTransaction;
|
||||||
|
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
|
||||||
import com.bluelinelabs.conductor.internal.NoOpControllerChangeHandler;
|
import com.bluelinelabs.conductor.internal.NoOpControllerChangeHandler;
|
||||||
import com.nextcloud.talk.R;
|
import com.nextcloud.talk.R;
|
||||||
import com.nextcloud.talk.activities.CallActivity;
|
import com.nextcloud.talk.activities.CallActivity;
|
||||||
@ -40,6 +43,7 @@ import com.nextcloud.talk.application.NextcloudTalkApplication;
|
|||||||
import com.nextcloud.talk.controllers.base.BaseController;
|
import com.nextcloud.talk.controllers.base.BaseController;
|
||||||
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
import com.nextcloud.talk.events.BottomSheetLockEvent;
|
||||||
import com.nextcloud.talk.models.database.UserEntity;
|
import com.nextcloud.talk.models.database.UserEntity;
|
||||||
|
import com.nextcloud.talk.models.json.call.CallOverall;
|
||||||
import com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall;
|
import com.nextcloud.talk.models.json.capabilities.CapabilitiesOverall;
|
||||||
import com.nextcloud.talk.models.json.rooms.Room;
|
import com.nextcloud.talk.models.json.rooms.Room;
|
||||||
import com.nextcloud.talk.models.json.rooms.RoomOverall;
|
import com.nextcloud.talk.models.json.rooms.RoomOverall;
|
||||||
@ -98,6 +102,8 @@ public class OperationsMenuController extends BaseController {
|
|||||||
private String callUrl;
|
private String callUrl;
|
||||||
|
|
||||||
private String baseUrl;
|
private String baseUrl;
|
||||||
|
private String callSession;
|
||||||
|
private String conversationToken;
|
||||||
|
|
||||||
private Disposable disposable;
|
private Disposable disposable;
|
||||||
|
|
||||||
@ -128,8 +134,23 @@ public class OperationsMenuController extends BaseController {
|
|||||||
private void processOperation() {
|
private void processOperation() {
|
||||||
userEntity = userUtils.getCurrentUser();
|
userEntity = userUtils.getCurrentUser();
|
||||||
OperationsObserver operationsObserver = new OperationsObserver();
|
OperationsObserver operationsObserver = new OperationsObserver();
|
||||||
|
|
||||||
|
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"));
|
||||||
|
} else {
|
||||||
|
baseUrl = callUrl.substring(0, callUrl.indexOf("/call"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (userEntity != null) {
|
if (userEntity != null) {
|
||||||
String credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
String credentials = ApiUtils.getCredentials(userEntity.getUsername(), userEntity.getToken());
|
||||||
|
|
||||||
|
if (!TextUtils.isEmpty(baseUrl) && !baseUrl.equals(userEntity.getBaseUrl())) {
|
||||||
|
credentials = null;
|
||||||
|
}
|
||||||
|
|
||||||
switch (operationCode) {
|
switch (operationCode) {
|
||||||
case 1:
|
case 1:
|
||||||
ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForRemoveSelfFromRoom(userEntity.getBaseUrl
|
ncApi.removeSelfFromRoom(credentials, ApiUtils.getUrlForRemoveSelfFromRoom(userEntity.getBaseUrl
|
||||||
@ -188,14 +209,8 @@ public class OperationsMenuController extends BaseController {
|
|||||||
.subscribe(operationsObserver);
|
.subscribe(operationsObserver);
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
String conversationToken = callUrl.substring(callUrl.lastIndexOf("/") + 1, callUrl.length());
|
String finalCredentials = credentials;
|
||||||
if (callUrl.contains("/index.php")) {
|
ncApi.getRoom(null, ApiUtils.getRoom(baseUrl, conversationToken))
|
||||||
baseUrl = callUrl.substring(0, callUrl.indexOf("/index.php"));
|
|
||||||
} else {
|
|
||||||
baseUrl = callUrl.substring(0, callUrl.indexOf("/call"));
|
|
||||||
}
|
|
||||||
|
|
||||||
ncApi.getRoom(credentials, ApiUtils.getRoom(baseUrl, conversationToken))
|
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.retry(1)
|
.retry(1)
|
||||||
@ -208,7 +223,7 @@ public class OperationsMenuController extends BaseController {
|
|||||||
@Override
|
@Override
|
||||||
public void onNext(RoomOverall roomOverall) {
|
public void onNext(RoomOverall roomOverall) {
|
||||||
room = roomOverall.getOcs().getData();
|
room = roomOverall.getOcs().getData();
|
||||||
ncApi.getCapabilities(null, ApiUtils.getUrlForCapabilities(baseUrl))
|
ncApi.getCapabilities(finalCredentials, ApiUtils.getUrlForCapabilities(baseUrl))
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
.subscribe(new Observer<CapabilitiesOverall>() {
|
.subscribe(new Observer<CapabilitiesOverall>() {
|
||||||
@ -223,9 +238,19 @@ public class OperationsMenuController extends BaseController {
|
|||||||
.getCapabilities().getSpreedCapability() != null &&
|
.getCapabilities().getSpreedCapability() != null &&
|
||||||
capabilitiesOverall.getOcs().getData()
|
capabilitiesOverall.getOcs().getData()
|
||||||
.getCapabilities().getSpreedCapability()
|
.getCapabilities().getSpreedCapability()
|
||||||
.getFeatures() != null) {
|
.getFeatures() != null && capabilitiesOverall.getOcs().getData()
|
||||||
|
.getCapabilities().getSpreedCapability()
|
||||||
|
.getFeatures().contains("guest-signaling")) {
|
||||||
if (room.isHasPassword() && room.isGuest()) {
|
if (room.isHasPassword() && room.isGuest()) {
|
||||||
|
eventBus.post(new BottomSheetLockEvent(true, 0,
|
||||||
|
true, false));
|
||||||
|
Bundle bundle = new Bundle();
|
||||||
|
bundle.putParcelable(BundleKeys.KEY_ROOM, Parcels.wrap(room));
|
||||||
|
bundle.putString(BundleKeys.KEY_CALL_URL, callUrl);
|
||||||
|
bundle.putInt(BundleKeys.KEY_OPERATION_CODE, 99);
|
||||||
|
getRouter().pushController(RouterTransaction.with(new EntryMenuController(bundle))
|
||||||
|
.pushChangeHandler(new HorizontalChangeHandler())
|
||||||
|
.popChangeHandler(new HorizontalChangeHandler()));
|
||||||
} else {
|
} else {
|
||||||
initiateCall();
|
initiateCall();
|
||||||
}
|
}
|
||||||
@ -259,7 +284,7 @@ public class OperationsMenuController extends BaseController {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 99:
|
case 99:
|
||||||
ncApi.joinRoom(credentials, ApiUtils.getUrlForRoomParticipants(userEntity.getBaseUrl(), room.getToken()),
|
ncApi.joinRoom(credentials, ApiUtils.getUrlForRoomParticipants(baseUrl, conversationToken),
|
||||||
callPassword)
|
callPassword)
|
||||||
.subscribeOn(Schedulers.newThread())
|
.subscribeOn(Schedulers.newThread())
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
@ -294,9 +319,10 @@ public class OperationsMenuController extends BaseController {
|
|||||||
} else {
|
} else {
|
||||||
resultsTextView.setText(R.string.nc_failed_signaling_settings);
|
resultsTextView.setText(R.string.nc_failed_signaling_settings);
|
||||||
webButton.setOnClickListener(v -> {
|
webButton.setOnClickListener(v -> {
|
||||||
new BottomSheetLockEvent(true, 0, false, true);
|
eventBus.post(new BottomSheetLockEvent(true, 0, false, true));
|
||||||
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(callUrl));
|
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(callUrl));
|
||||||
startActivity(browserIntent);
|
startActivity(browserIntent);
|
||||||
|
new BottomSheetLockEvent(true, 0, false, true);
|
||||||
});
|
});
|
||||||
webButton.setVisibility(View.VISIBLE);
|
webButton.setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
@ -329,13 +355,14 @@ public class OperationsMenuController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initiateCall() {
|
private void initiateCall() {
|
||||||
eventBus.post(new BottomSheetLockEvent(true, 0, false, true));
|
eventBus.post(new BottomSheetLockEvent(true, 0, true, true));
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, room.getToken());
|
bundle.putString(BundleKeys.KEY_ROOM_TOKEN, room.getToken());
|
||||||
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
|
bundle.putParcelable(BundleKeys.KEY_USER_ENTITY, Parcels.wrap(userEntity));
|
||||||
if (!baseUrl.equals(userEntity.getBaseUrl())) {
|
if (!baseUrl.equals(userEntity.getBaseUrl())) {
|
||||||
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, baseUrl);
|
bundle.putString(BundleKeys.KEY_MODIFIED_BASE_URL, baseUrl);
|
||||||
}
|
}
|
||||||
|
bundle.putString(BundleKeys.KEY_CALL_SESSION, callSession);
|
||||||
overridePushHandler(new NoOpControllerChangeHandler());
|
overridePushHandler(new NoOpControllerChangeHandler());
|
||||||
overridePopHandler(new NoOpControllerChangeHandler());
|
overridePopHandler(new NoOpControllerChangeHandler());
|
||||||
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
Intent callIntent = new Intent(getActivity(), CallActivity.class);
|
||||||
@ -355,6 +382,8 @@ public class OperationsMenuController extends BaseController {
|
|||||||
if (operationCode != 99) {
|
if (operationCode != 99) {
|
||||||
showResultImage(true, false);
|
showResultImage(true, false);
|
||||||
} else {
|
} else {
|
||||||
|
CallOverall callOverall = (CallOverall) o;
|
||||||
|
callSession = callOverall.getOcs().getData().getSessionId();
|
||||||
initiateCall();
|
initiateCall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@
|
|||||||
android:layout_marginBottom="12dp"
|
android:layout_marginBottom="12dp"
|
||||||
android:layout_marginEnd="24dp"
|
android:layout_marginEnd="24dp"
|
||||||
android:layout_marginStart="24dp"
|
android:layout_marginStart="24dp"
|
||||||
android:maxLines="2"
|
android:maxLines="3"
|
||||||
android:textAlignment="center"
|
android:textAlignment="center"
|
||||||
android:textColor="@color/colorPrimary"
|
android:textColor="@color/colorPrimary"
|
||||||
android:visibility="gone"/>
|
android:visibility="gone"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user