Browse Source

保存设备信息

master
KerwinZheng 5 years ago
parent
commit
3f32ca0d6a
8 changed files with 52 additions and 7 deletions
  1. +1
    -1
      .flutter-plugins-dependencies
  2. +1
    -1
      lib/chat/group_chat_view.dart
  3. +2
    -0
      lib/data/UserData.dart
  4. +1
    -1
      lib/home/homeMain.dart
  5. +1
    -0
      lib/main.dart
  6. +30
    -0
      lib/utils/HttpUtil.dart
  7. +12
    -3
      pubspec.lock
  8. +4
    -1
      pubspec.yaml

+ 1
- 1
.flutter-plugins-dependencies View File

@@ -1 +1 @@
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"agora_rtc_engine","dependencies":[]},{"name":"amap_location","dependencies":[]},{"name":"android_intent","dependencies":[]},{"name":"app_installer","dependencies":[]},{"name":"apple_sign_in","dependencies":[]},{"name":"audioplayer","dependencies":[]},{"name":"auto_orientation","dependencies":[]},{"name":"city_pickers","dependencies":[]},{"name":"connectivity","dependencies":[]},{"name":"easy_contact_picker","dependencies":[]},{"name":"file_picker","dependencies":[]},{"name":"flutter_app_badger","dependencies":[]},{"name":"flutter_audio_recorder","dependencies":[]},{"name":"flutter_bugly","dependencies":[]},{"name":"flutter_facebook_login","dependencies":[]},{"name":"flutter_ijkplayer","dependencies":[]},{"name":"flutter_inapp_purchase","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_native_image","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_qr_reader","dependencies":["image_picker"]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"fluwx_no_pay","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":[]},{"name":"image_cropper","dependencies":[]},{"name":"image_gallery_saver","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"jpush_flutter","dependencies":[]},{"name":"keyboard_utils","dependencies":[]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"multi_image_picker","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"photo_manager","dependencies":[]},{"name":"receive_sharing_intent","dependencies":[]},{"name":"share","dependencies":[]},{"name":"share_extend","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":[]},{"name":"video_player","dependencies":[]},{"name":"video_thumbnail","dependencies":[]},{"name":"wifi_info_plugin","dependencies":[]}]}
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"agora_rtc_engine","dependencies":[]},{"name":"amap_location","dependencies":[]},{"name":"android_intent","dependencies":[]},{"name":"app_installer","dependencies":[]},{"name":"apple_sign_in","dependencies":[]},{"name":"audioplayer","dependencies":[]},{"name":"auto_orientation","dependencies":[]},{"name":"city_pickers","dependencies":[]},{"name":"connectivity","dependencies":[]},{"name":"device_info","dependencies":[]},{"name":"easy_contact_picker","dependencies":[]},{"name":"file_picker","dependencies":[]},{"name":"flutter_app_badger","dependencies":[]},{"name":"flutter_audio_recorder","dependencies":[]},{"name":"flutter_bugly","dependencies":[]},{"name":"flutter_facebook_login","dependencies":[]},{"name":"flutter_ijkplayer","dependencies":[]},{"name":"flutter_inapp_purchase","dependencies":[]},{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_native_image","dependencies":[]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"flutter_qr_reader","dependencies":["image_picker"]},{"name":"flutter_webview_plugin","dependencies":[]},{"name":"fluwx_no_pay","dependencies":[]},{"name":"geolocator","dependencies":["google_api_availability","location_permissions"]},{"name":"google_api_availability","dependencies":[]},{"name":"google_maps_flutter","dependencies":[]},{"name":"image_cropper","dependencies":[]},{"name":"image_gallery_saver","dependencies":[]},{"name":"image_picker","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"jpush_flutter","dependencies":[]},{"name":"keyboard_utils","dependencies":[]},{"name":"location","dependencies":[]},{"name":"location_permissions","dependencies":[]},{"name":"multi_image_picker","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"package_info","dependencies":[]},{"name":"path_provider","dependencies":[]},{"name":"permission_handler","dependencies":[]},{"name":"photo_manager","dependencies":[]},{"name":"receive_sharing_intent","dependencies":[]},{"name":"share","dependencies":[]},{"name":"share_extend","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_macos","shared_preferences_web"]},{"name":"shared_preferences_macos","dependencies":[]},{"name":"shared_preferences_web","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":[]},{"name":"video_player","dependencies":[]},{"name":"video_thumbnail","dependencies":[]},{"name":"wifi_info_plugin","dependencies":[]}]}

+ 1
- 1
lib/chat/group_chat_view.dart View File

@@ -495,7 +495,7 @@ class _GroupChatPageState extends State<GroupChatPage> {
itemPositionsListener: itemPositionListener,
padding: EdgeInsets.all(8.0),
reverse: true,
// hitCallback: hideKeyBoard,
hitCallback: hideKeyBoard,
)),
);
}


