diff --git a/android/app/build.gradle b/android/app/build.gradle index fa40e32..bcce007 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -27,6 +27,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { + namespace = "com.example.queuing_system" compileSdkVersion flutter.compileSdkVersion compileOptions { @@ -51,6 +52,7 @@ android { targetSdkVersion 31 versionCode flutterVersionCode.toInteger() versionName flutterVersionName + multiDexEnabled true } buildTypes { @@ -68,4 +70,6 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.2.2' + } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 5a6de5c..aa876a1 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -14,7 +14,7 @@ + android:label="HMG Qline"> + if (project.hasProperty('android')) { + project.android { + if (namespace == null) { + namespace project.group + } + } + } + } + } + } rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { project.evaluationDependsOn(':app') } tasks.register("clean", Delete) { delete rootProject.buildDir -} +} \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index c021028..e464997 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Fri Jun 23 08:50:38 CEST 2017 +#Tue Nov 12 09:01:21 AST 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/android/settings.gradle b/android/settings.gradle index 44e62bc..f86bddf 100644 --- a/android/settings.gradle +++ b/android/settings.gradle @@ -1,11 +1,26 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version '8.7.0' apply false + id "org.jetbrains.kotlin.android" version "1.8.22" apply false + +} + +include ":app" \ No newline at end of file diff --git a/lib/core/api.dart b/lib/core/api.dart index 6c54639..ee14684 100644 --- a/lib/core/api.dart +++ b/lib/core/api.dart @@ -27,16 +27,14 @@ class MyHttpOverrides extends HttpOverrides { class API { static getCallRequestInfoByClinicInfo(String deviceIp, - {required Function(List, List, CallConfig callConfig) onSuccess, - required Function(dynamic) onFailure}) async { + {required Function(List, List, CallConfig callConfig) onSuccess, required Function(dynamic) onFailure}) async { final body = {"ipAdress": deviceIp, "apiKey": apiKey}; bool isDevMode = false; if (isDevMode) { final Map response = testPatientsData["data"] as Map; CallConfig callConfig = CallConfig.fromJson(response["callConfig"]); - var callPatients = - (response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList(); + var callPatients = (response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList(); var isQueuePatients = callPatients.where((element) => (element.isQueue == false && element.callType != 0)).toList(); log("callPatients: ${callPatients.toString()}"); log("isQueuePatients: ${isQueuePatients.toString()}"); @@ -50,11 +48,7 @@ class API { final response = apiResp["data"]; CallConfig callConfig = CallConfig.fromJson(response["callConfig"]); - var callPatients = (response["callPatients"] as List) - .map((j) => PatientTicketModel.fromJson(j)) - .toList() - .where((element) => element.callType != 0) - .toList(); + var callPatients = (response["callPatients"] as List).map((j) => PatientTicketModel.fromJson(j)).toList().where((element) => element.callType != 0).toList(); var isQueuePatients = callPatients.where((element) => (element.isQueue == false && element.callType != 0)).toList(); callPatients.sort((a, b) => a.editedOnTimeStamp.compareTo(b.editedOnTimeStamp)); @@ -108,7 +102,10 @@ class API { body: body, onSuccess: (response, status) { if (status == 200 && response["data"] != null) { - widgetsConfigModel = (response["data"] as List).map((e) => WidgetsConfigModel.fromJson(e)).toList().first; + List list = (response["data"] as List).map((e) => WidgetsConfigModel.fromJson(e)).toList(); + if (list.isNotEmpty) { + widgetsConfigModel = list.first; + } } }, onFailure: (error, status) => log("error: ${error.toString()}")); diff --git a/lib/core/base/base_app_client.dart b/lib/core/base/base_app_client.dart index b14ee46..02c2337 100644 --- a/lib/core/base/base_app_client.dart +++ b/lib/core/base/base_app_client.dart @@ -10,7 +10,7 @@ class BaseAppClient { static post(String endPoint, {Map? body, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure}) async { String url; - url = "$BASE_URL/api/PatientCall" + endPoint; + url = "$BASE_URL/api/PatientCall$endPoint"; // try { logger.i("URL : $url"); @@ -20,13 +20,16 @@ class BaseAppClient { 'Content-Type': 'application/json', 'Accept': 'application/json', }); + final int statusCode = response.statusCode; + logger.i("statusCode : $statusCode"); + if (statusCode < 200 || statusCode >= 400) { if (onFailure != null) { onFailure(Utils.generateContactAdminMsg(), statusCode); } } else { - logger.i("Response: ${response.body.toString()}"); + log("Response: ${response.body.toString()}"); var parsed = json.decode(response.body.toString()); if (onSuccess != null) { onSuccess(parsed, statusCode); @@ -47,7 +50,7 @@ class BaseAppClient { static get(String endPoint, {Map? body, Function(dynamic response, int statusCode)? onSuccess, Function(String error, int statusCode)? onFailure}) async { String url; - url = "$BASE_URL/api/PatientCall" + endPoint; + url = "$BASE_URL/api/PatientCall$endPoint"; try { // String token = await sharedPref.getString(TOKEN); @@ -83,11 +86,11 @@ class BaseAppClient { //TODO change this fun String error = parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage']; if (parsed["ValidationErrors"] != null) { - error = parsed["ValidationErrors"]["StatusMessage"].toString() + "\n"; + error = "${parsed["ValidationErrors"]["StatusMessage"]}\n"; if (parsed["ValidationErrors"]["ValidationErrors"] != null && parsed["ValidationErrors"]["ValidationErrors"].length != 0) { for (var i = 0; i < parsed["ValidationErrors"]["ValidationErrors"].length; i++) { - error = error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0] + "\n"; + error = "${error + parsed["ValidationErrors"]["ValidationErrors"][i]["Messages"][0]}\n"; } } } diff --git a/lib/core/config/config.dart b/lib/core/config/config.dart index aca4a27..6cba86c 100644 --- a/lib/core/config/config.dart +++ b/lib/core/config/config.dart @@ -4,9 +4,9 @@ const MAX_SMALL_SCREEN = 660; const ONLY_NUMBERS = "[0-9]"; const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_DATE = "[0-9/]"; -const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; -const BASE_URL = 'https://ms.hmg.com/nscapi'; // UAT -// const BASE_URL = 'https://qline.hmg.com'; // LIVE +// const BASE_URL = 'https://ms.hmg.com/nscapi2'; // Development DB +// const BASE_URL = 'https://ms.hmg.com/nscapi'; // UAT +const BASE_URL = 'https://qline.hmg.com'; // LIVE const apiKey = 'EE17D21C7943485D9780223CCE55DCE5'; // UAT // const BASE_URL = 'http://10.200.204.11:2222/Services/Nurses.svc/REST'; // const BASE_URL = 'https://hmgwebservices.com/'; diff --git a/lib/core/response_models/widgets_config_model.dart b/lib/core/response_models/widgets_config_model.dart index ef93c27..30e0f73 100644 --- a/lib/core/response_models/widgets_config_model.dart +++ b/lib/core/response_models/widgets_config_model.dart @@ -9,6 +9,8 @@ class WidgetsConfigModel { double? projectLongitude; int? cityKey; + + WidgetsConfigModel({ this.waitingAreaID, this.waitingAreaName, diff --git a/lib/footer/app_footer.dart b/lib/footer/app_footer.dart index 298f2f1..3123c1c 100644 --- a/lib/footer/app_footer.dart +++ b/lib/footer/app_footer.dart @@ -37,7 +37,7 @@ class AppFooter extends StatelessWidget { fontFamily: 'Poppins-Medium.ttf', ), ), - Text(appProvider.currentDeviceIp, + Text("v${appProvider.currentDeviceIp}", style: TextStyle(fontWeight: FontWeight.w500, fontSize: SizeConfig.getWidthMultiplier() * 2.2)), Row( children: [ diff --git a/lib/header/app_header.dart b/lib/header/app_header.dart index 884aee1..5fde76a 100644 --- a/lib/header/app_header.dart +++ b/lib/header/app_header.dart @@ -74,7 +74,7 @@ class AppHeader extends StatelessWidget implements PreferredSizeWidget { return Consumer( builder: (BuildContext context, AppProvider appProvider, Widget? child) { return Container( - height: 100, + height: 115, padding: const EdgeInsets.only(left: 20, right: 20), decoration: BoxDecoration(color: AppGlobal.vitalSignColor), child: Directionality( diff --git a/lib/home/app_provider.dart b/lib/home/app_provider.dart index b8c6e51..16bd180 100644 --- a/lib/home/app_provider.dart +++ b/lib/home/app_provider.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'dart:developer'; import 'dart:io'; -import 'package:connectivity/connectivity.dart'; +import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:intl/intl.dart'; @@ -25,7 +25,18 @@ bool isVoiceActualCompletedGlobally = false; class AppProvider extends ChangeNotifier { AppProvider() { - callInitializations(); + waitForIPAndCallInitializations(); + } + + Future waitForIPAndCallInitializations() async { + while (currentDeviceIp == "") { + await getCurrentIP(); + if (currentDeviceIp != "") { + await callInitializations(); + } else { + await Future.delayed(const Duration(seconds: 2)); + } + } } Future callInitializations() async { @@ -87,7 +98,7 @@ class AppProvider extends ChangeNotifier { ); } - logger.i("here logger.ig: ${isQueuePatients.length}"); + logger.i("isQueuePatients: ${isQueuePatients.length}"); if (isQueuePatients.isEmpty) { isCallingInProgress = false; @@ -198,7 +209,9 @@ class AppProvider extends ChangeNotifier { Future getPrayerDetailsFromServer() async { PrayersWidgetModel? prayersWidgetModel = await API.getPrayerDetailsFromServer( - latitude: currentWidgetsConfigModel!.projectLatitude ?? 0, longitude: currentWidgetsConfigModel!.projectLongitude ?? 0, onFailure: (error) => logger.i("Api call failed with this error: ${error.toString()}")); + latitude: currentWidgetsConfigModel!.projectLatitude ?? 0, + longitude: currentWidgetsConfigModel!.projectLongitude ?? 0, + onFailure: (error) => logger.i("Api call failed with this error: ${error.toString()}")); if (prayersWidgetModel != null) { currentPrayersWidgetModel = prayersWidgetModel; @@ -224,13 +237,16 @@ class AppProvider extends ChangeNotifier { // if (currentWidgetsConfigModel == null) return; await getInfoWidgetsConfigurationsFromServer().whenComplete(() async { - if (currentWidgetsConfigModel!.isWeatherReq!) { + if (currentWidgetsConfigModel == null) { + return; + } + if (currentWidgetsConfigModel!.isWeatherReq != null && currentWidgetsConfigModel!.isWeatherReq!) { await getWeatherDetailsFromServer(); } - if (currentWidgetsConfigModel!.isPrayerTimeReq!) { + if (currentWidgetsConfigModel!.isPrayerTimeReq != null && currentWidgetsConfigModel!.isPrayerTimeReq!) { await getPrayerDetailsFromServer(); } - if (currentWidgetsConfigModel!.isRssFeedReq!) { + if (currentWidgetsConfigModel!.isRssFeedReq != null && currentWidgetsConfigModel!.isRssFeedReq!) { await getRssFeedDetailsFromServer(); } }); @@ -243,6 +259,9 @@ class AppProvider extends ChangeNotifier { Future getTheWidgetsConfigurationsEveryMidnight() async { if (currentWidgetsConfigModel == null) return; + if (!(currentWidgetsConfigModel!.isWeatherReq ?? false) && !(currentWidgetsConfigModel!.isPrayerTimeReq ?? false) && !(currentWidgetsConfigModel!.isRssFeedReq ?? false)) { + return; + } if (!currentWidgetsConfigModel!.isWeatherReq! && !currentWidgetsConfigModel!.isPrayerTimeReq! && !currentWidgetsConfigModel!.isRssFeedReq!) { return; } @@ -494,7 +513,13 @@ class AppProvider extends ChangeNotifier { onDisconnect(exception) { logger.i("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() { @@ -502,9 +527,10 @@ class AppProvider extends ChangeNotifier { } listenNetworkConnectivity() async { - Connectivity().onConnectivityChanged.listen((event) async { - switch (event) { + Connectivity().onConnectivityChanged.listen((List event) async { + switch (event.first) { case ConnectivityResult.wifi: + case ConnectivityResult.ethernet: updateInternetConnection(true); await getCurrentIP(); if (signalRHelper.connection != null) { @@ -517,6 +543,16 @@ class AppProvider extends ChangeNotifier { break; case ConnectivityResult.mobile: break; + case ConnectivityResult.bluetooth: + // TODO: Handle this case. + break; + // TODO: Handle this case. + case ConnectivityResult.vpn: + // TODO: Handle this case. + break; + case ConnectivityResult.other: + // TODO: Handle this case. + break; } }); } diff --git a/lib/home/priority_calls_components.dart b/lib/home/priority_calls_components.dart index 8055e2a..fcc0337 100644 --- a/lib/home/priority_calls_components.dart +++ b/lib/home/priority_calls_components.dart @@ -26,7 +26,7 @@ class PriorityTickets extends StatelessWidget { children: [ const SizedBox(height: 50), TicketItem( - ticketNo: firstTicket.queueNo ?? '', + ticketNo: firstTicket.queueNo, callType: firstTicket.getCallType(), scale: 1.2, blink: true, @@ -43,7 +43,7 @@ class PriorityTickets extends StatelessWidget { .map((ticket) => Padding( padding: EdgeInsets.only(top: SizeConfig.getHeightMultiplier() * 2), child: TicketItem( - ticketNo: ticket.queueNo ?? '', + ticketNo: ticket.queueNo, callType: ticket.getCallType(), scale: 0.8, roomNo: ticket.roomNo, @@ -82,7 +82,7 @@ class TicketItem extends StatelessWidget { String getFormattedTicket(String ticketNo, bool isClinicAdded) { if (isClinicAdded) { var formattedString = ticketNo.split(" "); - return formattedString[0] + " " + formattedString[1]; + return "${formattedString[0]} ${formattedString[1]}"; } return ticketNo; } @@ -94,19 +94,21 @@ class TicketItem extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.center, children: [ - BlinkText(getFormattedTicket(ticketNo, isClinicAdded), - style: TextStyle( - fontSize: SizeConfig.getWidthMultiplier() * 10, - letterSpacing: -1, - height: 0.5, - fontWeight: FontWeight.bold, - ), - beginColor: Colors.black, - endColor: blink ? Colors.black.withOpacity(0.1) : Colors.black, - // endColor: blink ? AppGlobal.appRedColor : Colors.black, - times: 0, - duration: const Duration(seconds: 1)), - const SizedBox(height: 13), + BlinkText( + getFormattedTicket(ticketNo, isClinicAdded), + style: TextStyle( + fontSize: SizeConfig.getWidthMultiplier() * 10, + letterSpacing: -1, + height: 0.5, + fontWeight: FontWeight.bold, + ), + beginColor: Colors.black, + endColor: blink ? Colors.black.withOpacity(0.1) : Colors.black, + // endColor: blink ? AppGlobal.appRedColor : Colors.black, + times: 0, + duration: const Duration(seconds: 1), + ), + const SizedBox(height: 25), Directionality( textDirection: callConfig.textDirection, child: Row( @@ -114,8 +116,8 @@ class TicketItem extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ Padding( - padding: EdgeInsets.only(bottom: callType == CallType.vitalSign ? 0 : 8), - child: callType.icon(SizeConfig.getHeightMultiplier() * 3), + padding: EdgeInsets.only(bottom: callType == CallType.vitalSign ? 8 : 8), + child: callType.icon(SizeConfig.getHeightMultiplier() * 2), ), const SizedBox(width: 13), AppText( @@ -188,7 +190,7 @@ Widget priorityTicketsWithSideList({required List tickets, r log("appProvider.currentScreenRotation: ${appProvider.currentScreenRotation}"); final List children = [ - Expanded(flex: 7, child: PriorityTickets(callConfig: callConfig, tickets: priorityTickets)), + Expanded(flex: 8, child: PriorityTickets(callConfig: callConfig, tickets: priorityTickets)), Container(color: Colors.grey.withOpacity(0.1), width: 10, margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 50)), Expanded( flex: 6, diff --git a/lib/main.dart b/lib/main.dart index ccbf314..d6fea40 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,7 +6,7 @@ import 'package:logger/logger.dart'; import 'package:provider/provider.dart'; import 'package:queuing_system/core/api.dart'; import 'package:queuing_system/home/app_provider.dart'; -import 'package:wakelock/wakelock.dart'; +import 'package:wakelock_plus/wakelock_plus.dart'; import 'core/config/size_config.dart'; import 'home/home_screen.dart'; @@ -21,7 +21,7 @@ Logger logger = Logger( void main() { HttpOverrides.global = MyHttpOverrides(); WidgetsFlutterBinding.ensureInitialized(); - Wakelock.enable(); + WakelockPlus.enable(); runApp(const MyApp()); } @@ -36,12 +36,8 @@ class MyApp extends StatelessWidget { builder: (context, constraints) { return OrientationBuilder(builder: (context, orientation) { SizeConfig().init(constraints, orientation); - SystemChrome.setPreferredOrientations([ - DeviceOrientation.portraitUp, - // DeviceOrientation.portraitDown, - // DeviceOrientation.landscapeLeft, - // DeviceOrientation.landscapeRight, - ]); + SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); return MultiProvider( providers: [ @@ -49,7 +45,7 @@ class MyApp extends StatelessWidget { ], child: MaterialApp( showSemanticsDebugger: false, - title: 'Doctors App', + title: 'Qline Appointments', theme: ThemeData( primaryColor: Colors.grey, fontFamily: 'Poppins', diff --git a/lib/utils/call_by_voice.dart b/lib/utils/call_by_voice.dart index 2661e33..4a8bfae 100644 --- a/lib/utils/call_by_voice.dart +++ b/lib/utils/call_by_voice.dart @@ -58,7 +58,7 @@ class CallByVoice { flutterTts.setVolume(1.0); isVoiceActualCompletedGlobally = true; await flutterTts.awaitSpeakCompletion(true); - await flutterTts.speak(preVoice + " .. " + clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice); + await flutterTts.speak("$preVoice .. $clinicName .. $patientAlpha .. $patientNumeric .. $postVoice"); return; } @@ -69,9 +69,9 @@ class CallByVoice { await flutterTts.awaitSpeakCompletion(true); // await flutterTts.speak(preVoice + " .. " + clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. " + postVoice); - await flutterTts.speak(preVoice + " .. "); + await flutterTts.speak("$preVoice .. "); await flutterTts.setLanguage("en"); - await flutterTts.speak(clinicName + " .. " + patientAlpha + " .. " + patientNumeric + " .. "); + await flutterTts.speak("$clinicName .. $patientAlpha .. $patientNumeric .. "); await flutterTts.setLanguage(lang); isVoiceActualCompletedGlobally = true; await flutterTts.speak(postVoice); diff --git a/lib/utils/signalR_utils.dart b/lib/utils/signalR_utils.dart index 3ebd26e..53e4318 100644 --- a/lib/utils/signalR_utils.dart +++ b/lib/utils/signalR_utils.dart @@ -34,14 +34,14 @@ class SignalRHelper { required VoidCallback onConnecting, }) async { logger.i("Connecting Signal R with: $deviceIp"); - final url = hubBaseURL + "?IPAddress=$deviceIp"; + final url = "$hubBaseURL?IPAddress=$deviceIp"; // final url = hubBaseURL; connection = HubConnectionBuilder() .withUrl( url, HttpConnectionOptions( client: IOClient(HttpClient()..badCertificateCallback = (x, y, z) => true), - // transport: HttpTransportType.webSockets, + transport: HttpTransportType.webSockets, logging: (level, message) => log(message), )) .withAutomaticReconnect() @@ -55,7 +55,11 @@ class SignalRHelper { connection!.on('addChatMessage', (message) => onUpdateAvailable(message)); - await connection!.start(); + try { + await connection!.start(); + } catch (e) { + logger.i("Exception while connecting: ${e.toString()}"); + } } void sendMessage(List args) async { diff --git a/lib/utils/utils.dart b/lib/utils/utils.dart index 11ed84f..f431d71 100644 --- a/lib/utils/utils.dart +++ b/lib/utils/utils.dart @@ -1,5 +1,6 @@ -import 'package:connectivity/connectivity.dart'; +import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:queuing_system/core/config/size_config.dart'; +import 'package:queuing_system/main.dart'; class Utils { static getHeight() { @@ -16,12 +17,20 @@ class Utils { } static Future checkConnection() async { - ConnectivityResult connectivityResult = await (Connectivity().checkConnectivity()); - if ((connectivityResult == ConnectivityResult.mobile) || (connectivityResult == ConnectivityResult.wifi)) { + List connectivityResult = await (Connectivity().checkConnectivity()); + int indexEthernet = connectivityResult.indexWhere((element) => element == ConnectivityResult.ethernet); + + if (indexEthernet != -1) { + return true; + } + + int indexWifi = connectivityResult.indexWhere((element) => element == ConnectivityResult.wifi); + + if (indexWifi != -1) { return true; - } else { - return false; } + + return false; } // static TextStyle textStyle(context) => TextStyle(color: Theme.of(context).primaryColor); // diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index fda5d83..dbf44b3 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -6,19 +6,21 @@ import FlutterMacOS import Foundation import audio_session -import connectivity_macos +import connectivity_plus import flutter_tts import just_audio +import package_info_plus import path_provider_foundation import shared_preferences_foundation -import wakelock_macos +import wakelock_plus func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AudioSessionPlugin.register(with: registry.registrar(forPlugin: "AudioSessionPlugin")) - ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin")) + ConnectivityPlusPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlusPlugin")) FlutterTtsPlugin.register(with: registry.registrar(forPlugin: "FlutterTtsPlugin")) JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin")) + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) - WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin")) + WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) } diff --git a/pubspec.yaml b/pubspec.yaml index 385f42a..f09c4e5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -33,22 +33,23 @@ dependencies: # Base packages provider: ^6.0.1 - get_it: ^7.1.3 - connectivity: ^3.0.6 -# flutter_gifimage: ^1.0.1 - flutter_svg: ^1.0.3 - http: ^0.13.0 + get_it: ^8.0.2 + connectivity_plus: ^6.1.0 + # flutter_gifimage: ^1.0.1 + flutter_svg: ^2.0.14 + http: ^1.2.2 blinking_text: ^1.0.2 - just_audio: 0.9.31 - flutter_tts: 3.6.3 -# flutter_tts: ^4.0.2 - wakelock: ^0.6.2 - shared_preferences: ^2.2.1 + just_audio: ^0.9.42 + flutter_tts: ^4.1.0 + # flutter_tts: ^4.0.2 + wakelock_plus: ^1.2.8 + shared_preferences: ^2.3.5 #signalr core signalr_core: ^1.1.1 - intl: ^0.18.1 + intl: ^0.19.0 marquee: ^2.2.3 logger: ^2.4.0 + win32: ^5.8.0 @@ -61,7 +62,7 @@ dev_dependencies: # activated in the `analysis_options.yaml` file located at the root of your # package. See that file for information about deactivating specific lint # rules and activating additional ones. - flutter_lints: ^1.0.0 + flutter_lints: ^5.0.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 63d4407..661b0ef 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,9 +6,12 @@ #include "generated_plugin_registrant.h" +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + ConnectivityPlusWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); FlutterTtsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("FlutterTtsPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 26bfe68..7363fb2 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + connectivity_plus flutter_tts )