From 3814bf14ff39ab72611c211c19b85f527c8de130 Mon Sep 17 00:00:00 2001 From: OkaykOrhmn Date: Mon, 6 Jan 2025 15:13:58 +0330 Subject: [PATCH] fix some issues --- android/app/build.gradle | 2 +- android/app/src/debug/AndroidManifest.xml | 3 +- android/app/src/main/AndroidManifest.xml | 3 +- android/app/src/profile/AndroidManifest.xml | 3 +- android/build.gradle | 4 +- android/gradle.properties | 3 + .../gradle/wrapper/gradle-wrapper.properties | 2 +- .../notification/notification_service.dart | 49 --------------- lib/views/ai/create_bot_assistants_page.dart | 28 +++++---- lib/views/ai/widgets/ai_message_bar.dart | 17 ++--- lib/views/ai/widgets/ai_message_bar_ios.dart | 17 ++--- lib/views/direct/direct_state.dart | 4 -- .../edit_profile/widgets/profile_photo.dart | 14 +++-- lib/views/widgets/categories_list.dart | 4 +- lib/views/widgets/video/primary_controls.dart | 4 +- pubspec.lock | 62 ++++++------------- pubspec.yaml | 6 +- 17 files changed, 80 insertions(+), 145 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 49ffd2f..a3d1c30 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -36,7 +36,7 @@ if (keystorePropertiesFile.exists()) { android { namespace "com.didvan.didvanapp" - compileSdk 34 + compileSdk 35 ndkVersion "25.1.8937393" compileOptions { diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 06824d8..f880684 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 79aac85..c841e84 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 06824d8..f880684 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/android/build.gradle b/android/build.gradle index cac1b54..cae0df0 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.10' + ext.kotlin_version = '1.9.0' repositories { google() mavenCentral() @@ -7,7 +7,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:7.4.1' + classpath 'com.android.tools.build:gradle:8.3.2' classpath 'com.google.gms:google-services:4.3.14' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } diff --git a/android/gradle.properties b/android/gradle.properties index ed50858..4003f9b 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,3 +1,6 @@ org.gradle.jvmargs=-Xmx4608m android.useAndroidX=true android.enableJetifier=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index aeaff6f..fb5eb59 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip diff --git a/lib/services/notification/notification_service.dart b/lib/services/notification/notification_service.dart index b7edbd2..e218a5b 100644 --- a/lib/services/notification/notification_service.dart +++ b/lib/services/notification/notification_service.dart @@ -6,7 +6,6 @@ import 'package:didvan/services/storage/storage.dart'; import 'package:firebase_messaging/firebase_messaging.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:get/get.dart'; class NotificationService { @@ -167,51 +166,3 @@ class NotificationService { } } } - -class NotificationHelper { - static final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = - FlutterLocalNotificationsPlugin(); - - static Future initialized() async { - const AndroidInitializationSettings initializationSettingsAndroid = - AndroidInitializationSettings('@mipmap/ic_launcher'); - final initializationSettingsIos = DarwinInitializationSettings( - requestAlertPermission: true, - requestBadgePermission: true, - requestSoundPermission: true, - onDidReceiveLocalNotification: (id, title, body, payload) async {}, - ); - - await flutterLocalNotificationsPlugin.initialize( - InitializationSettings( - android: initializationSettingsAndroid, - iOS: initializationSettingsIos), - onDidReceiveNotificationResponse: (details) { - if (kDebugMode) { - print("onDidReceiveNotificationResponse: $details"); - } - }, onDidReceiveBackgroundNotificationResponse: localBackgroundHandler); - } - - static void displayNotification(RemoteMessage message) async { - try { - final id = DateTime.now().millisecondsSinceEpoch ~/ 1000; - const notifDetails = NotificationDetails( - android: AndroidNotificationDetails( - 'push_notificatiion', 'push_notificatiion_channel', - importance: Importance.max, priority: Priority.high)); - - await flutterLocalNotificationsPlugin.show( - id, message.data['title'], message.data['body'], notifDetails); - } on Exception catch (e) { - e.printError(); - } - } -} - -@pragma('vm:entry-point') -Future localBackgroundHandler(NotificationResponse data) async { - if (kDebugMode) { - print("onDidReceiveBackgroundNotificationResponse: $data"); - } -} diff --git a/lib/views/ai/create_bot_assistants_page.dart b/lib/views/ai/create_bot_assistants_page.dart index 0967da9..c9ede74 100644 --- a/lib/views/ai/create_bot_assistants_page.dart +++ b/lib/views/ai/create_bot_assistants_page.dart @@ -213,23 +213,26 @@ class _CreateBotAssistantsPageState extends State { final pickedFile = await MediaService.pickImage( source: ImageSource.gallery); - File? file; + CroppedFile? croppedFile; if (pickedFile != null && !kIsWeb) { - file = await ImageCropper().cropImage( + croppedFile = + await ImageCropper().cropImage( sourcePath: pickedFile.path, - androidUiSettings: - const AndroidUiSettings( - toolbarTitle: 'برش تصویر'), - iosUiSettings: const IOSUiSettings( - title: 'برش تصویر', - doneButtonTitle: 'تایید', - cancelButtonTitle: 'بازگشت', - ), + uiSettings: [ + AndroidUiSettings( + toolbarTitle: 'برش تصویر'), + IOSUiSettings( + title: 'برش تصویر', + doneButtonTitle: 'تایید', + cancelButtonTitle: 'بازگشت', + ) + ], compressQuality: 30, ); } - if (file != null) { + if (croppedFile != null) { + final file = File(croppedFile.path); final fileSizeInBytes = await file.length(); if (fileSizeInBytes > @@ -242,7 +245,8 @@ class _CreateBotAssistantsPageState extends State { return; } - state.image.value = XFile(file.path); + state.image.value = + XFile(croppedFile.path); } else if (kIsWeb && pickedFile != null) { final fileSizeInBytes = await pickedFile.length(); diff --git a/lib/views/ai/widgets/ai_message_bar.dart b/lib/views/ai/widgets/ai_message_bar.dart index 67363d3..256d279 100644 --- a/lib/views/ai/widgets/ai_message_bar.dart +++ b/lib/views/ai/widgets/ai_message_bar.dart @@ -594,17 +594,18 @@ class _AiMessageBarState extends State { final pickedFile = await MediaService.pickImage( source: ImageSource.gallery); - File? file; + CroppedFile? file; if (pickedFile != null && !kIsWeb) { file = await ImageCropper().cropImage( sourcePath: pickedFile.path, - androidUiSettings: - const AndroidUiSettings(toolbarTitle: 'برش تصویر'), - iosUiSettings: const IOSUiSettings( - title: 'برش تصویر', - doneButtonTitle: 'تایید', - cancelButtonTitle: 'بازگشت', - ), + uiSettings: [ + AndroidUiSettings(toolbarTitle: 'برش تصویر'), + IOSUiSettings( + title: 'برش تصویر', + doneButtonTitle: 'تایید', + cancelButtonTitle: 'بازگشت', + ) + ], compressQuality: 30, ); diff --git a/lib/views/ai/widgets/ai_message_bar_ios.dart b/lib/views/ai/widgets/ai_message_bar_ios.dart index 797bb1f..bd7729a 100644 --- a/lib/views/ai/widgets/ai_message_bar_ios.dart +++ b/lib/views/ai/widgets/ai_message_bar_ios.dart @@ -666,17 +666,18 @@ class _AiMessageBarIOSState extends State { final pickedFile = await MediaService.pickImage( source: ImageSource.gallery); - File? file; + CroppedFile? file; if (pickedFile != null && !kIsWeb) { file = await ImageCropper().cropImage( sourcePath: pickedFile.path, - androidUiSettings: - const AndroidUiSettings(toolbarTitle: 'برش تصویر'), - iosUiSettings: const IOSUiSettings( - title: 'برش تصویر', - doneButtonTitle: 'تایید', - cancelButtonTitle: 'بازگشت', - ), + uiSettings: [ + AndroidUiSettings(toolbarTitle: 'برش تصویر'), + IOSUiSettings( + title: 'برش تصویر', + doneButtonTitle: 'تایید', + cancelButtonTitle: 'بازگشت', + ) + ], compressQuality: 30, ); diff --git a/lib/views/direct/direct_state.dart b/lib/views/direct/direct_state.dart index 6847d94..a0e0b1a 100644 --- a/lib/views/direct/direct_state.dart +++ b/lib/views/direct/direct_state.dart @@ -15,7 +15,6 @@ import 'package:flutter_sound/public/flutter_sound_player.dart'; import 'package:flutter_sound/public/flutter_sound_recorder.dart'; import 'package:flutter_sound_platform_interface/flutter_sound_platform_interface.dart'; import 'package:flutter_sound_platform_interface/flutter_sound_recorder_platform_interface.dart'; -import 'package:flutter_vibrate/flutter_vibrate.dart'; import 'package:http/http.dart' as http; import 'package:permission_handler/permission_handler.dart'; @@ -176,9 +175,6 @@ class DirectState extends CoreProvier { Future startRecording() async { text = null; // await _recorder.hasPermission(); - if (!kIsWeb) { - Vibrate.feedback(FeedbackType.medium); - } record(); notifyListeners(); diff --git a/lib/views/profile/edit_profile/widgets/profile_photo.dart b/lib/views/profile/edit_profile/widgets/profile_photo.dart index 42a22f6..fdc1455 100644 --- a/lib/views/profile/edit_profile/widgets/profile_photo.dart +++ b/lib/views/profile/edit_profile/widgets/profile_photo.dart @@ -146,12 +146,14 @@ class _ProfilePhotoState extends State { file = await ImageCropper().cropImage( sourcePath: pickedFile.path, aspectRatio: const CropAspectRatio(ratioX: 1, ratioY: 1), - androidUiSettings: const AndroidUiSettings(toolbarTitle: 'برش تصویر'), - iosUiSettings: const IOSUiSettings( - title: 'برش تصویر', - doneButtonTitle: 'تایید', - cancelButtonTitle: 'بازگشت', - ), + uiSettings: [ + AndroidUiSettings(toolbarTitle: 'برش تصویر'), + IOSUiSettings( + title: 'برش تصویر', + doneButtonTitle: 'تایید', + cancelButtonTitle: 'بازگشت', + ), + ], compressQuality: 30, ); if (file == null) return; diff --git a/lib/views/widgets/categories_list.dart b/lib/views/widgets/categories_list.dart index 4575a0b..ca6074f 100644 --- a/lib/views/widgets/categories_list.dart +++ b/lib/views/widgets/categories_list.dart @@ -120,7 +120,9 @@ class _CategoriesListState extends State { return GestureDetector( onTap: () async { if (widget.selectedCats.isNotEmpty && - widget.selectedCats.first.id == category.id) return; + widget.selectedCats.first.id == category.id) { + return; + } widget.selectedCats.clear(); if (category.id != 0) widget.selectedCats.add(category); await _scrollController.animateTo( diff --git a/lib/views/widgets/video/primary_controls.dart b/lib/views/widgets/video/primary_controls.dart index a89d6e5..7686acd 100644 --- a/lib/views/widgets/video/primary_controls.dart +++ b/lib/views/widgets/video/primary_controls.dart @@ -139,7 +139,9 @@ class _PrimaryControlsState extends State { if (position.value.inSeconds > chewieController .videoPlayerController.value.duration.inSeconds - - 1) return; + 1) { + return; + } setState(() => isAnimatingForward = true); Duration forward = Duration(seconds: position.value.inSeconds + 1); diff --git a/pubspec.lock b/pubspec.lock index df0950a..2ece142 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -438,30 +438,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.3" - flutter_local_notifications: - dependency: "direct main" - description: - name: flutter_local_notifications - sha256: c500d5d9e7e553f06b61877ca6b9c8b92c570a4c8db371038702e8ce57f8a50f - url: "https://pub.dev" - source: hosted - version: "17.2.2" - flutter_local_notifications_linux: - dependency: transitive - description: - name: flutter_local_notifications_linux - sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af - url: "https://pub.dev" - source: hosted - version: "4.0.1" - flutter_local_notifications_platform_interface: - dependency: transitive - description: - name: flutter_local_notifications_platform_interface - sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66" - url: "https://pub.dev" - source: hosted - version: "7.2.0" flutter_localizations: dependency: "direct main" description: flutter @@ -568,14 +544,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_vibrate: - dependency: "direct main" - description: - name: flutter_vibrate - sha256: "9cc9b32cf52c90dd34c1cf396ed40010b2c74e69adbb0ff16005afa900971ad8" - url: "https://pub.dev" - source: hosted - version: "1.3.0" flutter_web_plugins: dependency: transitive description: flutter @@ -641,10 +609,26 @@ packages: dependency: "direct main" description: name: image_cropper - sha256: "60542ffd03436e6f80a1d7c9839f75b6a62b0a290cd98624fa29d150fdf672c8" + sha256: "266760ed426d7121f0ada02c672bfe5c1b5c714e908328716aee756f045709dc" url: "https://pub.dev" source: hosted - version: "1.5.1" + version: "8.1.0" + image_cropper_for_web: + dependency: transitive + description: + name: image_cropper_for_web + sha256: "34256c8fb7fcb233251787c876bb37271744459b593a948a2db73caa323034d0" + url: "https://pub.dev" + source: hosted + version: "6.0.2" + image_cropper_platform_interface: + dependency: transitive + description: + name: image_cropper_platform_interface + sha256: e8e9d2ca36360387aee39295ce49029362ae4df3071f23e8e71f2b81e40b7531 + url: "https://pub.dev" + source: hosted + version: "7.0.0" image_picker: dependency: "direct main" description: @@ -1266,14 +1250,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.3" - timezone: - dependency: transitive - description: - name: timezone - sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d" - url: "https://pub.dev" - source: hosted - version: "0.9.4" toggle_switch: dependency: "direct main" description: @@ -1556,4 +1532,4 @@ packages: version: "6.5.0" sdks: dart: ">=3.5.0 <4.0.0" - flutter: ">=3.20.0-1.2.pre" + flutter: ">=3.22.0" diff --git a/pubspec.yaml b/pubspec.yaml index 043402d..842a276 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -49,7 +49,6 @@ dependencies: cached_network_image: ^3.2.0 skeleton_text: ^3.0.0 carousel_slider: ^5.0.0 - flutter_vibrate: ^1.3.0 universal_html: ^2.0.8 record: ^5.1.2 @@ -59,7 +58,7 @@ dependencies: flutter_html: ^3.0.0-alpha.2 url_launcher: ^6.0.18 audio_video_progress_bar: ^2.0.0 - image_cropper: ^1.5.0 + # image_cropper: ^1.5.0 firebase_core: ^3.1.0 firebase_messaging: ^15.0.1 webview_flutter: ^4.8.0 @@ -92,7 +91,7 @@ dependencies: mime: ^1.0.2 path: any flutter_cache_manager: any - flutter_local_notifications: ^17.2.2 + # flutter_local_notifications: ^17.2.2 flutter_background_service: ^5.0.10 # js: ^0.6.7 flutter_sound: ^9.6.0 @@ -107,6 +106,7 @@ dependencies: sentry_flutter: ^8.12.0 persian_datetime_picker: ^3.1.0 just_audio_web: ^0.4.13 + image_cropper: ^8.1.0 # fading_edge_scrollview: ^4.1.1 dev_dependencies: flutter_test: