Skip to content
This repository has been archived by the owner on Feb 12, 2019. It is now read-only.

Support iOS 9. Add onNotSupported callback #195

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/addtohomescreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ ath.defaults = {
icon: true, // add touch icon to the message
message: '', // the message can be customized
validLocation: [], // list of pages where the message will be shown (array of regexes)
onNotSupported: null,
onInit: null, // executed on instance creation
onShow: null, // executed when the message is shown
onRemove: null, // executed when the message is removed
Expand Down Expand Up @@ -192,6 +193,11 @@ ath.isTablet = (ath.isMobileSafari && _ua.indexOf('iPad') > -1) || (ath.isMobile

ath.isCompatible = (ath.isMobileSafari && ath.OSVersion >= 6) || ath.isMobileChrome; // TODO: add winphone

if (ath.isMobileSafari) {
ath.OSVersion = parseInt(ath.OSVersion, 10);
ath.OSVersion = Math.min(ath.OSVersion, 8);
}

var _defaultSession = {
lastDisplayTime: 0, // last time we displayed the message
returningVisitor: false, // is this the first time you visit
Expand Down Expand Up @@ -265,6 +271,9 @@ ath.Class = function (options) {

// the device is not supported
if ( !ath.isCompatible ) {
if ( this.options.onNotSupported ) {
this.options.onNotSupported.call(this);
}
this.doLog("Add to homescreen: not displaying callout because device not supported");
return;
}
Expand Down