send the release v9.1

master
Faiz Hashmi 3 weeks ago
parent a6df0764fb
commit 1247b70b04

@ -167,7 +167,7 @@ class AppConstants {
static String apiKey = 'EE17D21C7943485D9780223CCE55DCE5';
static String testIP = '12.4.5.1'; // projectID.QlineType.ScreenType.AnyNumber (1 to 10)
static int thresholdForListUI = 5;
static double currentBuildVersion = 8.9;
static double currentBuildVersion = 9.1;
static double clearLogsHoursThreshold = 48;
}

@ -13,14 +13,12 @@ import 'package:wakelock_plus/wakelock_plus.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
try {
await AppDependencies.addDependencies();
await WakelockPlus.enable();
} catch (e) {
log('Initialization error: $e');
}
runApp(const MyApp());
}

@ -203,9 +203,8 @@ class GlobalConfigurationsModel {
screenLanguageText = json['screenLanguageText'];
// textDirection = json['textDirection'] == 2 ? TextDirection.rtl : TextDirection.ltr;
textDirection = TextDirection.rtl;
// screenMaxDisplayPatients = json['screenMaxDisplayPatients'] ?? 16;
// TODO: Uncomment this screenMaxDisplayPatients
screenMaxDisplayPatients = 15;
screenMaxDisplayPatients = json['screenMaxDisplayPatients'] ?? 16;
// screenMaxDisplayPatients = 15;
voiceLanguageEnum = (json['voiceLanguage'] as int).toLanguageEnum();
voiceLanguageText = json['voiceLanguageText'];
isNotiReq = json['isNotiReq'];

@ -15,7 +15,7 @@ abstract class TextToSpeechService {
bool isMute = false,
});
Future<void> speechTextTest(TicketData ticket);
// Future<void> speechTextTest(TicketData ticket);
void listenToTextToSpeechEvents({required Function() onVoiceCompleted});
}
@ -31,119 +31,120 @@ class TextToSpeechServiceImp implements TextToSpeechService {
Map<String, String> arabicVoice = {"name": "ar-xa-x-ard-local", "locale": "ar"};
@override
Future<void> speechTextTest(TicketData ticket) async {
const ttsGoogleEngine = 'com.google.android.tts';
LanguageEnum langEnum = ticket.voiceLanguageEnum;
List engines = await textToSpeechInstance.getEngines;
if (engines.contains(ttsGoogleEngine)) {
await textToSpeechInstance.setEngine(ttsGoogleEngine);
}
textToSpeechInstance.setVolume(1.0);
// final voices = await textToSpeechInstance.getVoices;
// log ("voices:: $voices");
await textToSpeechInstance.setVoice(arabicVoice);
if (langEnum == LanguageEnum.arabic) {
try {
await textToSpeechInstance.setLanguage(LanguageEnum.arabic.enumToString());
} catch (e) {
log("error setting language english: ${e.toString()}");
}
} else if (langEnum == LanguageEnum.english) {
try {
await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
} catch (e) {
log("error setting language english: ${e.toString()}");
}
}
String preVoice = ticket.ticketNoText;
String postVoice = ticket.postVoiceText;
if (preVoice.isNotEmpty) {
preVoice = '$preVoice..';
}
String ticketNo = ticket.queueNo!.trim().toString();
log("areLanguagesInstalled: ${await textToSpeechInstance.areLanguagesInstalled(["en", "ar"])}");
log("lang: $langEnum");
log("preVoice: $preVoice");
log("postVoice: $postVoice");
log("ticketNo: $ticketNo");
String patientAlpha = "";
String patientNumeric = "";
String clinicName = "";
bool isClinicNameAdded = (ticket.queueNo != ticket.callNoStr);
if (isClinicNameAdded) {
var queueNo = "";
var clinic = ticketNo.split(" ");
if (clinic.length > 1) {
clinicName = clinic[0];
queueNo = clinic[1];
} else {
queueNo = ticketNo;
}
var queueNoArray = queueNo.split("-");
if (queueNoArray.length > 2) {
patientAlpha = "${queueNoArray[0]} .. ${queueNoArray[1]}";
patientNumeric = queueNoArray[2];
} else {
patientAlpha = queueNoArray[0];
patientNumeric = queueNoArray[1];
}
} else {
var queueNoArray = ticketNo.split("-");
if (queueNoArray.length > 2) {
patientAlpha = "${queueNoArray[0]} .. ${queueNoArray[1]}";
patientNumeric = queueNoArray[2];
} else {
patientAlpha = queueNoArray[0];
patientNumeric = queueNoArray[1];
}
}
patientAlpha = patientAlpha.split('').join(' .. ');
String roomNo = "";
log("I will now all this:{ $preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo } ");
if (langEnum == LanguageEnum.english) {
await textToSpeechInstance.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo");
return;
}
if (isNeedToBreakVoiceForArabic) {
await textToSpeechInstance.awaitSpeakCompletion(true);
isSpeechCompleted = false;
if (preVoice.isNotEmpty) {
await textToSpeechInstance.speak("$preVoice ");
}
try {
await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
} catch (e) {
log("error setting language english: ${e.toString()}");
}
await textToSpeechInstance.speak("$patientAlpha .. $patientNumeric");
try {
await textToSpeechInstance.setLanguage(langEnum.enumToString());
} catch (e) {
log("error setting language langEnum: ${e.toString()}");
}
await textToSpeechInstance.speak("$postVoice $roomNo").whenComplete(() {
isSpeechCompleted = true;
});
} else {
await textToSpeechInstance.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo");
}
}
// Future<void> speechTextTest(TicketData ticket) async {
// const ttsGoogleEngine = 'com.google.android.tts';
// LanguageEnum langEnum = ticket.voiceLanguageEnum;
// List engines = await textToSpeechInstance.getEngines;
// if (engines.contains(ttsGoogleEngine)) {
// await textToSpeechInstance.setEngine(ttsGoogleEngine);
// }
//
// textToSpeechInstance.setVolume(1.0);
//
// // final voices = await textToSpeechInstance.getVoices;
// // log ("voices:: $voices");
//
// await textToSpeechInstance.setVoice(arabicVoice);
//
// if (langEnum == LanguageEnum.arabic) {
// try {
// await textToSpeechInstance.setLanguage(LanguageEnum.arabic.enumToString());
// } catch (e) {
// log("error setting language english: ${e.toString()}");
// }
// } else if (langEnum == LanguageEnum.english) {
// try {
// await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
// } catch (e) {
// log("error setting language english: ${e.toString()}");
// }
// }
// String preVoice = ticket.ticketNoText;
// String postVoice = ticket.postVoiceText;
// if (preVoice.isNotEmpty) {
// preVoice = '$preVoice..';
// }
// String ticketNo = ticket.queueNo!.trim().toString();
//
// log("areLanguagesInstalled: ${await textToSpeechInstance.areLanguagesInstalled(["en", "ar"])}");
//
// log("lang: $langEnum");
// log("preVoice: $preVoice");
// log("postVoice: $postVoice");
// log("ticketNo: $ticketNo");
//
// String patientAlpha = "";
// String patientNumeric = "";
// String clinicName = "";
//
// bool isClinicNameAdded = (ticket.queueNo != ticket.callNoStr);
//
// if (isClinicNameAdded) {
// var queueNo = "";
// var clinic = ticketNo.split(" ");
// if (clinic.length > 1) {
// clinicName = clinic[0];
// queueNo = clinic[1];
// } else {
// queueNo = ticketNo;
// }
//
// var queueNoArray = queueNo.split("-");
// if (queueNoArray.length > 2) {
// patientAlpha = "${queueNoArray[0]} .. ${queueNoArray[1]}";
// patientNumeric = queueNoArray[2];
// } else {
// patientAlpha = queueNoArray[0];
// patientNumeric = queueNoArray[1];
// }
// } else {
// var queueNoArray = ticketNo.split("-");
// if (queueNoArray.length > 2) {
// patientAlpha = "${queueNoArray[0]} .. ${queueNoArray[1]}";
// patientNumeric = queueNoArray[2];
// } else {
// patientAlpha = queueNoArray[0];
// patientNumeric = queueNoArray[1];
// }
// }
//
// patientAlpha = patientAlpha.split('').join(' .. ');
// String roomNo = "";
//
// log("I will now all this:{ $preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo } ");
//
// if (langEnum == LanguageEnum.english) {
// await textToSpeechInstance.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo");
// return;
// }
//
// if (isNeedToBreakVoiceForArabic) {
// await textToSpeechInstance.awaitSpeakCompletion(true);
//
// isSpeechCompleted = false;
// if (preVoice.isNotEmpty) {
// await textToSpeechInstance.speak("$preVoice ");
// }
// try {
// await textToSpeechInstance.setLanguage(LanguageEnum.english.enumToString());
// } catch (e) {
// log("error setting language english: ${e.toString()}");
// }
// await textToSpeechInstance.speak("$patientAlpha .. $patientNumeric");
//
// try {
// await textToSpeechInstance.setLanguage(langEnum.enumToString());
// } catch (e) {
// log("error setting language langEnum: ${e.toString()}");
// }
//
// await textToSpeechInstance.speak("$postVoice $roomNo").whenComplete(() {
// isSpeechCompleted = true;
// });
// } else {
// await textToSpeechInstance.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice $roomNo");
// }
// }
@override
Future<void> speechText({
@ -151,7 +152,7 @@ class TextToSpeechServiceImp implements TextToSpeechService {
required GlobalConfigurationsModel globalConfigurationsModel,
bool isMute = false,
}) async {
log("ticketdata i got: ${ticket.ticketModel.toString()}");
log("ticket data i got: ${ticket.ticketModel.toString()}");
const ttsGoogleEngine = 'com.google.android.tts';
LanguageEnum langEnum = ticket.ticketModel!.voiceLanguageEnum;
List engines = await textToSpeechInstance.getEngines;
@ -159,6 +160,7 @@ class TextToSpeechServiceImp implements TextToSpeechService {
await textToSpeechInstance.setEngine(ttsGoogleEngine);
}
log("engines: $engines");
await textToSpeechInstance.setVoice(arabicVoice);
if (isMute) {
@ -166,6 +168,8 @@ class TextToSpeechServiceImp implements TextToSpeechService {
} else {
textToSpeechInstance.setVolume(1.0);
}
textToSpeechInstance.setSpeechRate(0.4);
if (langEnum == LanguageEnum.arabic) {
try {
await textToSpeechInstance.setLanguage(LanguageEnum.arabic.enumToString());

@ -191,10 +191,6 @@ class QueuingViewModel extends ChangeNotifier {
notifyListeners();
}
Future<void> testSpeech() async {
textToSpeechService.speechTextTest(MockJsonRepo.ticket);
}
Future<void> callTicketOnScreen({required TicketData? ticketData}) async {
if (ticketData == null) return;
ScreenConfigViewModel screenConfigViewModel = getIt.get<ScreenConfigViewModel>();

@ -45,7 +45,7 @@ class ScreenConfigViewModel extends ChangeNotifier {
await getLastTimeUpdatedFromCache();
await getLastTimeLogsClearedFromCache();
listenNetworkConnectivity();
getTheWidgetsConfigurationsEveryMidnight();
initializeTimer();
}
Future<void> onAppResumed() async {
@ -304,7 +304,7 @@ class ScreenConfigViewModel extends ChangeNotifier {
DateTime lastChecked = DateTime.now();
Timer? _midnightTimer;
Future<void> getTheWidgetsConfigurationsEveryMidnight() async {
Future<void> initializeTimer() async {
// Cancel any existing timer to avoid multiple timers running
_midnightTimer?.cancel();
@ -317,40 +317,46 @@ class ScreenConfigViewModel extends ChangeNotifier {
return;
}
_midnightTimer = Timer.periodic(const Duration(minutes: 10), (timer) async {
counter++;
DateTime now = DateTime.now();
log("counterValue: $counter");
_midnightTimer = Timer.periodic(
const Duration(minutes: 10),
(timer) async {
counter++;
DateTime now = DateTime.now();
log("counterValue: $counter");
// Every Two hour, update RSS feed if required
if (counter % 12 == 0 && globalConfigurationsModel.isRssFeedReq) {
await getRssFeedDetailsFromServer();
}
if (globalConfigurationsModel.id == null) {
await getGlobalConfigurationsByIP();
}
log("lastChecked: [${lastChecked.day}]");
log("now: [${now.day}]");
// At midnight, update weather and prayer details if required
if (now.day != lastChecked.day) {
if (now.difference(now.copyWith(hour: 0, minute: 0, second: 0, millisecond: 0, microsecond: 0)).inMinutes >= 5) {
await nativeMethodChannelService.smartRestart(forceRestart: true, cleanupFirst: true);
// if (globalConfigurationsModel.isRssFeedReq) {
// await getRssFeedDetailsFromServer();
// }
// if (globalConfigurationsModel.isWeatherReq) {
// await getWeatherDetailsFromServer();
// }
// if (globalConfigurationsModel.isPrayerTimeReq) {
// await getPrayerDetailsFromServer();
// }
lastChecked = now;
// Every Two hour, update RSS feed if required
if (counter % 12 == 0 && globalConfigurationsModel.isRssFeedReq) {
await getRssFeedDetailsFromServer();
}
}
getNextPrayerToShow();
syncHubConnectionState();
});
log("lastChecked: [${lastChecked.day}]");
log("now: [${now.day}]");
// At midnight, update weather and prayer details if required
if (now.day != lastChecked.day) {
if (now.difference(now.copyWith(hour: 0, minute: 0, second: 0, millisecond: 0, microsecond: 0)).inMinutes >= 5) {
await nativeMethodChannelService.smartRestart(forceRestart: true, cleanupFirst: true);
// if (globalConfigurationsModel.isRssFeedReq) {
// await getRssFeedDetailsFromServer();
// }
// if (globalConfigurationsModel.isWeatherReq) {
// await getWeatherDetailsFromServer();
// }
// if (globalConfigurationsModel.isPrayerTimeReq) {
// await getPrayerDetailsFromServer();
// }
lastChecked = now;
}
}
getNextPrayerToShow();
syncHubConnectionState();
},
);
}
@override

@ -308,23 +308,20 @@ class _AppFooterState extends State<AppFooter> {
children: [
Padding(
padding: EdgeInsets.only(top: SizeConfig.getHeightMultiplier()! * 0.1),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
AppStrings.poweredBy,
fontSize: SizeConfig.getWidthMultiplier()! * 1.5,
fontWeight: FontWeight.w400,
color: AppColors.darkGreyTextColor,
),
AppText(
"v${screenConfigVM.currentScreenIP.replaceAll(".", "").replaceAll("0", "-")}(${AppConstants.currentBuildVersion})",
fontSize: SizeConfig.getWidthMultiplier()! * 1,
fontWeight: FontWeight.w400,
color: AppColors.darkGreyTextColor,
),
],
),
child: Column(mainAxisAlignment: MainAxisAlignment.center, children: [
AppText(
AppStrings.poweredBy,
fontSize: SizeConfig.getWidthMultiplier()! * 1.5,
fontWeight: FontWeight.w400,
color: AppColors.darkGreyTextColor,
),
AppText(
"v${screenConfigVM.currentScreenIP.replaceAll(".", "-")}(${AppConstants.currentBuildVersion})",
fontSize: SizeConfig.getWidthMultiplier()! * 1,
fontWeight: FontWeight.w400,
color: AppColors.darkGreyTextColor,
),
]),
),
SizedBox(width: SizeConfig.getWidthMultiplier()!),
Padding(

@ -167,11 +167,12 @@ class _MainQueueScreenState extends State<MainQueueScreen> {
// )
// ],
Expanded(
flex: 10,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: SizeConfig.getWidthMultiplier()! * 4),
child: dataContent(context: context),
)),
flex: 10,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: SizeConfig.getWidthMultiplier()! * 4),
child: dataContent(context: context),
),
),
],
);
},

Loading…
Cancel
Save