@ -163,7 +163,8 @@ class AppProvider extends ChangeNotifier {
RssFeedModel currentRssFeedModel = RssFeedModel ( ) ;
Future < void > getRssFeedDetailsFromServer ( ) async {
RssFeedModel ? rssFeedModel = await API . getRssFeedDetailsFromServer ( languageId: 0 , onFailure: ( error ) = > log ( " Api call failed with this error: ${ error . toString ( ) } " ) ) ;
RssFeedModel ? rssFeedModel =
await API . getRssFeedDetailsFromServer ( languageId: 0 , onFailure: ( error ) = > log ( " Api call failed with this error: ${ error . toString ( ) } " ) ) ;
if ( rssFeedModel ! = null ) {
currentRssFeedModel = rssFeedModel ;
@ -359,7 +360,6 @@ class AppProvider extends ChangeNotifier {
} else {
isCallingInProgress = false ;
log ( " Setting isCallingInProgress : $ isCallingInProgress " ) ;
if ( isApiCallNeeded ) {
Timer ( Duration ( seconds: patientCallConfigurations . concurrentCallDelaySec ) , ( ) async {
await callPatientsAPI ( ) ;
@ -421,25 +421,27 @@ class AppProvider extends ChangeNotifier {
if ( isQueuePatients . isNotEmpty ) {
/ / final length = isQueuePatients . length ;
/ / for ( int i = 0 ; i < length ; i + + ) {
await Future . delayed ( Duration ( seconds: patientCallConfigurations . concurrentCallDelaySec ) ) . whenComplete ( ( ) async {
PatientTicketModel temp = PatientTicketModel ( ) ;
if ( patientTickets . isNotEmpty & & isQueuePatients . length > 1 ) {
temp = patientTickets . elementAt ( 0 ) ;
patientTickets . removeAt ( 0 ) ;
}
notifyListeners ( ) ;
if ( isQueuePatients . isNotEmpty ) {
isQueuePatients . removeAt ( 0 ) ;
}
if ( patientTickets . isNotEmpty & & isQueuePatients . length > 1 ) {
patientTickets . add ( temp ) ;
}
notifyListeners ( ) ;
if ( isQueuePatients . isNotEmpty ) {
await voiceCallPatientTicket ( patientTickets . first , " setCompletionHandler " ) ;
updatePatientTicket ( patientTickets . first ) ;
}
} ) ;
await Future . delayed ( Duration ( seconds: patientCallConfigurations . concurrentCallDelaySec ) ) . whenComplete (
( ) async {
PatientTicketModel temp = PatientTicketModel ( ) ;
if ( patientTickets . isNotEmpty & & isQueuePatients . length > 1 ) {
temp = patientTickets . elementAt ( 0 ) ;
patientTickets . removeAt ( 0 ) ;
}
notifyListeners ( ) ;
if ( isQueuePatients . isNotEmpty ) {
isQueuePatients . removeAt ( 0 ) ;
}
if ( patientTickets . isNotEmpty & & isQueuePatients . length > 1 ) {
patientTickets . add ( temp ) ;
}
notifyListeners ( ) ;
if ( isQueuePatients . isNotEmpty ) {
await voiceCallPatientTicket ( patientTickets . first , " setCompletionHandler " ) ;
updatePatientTicket ( patientTickets . first ) ;
}
} ,
) ;
/ / }
}
@ -471,7 +473,7 @@ class AppProvider extends ChangeNotifier {
updatePatientTicket ( PatientTicketModel patientTicket ) {
if ( ! patientTicket . isQueue ) {
API . callUpdateNotIsQueueRecordByIDAsync ( currentDeviceIp , ticket: patientTicket , onSuccess: ( ticketsUpdated ) {
API . callUpdateNotIsQueueRecordByIDAsync ( currentDeviceIp , ticket: patientTicket , onSuccess: ( ticketsUpdated ) {
log ( " [ ${ patientTicket . callNoStr } ] Ticket Updated: $ ticketsUpdated " ) ;
} , onFailure: ( e ) {
log ( " Tickets Update ${ patientTicket . callNoStr } Failed with Error : ${ e . toString ( ) } " ) ;
@ -485,7 +487,8 @@ class AppProvider extends ChangeNotifier {
onDisconnect ( exception ) {
log ( " SignalR: onDisconnect " ) ;
signalRHelper . startSignalRConnection ( currentDeviceIp , onUpdateAvailable: onPingReceived , onConnect: onConnect , onConnecting: onConnecting , onDisconnect: onDisconnect ) ;
signalRHelper . startSignalRConnection ( currentDeviceIp ,
onUpdateAvailable: onPingReceived , onConnect: onConnect , onConnecting: onConnecting , onDisconnect: onDisconnect ) ;
}
onConnecting ( ) {