Code Monkey home page Code Monkey logo

launchgate's Introduction

LaunchGate

CI Status Version License Platform codecov.io Sponsored by Detroit Labs

LaunchGate makes it easy to let users know when an update to your app is available.

You can also block access to the app for older versions, which is useful in the event of a severe bug or security issue that requires users to update the app.

Additionally, you can use LaunchGate to display a remotely configured message to users at launch which can also be used to temporarily block access to the app (i.e. during back-end maintenance).

Need an Android version?

You're in luck! LaunchGate was built in parallel with its Android counterpart, Gandalf.

Installation

LaunchGate is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LaunchGate"

Usage

LaunchGate downloads & parses a remotely hosted JSON configuration file at launch, then takes appropriate action.

By default, LaunchGate expects a configuration file that looks something like this:

{
  "ios": {
    "requiredUpdate": {
      "minimumVersion": "1.1",
      "message": "An update is required to continue using this app."
    }
  }
}

If you want to use a different configuration structure than the default, you can! See the section below, for instructions on how to provide a custom parser.

Enabling LaunchGate

  1. Import it into your AppDelegate.
  2. Instantiate it, passing in the location of your configuration file and the App Store URI of your app.
  3. Lastly, call launchGate?.check() in applicationDidBecomeActive or sceneDidBecomeActive if you are using scene based windowing.
import LaunchGate

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

  var window: UIWindow?

  lazy var launchGate = LaunchGate(
    configURI: "https://www.example.com/config.json",
    appStoreURI: "itms-apps://itunes.apple.com/us/app/yourapp/id123456789"
  )

  func applicationDidBecomeActive(application: UIApplication) {
    launchGate?.check()
  }

}

or if you have a Application Scene Manifest setup:

import LaunchGate

class SceneDelegate: UIResponder, UIWindowSceneDelegate {

  var window: UIWindow?

  func sceneDidBecomeActive(_ scene: UIScene) {
    launchGate?.check()
  }

}

The Configuration File

The JSON configuration file is loaded by LaunchGate when check() is called. Using this file you can trigger a few different behaviors in your app.

"What's with the top-level ios object in the JSON? Why is that necessary?"

The top level "ios" object exists because LaunchGate was created in parallel with Gandalf, its Android counterpart project. As cross-platform mobile developers, we understand how annoying it can be to get two completely separate iOS & Android libraries satisfy the same feature requirements. By developing an LaunchGate (iOS) & Gandalf (Android) together, we are able to provide teams that build & maintained cross-platform apps a solution that should work similarly on both iOS & Android:

Example cross-platform configuration:

{
  "android": {
    "requiredUpdate": {
      "minimumVersion": "1.1",
      "message": "An update is required to continue using this app."
    }
  },
  "ios": {
    "requiredUpdate": {
      "minimumVersion": "1.1",
      "message": "An update is required to continue using this app."
    }
  }
}

Required Update

By including a requiredUpdate object you can specify a minimum app version and a message that will be displayed to users that have a version that is too old. Users with an older version will be locked out of app until they update.

Scenario: A previous version of your app had a critical bug or security vulnerability that you have patched in the current version of the app, but you still need to prevent users from continuing to use the older compromised version.

In this example, users with a version of the app less than "1.1" will see an alert dialog when the app is opened, with an "Update" button that will take them to the App Store so that they can download the latest version.

Required Update Screenshot

Optional Update

By including an optionalUpdate object you can specify the current version of the app in the App Store and a message to display to the user, possibly to encourage them to update the app.

Optional updates can be dismissed by the user and do not block the user from using the app. Also, an optional update dialog is only showed to the user once per version. That way users aren't nagged relentlessly every time they open the app.

Scenario: You've released a significant update to your app and want to encourage users that do not have automatic updates enabled to upgrade.

{
  "ios": {
    "optionalUpdate": {
      "optionalVersion": "1.2",
      "message": "A new version of the app is available."
    }
  }
}

Optional Update Screenshot

Alert Messages

Lastly, besides providing features related to specific app versions and updates, you can also use LaunchGate to display an informative message to your users when they open the app.

Blocking Alert

A "blocking" alert ("blocking": true) is an alert that is displayed to the user when they open the app but does not give the user any option to proceed into the app.

IMPORTANT → As long as you have blocking set to true users will be prevented from using your app, so make sure to remove or disable the blocking alert as soon as possible.

Scenario: Your app relies on a back-end web service that is temporarily down for maintenance, and you don't want users of the app to be affected.

{
  "ios": {
    "alert": {
      "message": "We are currently performing server maintenance. Please try again later.",
      "blocking": true
    }
  }
}

Blocking Alert Screenshot

Non-Blocking Alert

Like the optional update dialog, non-blocking alert messages are only displayed once per message.

Scenario: Your app relies on a back-end web service that is experiencing intermittent connectivity issues and you want to warn users that they the app experience may be degraded.

