Walmart Electrode basic understanding

750 Views Asked by At

I'm trying to create a basic iOS-app based on ReactNative using Electrode (Walmart - http://www.electrode.io/site/docs/introduction.html)

While I can get the app to work locally on my Mac, I'm struggling to understand how the whole Over-The-Air (OTA) update can/should work.

Here's what I've done so far

  • created a mini-app using ern create-miniapp TestApp
  • created a GIT-repository on BitBucket
  • created a Cauldron using ern cauldron repo add TestApp [Bitbucket-url]
  • added a nativeapp using ern cauldron add native app TestApp

But when I run the app using ern run-ios, it still seems to point towards my local machine (I can update the index-ios.js-file and it updates in the app). So what is lacking for getting the whole OTA-setup going where another programmer can updates the index-ios.js-file in the cloud/bitbucket (I'm guessing) and update the app on the fly?

2

There are 2 best solutions below

0
PeterAntonsen On BEST ANSWER

I ended up getting it to work on a 2nd try - The notes I've made underways is the following:

I searched around the net and used a bit here and there, so can't really point you to one simple guide..

PreRequisites

install Homebrew

https://brew.sh/

install ReactNative-cli-tools and codePush

brew install node

brew install watchman

npm install -g react-native-cli

Npm install -g code-push-cli

codePush register

Code-push register

(complete registration, validate by running this command again and it should say: [Error] You are already logged in from this machine.)

App

react-native init [AppName] Cd [AppName] npm install —save react-native-code-push Npm install (something goes wrong when installing code-push, so we have to reinstall some react-native elements)

code-push app add ReactApp ios react-native (Copy production deployment key)

React-native link react-native-code-push (Enter production deployment key)

Edit App.js

import codePush from 'react-native-code-push'

(Remove "export default" from main App class)

const codePushOptions = {
  checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
  installMode: codePush.InstallMode.IMMEDIATE
}

export default codePush(codePushOptions)(App);

release app to codePush server

code-push release-react ReactApp ios --deploymentName Production

command to see current status of reactApp codePush server

code-push deployment ls ReactApp -k

Open xCode project in \ios-folder

Set up signing if needed

edit xCode scheme to Release

edit App.js to make the change visible

Build and app-content should update after open to reflect changes made between version uploaded to codePush-server and local version

0
kushan85 On

If I understand correctly, for OTA to work, you need to do use the code-push command.

ern code-push <miniapps..>

Options:
  --help                     Show help                                                                                                                                                             [boolean]
  --descriptor, -d           Full native application selector (target native application version for the push)
  --force, -f                Force upgrade (ignore compatibility issues -at your own risks-)
  --appName                  Application name
  --deploymentName           Deployment to release the update to                                                                                                                                    [string]
  --platform, -p             Platform name (android / ios)                                                                                                                                          [string]
  --targetBinaryVersion, -t  Semver expression that specifies the binary app version(s) this release is targeting (e.g. 1.1.0, ~1.2.3)                                                              [string]
  --mandatory, -m            Specifies whether this release should be considered mandatory                                                                                                  [default: false]
  --rollout, -r              Percentage of users this release should be immediately available to                                                                                  [string] [default: "100%"]
  --skipConfirmation, -s     Skip final confirmation prompt if no compatibility issues are detected

More info about this command @ https://electrode.gitbooks.io/electrode-native/content/cli/code-push.html