diff --git a/android/app/build.gradle b/android/app/build.gradle index 8739868..167ec35 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -55,8 +55,8 @@ android { // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. minSdkVersion 23 targetSdkVersion 33 - versionCode 48 - versionName '1.5.48' + versionCode 49 + versionName '1.5.49' // manifestPlaceholders = [mapsApiKey: 'android/app/src/main/AndroidManifest.xml'] } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c04337e..39232ad 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -415,7 +415,7 @@ SPEC CHECKSUMS: local_auth_ios: c6cf091ded637a88f24f86a8875d8b0f526e2605 location: d5cf8598915965547c3f36761ae9cc4f4e87d22e nanopb: 438bc412db1928dac798aa6fd75726007be04262 - package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85 + package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943 permission_handler_apple: 036b856153a2b1f61f21030ff725f3e6fece2b78 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 @@ -437,7 +437,7 @@ SPEC CHECKSUMS: url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b vibration: 7d883d141656a1c1a6d8d238616b2042a51a1241 video_player_avfoundation: e9e6f9cae7d7a6d9b43519b0aab382bca60fcfd1 - wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47 + wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1 webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36 PODFILE CHECKSUM: 0bad49c413ac3d5029f2e67f7b21b01b6b7d5085 diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index 23b6af9..96c9ced 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -37,11 +37,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 41 + 42 CFBundleSignature ???? CFBundleVersion - 4.3.41 + 4.3.42 FirebaseAppDelegateProxyEnabled NO GMSApiKey diff --git a/lib/constant/info.dart b/lib/constant/info.dart index 5254d29..d6632df 100644 --- a/lib/constant/info.dart +++ b/lib/constant/info.dart @@ -1,14 +1,13 @@ class AppInformation { - static const String companyName = 'Mobile-App'; + static const String companyName = 'Sefer llc'; static const String appName = 'SEFER'; static const String phoneNumber = '962798583052'; static const String linkedInProfile = 'https://www.linkedin.com/in/hamza-ayed/'; - static const String website = 'https://mobile-app.store'; - static const String email = 'hamzaayed@mobile-app.store'; + static const String website = 'https://sefer.live'; + static const String email = 'hamzaayed@sefer.live'; - static const String privacyPolicy = - ''' + static const String privacyPolicy = ''' diff --git a/lib/constant/links.dart b/lib/constant/links.dart index e8f5ba4..a47267a 100644 --- a/lib/constant/links.dart +++ b/lib/constant/links.dart @@ -13,6 +13,7 @@ class AppLink { static String getTokenParent = "$server/ride/firebase/getTokenParent.php"; static String addTokens = "$server/ride/firebase/add.php"; static String addTokensDriver = "$server/ride/firebase/addDriver.php"; + static String packageInfo = "$server/auth/packageInfo.php"; //=======================Wallet=================== static String wallet = '$server/ride/passengerWallet'; diff --git a/lib/controller/functions/package_info.dart b/lib/controller/functions/package_info.dart new file mode 100644 index 0000000..3ea48d7 --- /dev/null +++ b/lib/controller/functions/package_info.dart @@ -0,0 +1,67 @@ +import 'dart:convert'; +import 'dart:io'; +import 'package:SEFER/constant/links.dart'; +import 'package:SEFER/controller/functions/crud.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:package_info_plus/package_info_plus.dart'; +import 'package:url_launcher/url_launcher.dart'; +import '../../constant/info.dart'; + +Future checkForUpdate(BuildContext context) async { + final packageInfo = await PackageInfo.fromPlatform(); + final currentVersion = packageInfo.buildNumber; + print('currentVersion is : $currentVersion'); + // Fetch the latest version from your server + String latestVersion = await getPackageInfo(); + + if (latestVersion.isNotEmpty && latestVersion != currentVersion) { + showUpdateDialog(context); + } +} + +Future getPackageInfo() async { + final response = await CRUD().get(link: AppLink.packageInfo, payload: { + "platform": Platform.isAndroid ? 'android' : 'ios', + "appName": AppInformation.appName, + }); + + if (response != 'failure') { + return jsonDecode(response)['message'][0]['version']; + } + return ''; +} + +void showUpdateDialog(BuildContext context) { + final String storeUrl = Platform.isAndroid + ? 'https://play.google.com/store/apps/details?id=com.mobileapp.store.ride' + : 'https://apps.apple.com/ae/app/sefer/id6458734951'; + showCupertinoDialog( + context: context, + barrierDismissible: false, + builder: (BuildContext context) { + return CupertinoAlertDialog( + title: Text('Update Available'.tr), + content: Text( + 'A new version of the app is available. Please update to the latest version.' + .tr, + ), + actions: [ + CupertinoDialogAction( + child: Text('Update'.tr), + onPressed: () async { + if (await canLaunchUrl(Uri.parse(storeUrl))) { + await launchUrl(Uri.parse(storeUrl)); + } else { + print('Could not launch $storeUrl'); + } + + Navigator.of(context).pop(); + }, + ), + ], + ); + }, + ); +} diff --git a/lib/controller/home/splash_screen_controlle.dart b/lib/controller/home/splash_screen_controlle.dart index 3f81b29..56f260e 100644 --- a/lib/controller/home/splash_screen_controlle.dart +++ b/lib/controller/home/splash_screen_controlle.dart @@ -3,6 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:SEFER/views/auth/login_page.dart'; +import 'package:package_info_plus/package_info_plus.dart'; import '../../constant/box_name.dart'; import '../../main.dart'; @@ -15,10 +16,23 @@ class SplashScreenController extends GetxController late Animation zoomInAnimation; late Animation zoomOutAnimation; - @override - void onInit() { - super.onInit(); + String packageInfo = ''; + late String version = '1.5.48'; + Future checkForUpdate() async { + final packageInfo = await PackageInfo.fromPlatform(); + final currentVersion = packageInfo.buildNumber; + final version1 = packageInfo.version; + print('currentVersion is : $currentVersion'); + // Fetch the latest version from your server + version = version1.toString(); + print('version: ${version}'); + update(); + } + @override + void onInit() async { + super.onInit(); + checkForUpdate(); animationController = AnimationController( vsync: this, duration: const Duration(seconds: 4), diff --git a/lib/controller/local/translations.dart b/lib/controller/local/translations.dart index d396982..2e09b19 100644 --- a/lib/controller/local/translations.dart +++ b/lib/controller/local/translations.dart @@ -4,6 +4,13 @@ class MyTranslation extends Translations { @override Map> get keys => { "ar": { + "Update Available": "تحديث متوفر", + "A new version of the app is available. Please update to the latest version.": + "تتوفر نسخة جديدة من التطبيق. يرجى التحديث إلى أحدث إصدار.", + "We use location to get accurate and nearest passengers for you": + "نستخدم الموقع للحصول على أقرب الركاب وأكثرهم دقة لك", + "This ride is already applied by another driver.": + "هذه الرحلة قام بقبولها سائق آخر بالفعل.", "We use your precise location to find the nearest available driver and provide accurate pickup and dropoff information. You can manage this in Settings.": "نستخدم موقعك الدقيق للعثور على أقرب سائق متاح وتوفير معلومات دقيقة عن مكان الاستلام والوجهة. يمكنك إدارة ذلك في الإعدادات.", 'message From Driver': '‏رسالة من السائق', @@ -733,7 +740,7 @@ iOS [https://getapp.cc/app/6458734951] "حَتَّى لَو مَفِيش كَارت SIM, مَاتِخَافْش! تُقَدِّر تِكَلِّم سِوَاقَك بِمَنْتَهَى البَسَاطَة عَن طَرِيق التَّطْبِيق بِتَاعِنَا. احنَا بِنَسْتَخْدِم تِكْنُولُوجْيَا حَدِيثَة عَشَان نِحافِظ عَلَى خَصُوصِيَّتَك", "This ride type allows changes, but the price may increase": "ده نوع الرحلات بيسمح بالتغيير بس السعر ممكن يزيد", - "message From passenger": "‏رسالة من الراكب", + "Select one message": "‏اختر رسالة", "My location is correct. You can search for me using the navigation app": "المَكَان اللِّي أنا فِيه صَحِيح، مُمْكِن تُدَوِّر عَليَّا مِن خِلَال تَطْبِيق المُلاحَة", diff --git a/lib/splash_screen_page.dart b/lib/splash_screen_page.dart index 05b291e..11d760f 100644 --- a/lib/splash_screen_page.dart +++ b/lib/splash_screen_page.dart @@ -59,7 +59,14 @@ class SplashScreen extends StatelessWidget { AppStyle.title.copyWith(color: AppColor.primaryColor), speed: const Duration(milliseconds: 200), ), - ], isRepeatingAnimation: false) + ], isRepeatingAnimation: false), + const SizedBox( + height: 100, + ), + Text( + splashScreenController.version.toString(), + style: AppStyle.title, + ), ], ), ), diff --git a/lib/views/home/map_page_passenger.dart b/lib/views/home/map_page_passenger.dart index 12537a3..e36d2ab 100644 --- a/lib/views/home/map_page_passenger.dart +++ b/lib/views/home/map_page_passenger.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:get/get.dart'; import '../../constant/box_name.dart'; import '../../constant/colors.dart'; +import '../../controller/functions/package_info.dart'; import '../../controller/home/map_passenger_controller.dart'; import '../../main.dart'; import '../../views/home/map_widget.dart/cancel_raide_page.dart'; @@ -30,6 +31,9 @@ class MapPagePassenger extends StatelessWidget { Widget build(BuildContext context) { Get.put(MapPassengerController()); Get.put(MyMenuController()); + WidgetsBinding.instance.addPostFrameCallback((_) { + checkForUpdate(context); + }); return Scaffold( body: SafeArea( child: Stack( diff --git a/lib/views/home/map_widget.dart/apply_order_widget.dart b/lib/views/home/map_widget.dart/apply_order_widget.dart index bb58537..b850503 100644 --- a/lib/views/home/map_widget.dart/apply_order_widget.dart +++ b/lib/views/home/map_widget.dart/apply_order_widget.dart @@ -26,7 +26,7 @@ class ApplyOrderWidget extends StatelessWidget { left: 0, right: 0, child: Container( - decoration: AppStyle.boxDecoration1, + decoration: AppStyle.boxDecoration, height: Get.height * .35, child: ListView( children: [ @@ -88,7 +88,7 @@ class ApplyOrderWidget extends StatelessWidget { Container( height: Get.height * .3, width: Get.width * .9, - decoration: AppStyle.boxDecoration1, + decoration: AppStyle.boxDecoration, child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ @@ -185,7 +185,7 @@ class ApplyOrderWidget extends StatelessWidget { title: 'Select one message'.tr, titleStyle: AppStyle.title, content: SizedBox( - width: Get.width * .6, + width: 300, height: Get.height * .5, child: ListView( children: [ @@ -203,7 +203,7 @@ class ApplyOrderWidget extends StatelessWidget { }, child: Container( decoration: - AppStyle.boxDecoration1, + AppStyle.boxDecoration, child: Padding( padding: const EdgeInsets.all( @@ -233,7 +233,7 @@ class ApplyOrderWidget extends StatelessWidget { }, child: Container( decoration: - AppStyle.boxDecoration1, + AppStyle.boxDecoration, child: Padding( padding: const EdgeInsets.all( @@ -263,7 +263,7 @@ class ApplyOrderWidget extends StatelessWidget { }, child: Container( decoration: - AppStyle.boxDecoration1, + AppStyle.boxDecoration, child: Padding( padding: const EdgeInsets.all( @@ -292,7 +292,7 @@ class ApplyOrderWidget extends StatelessWidget { }, child: Container( decoration: - AppStyle.boxDecoration1, + AppStyle.boxDecoration, child: Padding( padding: const EdgeInsets.all( @@ -309,7 +309,7 @@ class ApplyOrderWidget extends StatelessWidget { height: 5, ), SizedBox( - width: Get.width * .5, + width: 190, child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -318,7 +318,7 @@ class ApplyOrderWidget extends StatelessWidget { key: controller .messagesFormKey, child: SizedBox( - width: Get.width * .4, + width: 160, child: MyTextForm( controller: controller .messageToDriver, @@ -455,13 +455,13 @@ class TimeDriverToPassenger extends StatelessWidget { return controller.isDriverInPassengerWay == false || controller.timeToPassengerFromDriverAfterApplied > 0 ? Container( - decoration: AppStyle.boxDecoration1, + decoration: AppStyle.boxDecoration, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1), child: Stack( children: [ Container( - decoration: AppStyle.boxDecoration1, + decoration: AppStyle.boxDecoration, width: Get.width * .7, height: 35, // color: AppColor.yellowColor, diff --git a/lib/views/home/map_widget.dart/ride_begin_passenger.dart b/lib/views/home/map_widget.dart/ride_begin_passenger.dart index c6a755c..96364ce 100644 --- a/lib/views/home/map_widget.dart/ride_begin_passenger.dart +++ b/lib/views/home/map_widget.dart/ride_begin_passenger.dart @@ -31,7 +31,7 @@ class RideBeginPassenger extends StatelessWidget { right: 10, bottom: 4, child: Container( - decoration: AppStyle.boxDecoration1, + decoration: AppStyle.boxDecoration, height: controller.statusRide == 'Begin' ? Get.height * .33 : 0, // width: 100, child: Padding( diff --git a/pubspec.lock b/pubspec.lock index 89f17aa..f50584b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -341,10 +341,10 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" file: dependency: transitive description: @@ -1281,21 +1281,21 @@ packages: source: hosted version: "2.1.0" package_info_plus: - dependency: transitive + dependency: "direct main" description: name: package_info_plus - sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017" + sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0 url: "https://pub.dev" source: hosted - version: "4.2.0" + version: "8.0.0" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" + sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e url: "https://pub.dev" source: hosted - version: "2.0.1" + version: "3.0.0" path: dependency: "direct main" description: @@ -1428,10 +1428,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" pool: dependency: transitive description: @@ -1897,18 +1897,18 @@ packages: dependency: "direct main" description: name: wakelock_plus - sha256: f268ca2116db22e57577fb99d52515a24bdc1d570f12ac18bb762361d43b043d + sha256: "14758533319a462ffb5aa3b7ddb198e59b29ac3b02da14173a1715d65d4e6e68" url: "https://pub.dev" source: hosted - version: "1.1.4" + version: "1.2.5" wakelock_plus_platform_interface: dependency: transitive description: name: wakelock_plus_platform_interface - sha256: "40fabed5da06caff0796dc638e1f07ee395fb18801fbff3255a2372db2d80385" + sha256: "422d1cdbb448079a8a62a5a770b69baa489f8f7ca21aef47800c726d404f9d16" url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.1" watcher: dependency: transitive description: @@ -1969,10 +1969,10 @@ packages: dependency: transitive description: name: win32 - sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 + sha256: a79dbe579cb51ecd6d30b17e0cae4e0ea15e2c0e66f69ad4198f22a6789e94f4 url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.5.1" win32_registry: dependency: transitive description: @@ -2006,5 +2006,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" flutter: ">=3.19.0" diff --git a/pubspec.yaml b/pubspec.yaml index ebaf09d..7657a4d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -56,6 +56,7 @@ dependencies: google_sign_in: ^6.2.1 sign_in_with_apple: ^6.1.0 firebase_auth: ^4.19.6 + package_info_plus: ^8.0.0 dev_dependencies: flutter_test: