Quellcode durchsuchen

一次性删除@,红包照片相关限制

master
KerwinZheng vor 5 Jahren
Ursprung
Commit
4fd7db2b4b
13 geänderte Dateien mit 161 neuen und 51 gelöschten Zeilen
  1. +2
    -1
      i18n/en-US.json
  2. +2
    -1
      i18n/ja-JP.json
  3. +2
    -1
      i18n/ko-KR.json
  4. +2
    -1
      i18n/vi-VN.json
  5. +13
    -12
      i18n/zh-CN.json
  6. +2
    -1
      i18n/zh-HK.json
  7. +1
    -1
      lib/chat/group_chat_view.dart
  8. +85
    -29
      lib/chat/input_bar.dart
  9. +17
    -0
      lib/generated/i18n.dart
  10. +21
    -3
      lib/home/ProfilePage.dart
  11. +6
    -0
      lib/home/money_picture_view.dart
  12. +1
    -1
      lib/utils/HttpUtil.dart
  13. +7
    -0
      lib/utils/PicSwiper.dart

+ 2
- 1
i18n/en-US.json Datei anzeigen

@@ -1240,5 +1240,6 @@
"travel_start": "起点",
"travel_end": "终点",
"translation_butler_order_time_out": "翻译订单超时已被取消",
"shock_notice": "震动通知"
"shock_notice": "震动通知",
"max_upload_size": "最多上传/s1张"
}

+ 2
- 1
i18n/ja-JP.json Datei anzeigen

@@ -1239,5 +1239,6 @@
"travel_start": "起点",
"travel_end": "终点",
"translation_butler_order_time_out": "翻译订单超时已被取消",
"shock_notice": "震动通知"
"shock_notice": "震动通知",
"max_upload_size": "最多上传/s1张"
}

+ 2
- 1
i18n/ko-KR.json Datei anzeigen

@@ -1240,5 +1240,6 @@
"travel_start": "起点",
"travel_end": "终点",
"translation_butler_order_time_out": "翻译订单超时已被取消",
"shock_notice": "震动通知"
"shock_notice": "震动通知",
"max_upload_size": "最多上传/s1张"
}

+ 2
- 1
i18n/vi-VN.json Datei anzeigen

@@ -1239,5 +1239,6 @@
"travel_start": "起点",
"travel_end": "终点",
"translation_butler_order_time_out": "翻译订单超时已被取消",
"shock_notice": "震动通知"
"shock_notice": "震动通知",
"max_upload_size": "最多上传/s1张"
}

+ 13
- 12
i18n/zh-CN.json Datei anzeigen

@@ -1082,7 +1082,7 @@
"undefine_name": "未命名",
"group_qr_code": "群二维码名片",
"group_qr_code_tips": "该二维码7天内(/s1月/s2日前)有效,重新进入将更新",
"Goddess_heat": "女神热度",
"Goddess_heat": "女神热度",
"Goddess_heat_tips": "累计收获的礼物",
"new_friends": "新朋友",
"before_three_day": "三天前",
@@ -1162,7 +1162,7 @@
"confrim_recovery": "确定恢复已被焚毁的照片吗?\n(已经看过的用户可以再看一次)",
"send_to": "发送到",
"search_plach": "搜索位置",
"finding_place": "查找位置",
"finding_place": "查找位置",
"real_time_helper": "实时帮",
"translation_butler": "翻译管家",
"travel_butler": "出行管家",
@@ -1218,15 +1218,15 @@
"translation_more_desc": "更多描述",
"file": "文件",
"max_file": "文件大于/s1M",
"feedback_assistant":"反馈小助手",
"feedback_tips":"有什么问题都可以反馈给我哦",
"man_retranslate":"人工重译",
"robot_retranslate":"机器重译",
"see_original":"查看原文",
"forward":"转发",
"copy_download_url":"复制下载地址",
"total_friends_nus":"共/s1位朋友",
"hava_error_photo":"有图片违规",
"feedback_assistant": "反馈小助手",
"feedback_tips": "有什么问题都可以反馈给我哦",
"man_retranslate": "人工重译",
"robot_retranslate": "机器重译",
"see_original": "查看原文",
"forward": "转发",
"copy_download_url": "复制下载地址",
"total_friends_nus": "共/s1位朋友",
"hava_error_photo": "有图片违规",
"translation_butler_evaluation_tips2": "翻译服务已结束,辛苦你了。请保持在线,留意新订单通知",
"translation_butler_push_order_time": "时间:今天/s1 时长:",
"translation_butler_push_order_time2": "下单时间:今天/s1 等待时长:",
@@ -1240,5 +1240,6 @@
"travel_start": "起点",
"travel_end": "终点",
"translation_butler_order_time_out": "翻译订单超时已被取消",
"shock_notice":"震动通知"
"shock_notice": "震动通知",
"max_upload_size": "最多上傳/s1張"
}

+ 2
- 1
i18n/zh-HK.json Datei anzeigen

@@ -1239,5 +1239,6 @@
"travel_start": "起点",
"travel_end": "终点",
"translation_butler_order_time_out": "翻译订单超时已被取消",
"shock_notice": "震動通知"
"shock_notice": "震動通知",
"max_upload_size": "最多上传/s1张"
}

+ 1
- 1
lib/chat/group_chat_view.dart Datei anzeigen

@@ -118,7 +118,7 @@ class _GroupChatPageState extends State<GroupChatPage> {
isGroup: true);
msgList = ChatDataMgr().getGroupRecord();
if (unreadNums >= 10) {
if (unreadNums >= 10 && unreadNums <= msgList.length) {
unreadTime = msgList[unreadNums - 1].time;
}
for (int i = 0; i < msgList.length; i++) {


+ 85
- 29
lib/chat/input_bar.dart Datei anzeigen

@@ -33,9 +33,9 @@ import 'emoji_gif_text.dart';
import 'emoji_text.dart';
class AlterPostion {
int start;
int length;
AlterPostion(this.start, this.length);
int startIndex;
int endIndex;
AlterPostion(this.startIndex, this.endIndex);
}
class InputBar extends StatefulWidget {
@@ -70,6 +70,7 @@ class InputBarState extends State<InputBar>
int lastTxtLen = 0;
List<AlterPostion> alterPosition = [];
String originalInputStr = '';
@override
void initState() {
@@ -78,7 +79,28 @@ class InputBarState extends State<InputBar>
pageController = new PageController();
getKeyboardHeight();
_bloc.start();
_textCtrl.addListener(() {
if (alterPosition.length > 0) {
int offset = -1;
int currentIndex = _textCtrl.selection.baseOffset;
for (int i = 0; i < alterPosition.length; i++) {
var postion = alterPosition[i];
if (currentIndex >= postion.startIndex &&
currentIndex <= postion.endIndex) {
int middle = (postion.startIndex + postion.endIndex) ~/ 2;
offset =
currentIndex >= middle ? postion.endIndex : postion.startIndex;
break;
}
}
if (offset != -1) {
_textCtrl.value = TextEditingValue(
text: _textCtrl.text,
selection:
TextSelection.fromPosition(TextPosition(offset: offset)));
}
}
});
//处理引用事件
MessageMgr().on('Reply Select Message', replySelectMsg);
@@ -133,17 +155,22 @@ class InputBarState extends State<InputBar>
print('选中的成员~~~~~~~~~~~~ ${memberInfo.refName}');
String textStr;
String alterStr = '@${memberInfo.refName} ';
if (_textCtrl.text.length > 0) {
textStr = '${_textCtrl.text} @${memberInfo.refName} ';
textStr += _textCtrl.text + alterStr;
} else {
textStr = '@${memberInfo.refName} ';
textStr = alterStr;
}
alterPosition.add(AlterPostion(
_textCtrl.text.length, _textCtrl.text.length + alterStr.length));
_textCtrl.value = TextEditingValue(
text: textStr,
selection:
TextSelection.fromPosition(TextPosition(offset: textStr.length)));
originalInputStr = _textCtrl.text;
setState(() {
showKeyBoard();
_isComposingMessage = _textCtrl.text.length > 0;
@@ -160,6 +187,31 @@ class InputBarState extends State<InputBar>
// SystemChannels.textInput.invokeMethod('TextInput.show');
}
quickDeleteAlterName(String str) {
var result = str;
int starIndex = 0;
if (str.length < originalInputStr.length) {
int currentIndex = _textCtrl.selection.baseOffset;
for (int i = 0; i < alterPosition.length; i++) {
var postion = alterPosition[i];
if (currentIndex >= postion.startIndex &&
currentIndex <= postion.endIndex) {
result = originalInputStr.replaceRange(
postion.startIndex, postion.endIndex, '');
starIndex = postion.startIndex;
alterPosition.removeAt(i);
break;
}
}
}
if (str != result) {
_textCtrl.value = TextEditingValue(
text: result,
selection:
TextSelection.fromPosition(TextPosition(offset: starIndex)));
}
}
_getRefShortText() {
if (refMsg == null) {
return null;
@@ -248,16 +300,20 @@ class InputBarState extends State<InputBar>
// textSelectionControls: ExtendedMaterialTextSelectionControls(),
keyboardAppearance: Brightness.light,
onChanged: (String messageText) {
quickDeleteAlterName(messageText);
if (_textCtrl.text.length > 0) {
var last = messageText.substring(_textCtrl.text.length - 1);
if (last == '@' && _textCtrl.text.length > lastTxtLen) {
editFocus.unfocus();
_openAlterSelectPage();
bool isGroup = Provider.of<bool>(context);
if (isGroup) {
editFocus.unfocus();
_openAlterSelectPage();
}
}
}
lastTxtLen = _textCtrl.text.length;
originalInputStr = _textCtrl.text;
setState(() {
_isComposingMessage = _textCtrl.text.length > 0;
});
@@ -645,28 +701,28 @@ class InputBarState extends State<InputBar>
}
void _openAlterSelectPage() async {
bool isGroup = Provider.of<bool>(context);
if (isGroup) {
GroupInfoModel groupInfoModel = Provider.of<GroupInfoModel>(context);
editFocus.unfocus();
Provider.of<KeyboardIndexProvider>(context, listen: false)
.changeReadOnlyKey(true);
GroupMemberModel member =
await AlterSelectPage.pickAlterUser(context, groupInfoModel);
GroupInfoModel groupInfoModel = Provider.of<GroupInfoModel>(context);
if (member != null) {
print('选中的成员~~~~~~~~~~~~ ${member.refName}');
_textCtrl.text = '${_textCtrl.text}${member.refName} ';
alterMemberList.add(member);
}
editFocus.requestFocus();
Provider.of<KeyboardIndexProvider>(context, listen: false)
.changeReadOnlyKey(false);
editFocus.unfocus();
Provider.of<KeyboardIndexProvider>(context, listen: false)
.changeReadOnlyKey(true);
GroupMemberModel member =
await AlterSelectPage.pickAlterUser(context, groupInfoModel);
if (member != null) {
print('选中的成员~~~~~~~~~~~~ ${member.refName}');
alterPosition.add(AlterPostion(_textCtrl.text.length - 1,
_textCtrl.text.length + member.refName.length + 1));
_textCtrl.text += '${member.refName} ';
originalInputStr = _textCtrl.text;
alterMemberList.add(member);
}
editFocus.requestFocus();
_textCtrl.text;
Provider.of<KeyboardIndexProvider>(context, listen: false)
.changeReadOnlyKey(false);
}
List<int> getAlterUsers(String messageText) {


+ 17
- 0
lib/generated/i18n.dart Datei anzeigen

@@ -2517,6 +2517,8 @@ class I18n implements WidgetsLocalizations {
String get translation_butler_order_time_out => "翻译订单超时已被取消";
/// "震动通知"
String get shock_notice => "震动通知";
/// "最多上传/s1张"
String get max_upload_size => "最多上传/s1张";
}

class _I18n_en_US extends I18n {
@@ -6252,6 +6254,9 @@ class _I18n_vi_VN extends I18n {
/// "震动通知"
@override
String get shock_notice => "震动通知";
/// "最多上传/s1张"
@override
String get max_upload_size => "最多上传/s1张";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -9983,6 +9988,9 @@ class _I18n_zh_HK extends I18n {
/// "震動通知"
@override
String get shock_notice => "震動通知";
/// "最多上传/s1张"
@override
String get max_upload_size => "最多上传/s1张";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -13717,6 +13725,9 @@ class _I18n_zh_CN extends _I18n_zh_HK {
/// "震动通知"
@override
String get shock_notice => "震动通知";
/// "最多上傳/s1張"
@override
String get max_upload_size => "最多上傳/s1張";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -17451,6 +17462,9 @@ class _I18n_ko_KR extends I18n {
/// "震动通知"
@override
String get shock_notice => "震动通知";
/// "最多上传/s1张"
@override
String get max_upload_size => "最多上传/s1张";

@override
TextDirection get textDirection => TextDirection.ltr;
@@ -21182,6 +21196,9 @@ class _I18n_ja_JP extends I18n {
/// "震动通知"
@override
String get shock_notice => "震动通知";
/// "最多上传/s1张"
@override
String get max_upload_size => "最多上传/s1张";

@override
TextDirection get textDirection => TextDirection.ltr;


+ 21
- 3
lib/home/ProfilePage.dart Datei anzeigen

@@ -64,6 +64,8 @@ var cardWidth;
var greyColor = const Color(0xFFB2B2B2);
const MaxImgSize = 20;
class ProfilePage extends StatefulWidget {
@required
final userId;
@@ -431,10 +433,15 @@ class _ProfilePageState extends State<ProfilePage>
// }
// }
int leftLength = MaxImgSize - imgList.length;
if(leftLength <=0){
showToast(I18n.of(context).max_upload_size.replaceFirst('/s1', MaxImgSize.toString()));
return;
}
List<Asset> resultList = List<Asset>();
resultList = await MultiImagePicker.pickImages(
maxImages: 9,
maxImages: leftLength > 9 ? 9 : leftLength,
enableCamera: false,
selectedAssets: [],
cupertinoOptions: CupertinoOptions(takePhotoIcon: "chat"),
@@ -476,6 +483,8 @@ class _ProfilePageState extends State<ProfilePage>
showToast(I18n.of(context).hava_error_photo);
}
MessageMgr().emit('refresh_photo');
}else{
showToast(resData['msg']);
}
}
@@ -1192,6 +1201,7 @@ class _ProfilePageState extends State<ProfilePage>
isWatch: f['IsCheck'] == 1,
userId: userInfo.userId,
isBuy: f['PayStatus'] == 1,
isCheck: f['Status'] == 0,
))
.toList();
var list = imgList.map((data) {
@@ -1239,7 +1249,9 @@ class _ProfilePageState extends State<ProfilePage>
? I18n.of(context).his_photo
: I18n.of(context).her_photo)),
//+'(${I18n.of(context).visit_you.replaceFirst('/s1', userInfo.accessNum.toString())})',
description: isMyself ? I18n.of(context).upload : '',
description: isMyself
? '${I18n.of(context).upload}(${imgList.length}/$MaxImgSize)'
: '',
descriptionColor: Constants.BlueTextColor,
showDivider: true,
showRightIcon: false,
@@ -1369,10 +1381,16 @@ class _ProfilePageState extends State<ProfilePage>
showToast(I18n.of(context).no_photos);
return;
}
var moneyList = [];
for(int i = 0 ; i< imgList.length;i++){
if(imgList[i]['Status'] == 1){
moneyList.add(imgList[i]);
}
}
Navigator.of(context)
.push(new MaterialPageRoute(builder: (context) {
return MoneyPicture(
imageList: imgList,
imageList: moneyList,
);
}));
},


+ 6
- 0
lib/home/money_picture_view.dart Datei anzeigen

@@ -21,6 +21,7 @@ class MoneyPicture extends StatefulWidget {
class _MoneyPictureState extends State<MoneyPicture> {
int selectId = 0;
int originalMoneyId = 0;
Widget _buildImg(data) {
var width = (MediaQuery.of(context).size.width - 30) / 3;
@@ -77,6 +78,7 @@ class _MoneyPictureState extends State<MoneyPicture> {
if (element['Type'] == PhotoType.money.index ||
element['Type'] == PhotoType.destroyMoney.index) {
selectId = element['Id'];
originalMoneyId = selectId;
}
}
}
@@ -107,6 +109,10 @@ class _MoneyPictureState extends State<MoneyPicture> {
style: Constants.AppBarActionTextStyle),
),
onTap: () async {
if (originalMoneyId == selectId) {
Navigator.of(context).pop();
return;
}
Map rdata = {
"userId": UserData().basicInfo.userId,
"Id": selectId,


+ 1
- 1
lib/utils/HttpUtil.dart Datei anzeigen

@@ -219,7 +219,7 @@ class HttpUtil {
var fileBytes;
if (contentType == 'image' && size > 10240) {
fileBytes =
await WidgetUtil.getCompressImg(path, quality: 80, percentage: 80);
await WidgetUtil.getCompressImg(path, quality: 20, percentage: 60);
} else {
fileBytes = imgfile.readAsBytesSync();
}


+ 7
- 0
lib/utils/PicSwiper.dart Datei anzeigen

@@ -18,6 +18,7 @@ import 'package:extended_image/extended_image.dart';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:oktoast/oktoast.dart';
import 'package:provider/provider.dart';
import 'ChargeMoney.dart';
@@ -224,6 +225,10 @@ class _PicSwiperState extends State<PicSwiper>
value: isAgree,
activeColor: Colors.blue,
onChanged: (bool val) {
if(widget.pics[currentIndex].isCheck){
showToast(I18n.of(context).reviewing);
return;
}
HttpUtil().setPhote(context, id, isAgree ? 0 : 1, () {
this.setState(() {
isAgree = !isAgree;
@@ -895,6 +900,7 @@ class PicSwiperItem {
int type;
bool isBuy; //是否购买
bool isWatch; //是否观看
bool isCheck;//是否审核中
PicSwiperItem(
this.picUrl, {
this.file,
@@ -904,5 +910,6 @@ class PicSwiperItem {
this.isBuy = false,
this.isWatch = false,
this.userId,
this.isCheck = false,
});
}

Laden…
Abbrechen
Speichern