@placetime/corptime-conference 1.0.9 → 1.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@placetime/corptime-conference",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "description": "React Native SDK from Corptime-Conference",
5
5
  "main": "index.tsx",
6
6
  "license": "Apache-2.0",
@@ -1,4 +1,4 @@
1
- import { SET_ROOM_NAME } from '../base/conference/actionTypes';
1
+ import { SET_ROOM_INFO } from '../base/conference/actionTypes';
2
2
  import { setRoom } from '../base/conference/actions';
3
3
  import { getConferenceState } from '../base/conference/functions';
4
4
  import {
@@ -36,6 +36,9 @@ import { maybeRedirectToTokenAuthUrl } from './actions.any';
36
36
  import { addTrackStateToURL, getDefaultURL } from './functions.native';
37
37
  import logger from './logger';
38
38
  import { IReloadNowOptions, IStore } from './types';
39
+ import {doGetJSON} from "../base/util/httpUtils";
40
+ import {setRoomInfo} from "../base/conference/actions.any";
41
+ import {basePageVisibilityChanged, conferenceNotFoundVisibilityChanged} from "../overlay/actions.web";
39
42
 
40
43
  export * from './actions.any';
41
44
 
@@ -153,26 +156,37 @@ export function appNavigate(uri?: string, options: IReloadNowOptions = {}) {
153
156
 
154
157
  dispatch(setLocationURL(locationURL));
155
158
  dispatch(setConfig(config));
156
- dispatch(setRoom(room));
157
159
 
158
- if (!room) {
159
- goBackToRoot(getState(), dispatch);
160
-
161
- return;
162
- }
163
-
164
- dispatch(createDesiredLocalTracks());
165
- dispatch(clearNotifications());
166
-
167
- if (!options.hidePrejoin && isPrejoinPageEnabled(getState())) {
168
- if (isUnsafeRoomWarningEnabled(getState()) && isInsecureRoomName(room)) {
169
- navigateRoot(screen.unsafeRoomWarning);
170
- } else {
171
- navigateRoot(screen.preJoin);
172
- }
160
+ if (room) {
161
+ const backendApi = config.hosts?.backendGuestApi || "https://jitsi.dev.placetime.host/backend/api";
162
+ doGetJSON(backendApi + "/v2/guest/conferences/rooms/info?cid=" + encodeURIComponent(room)).then(res => {
163
+ if (res.data) {
164
+ dispatch(setRoomInfo(res.data));
165
+ dispatch(setRoom(room));
166
+
167
+ dispatch(createDesiredLocalTracks());
168
+ dispatch(clearNotifications());
169
+
170
+ if (!options.hidePrejoin && isPrejoinPageEnabled(getState())) {
171
+ if (isUnsafeRoomWarningEnabled(getState()) && isInsecureRoomName(room)) {
172
+ navigateRoot(screen.unsafeRoomWarning);
173
+ } else {
174
+ navigateRoot(screen.preJoin);
175
+ }
176
+ } else {
177
+ dispatch(connect());
178
+ navigateRoot(screen.conference.root);
179
+ }
180
+ } else {
181
+ goBackToRoot(getState(), dispatch);
182
+ return;
183
+ }
184
+ }).catch(() => {
185
+ goBackToRoot(getState(), dispatch);
186
+ return;
187
+ });
173
188
  } else {
174
- dispatch(connect());
175
- navigateRoot(screen.conference.root);
189
+ goBackToRoot(getState(), dispatch);
176
190
  }
177
191
  };
178
192
  }
@@ -1,6 +1,6 @@
1
1
  // @ts-expect-error
2
2
  import { API_ID } from '../../../modules/API';
3
- import { setRoom, setRoomNameGlobal } from '../base/conference/actions.web';
3
+ import { setRoom, setRoomInfo } from '../base/conference/actions.web';
4
4
  import {
5
5
  configWillLoad,
6
6
  setConfig
@@ -79,13 +79,13 @@ export function appNavigate(uri?: string) {
79
79
  dispatch(configWillLoad(locationURL, room));
80
80
 
81
81
  const config = await loadConfig();
82
- dispatch(setLocationURL(locationURL));
83
82
  dispatch(setConfig(config));
83
+ dispatch(setLocationURL(locationURL));
84
84
  if (room) {
85
- const backendApi = config.hosts?.backendGuestApi || "https://jitsi.dev.placetime.host/backend/api/v2/guest";
86
- doGetJSON(backendApi + "/conferences/rooms/info?cid=" + encodeURIComponent(room)).then(res => {
87
- if (res.data.name) {
88
- dispatch(setRoomNameGlobal(res.data.name));
85
+ const backendApi = config.hosts?.backendGuestApi || "https://jitsi.dev.placetime.host/backend/api";
86
+ doGetJSON(backendApi + "/v2/guest/conferences/rooms/info?cid=" + encodeURIComponent(room)).then(res => {
87
+ if (res.data) {
88
+ dispatch(setRoomInfo(res.data));
89
89
  dispatch(setRoom(room));
90
90
  dispatch(conferenceNotFoundVisibilityChanged(false));
91
91
  } else {
@@ -14,7 +14,6 @@ import DimensionsDetector from '../../base/responsive-ui/components/DimensionsDe
14
14
  import { updateSettings } from '../../base/settings/actions';
15
15
  import JitsiThemePaperProvider from '../../base/ui/components/JitsiThemeProvider.native';
16
16
  import { isEmbedded } from '../../base/util/embedUtils.native';
17
- import { setRoomNameGlobal } from '../../base/conference/actions.any';
18
17
  import { _getRouteToRender } from '../getRouteToRender.native';
19
18
  import logger from '../logger';
20
19
 
@@ -149,7 +148,6 @@ export class App extends AbstractApp<IProps> {
149
148
  if (ready) {
150
149
  clearInterval(i);
151
150
  resolve();
152
- dispatch?.(setRoomNameGlobal(this.props.url.roomName));
153
151
  }
154
152
  }, 50);
155
153
  });
@@ -330,11 +330,11 @@ export const SET_ROOM = 'SET_ROOM';
330
330
  * Default string type room name.
331
331
  *
332
332
  * {
333
- * type: SET_ROOM_NAME,
333
+ * type: SET_ROOM_INFO,
334
334
  * room: string
335
335
  * }
336
336
  */
337
- export const SET_ROOM_NAME = 'SET_ROOM_NAME';
337
+ export const SET_ROOM_INFO = 'SET_ROOM_INFO';
338
338
 
339
339
  /**
340
340
  * The type of (redux) action which updates the current known status of the
@@ -63,7 +63,7 @@ import {
63
63
  SET_PASSWORD_FAILED,
64
64
  SET_PENDING_SUBJECT_CHANGE,
65
65
  SET_ROOM,
66
- SET_ROOM_NAME,
66
+ SET_ROOM_INFO,
67
67
  SET_START_MUTED_POLICY,
68
68
  SET_START_REACTIONS_MUTED,
69
69
  UPDATE_CONFERENCE_METADATA
@@ -974,10 +974,10 @@ export function setRoom(room?: string) {
974
974
  };
975
975
  }
976
976
 
977
- export function setRoomNameGlobal(roomName: string) {
977
+ export function setRoomInfo(roomInfo: any) {
978
978
  return {
979
- type: SET_ROOM_NAME,
980
- roomName,
979
+ type: SET_ROOM_INFO,
980
+ roomInfo,
981
981
  }
982
982
  }
983
983
 
@@ -30,7 +30,7 @@ import {
30
30
  SET_PASSWORD,
31
31
  SET_PENDING_SUBJECT_CHANGE,
32
32
  SET_ROOM,
33
- SET_ROOM_NAME,
33
+ SET_ROOM_INFO,
34
34
  SET_START_MUTED_POLICY,
35
35
  SET_START_REACTIONS_MUTED,
36
36
  UPDATE_CONFERENCE_METADATA
@@ -194,6 +194,7 @@ export interface IConferenceState {
194
194
  properties?: object;
195
195
  room?: string;
196
196
  roomName?: string;
197
+ roomInfo?: any;
197
198
  startAudioMutedPolicy?: boolean;
198
199
  startReactionsMuted?: boolean;
199
200
  startVideoMutedPolicy?: boolean;
@@ -293,8 +294,8 @@ ReducerRegistry.register<IConferenceState>('features/base/conference',
293
294
 
294
295
  case SET_ROOM:
295
296
  return _setRoom(state, action);
296
- case SET_ROOM_NAME:
297
- return _setRoomName(state, action);
297
+ case SET_ROOM_INFO:
298
+ return _setRoomInfo(state, action);
298
299
  case SET_START_MUTED_POLICY:
299
300
  return {
300
301
  ...state,
@@ -694,8 +695,8 @@ function _setRoom(state: IConferenceState, action: AnyAction) {
694
695
  });
695
696
  }
696
697
 
697
- function _setRoomName(state: IConferenceState, action: AnyAction) {
698
- let { roomName } = action;
698
+ function _setRoomInfo(state: IConferenceState, action: AnyAction) {
699
+ let { roomInfo } = action;
699
700
 
700
701
  /**
701
702
  * The name of the room of the conference (to be) joined.
@@ -704,6 +705,7 @@ function _setRoomName(state: IConferenceState, action: AnyAction) {
704
705
  */
705
706
  return assign(state, {
706
707
  error: undefined,
707
- roomName
708
+ roomName: roomInfo.name,
709
+ roomInfo: roomInfo
708
710
  });
709
711
  }
@@ -219,7 +219,7 @@ export function getWhitelistedJSON(configName: 'interfaceConfig' | 'config', con
219
219
  */
220
220
  export function isNameReadOnly(state: IReduxState): boolean {
221
221
  return Boolean(state['features/base/config'].disableProfile
222
- || state['features/base/config'].readOnlyName);
222
+ || state['features/base/config'].readOnlyName || state['features/base/jwt'].user?.name);
223
223
  }
224
224
 
225
225
  /**
@@ -111,6 +111,13 @@ function _overwriteLocalParticipant(
111
111
  }
112
112
  }
113
113
 
114
+ function getCookie(name: string): string | undefined {
115
+ const matches = document.cookie.match(new RegExp(
116
+ "(?:^|; )" + name.replace(/([.$?*|{}()[]\/+^])/g, '\\$1') + "=([^;]*)"
117
+ ));
118
+ return matches ? matches[1] : undefined;
119
+ }
120
+
114
121
  /**
115
122
  * Notifies the feature jwt that the action {@link SET_CONFIG} or
116
123
  * {@link SET_LOCATION_URL} is being dispatched within a specific redux
@@ -132,15 +139,16 @@ function _setConfigOrLocationURL({ dispatch, getState }: IStore, next: Function,
132
139
 
133
140
  const { locationURL } = getState()['features/base/connection'];
134
141
 
135
- let jwt = locationURL ? parseJWTFromURLParams(locationURL) : undefined;
136
- if (jwt) {
137
- jitsiLocalStorage.setItem('jwt', jwt ?? '');
138
- } else {
139
- jwt = jitsiLocalStorage.getItem('jwt');
142
+ let jwt = getCookie('jwt');
143
+ if (!jwt) {
144
+ jwt = locationURL && navigator.product === 'ReactNative' ? parseJWTFromURLParams(locationURL) : undefined;
140
145
  }
146
+
141
147
  if (jwt) {
142
- const backendApi = "https://jitsi.dev.placetime.host/backend/api/v1";
143
- doGetJSON(backendApi + "/users/me", undefined, {
148
+ const state = getState();
149
+ const { hosts } = state['features/base/config'];
150
+ const backendApi = hosts?.backendGuestApi || "https://jitsi.dev.placetime.host/backend/api";
151
+ doGetJSON(backendApi + "/v1/users/me", undefined, {
144
152
  headers: {
145
153
  'Authorization': 'Bearer ' + jwt,
146
154
  },
@@ -457,7 +457,7 @@ export function _mapStateToProps(state: IReduxState) {
457
457
  const showCopyUrlButton = inviteEnabledFlag || !disableInviteFunctions;
458
458
  const deviceStatusVisible = isDeviceStatusVisible(state);
459
459
  const { showHangUp = true } = getLobbyConfig(state);
460
- const { roomName, membersOnly, lobbyWaitingForHost } = state['features/base/conference'];
460
+ const { roomName, membersOnly, lobbyWaitingForHost, roomInfo } = state['features/base/conference'];
461
461
  const { isLobbyChatActive, lobbyMessageRecipient, messages } = state['features/chat'];
462
462
  const { showModeratorLogin } = state['features/authentication'];
463
463
 
@@ -476,7 +476,7 @@ export function _mapStateToProps(state: IReduxState) {
476
476
  _participantId: participantId,
477
477
  _participantName: localParticipant?.name,
478
478
  _passwordJoinFailed: passwordJoinFailed,
479
- _renderPassword: !iAmSipGateway && !lobbyWaitingForHost,
479
+ _renderPassword: !iAmSipGateway && !lobbyWaitingForHost && roomInfo.password_hash,
480
480
  showCopyUrlButton,
481
481
  roomName,
482
482
  };
@@ -70,6 +70,7 @@ class LobbyScreen extends AbstractLobbyScreen<IProps> {
70
70
  super(props);
71
71
 
72
72
  this._onLogin = this._onLogin.bind(this);
73
+ this._onHardwareBackPress = this._onHardwareBackPress.bind(this);
73
74
  }
74
75
 
75
76
  override componentDidMount() {
@@ -274,8 +274,10 @@ const LocalRecordingManager: ILocalRecordingManager = {
274
274
  this.recorder.addEventListener('stop', async () => {
275
275
  const duration = Date.now() - this.startTime!;
276
276
 
277
- this.stream?.getTracks().forEach((track: MediaStreamTrack) => track.stop());
278
- gdmStream?.getTracks().forEach((track: MediaStreamTrack) => track.stop());
277
+ if (!onlySelf) {
278
+ this.stream?.getTracks().forEach((track: MediaStreamTrack) => track.stop());
279
+ gdmStream?.getTracks().forEach((track: MediaStreamTrack) => track.stop());
280
+ }
279
281
 
280
282
  // The stop event is emitted when the recorder is done, and _after_ the last buffered
281
283
  // data has been handed over to the dataavailable event.
@@ -47,10 +47,10 @@ MiddlewareRegistry.register(store => next => action => {
47
47
  // titleKey: 'notify.passwordSetRemotely'
48
48
  // }, NOTIFICATION_TIMEOUT_TYPE.SHORT));
49
49
  } else if (previousLockedState === LOCKED_REMOTELY && !currentLockedState) {
50
- store.dispatch(
51
- showNotification({
52
- titleKey: 'notify.passwordRemovedRemotely'
53
- }, NOTIFICATION_TIMEOUT_TYPE.SHORT));
50
+ // store.dispatch(
51
+ // showNotification({
52
+ // titleKey: 'notify.passwordRemovedRemotely'
53
+ // }, NOTIFICATION_TIMEOUT_TYPE.SHORT));
54
54
  }
55
55
 
56
56
  return result;