I'm very new to fine-uploader; I hope my question is relevant...
I'm trying to disable the camera for users of our Web App on iPad and iPhone only (iOS), both for Safari and Chrome. I have tried setting the option camera: {ios: false} but the camera option still shows in Safari and Chrome. When I use workarounds: { ios8BrowserCrash: true}, the camera option does disappear in Chrome but still shows in Safari. What am I missing?
We are using fine-uploader 5.1.2, I briefly tried 5.2.2 with the same results. The app is HTML5, Javascript, Angular with Java back-end. I have tested on iPad with iOS 8.3, 8.4 and 9 beta.
As an aside, the reason I'm trying to disable the camera is due to iOS often crashing when loading the image from the camera. I have found the application crashing a lot less when loading from the device image library, bypassing the camera. Is that a known issue with iPad/iPhones?
Thanks in advance for the help.
Thanks #Ray. For reference, I'm now using the latest FineUploader version 5.3.0.
As you suggested the multiple attribute was being removed. I traced it to the input.removeAttribute("multiple"); code below (s3.fine-uploader.js):
setMultiple: function(isMultiple, optInput) {
var input = optInput || this.getInput();
// Temporary workaround for bug in in iOS8 UIWebView that causes the browser to crash
// before the file chooser appears if the file input doesn't contain a multiple attribute.
// See #1283.
if (options.ios8BrowserCrashWorkaround && qq.ios8() && (qq.iosChrome() || qq.iosSafariWebView())) {
input.setAttribute("multiple", "");
}
else {
if (isMultiple) {
input.setAttribute("multiple", "");
}
else {
input.removeAttribute("multiple");
}
}
},
Despite options.ios8BrowserCrashWorkaround being set to true in my code (ios8BrowserCrash: true), the program was still going through to removeAttribute("multiple") line of code when running on IPad/Safari.
After several tries and errors I found out that (possibly...) the library code was missing testing for the condition qq.iosSafari()on an iPad (iOS 8.3) ; the qq.iosSafariWebView() test isn't sufficient to detect the Safari browser on my iPad, therefore missing the code where the multiple attribute is set.
I found out that the following options values in my calling code fixed the issue.
function initialiseS3() {
uploader = new qq.s3.FineUploader({
element: $element[0],
template: $(contents)[0],
debug: false,
// iosEmptyVideos workaround must be false to enable FineUploader to keep multiple:true in iOS
workarounds: {
iosEmptyVideos: false,
ios8BrowserCrash: true
},
// Must add the test qq.iosSafari() to set multiple to true and have the camera turned off on iPad
multiple: qq.ios8() && (qq.iosSafari() || qq.iosChrome() || qq.iosSafariWebView()) ? true : false,
camera: {
ios: false
},
… (more initialisations)
`
The last catch was to override the default value for the workaround option iosEmptyVideos and set it to iosEmptyVideos: false to avoid the library forcing multiple to false again. I hope this makes sense…
Related
I'm using WebSettingsCompat.setForceDark(webView.getSettings(), WebSettingsCompat.FORCE_DARK_OFF); on android 12 is working well, but on android 13 it not working. please help and thank you.
For apps targeting Android 13 (API level 33) or higher, the setForceDark() method is deprecated, resulting in a no-op if the method is called.
Instead, WebView now always sets the media query prefers-color-scheme according to the app's theme attribute, isLightTheme. In other words, if isLightTheme is true or not specified, prefers-color-scheme is light; otherwise, it is dark. This behavior means that the web content's light or dark style is applied automatically to match the app's theme if the content supports it.
For most apps, the new behavior should apply the appropriate app styles automatically, however you should test your app to check for any cases where you might've been manually controlling dark mode settings.
If you still need to customize your app's color theme behavior, use the setAlgorithmicDarkeningAllowed() method instead. For backward compatibility with previous Android versions, we recommend using the equivalent setAlgorithmicDarkeningAllowed() method in AndroidX.
See the documentation for that method to learn more about what behavior you can expect in your app depending on your app's targetSdkVersion and theme settings.
For more info, visit to this docs https://developer.android.com/about/versions/13/behavior-changes-13
Try this
if (SDK_INT >= 32) {
if (WebViewFeature.isFeatureSupported(WebViewFeature.ALGORITHMIC_DARKENING)) {
try { WebSettingsCompat.setAlgorithmicDarkeningAllowed(myWebView.getSettings(), true);
} catch (Exception e) {
e.printStackTrace();
}
}
}else {
if (WebViewFeature.isFeatureSupported(WebViewFeature.FORCE_DARK)) {
int nightModeFlags = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (nightModeFlags == Configuration.UI_MODE_NIGHT_YES) {
//Theme is switched to Night/Dark mode, turn on webview darkening
WebSettingsCompat.setForceDark(myWebView.getSettings(), WebSettingsCompat.FORCE_DARK_ON);
}
After 2 days I'm driving myself nuts because I can't resolve this. My issue is as follows:
1.) I am trying to use javascript target an iOS device (regardless of browser being Chrome on apple, Safari, Firefox on apple etc...) to show a different DOM element verses non iOS browsers.
2. ) My iOS detection code is as follows, which I've seen in several other threads: // Detects if device is on iOS
const isIos = () => {
const userAgent = window.navigator.userAgent.toLowerCase();
return /iphone|ipad|ipod/.test( userAgent );
}
3.) After running this check I am attempting the following in both Safari and Chrome on iOS "my way which I'm assuming is incorrect because it's not working lol!" :
if(!isIos()) {
setTimeout(function() {
console.log('showing non iOS banner prompt after delay');
}, 10000);
} else if (isIos()) {
setTimeout(function() {
console.log('showing iOS banner prompt after delay');
}, 10000);
}
4.) The proper log is shown through chrome dev tools on my windows laptop when selecting an iOS device (which I know is not an actual iOS enviroment), but no matter what i do, once loaded to the live site it ALWAYS shows the non Ios log on my iPad.
SOLVED (for iPAD)
After finding this post enter link description here i changed my detection method. I was testing on an iPAD (as this is the only Apple product i own because I'm not a fan) and after this correction my current issue was resolved. I hope this works on other devices as well but won't know until I borrow a freind's. Hope someone else finds this helpful.
||
(navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1)
const isIos = () => {
const userAgent = window.navigator.userAgent.toLowerCase();
return /iphone|ipad|ipod/.test( userAgent ) || (navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);
}
I'm developing a App with Ionic 2 and I'm have problems with #ionic-native/Camera. I've this code on Upload.ts
let loader = this.loading.create({
content: 'Carregando video....'
});
loader.present().then(() => {
const options: CameraOptions = {
quality: 100,
destinationType: this.camera.DestinationType.FILE_URI,
sourceType: this.camera.PictureSourceType.PHOTOLIBRARY,
mediaType: this.camera.MediaType.VIDEO,
}
this.camera.getPicture(options).then((videoData) => {
this.uploadForm.controls['file'].setValue(videoData)
loader.dismiss();
}, (err) => {
console.log(err);
});
});
This code works fine in Android, but when I run ionic cordova run ios -lc, the promise this.camera.getPicture(options) is never resolved, so the loader keep running forever.
Thanks in advance!
So, I found the problem. First thing is that native components bugs with -l (--livereload). I don't know how to explain why but I got this information from the Ionic Worldwide slack. A member from Ionic Team said:
"live-reload on a device can cause issues with plugins and file system".
So I used this video to understand how to debbug the APP using the iOS emulator and Safari.
https://www.youtube.com/watch?v=Aob749bkoLY
A little brief of the video: when using iOS emulator, you can access the menu Developer > Emulator > <App Name>. A new window with inspector tools will open and logs from the emulator will appear on this window.
I found out that's the video url was incorrect. Before, to be compatible with Android, I've this code responsible to find the video pointer in system and send to the server:
filePath = 'file:///' + this.uploadForm.controls['file'].value;
But, iOS File Picker already has a "file:///" prefix. So prefixing it again made it wrong. So I updated the code to be like this:
if (this.platform.is('android')) {
filePath = 'file:///' + this.uploadForm.controls['file'].value;
} else {
filePath = this.uploadForm.controls['file'].value;
}
This resolved the problem.
So, I've created a save system for my game.The thing is it works fine on Flash and Air for desktop, but not Air For iOS when I wrap it as an iOS app.Does sharedObject.getLocal work with iOS? If not, what else can I use?
Yes, it should work. If var mySharedObject.getLocal("game") does not work, then you probably have a corrupted system, or a very old version of IOS. To be sure, post the code you're using. Also, make sure you have a correct render mode for your type of application.
2nd Option: Check your memory. If you don't have enough memory to support SharedObject, it won't store the memory. Do a test, add this code:
if(mySharedObject.size != 0)
{
textfield.text = "works."
}else{
textfield.text = "nowork."
make a textbox input called 'textfield' and a SharedObject variable 'mySharedObject'.
I'm getting this error when I press a button in a flash/air app that used to work in the AIR 3.2 SDK - now upgraded to the AIR 3.5 SDK. Any help much appreciated.
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at seed_template_fla::MainTimeline/frame7()[seed_template_fla.MainTimeline::frame7:31]
at flash.display::MovieClip/gotoAndPlay()
at seed_template_fla::MainTimeline/gotoPage() [seed_template_fla.MainTimeline::frame1:20]
at seed_template_fla::MainTimeline/gotoRepro() [seed_template_fla.MainTimeline::frame1:12]
I'm creating an app for iPhone using Flash CS6 on Mac and exporting using the Air 3.5 SDK. I also have the AIR 3.5 runtime installed.
The app is very simple at the moment. It basically moves from frame to frame when you press a button using the gotoAndPlay(frameNr) function. There are some hexes on the frames that update an array of numbers when clicked. They are also toggled visible/not visible.
This used to work perfectly using the AIR 3.2 SDK, but I recently downloaded the AIR 3.5 SDK from adobe and added it through flash (Help>Manage Air SDK) and set it as the build target in File>Publish Settings>Target.
When I switch back to AIR 3.2 SDK, the app works perfectly again.
Also, when I upload the app to my iPhone 4S running IOS 5.1 using AIR 3.5 SDK, I just see a black screen with 5 loading dots flashing. This also works fine with AIR 3.2 SDK.
This is the code for frame 7
The last line is line 31.
stop();
techtitle.text = "Select Trait";
techdesc.text = "Spend points to change core stats and other special abilities";
points.visible = false;
techpoints.visible=false;
pointsbalance.text = myPoints.toString();
btn_tech.visible = false;
curTechSelected = null;
trace("set hexes invisible");
for (var j:int = 0; j <= 67; j++) {
if (hexStatusb[j] == 1) {
this["btn_hex_"+j+"b"].visible = false;
}
}
function onBtnHex37bClick(event:MouseEvent):void
{
techtitle.text = "tech1";
techdesc.text = "tech1 description"
techpoints.text = "-2";
points.visible = true;
techpoints.visible=true;
btn_tech.visible = true;
curTechSelected = btn_hex_37b;
curTechSelectedNr = 37;
curTechPoints = 2;
}
trace(this["btn_hex_37b"]);
btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);
OK - so, after trying out lots of things, I figured out why this is happening.
Solution: get rid of all TFL text objects when running AIR 3.5 SDK
It seems that the TFL Text library wasn't being loaded properly at runtime. Something crucial that I neglected to mention was that I was getting this warning message (similar here http://forums.adobe.com/thread/825637)
Content will not stream... The runtime shared libraries being preloaded are textLayout_1.0.0.05... TFLText
and this warning message in the output
Warning: Ignoring 'secure' attribute in policy file from http://fpdownload.adobe.com/pub/swz/crossdomain.xml. The 'secure' attribute is only permitted in HTTPS and socket policy files.
Simply removing all TFLText objects and changing them to classic text makes the app work fine again.
#csomakk Great news. I have found the answer. You can publish in 3.5 and 3.6 and have your TLF Text too. I posted a write-up on my blog that shows exactly how to do it.
To get started: the error message states that something is null.. it means, that the program doesn't know, where to look for it. It can happen, when you didn't create the object (btn_hex_37b = new MovieClip()); or you haven't even created a variable for it.
on the given line (btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);) only btn_hex_37b can be null, because onBtnHex37bClick exists, and if it wouldn't, the program wouldn't compile.
The reason it came up when switching to AIR 3.5 is probably that it calls some creation functions in different order. Go to the line where you define the btn_hex_37b variable. Search for that functions calling.. Make sure, that btn_hex_37b is created before going to frame7.
Also, if its not a vital, to have onBtn_hex_37bClick, you can do the following:
if(btn_hex_37b){
btn_hex_37b.addEventListener(MouseEvent.CLICK, onBtnHex37bClick);
}
the if will check if btn_hex_37b is not null.
On the else method, you can give a timeouted method(but that is ugly), or give the eventlistener right after the creation of the object.
Hope this helped.
For Flash CS6, copy this swc:
/Applications/Adobe Flash CS6/Common/Configuration/ActionScript 3.0/libs/flash.swc
Into my Flash Builder project using these steps:
http://interactivesection.files.wordpress.com/2009/06/include_fl_packages_in_flex_builder-1.jpg
and then use this link
http://curtismorley.com/2013/03/05/app-used-to-work-with-air-3-2-or-3-4-doesnt-work-with-air-3-5-or-3-6/#comment-241102