Skip to content
This repository has been archived by the owner on Nov 20, 2018. It is now read-only.

Commit

Permalink
fix(ios8-safari): only apply workaround to iOS 8.0.0
Browse files Browse the repository at this point in the history
fixes #1284
  • Loading branch information
Ray Nicholus committed Oct 1, 2014
1 parent 0318748 commit 7e69916
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion client/js/uploader.basic.api.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@
_maybeHandleIos8SafariWorkaround: function() {
var self = this;

if (this._options.workarounds.ios8SafariUploads && qq.ios8() && qq.iosSafari()) {
if (this._options.workarounds.ios8SafariUploads && qq.ios800() && qq.iosSafari()) {
setTimeout(function() {
window.alert(self._options.messages.unsupportedBrowserIos8Safari);
}, 0);
Expand Down
2 changes: 1 addition & 1 deletion client/js/uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ qq.FineUploader = function(o, namespace) {
text: this._options.text
});

if (this._options.workarounds.ios8SafariUploads && qq.ios8() && qq.iosSafari()) {
if (this._options.workarounds.ios8SafariUploads && qq.ios800() && qq.iosSafari()) {
this._templating.renderFailure(this._options.messages.unsupportedBrowserIos8Safari);
}
else if (!qq.supportedFeatures.uploading || (this._options.cors.expected && !qq.supportedFeatures.uploadCors)) {
Expand Down
5 changes: 5 additions & 0 deletions client/js/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,11 @@ var qq = function(element) {
return qq.ios() && navigator.userAgent.indexOf(" OS 8_") !== -1;
};

// iOS 8.0.0
qq.ios800 = function() {
return qq.ios() && navigator.userAgent.indexOf(" OS 8_0 ") !== -1;
};

qq.ios = function() {
/*jshint -W014 */
return navigator.userAgent.indexOf("iPad") !== -1
Expand Down
2 changes: 1 addition & 1 deletion docs/api/options.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ alert("The `chunking.success.endpoint` option **only** applies to traditional up
(
("workarounds.iosEmptyVideos", "iosEmptyVideos", "Ensures all `<input type='file'>` elements tracked by Fine Uploader do NOT contain a `multiple` attribute to work around an issue present in iOS7 & 8 that otherwise results in 0-sized uploaded videos.", "Boolean", "true",),
("workarounds.ios8BrowserCrash", "ios8BrowserCrash", "Ensures all `<input type='file'>` elements tracked by Fine Uploader always have a `multiple` attribute present. This only applies to iOS8 Chrome and iOS8 UIWebView, and is put in place to work around an issue that causes the browser to crash when a file input element does not contain a `multiple` attribute inside of a UIWebView container created by an iOS8 app compiled with and iOS7 SDK.", "Boolean", "true",),
("workarounds.ios8SafariUploads", "ios8SafariUploads", "Disables Fine Uploader and displays a message to the user in iOS8 Safari. Due to serious bugs in iOS8 Safari, uploading is not possible.", "Boolean", "true",)
("workarounds.ios8SafariUploads", "ios8SafariUploads", "Disables Fine Uploader and displays a message to the user in iOS 8.0.0 Safari. Due to serious bugs in iOS 8.0.0 Safari, uploading is not possible. This was apparently fixed in subsequent builds of iOS8, so this workaround only targets 8.0.0.", "Boolean", "true",)
)
)
}}
Expand Down
4 changes: 2 additions & 2 deletions docs/index.jmd
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{% markdown %}

{{ alert(
"""iOS8 contains some serious bugs that prevent uploading in some cases. Workarounds are included
"""iOS 8.0.0 contains some serious bugs that prevent uploading in some cases. Workarounds are included
in Fine Uploader in an attempt to deal with these issues. Unfortunately, there are no known
workarounds for iOS8 Safari, and uploading in that browser is not possible at this time
workarounds for iOS 8.0.0 Safari, and uploading in that browser is not possible at this time
Please see [the blog post on this topic for more details](http://blog.fineuploader.com/2014/09/10/ios8-presents-serious-issues-that-prevent-file-uploading/).""", "warning", "Attention") }}

{{ alert(
Expand Down
10 changes: 5 additions & 5 deletions test/unit/workarounds.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,23 +246,23 @@ describe("browser-specific workarounds", function() {
});
});

describe("iOS8 Safari uploads impossible", function() {
var origIos8 = qq.ios8,
describe("iOS 8.0.0 Safari uploads impossible", function() {
var origIos800 = qq.ios800,
origIosSafari = qq.iosSafari,
origWindowAlert = window.alert;

beforeEach(function() {
qq.ios8 = function() {return true;};
qq.ios800 = function() {return true;};
qq.iosSafari = function() {return true;};
});

afterEach(function() {
qq.ios8 = origIos8;
qq.ios800 = origIos800;
qq.iosSafari = origIosSafari;
window.alert = origWindowAlert;
});

it("throws an error and pops up an alert if addFiles or addBlobs is called in iOS8 Safari", function(done) {
it("throws an error and pops up an alert if addFiles or addBlobs is called in iOS 8.0.0 Safari", function(done) {
var uploader = new qq.FineUploaderBasic({
element: $fixture[0],
button: $button[0],
Expand Down

0 comments on commit 7e69916

Please sign in to comment.