0.0.227 • Published 4 years ago

@maestro_io/mobile_sdk v0.0.227

Weekly downloads
-
License
-
Repository
-
Last release
4 years ago

Maestro Mobile SDK

The Maestro Mobile SDK is a collection of React Native components that allow you to embed portions or all of Maestro into your own mobile application.

Installation

Using npm:

npm install --save @maestro_io/mobile_sdk @precor/web-api-bridge @react-native-community/async-storage @react-native-community/clipboard @react-native-community/masked-view @react-native-firebase/app @react-native-firebase/database react-native-gesture-handler react-native-get-random-values react-native-linear-gradient react-native-modal react-native-progress react-native-safe-area-context react-native-screens react-native-vector-icons react-native-video react-native-webview@8.1.2

or using yarn:

yarn add @maestro_io/mobile_sdk @precor/web-api-bridge @react-native-community/async-storage @react-native-community/clipboard @react-native-community/masked-view @react-native-firebase/app @react-native-firebase/database react-native-gesture-handler react-native-get-random-values react-native-linear-gradient react-native-modal react-native-progress react-native-safe-area-context react-native-screens react-native-vector-icons react-native-video react-native-webview@8.1.2

Android installation

Add this line in your android/app/build.gradle to make vector icons work

apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

Add multiDexEnabled true app/build.grandle to enable multidex

    defaultConfig {
        + multiDexEnabled true
        applicationId "com.myapp"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 1
        versionName "1.0"
    }

Adding fireabse

First, place google-services.json inside of your project at the following location: /android/app/google-services.json. Then, add the google-services plugin as a dependency inside of your /android/build.gradle file:

buildscript {
  dependencies {
    // ... other dependencies
    classpath 'com.google.gms:google-services:4.2.0'
    // Add me --- /\
  }
}

Lastly, execute the plugin by adding the following to the very bottom of your /android/app/build.gradle file:

apply plugin: 'com.google.gms.google-services'

Read more about firebase for android

  • To make react native video works run the next command
react-native link react-native-video

IOS installation

Go to ios and run

  pod install

Put your GoogleService-Info.plist file into your xcode project.

Read more about firebase for IOS

Setup

Befor start to use these components you need no wrap your app with MaestroMobileSdkProvider and pass your siteId through props

Example

const SITE_ID = "site-id";
const App = () => {
  return (
    <MaestroMobileSdkProvider siteId={SITE_ID}>
      <MyAppContent />
    </MaestroMobileSdkProvider>
  );
};

Components

ChannelSelect

Displays all channels availables to select then you can catch which one was selected through events

read more

EmbedPanels

Shows the panels based on the page slug you have selected

read more

Header

It contains the action buttons such Login, open channel select, open navbar select and when the logo is pressed.

read more

LoginModal

Displays the loginForm based on your site and then you will be able to know if the user is authenticated or not.

read more

NavBar

Contains all nav bar items so you can select one and then you will get what nav item was selected, url and its name.

read more

Page

It is going to show playlist, video row or different things depending of id you pass by props. Also it receive a callback when it request to change to another page and if the user press a video item so you will be able to start the video using VideoPlayerCollapse

read more

UserModal

It shows the settings about the current user loged it and its logout button.

read more

VideoPlayerCollapse

It shows the video with depending of the VideoItem provided by Page

read more