@trium/zeta

0.9.2 • Public • Published

Zeta

Usage

import { ZetaSDK } from '@trium/zeta'

<ZetaSDK 
    baseUrl="YOUR-BASE-URL-HERE-OR-PROVIDED-BASE-URL" 
    authToken="YOUR-AUTH-TOKEN" 
    exitRoute={null} // pass screen route to resume back to your app
/>

hypersnapsdk library

You would need to request for hypersnapsdk_reactnative aws credentials from zeta and add it to android/gradle.properties of your project

aws_access_key=ZETA-AWS-ACCESS-KEY
aws_secret_pass=ZETA-AWS-SECRET-PASS

Initial setup

Add this postinstall-script.js to the root of your project, add "install-deps": "node postinstall-script.js" to the script in your package.json

NOTE: if you are using npm, replace the command i.e yarn list --depth=0 --json to npm list --depth=0 --json and yarn add ${excludedDependencies.join(' ')} to npm install ${excludedDependencies.join(' ')}

const { execSync } = require('child_process');

const excludedDependencies = ['react-native-device-info', 'react-native-get-location', 'react-native-get-sms-android', 'react-native-permissions', 'react-native-contacts', 'hypersnapsdk_reactnative']; 

function installDependencies() {
  try {
    const hasRun = process.env.POST_INSTALL_HAS_RUN;
    if (hasRun) {
      console.log('Dependencies have already been installed.');
      return;
    }

    const installedDeps = execSync('yarn list --depth=0 --json').toString();
    const parsedDeps = JSON.parse(installedDeps);

    if (!parsedDeps.dependencies) {
      if (excludedDependencies.length > 0) {
        execSync(`yarn add ${excludedDependencies.join(' ')}`, { stdio: 'inherit' });
      } else {
        console.log('No new dependencies to install.');
      }
    } else {
      const currentDependencies = Object.keys(parsedDeps.dependencies);
      const newDependencies = currentDependencies.filter(dep => !excludedDependencies.includes(dep));

      if (newDependencies.length > 0) {
        execSync(`yarn add ${newDependencies.join(' ')}`, { stdio: 'inherit' });
      } else {
        console.log('No new dependencies to install.');
      }
    }

    process.env.POST_INSTALL_HAS_RUN = 'true';
  } catch (error) {
    console.error('Error occurred:', error.message);
  }
}

installDependencies();

Installation

Please read this entire section.

npm

npm install @trium/zeta && npm run install-deps

yarn

yarn add @trium/zeta && yarn install-deps

Permissions

API 23+

Android requires allowing permissions with https://facebook.github.io/react-native/docs/permissionsandroid.html

...
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
...

Package Sidebar

Install

npm i @trium/zeta

Weekly Downloads

1

Version

0.9.2

License

ISC

Unpacked Size

190 kB

Total Files

35

Last publish

Collaborators

  • ellysmoore
  • favourokonta
  • triumlimited