Browse Source

[fix]修改意见反馈界面bug和添加ios通知配置

Destiny 1 year ago
parent
commit
6d8194b8d3

+ 242 - 0
Podfile.lock

@@ -0,0 +1,242 @@
+PODS:
+  - app_links (0.0.2):
+    - Flutter
+  - app_tracking_transparency (0.0.1):
+    - Flutter
+  - audio_session (0.0.1):
+    - Flutter
+  - connectivity_plus (0.0.1):
+    - Flutter
+    - FlutterMacOS
+  - device_info_plus (0.0.1):
+    - Flutter
+  - DKImagePickerController/Core (4.3.9):
+    - DKImagePickerController/ImageDataManager
+    - DKImagePickerController/Resource
+  - DKImagePickerController/ImageDataManager (4.3.9)
+  - DKImagePickerController/PhotoGallery (4.3.9):
+    - DKImagePickerController/Core
+    - DKPhotoGallery
+  - DKImagePickerController/Resource (4.3.9)
+  - DKPhotoGallery (0.0.19):
+    - DKPhotoGallery/Core (= 0.0.19)
+    - DKPhotoGallery/Model (= 0.0.19)
+    - DKPhotoGallery/Preview (= 0.0.19)
+    - DKPhotoGallery/Resource (= 0.0.19)
+    - SDWebImage
+    - SwiftyGif
+  - DKPhotoGallery/Core (0.0.19):
+    - DKPhotoGallery/Model
+    - DKPhotoGallery/Preview
+    - SDWebImage
+    - SwiftyGif
+  - DKPhotoGallery/Model (0.0.19):
+    - SDWebImage
+    - SwiftyGif
+  - DKPhotoGallery/Preview (0.0.19):
+    - DKPhotoGallery/Model
+    - DKPhotoGallery/Resource
+    - SDWebImage
+    - SwiftyGif
+  - DKPhotoGallery/Resource (0.0.19):
+    - SDWebImage
+    - SwiftyGif
+  - file_picker (0.0.1):
+    - DKImagePickerController/PhotoGallery
+    - Flutter
+  - Flutter (1.0.0)
+  - flutter_foreground_task (0.0.1):
+    - Flutter
+  - flutter_umeng (0.0.1):
+    - Flutter
+  - gravity_engine (0.0.1):
+    - Flutter
+  - in_app_purchase_storekit (0.0.1):
+    - Flutter
+    - FlutterMacOS
+  - just_audio (0.0.1):
+    - Flutter
+  - MMKV (1.3.9):
+    - MMKVCore (~> 1.3.9)
+  - mmkv_ios (1.0.3):
+    - Flutter
+    - MMKV (< 2.0, >= 1.3.9)
+  - MMKVCore (1.3.9)
+  - package_info_plus (0.4.5):
+    - Flutter
+  - path_provider_foundation (0.0.1):
+    - Flutter
+    - FlutterMacOS
+  - photo_manager (2.0.0):
+    - Flutter
+    - FlutterMacOS
+  - record_darwin (1.0.0):
+    - Flutter
+    - FlutterMacOS
+  - SDWebImage (5.19.0):
+    - SDWebImage/Core (= 5.19.0)
+  - SDWebImage/Core (5.19.0)
+  - share_plus (0.0.1):
+    - Flutter
+  - shared_preferences_foundation (0.0.1):
+    - Flutter
+    - FlutterMacOS
+  - shortcut (0.0.1):
+    - Flutter
+  - sqflite_darwin (0.0.4):
+    - Flutter
+    - FlutterMacOS
+  - SwiftyGif (5.4.5)
+  - system_share (0.0.1):
+    - Flutter
+  - url_launcher_ios (0.0.1):
+    - Flutter
+  - video_player_avfoundation (0.0.1):
+    - Flutter
+    - FlutterMacOS
+  - wakelock_plus (0.0.1):
+    - Flutter
+  - webview_flutter_wkwebview (0.0.1):
+    - Flutter
+    - FlutterMacOS
+  - wechat_kit (6.0.1):
+    - Flutter
+    - wechat_kit/no_pay (= 6.0.1)
+    - wechat_kit/vendor (= 6.0.1)
+  - wechat_kit/no_pay (6.0.1):
+    - Flutter
+  - wechat_kit/vendor (6.0.1):
+    - Flutter
+
+DEPENDENCIES:
+  - app_links (from `.symlinks/plugins/app_links/ios`)
+  - app_tracking_transparency (from `.symlinks/plugins/app_tracking_transparency/ios`)
+  - audio_session (from `.symlinks/plugins/audio_session/ios`)
+  - connectivity_plus (from `.symlinks/plugins/connectivity_plus/darwin`)
+  - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
+  - file_picker (from `.symlinks/plugins/file_picker/ios`)
+  - Flutter (from `Flutter`)
+  - flutter_foreground_task (from `.symlinks/plugins/flutter_foreground_task/ios`)
+  - flutter_umeng (from `.symlinks/plugins/flutter_umeng/ios`)
+  - gravity_engine (from `.symlinks/plugins/gravity_engine/ios`)
+  - in_app_purchase_storekit (from `.symlinks/plugins/in_app_purchase_storekit/darwin`)
+  - just_audio (from `.symlinks/plugins/just_audio/ios`)
+  - mmkv_ios (from `.symlinks/plugins/mmkv_ios/ios`)
+  - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
+  - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
+  - photo_manager (from `.symlinks/plugins/photo_manager/ios`)
+  - record_darwin (from `.symlinks/plugins/record_darwin/ios`)
+  - share_plus (from `.symlinks/plugins/share_plus/ios`)
+  - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
+  - shortcut (from `.symlinks/plugins/shortcut/ios`)
+  - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
+  - system_share (from `.symlinks/plugins/system_share/ios`)
+  - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
+  - video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
+  - wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
+  - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)
+  - wechat_kit (from `.symlinks/plugins/wechat_kit/ios`)
+
+SPEC REPOS:
+  trunk:
+    - DKImagePickerController
+    - DKPhotoGallery
+    - MMKV
+    - MMKVCore
+    - SDWebImage
+    - SwiftyGif
+
+EXTERNAL SOURCES:
+  app_links:
+    :path: ".symlinks/plugins/app_links/ios"
+  app_tracking_transparency:
+    :path: ".symlinks/plugins/app_tracking_transparency/ios"
+  audio_session:
+    :path: ".symlinks/plugins/audio_session/ios"
+  connectivity_plus:
+    :path: ".symlinks/plugins/connectivity_plus/darwin"
+  device_info_plus:
+    :path: ".symlinks/plugins/device_info_plus/ios"
+  file_picker:
+    :path: ".symlinks/plugins/file_picker/ios"
+  Flutter:
+    :path: Flutter
+  flutter_foreground_task:
+    :path: ".symlinks/plugins/flutter_foreground_task/ios"
+  flutter_umeng:
+    :path: ".symlinks/plugins/flutter_umeng/ios"
+  gravity_engine:
+    :path: ".symlinks/plugins/gravity_engine/ios"
+  in_app_purchase_storekit:
+    :path: ".symlinks/plugins/in_app_purchase_storekit/darwin"
+  just_audio:
+    :path: ".symlinks/plugins/just_audio/ios"
+  mmkv_ios:
+    :path: ".symlinks/plugins/mmkv_ios/ios"
+  package_info_plus:
+    :path: ".symlinks/plugins/package_info_plus/ios"
+  path_provider_foundation:
+    :path: ".symlinks/plugins/path_provider_foundation/darwin"
+  photo_manager:
+    :path: ".symlinks/plugins/photo_manager/ios"
+  record_darwin:
+    :path: ".symlinks/plugins/record_darwin/ios"
+  share_plus:
+    :path: ".symlinks/plugins/share_plus/ios"
+  shared_preferences_foundation:
+    :path: ".symlinks/plugins/shared_preferences_foundation/darwin"
+  shortcut:
+    :path: ".symlinks/plugins/shortcut/ios"
+  sqflite_darwin:
+    :path: ".symlinks/plugins/sqflite_darwin/darwin"
+  system_share:
+    :path: ".symlinks/plugins/system_share/ios"
+  url_launcher_ios:
+    :path: ".symlinks/plugins/url_launcher_ios/ios"
+  video_player_avfoundation:
+    :path: ".symlinks/plugins/video_player_avfoundation/darwin"
+  wakelock_plus:
+    :path: ".symlinks/plugins/wakelock_plus/ios"
+  webview_flutter_wkwebview:
+    :path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"
+  wechat_kit:
+    :path: ".symlinks/plugins/wechat_kit/ios"
+
+SPEC CHECKSUMS:
+  app_links: e7a6750a915a9e161c58d91bc610e8cd1d4d0ad0
+  app_tracking_transparency: e169b653478da7bb15a6c61209015378ca73e375
+  audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
+  connectivity_plus: 4c41c08fc6d7c91f63bc7aec70ffe3730b04f563
+  device_info_plus: 97af1d7e84681a90d0693e63169a5d50e0839a0d
+  DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c
+  DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60
+  file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
+  Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
+  flutter_foreground_task: 21ef182ab0a29a3005cc72cd70e5f45cb7f7f817
+  flutter_umeng: 9005e3f776ff69868f0d75fbb2f11b33fbafc850
+  gravity_engine: 750c5f2424a042f334f1154ece41d916eb148d6a
+  in_app_purchase_storekit: 8c3b0b3eb1b0f04efbff401c3de6266d4258d433
+  just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
+  MMKV: 817ba1eea17421547e01e087285606eb270a8dcb
+  mmkv_ios: 51a53dffa3e2bb8b743762514c754666abab2a6c
+  MMKVCore: af055b00e27d88cd92fad301c5fecd1ff9b26dd9
+  package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
+  path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
+  photo_manager: ff695c7a1dd5bc379974953a2b5c0a293f7c4c8a
+  record_darwin: df0a677188e5fed18472550298e675f19ddaffbe
+  SDWebImage: 981fd7e860af070920f249fd092420006014c3eb
+  share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
+  shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
+  shortcut: 4fb7f85e55054fc349f3adc91dc852871ebc28b9
+  sqflite_darwin: a553b1fd6fe66f53bbb0fe5b4f5bab93f08d7a13
+  SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
+  system_share: 0ad7003e9f9086fe8a82339214ce240a9250f9c2
+  url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
+  video_player_avfoundation: 7c6c11d8470e1675df7397027218274b6d2360b3
+  wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
+  webview_flutter_wkwebview: 0982481e3d9c78fd5c6f62a002fcd24fc791f1e4
+  wechat_kit: 2ae8a941c74332323910c34baac8a69549aa4a3f
+
+PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5
+
+COCOAPODS: 1.15.2

