Remove unused capability checking

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-05-11 11:21:43 +02:00
parent a4cc7f2816
commit 2fd0933383
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA

View File

@ -35,7 +35,6 @@ import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.bluelinelabs.conductor.RouterTransaction; import com.bluelinelabs.conductor.RouterTransaction;
import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler; import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler;
@ -318,15 +317,7 @@ public class OperationsMenuController extends BaseController {
.pushChangeHandler(new HorizontalChangeHandler()) .pushChangeHandler(new HorizontalChangeHandler())
.popChangeHandler(new HorizontalChangeHandler())); .popChangeHandler(new HorizontalChangeHandler()));
} else { } else {
try { initiateConversation(false);
initiateConversation(
false,
LoganSquare.parse(currentUser.getCapabilities(), Capabilities.class)
);
} catch (IOException e) {
Log.e(TAG, "Failed to parse capabilities for guest");
showResultImage(false, false);
}
} }
} }
@ -562,7 +553,7 @@ public class OperationsMenuController extends BaseController {
} }
if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) { if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) {
initiateConversation(true, null); initiateConversation(true);
} }
dispose(); dispose();
} }
@ -604,54 +595,34 @@ public class OperationsMenuController extends BaseController {
} }
if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) { if (localInvitedGroups.size() == 0 && localInvitedUsers.size() == 0) {
initiateConversation(true, null); initiateConversation(true);
} }
dispose(); dispose();
} }
}); });
} }
} else { } else {
initiateConversation(true, null); initiateConversation(true);
} }
} }
private void initiateConversation(boolean dismissView, @Nullable Capabilities capabilities) { private void initiateConversation(boolean dismissView) {
Bundle bundle = new Bundle();
boolean isGuestUser = false;
if (baseUrl != null && !baseUrl.equals(currentUser.getBaseUrl())) {
isGuestUser = true;
}
eventBus.post(new BottomSheetLockEvent(true, 0, eventBus.post(new BottomSheetLockEvent(true, 0,
true, true, dismissView)); true, true, dismissView));
Intent conversationIntent = new Intent(getActivity(), MagicCallActivity.class); Intent conversationIntent = new Intent(getActivity(), MagicCallActivity.class);
Bundle bundle = new Bundle();
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), conversation.getToken()); bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_TOKEN(), conversation.getToken());
bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), conversation.getRoomId()); bundle.putString(BundleKeys.INSTANCE.getKEY_ROOM_ID(), conversation.getRoomId());
bundle.putString(BundleKeys.INSTANCE.getKEY_CONVERSATION_NAME(), conversation.getDisplayName()); bundle.putString(BundleKeys.INSTANCE.getKEY_CONVERSATION_NAME(), conversation.getDisplayName());
UserEntity conversationUser; bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), currentUser);
if (isGuestUser) {
conversationUser = new UserEntity();
conversationUser.setBaseUrl(baseUrl);
conversationUser.setUserId("?");
try {
conversationUser.setCapabilities(LoganSquare.serialize(capabilities));
} catch (IOException e) {
Log.e("OperationsMenu", "Failed to serialize capabilities");
}
} else {
conversationUser = currentUser;
}
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_USER_ENTITY(), conversationUser);
bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(), Parcels.wrap(conversation)); bundle.putParcelable(BundleKeys.INSTANCE.getKEY_ACTIVE_CONVERSATION(), Parcels.wrap(conversation));
bundle.putString(BundleKeys.INSTANCE.getKEY_CONVERSATION_PASSWORD(), callPassword); bundle.putString(BundleKeys.INSTANCE.getKEY_CONVERSATION_PASSWORD(), callPassword);
conversationIntent.putExtras(bundle); conversationIntent.putExtras(bundle);
if (getParentController() != null) { if (getParentController() != null) {
ConductorRemapping.INSTANCE.remapChatController(getParentController().getRouter(), conversationUser.getId(), ConductorRemapping.INSTANCE.remapChatController(getParentController().getRouter(), currentUser.getId(),
conversation.getToken(), bundle, true); conversation.getToken(), bundle, true);
} }
} }
@ -670,7 +641,7 @@ public class OperationsMenuController extends BaseController {
} else { } else {
RoomOverall roomOverall = (RoomOverall) o; RoomOverall roomOverall = (RoomOverall) o;
conversation = roomOverall.getOcs().getData(); conversation = roomOverall.getOcs().getData();
initiateConversation(true, serverCapabilities); initiateConversation(true);
} }
} }