{
  "ios": {
    "alert": {
      "message": "We are currently working to resolve intermittent web service issues. We apologize if your app experience is affected.",
      "blocking": false
    }
  }
}

Non-Blocking Alert Screenshot

Custom Configuration Parser

If you need to use something other than the default configuration JSON object, you can write your own parser that conforms to the LaunchGateParser protocol, and set it on the LaunchGate instance before calling check().

See the example project.

Author

Dan Trenz (@dtrenz) c/o Detroit Labs

License

LaunchGate is available under the Apache License, Version 2.0. See the LICENSE file for more info.

launchgate's People

Contributors

dtrenz avatar ibrahimql avatar jshier avatar kurabi avatar rlrg avatar slaunchaman avatar tolkiana avatar whinchman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

launchgate's Issues

Swift 3.0

This project needs to be updated to support Swift 3.0.

Add version checking logic

The library should be able to look at various forms of version strings or version codes and deduce which version is higher / lower. This will involve major and minor numbers, ex "1.2.1 vs 1.3.0" and "1.5 vs 2.1" as well as a version code that may be only an integer. The consumer should be able to configure what the library is evaluating, the version name or the version code.

see: btkelly/gandalf#5

Add check when app is foregrounded

This would help further lock down the app when needed. The use case is a user that keeps the application backgrounded on the device for a long period of time.

Carthage Support

It would be nice if I could use the Framework through Carthage.

screen shot 2018-03-26 at 16 35 22

/usr/bin/xcrun xcodebuild -workspace /Users/munirwanis/Documents/Git/onestap-app-ios/Carthage/Checkouts/LaunchGate/LaunchGate.xcworkspace -scheme LaunchGate -configuration Release -derivedDataPath /Users/munirwanis/Library/Caches/org.carthage.CarthageKit/DerivedData/9.2_9C40b/LaunchGate/1.0.2 -sdk iphoneos ONLY_ACTIVE_ARCH=NO BITCODE_GENERATION_MODE=bitcode CODE_SIGNING_REQUIRED=NO CODE_SIGN_IDENTITY= CARTHAGE=YES archive -archivePath ./ SKIP_INSTALL=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=NO CLANG_ENABLE_CODE_COVERAGE=NO (launched in /Users/munirwanis/Documents/Git/onestap-app-ios/Carthage/Checkouts/LaunchGate)User defaults from command line:
    IDEArchivePathOverride = /Users/munirwanis/Documents/Git/onestap-app-ios/Carthage/Checkouts/LaunchGate
    IDEDerivedDataPathOverride = /Users/munirwanis/Library/Caches/org.carthage.CarthageKit/DerivedData/9.2_9C40b/LaunchGate/1.0.2

Build settings from command line:
    BITCODE_GENERATION_MODE = bitcode
    CARTHAGE = YES
    CLANG_ENABLE_CODE_COVERAGE = NO
    CODE_SIGN_IDENTITY = 
    CODE_SIGNING_REQUIRED = NO
    GCC_INSTRUMENT_PROGRAM_FLOW_ARCS = NO
    ONLY_ACTIVE_ARCH = NO
    SDKROOT = iphoneos11.2
    SKIP_INSTALL = YES

=== BUILD TARGET LaunchGate OF PROJECT LaunchGate WITH CONFIGURATION Release ===

Check dependencies
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.
The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

** ARCHIVE FAILED **


The following build commands failed:
	Check dependencies
(1 failure)

Add Travis CI

Add Travis CI checks for;

  • PR builds
  • merges to develop
  • merges to master branch

Message display manager

A simple manager that will check / update values based on a bootstrap object (JSON from server) and determine if the app should display a dialog or not. This should also be notified when a user interacts with a dialog and update the corresponding data in shared prefs.

Values to be compared against past values:

  • Optional version with optional message
  • Alerta message

Android-iOS logic difference

There is a slight difference in the operation comparing to Gandalf: the alert has more priority over the optionalUpdate in Gandalf and in the LaunchGate it is just the opposite.

Gandalf (Android) logic:
screen shot 2017-09-27 at 16 17 01

Current LaunchGate (iOS) logic:
screen shot 2017-09-27 at 16 17 11

Some unit tests sometimes fail only locally

Some unit tests sometimes fail locally and with Travis CI they pass. To reproduce the issue, you just have to check out the last commit of the develop.

If you cannot reproduce it, please, can you tell me why does this happen to me?

Problem reproduced with

  • XCode9
  • Simulator used: iphone 8 (iOS11)

Please, check the screenshots to see what I mean:

screen shot 2017-09-27 at 13 01 43

screen shot 2017-09-27 at 12 49 18

![screen shot 2017-09-27 at 12 49 05](https://user-images.githubusercontent.com/19955480/30911725-02e2a7d4-a38a-11e7-8f3a-bf53debc0c5f.png)

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.