added projectID and sent version 9.4 to Tak main branch

master_clone
Faiz Hashmi 2 months ago
parent 726bef8562
commit 2a99222b57

@ -17,32 +17,6 @@ import java.io.File
class MainActivity : FlutterActivity() { class MainActivity : FlutterActivity() {
private val CHANNEL = "com.example.hmg_qline/foreground" private val CHANNEL = "com.example.hmg_qline/foreground"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Keep screen on at all times (AC-powered kiosk display)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
// Disable sleep/screensaver for kiosk mode
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
// Log if app was restarted
if (intent.getBooleanExtra("restarted", false)) {
Log.d("MainActivity", "App restarted successfully")
}
// Log if launched from boot
if (intent.getBooleanExtra("launched_from_boot", false)) {
Log.d("MainActivity", "App launched from boot")
// Give system time to settle after boot
Thread.sleep(2000)
}
Log.d("MainActivity", "MainActivity created - Kiosk display mode active")
}
companion object { companion object {
private const val TAG = "MainActivity" private const val TAG = "MainActivity"
@ -349,6 +323,15 @@ class MainActivity : FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
// Keep screen on at all times (AC-powered kiosk display)
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED)
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON)
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD)
// Disable sleep/screensaver for kiosk mode
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
// Log if app was restarted // Log if app was restarted
if (intent.getBooleanExtra("restarted", false)) { if (intent.getBooleanExtra("restarted", false)) {
Log.d(TAG, "App restarted successfully") Log.d(TAG, "App restarted successfully")
@ -361,6 +344,8 @@ class MainActivity : FlutterActivity() {
Thread.sleep(2000) Thread.sleep(2000)
} }
Log.d(TAG, "MainActivity created - Kiosk display mode active")
// Schedule daily restart alarm at 00:15 (12:15 AM) // Schedule daily restart alarm at 00:15 (12:15 AM)
// This ensures the alarm is always set when app starts // This ensures the alarm is always set when app starts
initializeRestartAlarm() initializeRestartAlarm()

@ -8,7 +8,7 @@ bool useTestIP = false;
bool isNeedToBreakVoiceForArabic = true; bool isNeedToBreakVoiceForArabic = true;
bool isSpeechCompleted = true; bool isSpeechCompleted = true;
bool isAndroid14 = true; bool isAndroid14 = false;
class AppStrings { class AppStrings {
static String timeRemainingText = "Time Remaining"; static String timeRemainingText = "Time Remaining";
@ -174,7 +174,15 @@ class AppConstants {
// Maximum log file size in bytes before rotation/clearing. Default 2 MB. // Maximum log file size in bytes before rotation/clearing. Default 2 MB.
static int maxLogFileSizeBytes = 2 * 1024 * 1024; static int maxLogFileSizeBytes = 2 * 1024 * 1024;
// Takhasusi Main Branch IPs - These devices use getTurnsByOrientationForOlderVersions() // Project IDs for different branches
static const int projectIdTakhasusiMain = 16;
static const int projectIdSuwaidi = 17;
static const int projectIdKhobar = 60;
static const int projectIdTakhasusiWomen = 140;
// Deprecated: IP-based detection - now using projectID from server
// Kept for backward compatibility reference only
@Deprecated('Use projectID-based detection instead')
static const List<String> takhasusiMainBranchIps = [ static const List<String> takhasusiMainBranchIps = [
'10.70.194.87', '10.70.194.87',
'10.70.6.139', '10.70.6.139',
@ -268,13 +276,7 @@ class MockJsonRepo {
id: 189805, id: 189805,
patientID: 4292695, patientID: 4292695,
queueNo: 'W-T-4', queueNo: 'W-T-4',
laBQGroupID: null, laBQGroupID: 0,
queueNo: 'FMC W-T-4',
counterBatchNo: null,
calledBy: null,
calledOn: null,
servedOn: null,
patientName: null,
mobileNo: '0598544522', mobileNo: '0598544522',
patientEmail: 'munira.ali@hotmail.com', patientEmail: 'munira.ali@hotmail.com',
preferredLang: 2, preferredLang: 2,

@ -53,12 +53,16 @@ class MyApp extends StatelessWidget {
log("Constraints: maxWidth=${constraints.maxWidth}, maxHeight=${constraints.maxHeight}"); log("Constraints: maxWidth=${constraints.maxWidth}, maxHeight=${constraints.maxHeight}");
log("Is Portrait (OrientationBuilder): ${orientation == Orientation.portrait}"); log("Is Portrait (OrientationBuilder): ${orientation == Orientation.portrait}");
log("Is Landscape (OrientationBuilder): ${orientation == Orientation.landscape}"); log("Is Landscape (OrientationBuilder): ${orientation == Orientation.landscape}");
log("Device Pixel Ratio: ${MediaQuery.of(context).devicePixelRatio}");
log("Physical Size: width=${constraints.maxWidth * MediaQuery.of(context).devicePixelRatio}, height=${constraints.maxHeight * MediaQuery.of(context).devicePixelRatio}");
log("SizeConfig - realWidth: ${SizeConfig.realScreenWidth}, realHeight: ${SizeConfig.realScreenHeight}");
log("SizeConfig - isPortrait: ${SizeConfig.isPortrait}, screenWidth: ${SizeConfig.screenWidth}, screenHeight: ${SizeConfig.screenHeight}");
log("====================================="); log("=====================================");
SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky);
if (!isAndroid14) { // if (!isAndroid14) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); // SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
} // }
return MultiProvider( return MultiProvider(
providers: [ providers: [
ChangeNotifierProvider<ScreenConfigViewModel>( ChangeNotifierProvider<ScreenConfigViewModel>(

@ -82,8 +82,6 @@ class GlobalConfigurationsModel {
List<KioskLanguageConfigModel>? kioskLanguageConfigList; List<KioskLanguageConfigModel>? kioskLanguageConfigList;
bool isFromTakhasusiMain = false; bool isFromTakhasusiMain = false;
bool globalClinicPrefixReq = false;
bool clinicPrefixReq = true;
String vitalSignTextEng = "Vital Sign"; String vitalSignTextEng = "Vital Sign";
String doctorTextEng = "Doctor"; String doctorTextEng = "Doctor";
@ -186,8 +184,6 @@ class GlobalConfigurationsModel {
this.kioskQueueList, this.kioskQueueList,
this.kioskLanguageConfigList, this.kioskLanguageConfigList,
this.isFromTakhasusiMain = false, this.isFromTakhasusiMain = false,
this.globalClinicPrefixReq = false,
this.clinicPrefixReq = true,
this.vitalSignTextEng = "Vital Sign", this.vitalSignTextEng = "Vital Sign",
this.doctorTextEng = "Doctor", this.doctorTextEng = "Doctor",
this.procedureTextEng = "Procedure", this.procedureTextEng = "Procedure",
@ -287,8 +283,7 @@ class GlobalConfigurationsModel {
kioskQueueList = []; kioskQueueList = [];
} }
if (json['kioskConfig'] != null) { if (json['kioskConfig'] != null) {
kioskLanguageConfigList = kioskLanguageConfigList = List<KioskLanguageConfigModel>.from(json['kioskConfig'].map((kioskQueueJson) => KioskLanguageConfigModel.fromJson(kioskQueueJson)));
List<KioskLanguageConfigModel>.from(json['kioskConfig'].map((kioskQueueJson) => KioskLanguageConfigModel.fromJson(kioskQueueJson)));
} else { } else {
kioskLanguageConfigList = []; kioskLanguageConfigList = [];
} }

@ -82,9 +82,7 @@ class TextToSpeechServiceImp implements TextToSpeechService {
postVoice = ticket.ticketModel!.postVoiceText; postVoice = ticket.ticketModel!.postVoiceText;
} }
String roomNo = ''; String roomNo = '';
if (globalConfigurationsModel.qTypeEnum != QTypeEnum.appointment && if (globalConfigurationsModel.qTypeEnum != QTypeEnum.appointment && ticket.ticketModel!.roomNo.isNotEmpty) {
ticket.ticketModel!.roomNo != null &&
ticket.ticketModel!.roomNo!.isNotEmpty) {
roomNo = ".. ${ticket.ticketModel!.roomNo.toString()}"; roomNo = ".. ${ticket.ticketModel!.roomNo.toString()}";
} }
@ -92,7 +90,7 @@ class TextToSpeechServiceImp implements TextToSpeechService {
preVoice = '$preVoice..'; preVoice = '$preVoice..';
} }
String ticketNo = ticket.ticketModel!.queueNo!.trim().toString(); String ticketNo = ticket.ticketModel!.queueNo.trim().toString();
log("areLanguagesInstalled: ${await textToSpeechInstance.areLanguagesInstalled(["en-US", "ar-SA"])}"); log("areLanguagesInstalled: ${await textToSpeechInstance.areLanguagesInstalled(["en-US", "ar-SA"])}");
log("lang: $langEnum"); log("lang: $langEnum");

@ -215,7 +215,8 @@ class QueuingViewModel extends ChangeNotifier {
callTypeEnum: ticketData.callTypeEnum, callTypeEnum: ticketData.callTypeEnum,
); );
} else { } else {
screenConfigViewModel.acknowledgeTicket(ticketQueueID: ticketData.id ?? 0, screenConfigViewModel.acknowledgeTicket(
ticketQueueID: ticketData.id ?? 0,
ipAddress: screenConfigViewModel.currentScreenIP, ipAddress: screenConfigViewModel.currentScreenIP,
); );
} }

@ -180,23 +180,23 @@ class ScreenConfigViewModel extends ChangeNotifier {
} }
void updateGlobalConfigurationsModel({required var value, bool needNotify = false, bool shouldUpdateNextPrayer = false}) { void updateGlobalConfigurationsModel({required var value, bool needNotify = false, bool shouldUpdateNextPrayer = false}) {
// Ensure the incoming value is the GlobalConfigurationsModel and set the Takhasusi flag based on current IP // Ensure the incoming value is the GlobalConfigurationsModel and set the Takhasusi flag based on projectID
if (value is GlobalConfigurationsModel) { if (value is GlobalConfigurationsModel) {
// IPs that belong to Takhasusi main - using AppConstants // Use projectID-based detection (projectID = 16 for Takhasusi Main)
try { try {
value.isFromTakhasusiMain = AppConstants.takhasusiMainBranchIps.contains(currentScreenIP); value.isFromTakhasusiMain = value.projectID == AppConstants.projectIdTakhasusiMain;
// Debug logging for Takhasusi Main detection // Debug logging for Takhasusi Main detection
log("=== TAKHASUSI MAIN CHECK ==="); log("=== TAKHASUSI MAIN CHECK (ProjectID-based) ===");
log("Current Screen IP: $currentScreenIP"); log("Current Screen IP: $currentScreenIP");
log("Is Takhasusi Main: ${value.isFromTakhasusiMain}"); log("Project ID: ${value.projectID}");
log("Takhasusi Main IPs count: ${AppConstants.takhasusiMainBranchIps.length}"); log("Is Takhasusi Main (projectID == 16): ${value.isFromTakhasusiMain}");
if (value.isFromTakhasusiMain) { if (value.isFromTakhasusiMain) {
log("✅ This device will use getTurnsByOrientationForOlderVersions()"); log("✅ This device will use getTurnsByOrientationForOlderVersions()");
} else { } else {
log("✅ This device will use getTurnsByOrientation()"); log("✅ This device will use getTurnsByOrientationForNewVersions()");
} }
log("============================"); log("==========================================");
} catch (_) { } catch (_) {
value.isFromTakhasusiMain = false; value.isFromTakhasusiMain = false;
} }

@ -58,14 +58,14 @@ class PriorityTickets extends StatelessWidget {
return [_buildPrimaryTicket(context, tickets[0], isFullWidth: true)]; return [_buildPrimaryTicket(context, tickets[0], isFullWidth: true)];
case 2: case 2:
return [ return [
Expanded(child: _buildPrimaryTicket(context, tickets[0], isHalf: true)), Expanded(child: _buildPrimaryTicket(context, tickets[0], isFullWidth: true)),
globalConfigurationsModel.isFromTakhasusiMain ? SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.2) : SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.5), globalConfigurationsModel.isFromTakhasusiMain ? SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.2) : SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.5),
Expanded(child: _buildSecondaryTicket(context, tickets[1], isHalf: true)), Expanded(child: _buildSecondaryTicket(context, tickets[1], isHalf: true)),
]; ];
case 3: case 3:
case 4: case 4:
return [ return [
Expanded(child: _buildPrimaryTicket(context, tickets[0], isHalf: true)), Expanded(child: _buildPrimaryTicket(context, tickets[0], isFullWidth: true)),
globalConfigurationsModel.isFromTakhasusiMain ? SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.2) : SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.5), globalConfigurationsModel.isFromTakhasusiMain ? SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.2) : SizedBox(height: SizeConfig.getHeightMultiplier()! * 0.5),
Expanded(child: _buildOtherTicketsRow(context, noOfTicketsToSkipFromStart: 1, isHalf: true)), Expanded(child: _buildOtherTicketsRow(context, noOfTicketsToSkipFromStart: 1, isHalf: true)),
]; ];
@ -108,8 +108,6 @@ class PriorityTickets extends StatelessWidget {
roomNo: ticket.ticketModel?.roomNo ?? '', roomNo: ticket.ticketModel?.roomNo ?? '',
roomText: _getRoomText(), roomText: _getRoomText(),
roomTextAr: _getRoomTextAr(), roomTextAr: _getRoomTextAr(),
callTypeEnum: ticket.ticketModel?.callTypeEnum ?? CallTypeEnum.vitalSign,
isClinicAdded: false,
callTypeEnum: ticket.ticketModel?.callTypeEnum ?? CallTypeEnum.none, callTypeEnum: ticket.ticketModel?.callTypeEnum ?? CallTypeEnum.none,
textDirection: globalConfigurationsModel.textDirection, textDirection: globalConfigurationsModel.textDirection,
screenTypeEnum: globalConfigurationsModel.screenTypeEnum, screenTypeEnum: globalConfigurationsModel.screenTypeEnum,
@ -117,30 +115,32 @@ class PriorityTickets extends StatelessWidget {
globalConfigurationsModel: globalConfigurationsModel, globalConfigurationsModel: globalConfigurationsModel,
); );
if (isHalf) { log("isFullWidth: ${isFullWidth} and _buildPrimaryTicket");
if (isFullWidth) {
return Center( return Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * 0.7, // 60% of screen width maxWidth: MediaQuery.of(context).size.width * 0.6, // 60% of screen width
minHeight: SizeConfig.getHeightMultiplier() * 2.2, // Minimum height minHeight: SizeConfig.getHeightMultiplier() * 2, // Minimum height
), ),
child: Transform.scale( child: Transform.scale(
scale: _getTicketScale(), scale: _getTicketScale() + 0.2,
child: primaryCallingCard, child: primaryCallingCard,
), ),
), ),
); );
} }
if (isFullWidth) { if (isHalf) {
return Center( return Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width * 0.6, // 60% of screen width maxWidth: MediaQuery.of(context).size.width * 0.6, // 60% of screen width
minHeight: SizeConfig.getHeightMultiplier() * 2, // Minimum height minHeight: SizeConfig.getHeightMultiplier() * 2.2, // Minimum height
), ),
child: Transform.scale( child: Transform.scale(
scale: _getTicketScale() + 0.2, scale: _getTicketScale(),
child: primaryCallingCard, child: primaryCallingCard,
), ),
), ),
@ -158,9 +158,7 @@ class PriorityTickets extends StatelessWidget {
roomNo: ticket.ticketModel?.roomNo ?? '', roomNo: ticket.ticketModel?.roomNo ?? '',
roomText: _getRoomText(), roomText: _getRoomText(),
roomTextAr: _getRoomTextAr(), roomTextAr: _getRoomTextAr(),
isClinicAdded: false,
callTypeEnum: ticket.ticketModel?.callTypeEnum ?? CallTypeEnum.none, callTypeEnum: ticket.ticketModel?.callTypeEnum ?? CallTypeEnum.none,
callTypeEnum: ticket.ticketModel?.callTypeEnum ?? CallTypeEnum.vitalSign,
textDirection: globalConfigurationsModel.textDirection, textDirection: globalConfigurationsModel.textDirection,
screenTypeEnum: globalConfigurationsModel.screenTypeEnum, screenTypeEnum: globalConfigurationsModel.screenTypeEnum,
langTypeEnum: globalConfigurationsModel.screenLanguageEnum, langTypeEnum: globalConfigurationsModel.screenLanguageEnum,
@ -198,7 +196,7 @@ class PriorityTickets extends StatelessWidget {
return globalConfigurationsModel.screenTypeEnum == ScreenTypeEnum.roomLevelScreen return globalConfigurationsModel.screenTypeEnum == ScreenTypeEnum.roomLevelScreen
? 1.5 ? 1.5
: globalConfigurationsModel.isFromTakhasusiMain : globalConfigurationsModel.isFromTakhasusiMain
? 0.9 ? 0.7
: 1.2; : 1.2;
} }

