botman don't run callback param of ask method the first time when sendWidgetOpenedEvent = true - botman

I have a problem with botman io ask function.
I set sendWidgetOpenedEvent = true so the first time open botman window the chat botman show. it is ok.
I create 5 button. with line code line this
5 buttons can show on the dialog window.
But when user clicks the button, botman don't run callback param of ask method.
More detail explaination. Firt time we call botman method so, botman cannot hears any text from users. I think that why the callback ask can not call.
if user send message first, botman show button, user clicks button, the callback ask can be called.
Can someone give me some hints to fix this bug.

Related

Infinite Redirect Loop on Google One Tap Signin

I'm having trouble finding any documentation in regards to Google One Tap UX and how to persist signin state after a signin redirect. I am using the html api, check the code here:
setTimeout(function () {
let target = document.getElementById('google-signin');
target.innerHTML = '<div id="g_id_onload" data-client_id="x" data-context="signin" data-login_uri="https://x/account/google/callback" data-auto_select="true" data-itp_support="true"></div>';
var s = document.createElement("script");
s.src = 'https://accounts.google.com/gsi/client';
document.head.appendChild(s);
console.log('appended script', s);
}, 30000);
</script>
Essentially I am delaying this signin popup for 30 seconds, that part works fine but soon after this is what happens:
Sign in occurs
Redirect happens
Server redirects back to the referer page
After 30 seconds the process starts again
I would have assumed the google sdk would set a cookie or something somewhere but I guess it does not, either that I'm supposed to handle persisting signin state through my own means. I just want to know the correct approach here.
My question is: How does google know if a user has already signed in using Google One Tap UX?
Figured out a solution. Google allows you to put a property on your div tag called data-skip_prompt_cookie="yourcookie" this will skip the one tap prompt if that cookie is present with a truthy value.
What I did was on my server callback in asp.net I added a cookie to the response. This ensures the prompt is only disabled once someone actually signs in.
Response.Cookies.Append(
"yourcookie", "true");
This ensures when my server redirects back to the originating page, the cookie exists and the one tap does not show up again

MS Teams - TaskModule close the window

I display a third party web page(client page) in the task module
using Deeplink
https://teams.microsoft.com/l/task/botid?url=https:test.com/test.html&height=450&width=510&title=Custom+Form&completionBotId=botid
new AdaptiveOpenUrlAction() { Title = "Enable MS Team access", Url = new Uri(DeeplinkHelper.DeepLink }
Here the web page is opening in Task module, I need to close this task module by clicking the button available on the web page(URL) and send the result to completionBotId.
Any sample pls that need to implement in client-side code.
There are two steps to make this work:
you need to reference the Teams Javascript SDK in your web page
When your user clicks the button, you would call microsoftTeams.tasks.submitTask in your 'click' event handler. There are a few parameter options for this method, depending on whether you want it to send anything back to your bot. To simply close the window, call microsoftTeams.tasks.submitTask(null);, or if you want to send an object back, call microsoftTeams.tasks.submitTask(whateverObjectYouWantToSendBack);

prevent swing dialog self dismissed by click/toch outside

i have followind definition in gradle for asking a pass:
def askPass() {
def msg = 'Please enter the passphrase for the keyfile:'
def console = System.console()
return console != null
? console.readPassword('%s: ', msg)
: javax.swing.JOptionPane.showInputDialog(msg)
}
i use it to gather pass at when some task nearly ends - task is run (gradle myTask) from IDE (intellij) in terminal - so it is a separate not tied to idee process, normally the dialog opens and i can write my pas but sometimes when the task takes long time im moving out IDE to do some other things moving a focus from IDE and when the task is at the end it invokes def to ask pass and gains focus popping up dialog on top of everything (im on linux os)
now to the point:
when i do something and the dialogs popups sometimes i don't react so fast or my hands are fasters as my eyes as i was ocuppied by then other job - i click outside dialog area and the poped up dialog dissapears - no buttons are hitted... now the popup is gone the task is not done waiting for input ... (this looks like dismiss dialog by click outside and the dismiss result is not handled) in this def
so my question:
how can i make the popup no dismissable till the cancel or ok buttion is not used (by click/select/accept) ?
I believe you are looking for modal dialog. It forces the user to select a choice before leaving to previous window. In your case, you should use javax.swing.JDialog instead of javax.swing.JOptionPane.

Can I block a form submit action after first click

On a webpage, is it safe to block a submit action after user clicked it once (to avoid double posting) or is there a risk that I now block my user, in case of no/bad connectivity, post not reaching the server etc..
So in other words, can I trust that my post request always reaches the server and back to the user?
It is ok to disable button on Submit... but please make sure that you execute SUBMIT script after you have disabled it...
p.s. Common behavior is that submit button does not proceed to submit after you disabled it, you should do it manually.
To encounter no/bad connectivity, you can set javaScript timer that will return submit button to its normal state after some time, so user can click it again
Ideally you should send a server call and disable the submit button and wait for the response to comeback and if status is failed enable submit button otherwise do nothing and process the response as you need it
i think you are using javascript for making a server call if yes then it's very easy to pass a callback and listen for the response

XCode 7 UI Testing: Dismissal of system-generated UIAlertController does not work

I have a UI test which involves the dismissal of a system-generated UIAlertController. This alert asks the user for the permission to access the device's calendar. The objective of the test is the behaviour after a tap on the OK button:
1 let app = XCUIApplication()
...
// this code was basically generated by the recording feature of XCode 7
2 app.alerts.elementBoundByIndex(0).collectionViews.buttons["OK"].tap()
Now, instead of clicking the OK button, line 2 makes the simulator tap onto the first button which happens to be the Cancel button...
Additionally, I found out that the testing framework does not accurately recognize the appearing alert. So if I check the current count of alerts I always get 0:
// ...tap...
let count = app.alerts.count // == 0
This also happens if I use an NSPredicate for the condition and wait for several seconds.
Is it possible that UI tests do not work reliably with system-generated alerts? I am using XCode 7.0.1.
Xcode 7.1 has finally fixed the issue with system alerts. There are, however, two small gotchas.
First, you need to set up a "UI Interuption Handler" before presenting the alert. This is our way of telling the framework how to handle an alert when it appears.
Second, after presenting the alert you must interact with the interface. Simply tapping the app works just fine, but is required.
addUIInterruptionMonitorWithDescription("Location Dialog") { (alert) -> Bool in
alert.buttons["Allow"].tap()
return true
}
app.buttons["Request Location"].tap()
app.tap() // need to interact with the app for the handler to fire
The "Location Dialog" is just a string to help the developer identify which handler was accessed, it is not specific to the type of alert. I believe that returning true from the handler marks it as "complete", which means it won't be called again.
I managed to dismiss access prompt for contacts like this:
let alert = app.alerts["\u{201c}******\u{201d} Would Like to Access Your Contacts"].collectionViews.buttons["OK"]
if alert.exists
{
alert.tap()
}
Replace asterisks with your app's name. It might work the same for calendar.
This is what I ended up using to get the prompt to appear and then allow access to Contacts:
func allowAccessToContacts(textFieldsName: String)
{
let app = XCUIApplication()
let textField = app.textFields[textFieldsName]
textField.tap()
textField.typeText("aaa")
let alert = app.alerts["\u{201c}******\u{201d} Would Like to Access Your Contacts"].collectionViews.buttons["OK"]
if alert.exists
{
alert.tap()
}
textField.typeText("\u{8}\u{8}\u{8}")
}