+ 18 - 12
ios/Podfile.lock

@@ -47,6 +47,8 @@ PODS:
   - Flutter (1.0.0)
   - flutter_foreground_task (0.0.1):
     - Flutter
+  - flutter_local_notifications (0.0.1):
+    - Flutter
   - flutter_umeng (0.0.1):
     - Flutter
   - gravity_engine (0.0.1):
@@ -56,12 +58,12 @@ PODS:
     - FlutterMacOS
   - just_audio (0.0.1):
     - Flutter
-  - MMKV (1.3.9):
-    - MMKVCore (~> 1.3.9)
-  - mmkv_ios (1.0.3):
+  - MMKV (2.0.0):
+    - MMKVCore (~> 2.0.0)
+  - mmkv_ios (1.0.7):
     - Flutter
-    - MMKV (< 2.0, >= 1.3.9)
-  - MMKVCore (1.3.9)
+    - MMKV (< 2.1, >= 2.0.0)
+  - MMKVCore (2.0.0)
   - package_info_plus (0.4.5):
     - Flutter
   - path_provider_foundation (0.0.1):
@@ -73,9 +75,9 @@ PODS:
   - record_darwin (1.0.0):
     - Flutter
     - FlutterMacOS
-  - SDWebImage (5.19.0):
-    - SDWebImage/Core (= 5.19.0)
-  - SDWebImage/Core (5.19.0)
+  - SDWebImage (5.19.7):
+    - SDWebImage/Core (= 5.19.7)
+  - SDWebImage/Core (5.19.7)
   - share_plus (0.0.1):
     - Flutter
   - shared_preferences_foundation (0.0.1):
