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