Coder Social home page Coder Social logo

digideskio / ionic-plugin-deploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from urbiwanus/ionic-plugins-deploy

0.0 1.0 0.0 531 KB

Plugin for the Ionic Deploy Service

Home Page: http://docs.ionic.io/deploy

License: Apache License 2.0

Java 3.73% Objective-C 16.73% C 77.59% C++ 1.73% JavaScript 0.22%

ionic-plugin-deploy's Introduction

Ionic Deploy Plugin

The Cordova plugin for Ionic Deploy.

Check out our docs for more detailed information.

Installation

See our docs for installation steps.

Cordova Plugin API

IonicDeploy

  • this Cordova plugin defines a new global IonicDeploy object

  • this object exposes the following methods

init (appId: String, serverUrl: String)

  • appId: String
  • serverUrl: String

Example:

IonicDeploy.init('org.cordova.helloworld', 'https://helloworld.org/deploy')

check (appId, channelTag, onSuccess, onError)

  • appId: String
  • channelTag: String
  • onSuccess: CheckHandler
  • onError: ErrorHandler

Contact the remote IonicDeploy service (as configured during IonicDeploy.init(...)) and passes the result along to IonicDeploy.init(...).

CheckHandler (result)
  • result: String

  • if result is the string "true", then a new update is available

ErrorHandler (error)

parseUpdate (appId, response, onSuccess, onError)

  • appId: String
  • response: UpdateResponse
  • onSuccess: CheckHandler
  • onError: ErrorHandler

Determine whether an update is available, by checking the provided response data. Store metadata from available updates for future calls to IonicDeploy.download(...).

This function is useful for testing, and also for using a custom remote update service. For all other use cases, you should just use IonicDeploy.check(...).

UpdateResponse
interface UpdateResponse {
  data: {
    available: Boolean,
    compatible: Boolean,
    snapshot: String, // (unique per update, e.g. UUID)
    url: String // (URL to download)
  }
}

download (appId, onSuccess, onError)

  • appId: String
  • onSuccess: DownloadHandler
  • onError: ErrorHandler

Using the metadata from a recent IonicDeploy.check(...) (or IonicDeploy.parseUpdate(...)), download and store an available update ZIP file.

DownloadHandler (result)
  • result: String or Number

If result is a numeric value, it communicates progress. If result is the string "true", it communicates completion.

extract (appId, onSuccess, onError)

  • appId: String
  • onSuccess: ExtractHandler
  • onError: ErrorHandler

Unpack and apply the update ZIP file from a recent IonicDeploy.download(...). After the app is terminated / destroyed by the operating system, the update will take effect.

The contents of the ZIP file should be the contents of the platform-specific "www" directory from a Cordova project. This directory is regenerated during cordova build.

ExtractHandler (result)
  • result: String or Number

If result is a numeric value, it communicates progress. If result is the string "done", it communicates completion.

redirect (appId)

  • appId: String

Navigate the webview to the version provided by a recent IonicDeploy.extract(...). This is useful for use cases where it is undesirable to wait for the operating system to terminate / destroy the app.

Any unsaved user data / state will be lost, so design your UX and/or data persistence approach accordingly.

ionic-plugin-deploy's People

Contributors

fuiste avatar ericb avatar tlancina avatar imhoffd avatar mlynch avatar jokeyrhyme avatar jskrzypek avatar ace68723 avatar giangndm avatar keithdmoore avatar kenmickles avatar pauly4it avatar pawurb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.