@@ -117,6 +119,7 @@ DEPENDENCIES:
   - file_picker (from `.symlinks/plugins/file_picker/ios`)
   - Flutter (from `Flutter`)
   - flutter_foreground_task (from `.symlinks/plugins/flutter_foreground_task/ios`)
+  - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
   - flutter_umeng (from `.symlinks/plugins/flutter_umeng/ios`)
   - gravity_engine (from `.symlinks/plugins/gravity_engine/ios`)
   - in_app_purchase_storekit (from `.symlinks/plugins/in_app_purchase_storekit/darwin`)
@@ -163,6 +166,8 @@ EXTERNAL SOURCES:
     :path: Flutter
   flutter_foreground_task:
     :path: ".symlinks/plugins/flutter_foreground_task/ios"
+  flutter_local_notifications:
+    :path: ".symlinks/plugins/flutter_local_notifications/ios"
   flutter_umeng:
     :path: ".symlinks/plugins/flutter_umeng/ios"
   gravity_engine:
@@ -213,18 +218,19 @@ SPEC CHECKSUMS:
   file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
   Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
   flutter_foreground_task: 21ef182ab0a29a3005cc72cd70e5f45cb7f7f817
+  flutter_local_notifications: 4cde75091f6327eb8517fa068a0a5950212d2086
   flutter_umeng: 9005e3f776ff69868f0d75fbb2f11b33fbafc850
   gravity_engine: 750c5f2424a042f334f1154ece41d916eb148d6a
   in_app_purchase_storekit: 8c3b0b3eb1b0f04efbff401c3de6266d4258d433
   just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
