Synchronise API calls
This commit is contained in:
parent
79425abc05
commit
fdf78de626
21
source/app.d
21
source/app.d
|
@ -137,6 +137,8 @@ class ApiClient
|
||||||
private string _sessionId;
|
private string _sessionId;
|
||||||
private int _requestCounter;
|
private int _requestCounter;
|
||||||
|
|
||||||
|
private bool _busy;
|
||||||
|
|
||||||
this(string locale)
|
this(string locale)
|
||||||
{
|
{
|
||||||
_locale = locale;
|
_locale = locale;
|
||||||
|
@ -196,6 +198,13 @@ class ApiClient
|
||||||
|
|
||||||
string getAccountAvailable()
|
string getAccountAvailable()
|
||||||
{
|
{
|
||||||
|
while(_busy)
|
||||||
|
{
|
||||||
|
sleep(10.msecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
_busy = true;
|
||||||
|
|
||||||
auto clickImageEvent = createClickImageEvent("Container@reuse_Screen@img_Account");
|
auto clickImageEvent = createClickImageEvent("Container@reuse_Screen@img_Account");
|
||||||
|
|
||||||
auto widgetEventsRequest = new WidgetEvents("Container", [clickImageEvent]);
|
auto widgetEventsRequest = new WidgetEvents("Container", [clickImageEvent]);
|
||||||
|
@ -210,6 +219,8 @@ class ApiClient
|
||||||
|
|
||||||
goHome();
|
goHome();
|
||||||
|
|
||||||
|
_busy = false;
|
||||||
|
|
||||||
foreach(widgetUpdate; response.responseSets[0].responses[0]["ScreenUpdate"])
|
foreach(widgetUpdate; response.responseSets[0].responses[0]["ScreenUpdate"])
|
||||||
{
|
{
|
||||||
if(widgetUpdate["widgetId"] == "Container@reuse_flowApplication@repeater_1292926459910")
|
if(widgetUpdate["widgetId"] == "Container@reuse_flowApplication@repeater_1292926459910")
|
||||||
|
@ -225,8 +236,16 @@ class ApiClient
|
||||||
|
|
||||||
string getCardAvailable()
|
string getCardAvailable()
|
||||||
{
|
{
|
||||||
|
while(_busy)
|
||||||
|
{
|
||||||
|
sleep(10.msecs);
|
||||||
|
}
|
||||||
|
|
||||||
|
_busy = true;
|
||||||
|
|
||||||
auto clickImageEvent = createClickImageEvent("Container@reuse_Screen@img_card");
|
auto clickImageEvent = createClickImageEvent("Container@reuse_Screen@img_card");
|
||||||
|
|
||||||
|
|
||||||
auto widgetEventsRequest = new WidgetEvents("Container", [clickImageEvent]);
|
auto widgetEventsRequest = new WidgetEvents("Container", [clickImageEvent]);
|
||||||
sendRequest("sequential", widgetEventsRequest);
|
sendRequest("sequential", widgetEventsRequest);
|
||||||
|
|
||||||
|
@ -239,6 +258,8 @@ class ApiClient
|
||||||
|
|
||||||
goHome();
|
goHome();
|
||||||
|
|
||||||
|
_busy = false;
|
||||||
|
|
||||||
foreach(widgetUpdate; response.responseSets[0].responses[0]["ScreenUpdate"])
|
foreach(widgetUpdate; response.responseSets[0].responses[0]["ScreenUpdate"])
|
||||||
{
|
{
|
||||||
if(widgetUpdate["widgetId"] == "Container@reuse_flowApplication@reuse_CreditCardCommonData@lbl_available_amount_value")
|
if(widgetUpdate["widgetId"] == "Container@reuse_flowApplication@reuse_CreditCardCommonData@lbl_available_amount_value")
|
||||||
|
|
Loading…
Reference in New Issue