Commit 20b8eed0 authored by Valere's avatar Valere

Fix / widgets hidden when no IM in settings

parent 32ad61ea
......@@ -136,11 +136,6 @@ public class JitsiCallActivity extends VectorAppCompatActivity implements JitsiM
return;
}
if (getWidgetManager() == null) {
finish();
return;
}
mRoom = mSession.getDataHandler().getRoom(mWidget.getRoomId());
if (null == mRoom) {
Log.e(LOG_TAG, "## onCreate() : undefined room " + mWidget.getRoomId());
......
......@@ -171,12 +171,8 @@ public class ActiveWidgetsBanner extends FrameLayout {
* Refresh the view visibility
*/
private void refresh() {
WidgetsManager wm = getWidgetManager(getContext());
if (wm == null) {
return;
}
if ((null != mRoom) && (null != mSession)) {
List<Widget> activeWidgets = wm.getActiveWebviewWidgets(mSession, mRoom);
List<Widget> activeWidgets = WidgetsManager.getActiveWebviewWidgets(mSession, mRoom);
Widget firstWidget = null;
if ((activeWidgets.size() != mActiveWidgets.size()) || !mActiveWidgets.containsAll(activeWidgets)) {
......@@ -202,7 +198,7 @@ public class ActiveWidgetsBanner extends FrameLayout {
setVisibility((mActiveWidgets.size() > 0) ? View.VISIBLE : View.GONE);
// show the close widget button if the user is allowed to do it
mCloseWidgetIcon.setVisibility(((null != firstWidget) && (null == wm.checkWidgetPermission(mSession, mRoom))) ?
mCloseWidgetIcon.setVisibility(((null != firstWidget) && (null == WidgetsManager.checkWidgetPermission(mSession, mRoom))) ?
View.VISIBLE : View.GONE);
}
}
......
......@@ -243,12 +243,8 @@ public class VectorOngoingConferenceCallView extends RelativeLayout {
* Refresh the view visibility
*/
public void refresh() {
WidgetsManager wm = Matrix.getWidgetManager(getContext());
if (wm == null) {
return;
}
if ((null != mRoom) && (null != mSession)) {
List<Widget> mActiveWidgets = wm.getActiveJitsiWidgets(mSession, mRoom);
List<Widget> mActiveWidgets = WidgetsManager.getActiveJitsiWidgets(mSession, mRoom);
Widget widget = mActiveWidgets.isEmpty() ? null : mActiveWidgets.get(0);
if (mActiveWidget != widget) {
......@@ -266,7 +262,7 @@ public class VectorOngoingConferenceCallView extends RelativeLayout {
setVisibility(((!MXCallsManager.isCallInProgress(call) && mRoom.isOngoingConferenceCall()) || (null != mActiveWidget)) ? View.VISIBLE : View.GONE);
// show the close widget button if the user is allowed to do it
mCloseWidgetIcon.setVisibility(((null != mActiveWidget) && (null == wm.checkWidgetPermission(mSession, mRoom))) ?
mCloseWidgetIcon.setVisibility(((null != mActiveWidget) && (null == WidgetsManager.checkWidgetPermission(mSession, mRoom))) ?
View.VISIBLE : View.GONE);
}
}
......
......@@ -95,7 +95,7 @@ public class WidgetsManager {
* @param room the room to check.
* @return the active widgets list
*/
public List<Widget> getActiveWidgets(MXSession session, Room room) {
public static List<Widget> getActiveWidgets(MXSession session, Room room) {
return getActiveWidgets(session, room, null, null);
}
......@@ -124,7 +124,7 @@ public class WidgetsManager {
* @param excludedTypes the excluded widget types
* @return the active widgets list
*/
private List<Widget> getActiveWidgets(final MXSession session, final Room room, final Set<String> widgetTypes, final Set<String> excludedTypes) {
private static List<Widget> getActiveWidgets(final MXSession session, final Room room, final Set<String> widgetTypes, final Set<String> excludedTypes) {
// Get all im.vector.modular.widgets state events in the room
List<Event> widgetEvents = room.getState().getStateEvents(new HashSet<>(Arrays.asList(WIDGET_EVENT_TYPE)));
......@@ -210,7 +210,7 @@ public class WidgetsManager {
* @param room the room
* @return the list of active widgets
*/
public List<Widget> getActiveJitsiWidgets(final MXSession session, final Room room) {
public static List<Widget> getActiveJitsiWidgets(final MXSession session, final Room room) {
return getActiveWidgets(session, room, new HashSet<>(Arrays.asList(WidgetsManager.WIDGET_TYPE_JITSI)), null);
}
......@@ -221,7 +221,7 @@ public class WidgetsManager {
* @param room the room
* @return the list of active widgets
*/
public List<Widget> getActiveWebviewWidgets(final MXSession session, final Room room) {
public static List<Widget> getActiveWebviewWidgets(final MXSession session, final Room room) {
return getActiveWidgets(session, room, null, new HashSet<>(Arrays.asList(WidgetsManager.WIDGET_TYPE_JITSI)));
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment