How to use react-native-config - 10 common examples

To help you get started, we’ve selected a few react-native-config 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 Vinylize / Yetta-App / src / service / YettaServerAPI / verification.js View on Github external
import * as YettaServerAPIclient from './client';
import { handleError } from './../../utils/errorHandlers';
import Config from 'react-native-config';
import store from './../../store';

// redux functions
import { setIsWaitingForJudge } from './../../actions/runnerStatusActions';
import { setBusyWaitingRunnerIdImageUpload } from './../../actions/busyWaitingActions';

const ID_UPLOAD_URL = `${Config.API_URL}/upload?query=mutation{userUploadIdImage(input:{}){imgUrl clientMutationId}}`;

export const runnerApplyFirstJudge = () => {
  return new Promise((resolve, reject) => {
    return YettaServerAPIclient.getLokkaClient()
      .then(client => {
        return client.mutate(`{
          runnerApplyFirstJudge(
            input:{
            }
          ) {
            result
          }
        }`);
      })
      .then(res => {
        __DEV__ && console.log(res); // eslint-disable-line no-undef
github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCore / UI / Chat / index.js View on Github external
if (props.isBot !== true) {
      const nationIdX = props.groupDefault
        ? props.groupNationId
        : props.nationId; // hardcode for bitnation chat group
      const selectedNation = resolveNation(props.nations || [], nationIdX);
      if (!selectedNation) {
        if (Platform.OS === "ios") {
          props.navigator.pop();
        } else {
          props.navigator.dismissModal();
        }
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ["websocket"],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`
      });
      this.connection.on("connect", () => {
        this.connection.emit("room:join", {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false
      };
    } else {
      // add initial bot message
github Bit-Nation / BITNATION-Pangea-mobile / src / screens / ChatScreen / index.js View on Github external
constructor(props: Props) {
    super(props);

    if (props.isBot !== true) {
      const selectedNation = resolveNation(props.nations || [], props.nationId);
      if (selectedNation === null) {
        props.navigator.pop();
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ['websocket'],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`,
      });
      this.connection.on('connect', () => {
        this.connection.emit('room:join', {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false,
      };
    } else {
      // add initial bot message
github Bit-Nation / BITNATION-Pangea-mobile / src / screens / ChatScreen / index.js View on Github external
constructor(props: Props) {
    super(props);

    if (props.isBot !== true) {
      const selectedNation = resolveNation(props.nations || [], props.nationId);
      if (selectedNation === null) {
        props.navigator.pop();
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ['websocket'],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`,
      });
      this.connection.on('connect', () => {
        this.connection.emit('room:join', {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false,
      };
    } else {
      // add initial bot message
github Bit-Nation / BITNATION-Pangea-mobile / src / PangeaCore / UI / Chat / index.js View on Github external
: props.nationId; // hardcode for bitnation chat group
      const selectedNation = resolveNation(props.nations || [], nationIdX);
      if (!selectedNation) {
        if (Platform.OS === "ios") {
          props.navigator.pop();
        } else {
          props.navigator.dismissModal();
        }
        return;
      }
      this.nationId = selectedNation.idInSmartContract;
      // Creating the socket-client instance will automatically connect to the server.
      this.connection = SocketIOClient(config.CHAT_URL, {
        transports: ["websocket"],
        upgrade: false,
        query: `token=${config.AUTH_TOKEN}`
      });
      this.connection.on("connect", () => {
        this.connection.emit("room:join", {
          nation_id: this.nationId,
        });
      });

      this.state = {
        messages: [],
        joined: false
      };
    } else {
      // add initial bot message
      this.state = {
        messages: [
          {
github LedgerHQ / ledger-live-mobile / src / live-common-setup.js View on Github external
listen(({ type, message, ...rest }) => {
    if (Object.keys(rest).length) {
      console.log(`${type}: ${message || ""}`, rest); // eslint-disable-line no-console
    } else {
      console.log(`${type}: ${message || ""}`); // eslint-disable-line no-console
    }
  });
}

if (Config.DEBUG_SOCKET) {
  logs.subscribe(e => {
    console.log(e); // eslint-disable-line no-console
  });
}

if (Config.BLE_LOG_LEVEL) BluetoothTransport.setLogLevel(Config.BLE_LOG_LEVEL);

setNetwork(network);
setEnv("FORCE_PROVIDER", Config.FORCE_PROVIDER);

// Add support of HID (experimental until we stabilize it)

registerTransportModule({
  id: "hid",

  // prettier-ignore
  open: id => { // eslint-disable-line consistent-return
    if (id.startsWith("usb|")) {
      const devicePath = JSON.parse(id.slice(4));
      return retry(() => HIDTransport.open(devicePath), { maxRetry: 2 });
    }
  },
github Bit-Nation / BITNATION-Pangea-mobile / src / services / accounts / index.js View on Github external
static async validateMnemonicWithAccount(accountStore: string, profile: Profile, mne: Mnemonic): Promise {
    try {
      await panthalassaStop();
      // eslint-disable-next-line no-empty
    } catch (e) {
      // We ignore exception, since we just need stop it in case it was started earlier.
    }
    const config = JSON.stringify({
      encrypted_key_manager: accountStore,
      enable_debugging: false,
      eth_ws_endpoint: 'wss://mainnet.infura.io/_ws',
      private_chat_endpoint: Config.CHAT_WSS_ENDPOINT,
      private_chat_bearer_token: Config.CHAT_TOKEN,
    });

    try {
      await panthalassaStartFromMnemonic(config, compressMnemonic(mne));
    } catch (e) {
      console.log(`[TEST] Panthalassa start failed: ${e.message}`);
      return false;
    }

    return true;
  }
github Bit-Nation / BITNATION-Pangea-mobile / src / modules / accounts / accounts-services.js View on Github external
try {
      await panthalassaStop();
      // eslint-disable-next-line no-empty
    } catch (e) {
      // We ignore exception, since we just need stop it in case it was started earlier.
    }
    const signedProfile = await AccountsService.signProfileStandalone(profile, accountStore, password).catch(() => {
      throw new InvalidPasswordError();
    });
    const config = JSON.stringify({
      encrypted_key_manager: accountStore,
      signed_profile: signedProfile,
      enable_debugging: false,
      eth_ws_endpoint: networkType === 'main' ? 'wss://mainnet.infura.io/ws' : 'wss://rinkeby.infura.io/ws',
      private_chat_endpoint: Config.CHAT_WSS_ENDPOINT,
      private_chat_bearer_token: Config.CHAT_TOKEN,
    });

    try {
      await panthalassaStart(config, password);
    } catch (e) {
      console.log(`[TEST] Panthalassa start failed: ${e.message}`);
      return false;
    }

    try {
      await ChatService.uploadProfile(signedProfile);
    } catch (e) {
      console.log(`[TEST] Profile upload fail: ${e.message}`);
    }

    return true;
github 0mkara / RNAWebRTCApp / src / components / GoogleSigninButton / GoogleSignInButon.js View on Github external
constructor(props) {
    super(props);
    this.state = {
      isSigninInProgress: false
    };
    this._signIn = this._signIn.bind(this);
    console.log(env.GOOGLE_CLIENT_ID);
    console.log(env.GOOGLE_ANDROID_CLIENT_ID);
    const configure = {
      scopes: [], // what API you want to access on behalf of the user, default is email and profile
      webClientId: env.GOOGLE_CLIENT_ID, // client ID of type WEB for your server (needed to verify user ID and offline access)
      offlineAccess: true, // if you want to access Google API on behalf of the user FROM YOUR SERVER
      hostedDomain: '', // specifies a hosted domain restriction
      loginHint: '', // [iOS] The user's ID, or email address, to be prefilled in the authentication UI if possible. [See docs here](https://developers.google.com/identity/sign-in/ios/api/interface_g_i_d_sign_in.html#a0a68c7504c31ab0b728432565f6e33fd)
      forceConsentPrompt: true, // [Android] if you want to show the authorization prompt at each login.
      accountName: '', // [Android] specifies an account name on the device that should be used
      androidClientId: env.GOOGLE_ANDROID_CLIENT_ID // [iOS] optional, if you want to specify the client ID of type iOS (otherwise, it is taken from GoogleService-Info.plist)
    };
    GoogleSignin.configure(configure);
  }
  _signIn = async () => {
github 0mkara / RNAWebRTCApp / src / components / GoogleSigninButton / GoogleSignInButon.js View on Github external
constructor(props) {
    super(props);
    this.state = {
      isSigninInProgress: false
    };
    this._signIn = this._signIn.bind(this);
    console.log(env.GOOGLE_CLIENT_ID);
    console.log(env.GOOGLE_ANDROID_CLIENT_ID);
    const configure = {
      scopes: [], // what API you want to access on behalf of the user, default is email and profile
      webClientId: env.GOOGLE_CLIENT_ID, // client ID of type WEB for your server (needed to verify user ID and offline access)
      offlineAccess: true, // if you want to access Google API on behalf of the user FROM YOUR SERVER
      hostedDomain: '', // specifies a hosted domain restriction
      loginHint: '', // [iOS] The user's ID, or email address, to be prefilled in the authentication UI if possible. [See docs here](https://developers.google.com/identity/sign-in/ios/api/interface_g_i_d_sign_in.html#a0a68c7504c31ab0b728432565f6e33fd)
      forceConsentPrompt: true, // [Android] if you want to show the authorization prompt at each login.
      accountName: '', // [Android] specifies an account name on the device that should be used
      androidClientId: env.GOOGLE_ANDROID_CLIENT_ID // [iOS] optional, if you want to specify the client ID of type iOS (otherwise, it is taken from GoogleService-Info.plist)
    };
    GoogleSignin.configure(configure);
  }
  _signIn = async () => {