 class QRReaderModule
-  notInApp: -> navigator.userAgent.indexOf("AppGyverSteroids") == -1
+  isInApp: ->
+    [navigator.userAgent, window.parent.navigator.userAgent]
+      .reduce ((value, userAgent) -> userAgent.indexOf("AppGyverSteroids") != -1 || value), false
 
   pluginAvailable: -> cordova?.plugins?.barcodeScanner?.scan?
 

    else
      @processScanResult result.text

  onScanError: (error) =>
    errorMsg = error
    if error == "unable to obtain video capture device input"
      errorMsg = "Could not access Camera. To fix this, switch to the Settings app, and go to:\n\n  Privacy > Camera\n\nThen, ensure the slider is enabled (green) for the Enterprise app."

    true

  #extract the collection name and id of the item
  parseCode: (code) ->
    parts = code.split(":")
    return {
      collection:parts[0]