-  MMKV: 817ba1eea17421547e01e087285606eb270a8dcb
-  mmkv_ios: 51a53dffa3e2bb8b743762514c754666abab2a6c
-  MMKVCore: af055b00e27d88cd92fad301c5fecd1ff9b26dd9
+  MMKV: f7d1d5945c8765f97f39c3d121f353d46735d801
+  mmkv_ios: 9f1eb285b3188b2d9d02bb850201a521b4b75db8
+  MMKVCore: c04b296010fcb1d1638f2c69405096aac12f6390
   package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
   path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
   photo_manager: ff695c7a1dd5bc379974953a2b5c0a293f7c4c8a
   record_darwin: df0a677188e5fed18472550298e675f19ddaffbe
-  SDWebImage: 981fd7e860af070920f249fd092420006014c3eb
+  SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3
   share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
   shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
   shortcut: 4fb7f85e55054fc349f3adc91dc852871ebc28b9

+ 1 - 1
ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

@@ -51,7 +51,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "Release"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 14 - 3
ios/Runner/AppDelegate.swift

@@ -1,5 +1,6 @@
 import Flutter
 import UIKit
+import flutter_local_notifications
 
 @main
 @objc class AppDelegate: FlutterAppDelegate {
@@ -7,15 +8,25 @@ import UIKit
     _ application: UIApplication,
     didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
   ) -> Bool {
+      
+    FlutterLocalNotificationsPlugin.setPluginRegistrantCallback { (registry) in
+        GeneratedPluginRegistrant.register(with: registry)
+    }
+      
+    if #available(iOS 10.0, *) {
+        UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
+    }
+      
     GeneratedPluginRegistrant.register(with: self)
 
     SwiftFlutterForegroundTaskPlugin.setPluginRegistrantCallback(registerPlugins)
-    if #available(iOS 10.0, *) {
-      UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
-    }
 
     return super.application(application, didFinishLaunchingWithOptions: launchOptions)
   }
