How to use the react-native-voximplant.Voximplant.ClientState function in react-native-voximplant

To help you get started, we’ve selected a few react-native-voximplant examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github voximplant / react-native-demo / src / manager / LoginManager.js View on Github external
async loginWithToken() {
        try {
            let state = await this.client.getClientState();
            if (state === Voximplant.ClientState.DISCONNECTED) {
                await this.client.connect();
            }
            if (state !== Voximplant.ClientState.LOGGED_IN) {
                const username = await AsyncStorage.getItem('usernameValue');
                const accessToken = await AsyncStorage.getItem('accessToken');
                console.log('LoginManager: loginWithToken: user: ' + username + ', token: ' + accessToken );
                const authResult = await this.client.loginWithToken(username + '.voximplant.com', accessToken);
                await this._processLoginSuccess(authResult);
            }
        } catch (e) {
            console.log('LoginManager: loginWithToken: ' + e.name);
            if (e.name === Voximplant.ClientEvents.AuthResult) {
                console.log('LoginManager: loginWithToken: error code: ' + e.code);
            }
        }
    }
github voximplant / react-native-demo / src / manager / LoginManager.js View on Github external
async loginWithToken() {
        try {
            let state = await this.client.getClientState();
            if (state === Voximplant.ClientState.DISCONNECTED) {
                await this.client.connect();
            }
            if (state !== Voximplant.ClientState.LOGGED_IN) {
                const username = await AsyncStorage.getItem('usernameValue');
                const accessToken = await AsyncStorage.getItem('accessToken');
                console.log('LoginManager: loginWithToken: user: ' + username + ', token: ' + accessToken );
                const authResult = await this.client.loginWithToken(username + '.voximplant.com', accessToken);
                await this._processLoginSuccess(authResult);
            }
        } catch (e) {
            console.log('LoginManager: loginWithToken: ' + e.name);
            if (e.name === Voximplant.ClientEvents.AuthResult) {
                console.log('LoginManager: loginWithToken: error code: ' + e.code);
            }
        }
    }