How to use the react-native-config.RN_TEXTILE_CAFE_GATEWAY_URL function in react-native-config

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 textileio / photos / App / Containers / App.tsx View on Github external
componentWillMount () {
    this.textile.setup(
      {
        RELEASE_TYPE: RNConfig.RN_RELEASE_TYPE
      },
      {
        TEXTILE_CAFE_TOKEN: RNConfig.RN_TEXTILE_CAFE_TOKEN,
        TEXTILE_CAFE_GATEWAY_URL: RNConfig.RN_TEXTILE_CAFE_GATEWAY_URL,
        TEXTILE_CAFE_OVERRIDE: RNConfig.RN_TEXTILE_CAFE_OVERRIDE
      }
    )
  }
github textileio / photos / App / Sagas / NodeLifecycle.ts View on Github external
async function discoverCafes() {
  const response = await fetch(`${Config.RN_TEXTILE_CAFE_GATEWAY_URL}/cafes`, { method: 'GET' })
  if (response.status < 200 || response.status > 299) {
    throw new Error(`Status code error: ${response.statusText}`)
  }
  const discoveredCafes = await response.json() as DiscoveredCafes
  return discoveredCafes
}
github textileio / photos / App / Services / cafe-gateway-api.ts View on Github external
export interface DiscoveredCafe {
  readonly peer: string
  readonly address: string
  readonly api: string
  readonly protocol: string
  readonly node: string
  readonly url: string
}

export interface DiscoveredCafes {
  readonly primary?: DiscoveredCafe
  readonly secondary?: DiscoveredCafe
}

const api = create({
  baseURL: Config.RN_TEXTILE_CAFE_GATEWAY_URL,
  timeout: 2000
})

async function discoveredCafes() {
  const response = await api.get('/cafes')
  if (response.ok) {
    if (response.data) {
      return response.data
    } else {
      throw new Error('missing response data')
    }
  } else {
    throw new Error(response.problem)
  }
}
github textileio / photos / App / Containers / Wallet.js View on Github external
if (state.storage.overview && state.storage.overview.thread_cnt) {
    overview = {
      available: !!state.storage.overview,
      photoCount: state.storage.overview ? photos.length.toString() : '·',
      photoTitle: !state.storage.overview || photos.length !== 1 ? 'photos' : 'photo',
      groupCount: state.storage.overview ? (state.storage.overview.thread_cnt - nonSharedGroups).toString() : '·',
      groupTitle: !state.storage.overview || state.storage.overview.thread_cnt - nonSharedGroups !== 1 ? 'groups' : 'group',
      contactCount: state.storage.overview ? state.storage.overview.contact_cnt.toString() : '·',
      contactTitle: !state.storage.overview || state.storage.overview.contact_cnt !== 1 ? 'contacts' : 'contact'
    }
  }

  const profile = state.account.profile.value
  let avatarUrl
  if (profile && profile.avatar) {
    avatarUrl = Config.RN_TEXTILE_CAFE_GATEWAY_URL + '/ipfs/' + profile.avatar + '/0/large/d'
  }

  return {
    contacts,
    threadId,
    photos,
    items,
    displayImages: state.textileNode.nodeState.state === 'started',
    placeholderText,
    verboseUi: state.preferences.verboseUi,
    profile,
    showTourScreen: state.preferences.tourScreens.wallet,
    avatarUrl: avatarUrl,
    username: profile && profile.username ? profile.username : undefined,
    selectedTab: state.preferences.viewSettings.selectedWalletTab,
    storage: state.preferences.storage,