agora-appbuilder-core 4.0.0-ms.2 → 4.0.0-ms.5
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
|
@@ -57,25 +57,25 @@ const AuthProvider = (props: AuthProviderProps) => {
|
|
|
57
57
|
|
|
58
58
|
const enableAuth = $config.ENABLE_IDP_AUTH || $config.ENABLE_TOKEN_AUTH;
|
|
59
59
|
|
|
60
|
-
useEffect(()=>{
|
|
61
|
-
SDKMethodEventsManager.on('login',async(res,rej,token)=>{
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
SDKMethodEventsManager.on('login', async (res, rej, token) => {
|
|
62
62
|
try {
|
|
63
63
|
await AsyncStorage.setItem('SDK_TOKEN', token);
|
|
64
|
-
await enableTokenAuth()
|
|
65
|
-
res()
|
|
64
|
+
await enableTokenAuth();
|
|
65
|
+
res();
|
|
66
66
|
} catch (error) {
|
|
67
|
-
rej('SDK Login failed'+JSON.stringify(error))
|
|
68
|
-
}
|
|
69
|
-
})
|
|
70
|
-
SDKMethodEventsManager.on('logout',async(res,rej)=>{
|
|
67
|
+
rej('SDK Login failed' + JSON.stringify(error));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
SDKMethodEventsManager.on('logout', async (res, rej) => {
|
|
71
71
|
try {
|
|
72
|
-
await tokenLogout()
|
|
73
|
-
res()
|
|
72
|
+
await tokenLogout();
|
|
73
|
+
res();
|
|
74
74
|
} catch (error) {
|
|
75
|
-
rej('SDK Logout failed'+JSON.stringify(error))
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
},[])
|
|
75
|
+
rej('SDK Logout failed' + JSON.stringify(error));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}, []);
|
|
79
79
|
|
|
80
80
|
useEffect(() => {
|
|
81
81
|
if (!authenticated && authError) {
|
|
@@ -122,13 +122,10 @@ const AuthProvider = (props: AuthProviderProps) => {
|
|
|
122
122
|
|
|
123
123
|
const authLogin = () => {
|
|
124
124
|
if (enableAuth) {
|
|
125
|
-
console.log('supriya enable AUTH FLOW');
|
|
126
125
|
// Authenticated login flow
|
|
127
126
|
if ($config.ENABLE_IDP_AUTH && !isSDK()) {
|
|
128
|
-
console.log('supriya enable AUTH IDP');
|
|
129
127
|
enableIDPAuth();
|
|
130
128
|
} else if ($config.ENABLE_TOKEN_AUTH && isSDK()) {
|
|
131
|
-
console.log('supriya enable AUTH SDK');
|
|
132
129
|
enableTokenAuth()
|
|
133
130
|
.then((res) => {
|
|
134
131
|
setIsAuthenticated(true);
|
|
@@ -152,7 +149,6 @@ const AuthProvider = (props: AuthProviderProps) => {
|
|
|
152
149
|
}
|
|
153
150
|
} else {
|
|
154
151
|
// Unauthenticated login flow
|
|
155
|
-
console.log('supriya enable UNAUTH FLOW');
|
|
156
152
|
fetch(GET_UNAUTH_FLOW_API_ENDPOINT(), {
|
|
157
153
|
credentials: 'include',
|
|
158
154
|
})
|
|
@@ -160,7 +156,6 @@ const AuthProvider = (props: AuthProviderProps) => {
|
|
|
160
156
|
.then((response) => {
|
|
161
157
|
//rsdk,websdk,android,ios
|
|
162
158
|
if (isSDK() || isAndroid() || isIOS()) {
|
|
163
|
-
console.log('supriya enable UNAUTH in SDK');
|
|
164
159
|
if (!response.token) {
|
|
165
160
|
throw new Error('Token not received');
|
|
166
161
|
} else {
|
|
@@ -211,9 +206,7 @@ const AuthProvider = (props: AuthProviderProps) => {
|
|
|
211
206
|
};
|
|
212
207
|
|
|
213
208
|
const authLogout = () => {
|
|
214
|
-
console.log('supriya logout user');
|
|
215
209
|
if (enableAuth && $config.ENABLE_IDP_AUTH && !isSDK()) {
|
|
216
|
-
console.log('supriya logout AUTH IDP');
|
|
217
210
|
idpLogout()
|
|
218
211
|
.then((res) => {
|
|
219
212
|
console.log('user successfully logged out');
|
|
@@ -227,7 +220,6 @@ const AuthProvider = (props: AuthProviderProps) => {
|
|
|
227
220
|
history.push('/login');
|
|
228
221
|
});
|
|
229
222
|
} else {
|
|
230
|
-
console.log('supriya logout AUTH/UNAUTH');
|
|
231
223
|
if (!enableAuth || isSDK()) {
|
|
232
224
|
//no need to logout because we need token to see the create screen
|
|
233
225
|
history.push('/create');
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, {useContext, useState} from 'react';
|
|
2
2
|
import {useRtc} from 'customization-api';
|
|
3
|
-
import {useAuth} from '../auth/AuthProvider';
|
|
4
3
|
|
|
5
4
|
import EndcallPopup from './EndcallPopup';
|
|
6
5
|
import StorageContext from '../components/StorageContext';
|
|
@@ -24,7 +23,6 @@ const stopForegroundService = () => {
|
|
|
24
23
|
|
|
25
24
|
const LocalEndcall = (props: LocalEndcallProps) => {
|
|
26
25
|
const {dispatch} = useRtc();
|
|
27
|
-
const {authLogout} = useAuth();
|
|
28
26
|
const {showLabel = $config.ICON_TEXT, isOnActionSheet = false} = props;
|
|
29
27
|
//commented for v1 release
|
|
30
28
|
//const endCallLabel = useString('endCallButton')();
|
|
@@ -43,7 +41,6 @@ const LocalEndcall = (props: LocalEndcallProps) => {
|
|
|
43
41
|
value: [],
|
|
44
42
|
});
|
|
45
43
|
});
|
|
46
|
-
authLogout();
|
|
47
44
|
// stopping foreground servie on end call
|
|
48
45
|
stopForegroundService();
|
|
49
46
|
};
|