+ 2
- 0
lib/data/UserData.dart View File

@@ -64,6 +64,8 @@ class UserData {
int homemainIndex = 0;
String currentCity = '';
String deviceLanguageCode;
Map<String, dynamic> toJson() {
Map<String, dynamic> json = new Map<String, dynamic>();
json['language'] = language;


+ 1
- 1
lib/home/homeMain.dart View File

@@ -174,7 +174,7 @@ class _HomeMainState extends State<HomeMain> {
postContact(null);
postLoaction();
locationSchedule();
HttpUtil().saveMobileInfo();
WidgetsBinding.instance.addPostFrameCallback((_) {
VersionUtils.versionUpdate(context);
ReceiveShareFile.start();


+ 1
- 0
lib/main.dart View File

@@ -405,6 +405,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
final String lang =
deviceLocale != null ? deviceLocale.toString() : "";
print('#### fl: $lang');
UserData().deviceLanguageCode = deviceLocale.toString();
//设置设备语言
if (language.containsKey(deviceLocale.toString()))
UserData().deviceLanguage =


+ 30
- 0
lib/utils/HttpUtil.dart View File

@@ -24,6 +24,7 @@ import 'package:chat/utils/local_notification_util.dart';
import 'package:chat/utils/sp_utils.dart';
import 'package:chat/utils/sql_util.dart';
import 'package:chat/utils/user_info_table.dart';
import 'package:device_info/device_info.dart';
import 'dart:core';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
@@ -1417,4 +1418,33 @@ class HttpUtil {
FriendListMgr().checkFromServer(resData['data']);
}
}
//保存设备名称和编码
saveMobileInfo() async {
String mobileType = '';
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (Platform.isAndroid) {
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
mobileType = androidInfo.model;
print('Running on ${androidInfo.model}'); // e.g. "Moto G (4)"
} else if (Platform.isIOS) {
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
mobileType = iosInfo.utsname.machine;
}
Map data = {
"userId": UserData().basicInfo.userId,
};
data['sign'] = TokenMgr().getSign(data);
data['model'] = mobileType;
data['coding'] = UserData().deviceLanguageCode;
Response res =
await HttpUtil().post('user/save/modelAndCoding', data: data);
Map resData = res.data;
print(resData);
}
}

+ 12
- 3
pubspec.lock View File

@@ -259,6 +259,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.9"
device_info:
dependency: "direct main"
description:
name: device_info
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.2+1"
dio:
dependency: "direct main"
description:
@@ -919,9 +926,11 @@ packages:
scrollable_positioned_list:
dependency: "direct main"
description:
name: scrollable_positioned_list
url: "https://pub.flutter-io.cn"
source: hosted
path: "."
ref: HEAD
resolved-ref: "6ac696b0550694de0eac3f4c30956e21a6dad748"
url: "https://github.com/KerwinZheng/scrollable_positioned_list.git"
source: git
version: "0.1.2"
share:
dependency: "direct main"


+ 4
- 1
pubspec.yaml View File

@@ -177,7 +177,10 @@ dependencies:
share_extend: ^1.1.1
#多图片选择
multi_image_picker: ^4.6.4
scrollable_positioned_list: ^0.1.2
scrollable_positioned_list:
git: https://github.com/KerwinZheng/scrollable_positioned_list.git
#设备信息
device_info: ^0.4.2+1

dev_dependencies:
flutter_test:


Loading…
Cancel
Save