+    
+    override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
+        super.application(application, didReceiveRemoteNotification: userInfo, fetchCompletionHandler: completionHandler)
+    }
 }
 
 func registerPlugins(registry: FlutterPluginRegistry) {

+ 1 - 0
lib/main.dart

@@ -12,6 +12,7 @@ import 'package:electronic_assistant/utils/app_info_util.dart';
 import 'package:electronic_assistant/device/device_info_util.dart';
 import 'package:electronic_assistant/utils/desktop_shortcut_utils.dart';
 import 'package:electronic_assistant/utils/mmkv_util.dart';
+import 'package:electronic_assistant/utils/notification_util.dart';
 import 'package:electronic_assistant/utils/toast_util.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter_foreground_task/flutter_foreground_task.dart';

+ 9 - 0
lib/module/main/drawer/complaint/controller.dart

@@ -20,6 +20,15 @@ class ComplaintOpinionController extends BaseController {
   }
 
   void requestSubmit() {
+    if (content.value.isEmpty) {
+      if (title.value == "投诉举报") {
+        ToastUtil.showToast("请输入投诉内容后重试");
+      } else {
+        ToastUtil.showToast("请输入意见建议后重试");
+      }
+      return;
+    }
+
     var type = 1;
     if (title.value == "投诉举报") {
       type = 2;

+ 22 - 18
lib/module/main/drawer/complaint/view.dart

@@ -78,25 +78,29 @@ class ComplaintOpinionPage extends BasePage<ComplaintOpinionController> {
                 borderRadius: BorderRadius.circular(8),
               ),
               height: 260.h,
-              child: TextField(
-                maxLength: 200,
-                maxLines: null,
-                cursorColor: ColorName.colorPrimary,
-                style: TextStyle(
-                    fontSize: 15.sp, color: ColorName.primaryTextColor),
-                decoration: InputDecoration(
-                  counterText: '',
-                  border: InputBorder.none,
-                  fillColor: Colors.transparent,
-                  hintText: "请输入您的投诉内容",
-                  hintStyle: TextStyle(
-                      fontSize: 15.sp, color: ColorName.tertiaryTextColor),
-                  contentPadding: const EdgeInsets.all(12).w,
+              child: Obx(
+                () => TextField(
+                  maxLength: 200,
+                  maxLines: null,
+                  cursorColor: ColorName.colorPrimary,
+                  style: TextStyle(
+                      fontSize: 15.sp, color: ColorName.primaryTextColor),
+                  decoration: InputDecoration(
+                    counterText: '',
+                    border: InputBorder.none,
+                    fillColor: Colors.transparent,
+                    hintText: controller.title.value == "投诉举报"
+                        ? "请输入您的投诉内容"
+                        : "请输入您的意见建议",
+                    hintStyle: TextStyle(
+                        fontSize: 15.sp, color: ColorName.tertiaryTextColor),
+                    contentPadding: const EdgeInsets.all(12).w,
+                  ),
+                  onChanged: (value) {
+                    controller.numCount.value = value.length;
+                    controller.content.value = value;
+                  },
                 ),
-                onChanged: (value) {
-                  controller.numCount.value = value.length;
-                  controller.content.value = value;
-                },
               ),
             ),
             SizedBox(

+ 14 - 9
lib/utils/notification_util.dart

@@ -35,12 +35,16 @@ class NotificationUtil {
         AndroidInitializationSettings('@mipmap/ic_launcher');
 
     DarwinInitializationSettings initializationSettingsIOS =
-        DarwinInitializationSettings(onDidReceiveLocalNotification:
-            (int id, String? title, String? body, String? payload) async {
-      if (payload != null) {
-        TalkPage.startById(payload);
-      }
-    });
+        DarwinInitializationSettings(
+            requestSoundPermission: true,
+            requestBadgePermission: true,
+            requestAlertPermission: true,
+            onDidReceiveLocalNotification:
+                (int id, String? title, String? body, String? payload) async {
+              if (payload != null) {
+                TalkPage.startById(payload);
+              }
+            });
 
     InitializationSettings initializationSettings = InitializationSettings(
       android: initializationSettingsAndroid,
@@ -65,11 +69,12 @@ class NotificationUtil {
       priority: Priority.high,
     );
 
+    // ios的通知
+    const String darwinNotificationCategoryPlain = 'plainCategory';
     const DarwinNotificationDetails iOSPlatformChannelSpecifics =
         DarwinNotificationDetails(
-            //TODO
-
-            );
+      categoryIdentifier: darwinNotificationCategoryPlain,
+    );
     const NotificationDetails platformChannelSpecifics = NotificationDetails(
         android: androidPlatformChannelSpecifics,
         iOS: iOSPlatformChannelSpecifics);