@ -70,7 +70,7 @@ class QueueItemNormalCard extends StatelessWidget {
child: Center( child: Center(
child: AppText( child: AppText(
ticketNo, ticketNo,
fontSize: shouldReduceSize(ticketNo) ? SizeConfig.getWidthMultiplier() * 2.5 : SizeConfig.getWidthMultiplier() * 5, fontSize: shouldReduceSize(ticketNo) ? SizeConfig.getWidthMultiplier() * 2.8 : SizeConfig.getWidthMultiplier() * 5,
letterSpacing: -1, letterSpacing: -1,
fontHeight: 0.5, fontHeight: 0.5,
color: AppColors.greyTextColor, color: AppColors.greyTextColor,

@ -189,8 +189,8 @@ class _MainQueueScreenState extends State<MainQueueScreen> {
return Selector<ScreenConfigViewModel, ScreenOrientationEnum>( return Selector<ScreenConfigViewModel, ScreenOrientationEnum>(
selector: (context, screenConfigViewModel) => screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum, selector: (context, screenConfigViewModel) => screenConfigViewModel.globalConfigurationsModel.orientationTypeEnum,
builder: (BuildContext context, ScreenOrientationEnum screenOrientationEnum, Widget? child) { builder: (BuildContext context, ScreenOrientationEnum screenOrientationEnum, Widget? child) {
//TODO: For Testing Only
//TODO: For Testing Only
log("=== ROTATEDBOX DEBUG ==="); log("=== ROTATEDBOX DEBUG ===");
log("ScreenOrientationEnum: $screenOrientationEnum"); log("ScreenOrientationEnum: $screenOrientationEnum");
log("isFromTakhasusiMain: ${globalConfigurationsModel.isFromTakhasusiMain}"); log("isFromTakhasusiMain: ${globalConfigurationsModel.isFromTakhasusiMain}");

Loading…
Cancel
Save