Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duration does not seem to accept values on "show" and "showWithOptions"methods (Android 8.0) #117

Open
5 of 7 tasks
angel1st opened this issue Aug 10, 2018 · 17 comments
Open
5 of 7 tasks

Comments

@angel1st
Copy link

angel1st commented Aug 10, 2018

Expected behaviour

duration param should be adjustable and should allow to set different times e.g. 10000.

Actual behaviour

Neither of methods - show nor showWithOptions seems to keep toast alive for more than 3000 (3 secs).

I'm seeing this behaviour on

  • iOS device
  • iOS sim
  • Android device
  • Android sim

Hardware models

Samsung Galaxy S8

OS versions

Android 8.0

I'm not a dummy, so I've checked these

  • It happens on a fresh Cordova CLI project as well.
  • I'm waiting for deviceready to fire.
  • My JavaScript has no errors (window.onerror catches nothing).

So how can we reproduce this?

The below code snippet should suffice in reproduction steps:

     var waitToConfirm = 10000;
     if (!readyToExit) {
         readyToExit = true;
         // app exit has to be confirmed
         /* this snippet doesn't work as well
         window.plugins.toast.showWithOptions({
                 message: locale.getString("common.confrimAppExit"),
                  duration: waitToConfirm,
                  position: "center"
         });
         */
         window.plugins.toast.show(locale.getString("common.confrimAppExit"), waitToConfirm, 'center');
     } else {
         navigator.app.exitApp();
     }
     $timeout(() => {
         // simply reset readyToExit, since the user doesn't confirm app exit
         readyToExit = false;
      }, waitToConfirm);

Note: I had a chance to test the very same code snippet above on Xiaomi Redmi Note 4 / Android 7.0 and everything works just fine (the duration has been properly respected by the plugin). It seems the issue is due to OS version, since it is present on the emulator, which runs on Android 8.0 as well.

@angel1st angel1st changed the title duration does not seem to accept values on "show" and "showWithOptions"methods duration does not seem to accept values on "show" and "showWithOptions"methods (Android 8.0) Aug 11, 2018
@angel1st
Copy link
Author

Any chances to receive some feedback on the above issue?

@lolaswift
Copy link

Same issue. Only on android.

@angel1st
Copy link
Author

angel1st commented Oct 9, 2018

@EddyVerbruggen - any chances to see this issue updated soon?

@EddyVerbruggen
Copy link
Owner

Not by me, perhaps someone else.

@angel1st
Copy link
Author

angel1st commented Oct 9, 2018

Any idea how to move it forward? It was reported two months ago and basically, nobody gives an attention...

@442623641
Copy link

any chances to see this issue updated soon?

@angel1st
Copy link
Author

angel1st commented Nov 3, 2018

guys - anyone able to at least elaborate on the issue? It's been almost three months since I reported it and so far nobody gives any valuable feedback...

@442623641
Copy link

it work for me:
Toast.java, find
private static final boolean IS_AT_LEAST_PIE = Build.VERSION.SDK_INT >= 28;
replace with
private static final boolean IS_AT_LEAST_PIE = Build.VERSION.SDK_INT >= 26;

@EddyVerbruggen
Copy link
Owner

2.7.1 is now compatible with any Android version, but it may have implications for how long the Toast is shown. It is what it is.

@angel1st
Copy link
Author

@EddyVerbruggen - actually it does not fix the issue described above - at least not on the OS and the device reported by me. Hence I think the issue shouldn't been closed.

@EddyVerbruggen
Copy link
Owner

I’d be happy to merge a PR to fix your issue, but I want to be transparent that there’s no fix to be expected by me.

@angel1st
Copy link
Author

angel1st commented Nov 11, 2018

I must say I am a bit confused here - I have reported a bug for Android 8.0, confirmed by others as well. It has not been fixed, yet, the issue has been closed.
I believe at least if the issue cannot be fixed, in the plugin description it has to be clearly stated the fact that it does not support duration option for specific OS versions.
Why I should fill in a PR, while we have a bug, it is not clear to me as well.

I stand by my words - the issue should not been closed, since it has not been actually fixed.

@EddyVerbruggen
Copy link
Owner

Happy to reopen, I’m just giving you a heads up I will not be fixing this any time soon, so you don’t have false expectations.

IMO it’s better to have a working Toast on all Android versions (fix in 2.7.1) than supporting a duration on all versions (it does work on some, but I don’t know which exactly).

@angel1st
Copy link
Author

Thanks, mate.
I see your point now and I do agree it is better to have a toast working on all Android versions.
Anyway, as long as this issue specifically addresses a duration malfunctioning, let's keep it open and hope at some point it will be fixed one way or another.

EddyVerbruggen added a commit that referenced this issue Nov 11, 2018
@EddyVerbruggen
Copy link
Owner

Thank you.

Btw, I noticed 2.7.1 ignores even the 'short' and 'long' duration settings (always 'long'). 2.7.2 fixes that.

@angel1st
Copy link
Author

Thanks, Eddy. Just to get this one straight - the user can set ether short or long duration and it will be respected; however, they cannot set duration via the toast.show method, correct?

@EddyVerbruggen
Copy link
Owner

I've tested these 3 (from the readme):

<button onclick="window.plugins.toast.showShortTop('Hello there!', function(a){console.log('toast success: ' + a)}, function(b){alert('toast error: ' + b)})">Toast showShortTop</button>
<button onclick="window.plugins.toast.showLongBottom('Hello there!', function(a){console.log('toast success: ' + a)}, function(b){alert('toast error: ' + b)})">Toast showLongBottom</button>
<button onclick="window.plugins.toast.show('Hello there!', 'long', 'center', function(a){console.log('toast success: ' + a)}, function(b){alert('toast error: ' + b)})">Toast show long center</button>

And all of those respect the short/long setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants