From e778f2b46334c4abcbcf151a9b47e21c8d85cf73 Mon Sep 17 00:00:00 2001 From: dom Date: Thu, 16 Apr 2026 17:50:52 +0800 Subject: [PATCH] correct reply field names Signed-off-by: dom --- .../bilibili/main/community/reply/v1.pb.dart | 29 +++---- .../main/community/reply/v1.pbenum.dart | 29 +++++++ .../main/community/reply/v1.pbjson.dart | 76 ++++++++++++------- lib/grpc/reply.dart | 2 +- .../video/reply/widgets/reply_item_grpc.dart | 5 +- 5 files changed, 96 insertions(+), 45 deletions(-) diff --git a/lib/grpc/bilibili/main/community/reply/v1.pb.dart b/lib/grpc/bilibili/main/community/reply/v1.pb.dart index e313115dd..53e01c6f4 100644 --- a/lib/grpc/bilibili/main/community/reply/v1.pb.dart +++ b/lib/grpc/bilibili/main/community/reply/v1.pb.dart @@ -8159,7 +8159,7 @@ class ReplyControl extends $pb.GeneratedMessage { ReplyControl_EasterEggLabel? easterEggLabel, $core.String? contextFeature, ReplyControl_InsertEffect? insertEffect, - $core.int? translationSwitch, + TranslationSwitch? translationSwitch, $core.bool? showTranslation, }) { final result = create(); @@ -8261,7 +8261,8 @@ class ReplyControl extends $pb.GeneratedMessage { ..aOS(35, _omitFieldNames ? '' : 'contextFeature') ..aOM(36, _omitFieldNames ? '' : 'insertEffect', subBuilder: ReplyControl_InsertEffect.create) - ..aI(37, _omitFieldNames ? '' : 'translationSwitch') + ..aE(37, _omitFieldNames ? '' : 'translationSwitch', + enumValues: TranslationSwitch.values) ..aOB(100, _omitFieldNames ? '' : 'showTranslation') ..hasRequiredFields = false; @@ -8612,9 +8613,9 @@ class ReplyControl extends $pb.GeneratedMessage { ReplyControl_InsertEffect ensureInsertEffect() => $_ensure(35); @$pb.TagNumber(37) - $core.int get translationSwitch => $_getIZ(36); + TranslationSwitch get translationSwitch => $_getN(36); @$pb.TagNumber(37) - set translationSwitch($core.int value) => $_setSignedInt32(36, value); + set translationSwitch(TranslationSwitch value) => $_setField(37, value); @$pb.TagNumber(37) $core.bool hasTranslationSwitch() => $_has(36); @$pb.TagNumber(37) @@ -14020,12 +14021,12 @@ class TranslateReplyReq extends $pb.GeneratedMessage { factory TranslateReplyReq({ $fixnum.Int64? type, $fixnum.Int64? oid, - $core.Iterable<$fixnum.Int64>? rpid, + $core.Iterable<$fixnum.Int64>? rpids, }) { final result = create(); if (type != null) result.type = type; if (oid != null) result.oid = oid; - if (rpid != null) result.rpid.addAll(rpid); + if (rpids != null) result.rpids.addAll(rpids); return result; } @@ -14045,7 +14046,7 @@ class TranslateReplyReq extends $pb.GeneratedMessage { createEmptyInstance: create) ..aInt64(1, _omitFieldNames ? '' : 'type') ..aInt64(2, _omitFieldNames ? '' : 'oid') - ..p<$fixnum.Int64>(3, _omitFieldNames ? '' : 'rpid', $pb.PbFieldType.K6) + ..p<$fixnum.Int64>(3, _omitFieldNames ? '' : 'rpids', $pb.PbFieldType.K6) ..hasRequiredFields = false; @$core.Deprecated('See https://github.com/google/protobuf.dart/issues/998.') @@ -14086,16 +14087,16 @@ class TranslateReplyReq extends $pb.GeneratedMessage { void clearOid() => $_clearField(2); @$pb.TagNumber(3) - $pb.PbList<$fixnum.Int64> get rpid => $_getList(2); + $pb.PbList<$fixnum.Int64> get rpids => $_getList(2); } class TranslateReplyResp extends $pb.GeneratedMessage { factory TranslateReplyResp({ - $core.Iterable<$core.MapEntry<$fixnum.Int64, ReplyInfo>>? translatedReply, + $core.Iterable<$core.MapEntry<$fixnum.Int64, ReplyInfo>>? translatedReplies, }) { final result = create(); - if (translatedReply != null) - result.translatedReply.addEntries(translatedReply); + if (translatedReplies != null) + result.translatedReplies.addEntries(translatedReplies); return result; } @@ -14113,8 +14114,8 @@ class TranslateReplyResp extends $pb.GeneratedMessage { package: const $pb.PackageName( _omitMessageNames ? '' : 'bilibili.main.community.reply.v1'), createEmptyInstance: create) - ..m<$fixnum.Int64, ReplyInfo>(1, _omitFieldNames ? '' : 'translatedReply', - entryClassName: 'TranslateReplyResp.TranslatedReplyEntry', + ..m<$fixnum.Int64, ReplyInfo>(1, _omitFieldNames ? '' : 'translatedReplies', + entryClassName: 'TranslateReplyResp.TranslatedRepliesEntry', keyFieldType: $pb.PbFieldType.O6, valueFieldType: $pb.PbFieldType.OM, valueCreator: ReplyInfo.create, @@ -14142,7 +14143,7 @@ class TranslateReplyResp extends $pb.GeneratedMessage { static TranslateReplyResp? _defaultInstance; @$pb.TagNumber(1) - $pb.PbMap<$fixnum.Int64, ReplyInfo> get translatedReply => $_getMap(0); + $pb.PbMap<$fixnum.Int64, ReplyInfo> get translatedReplies => $_getMap(0); } const $core.bool _omitFieldNames = diff --git a/lib/grpc/bilibili/main/community/reply/v1.pbenum.dart b/lib/grpc/bilibili/main/community/reply/v1.pbenum.dart index 5ba26c645..ff13cfda9 100644 --- a/lib/grpc/bilibili/main/community/reply/v1.pbenum.dart +++ b/lib/grpc/bilibili/main/community/reply/v1.pbenum.dart @@ -194,6 +194,35 @@ class UserCallbackScene extends $pb.ProtobufEnum { const UserCallbackScene._(super.value, super.name); } +class TranslationSwitch extends $pb.ProtobufEnum { + static const TranslationSwitch TRANSLATION_SWITCH_UNSPECIFIED = + TranslationSwitch._( + 0, _omitEnumNames ? '' : 'TRANSLATION_SWITCH_UNSPECIFIED'); + static const TranslationSwitch TRANSLATION_SWITCH_UNSUPPORTED = + TranslationSwitch._( + 1, _omitEnumNames ? '' : 'TRANSLATION_SWITCH_UNSUPPORTED'); + static const TranslationSwitch TRANSLATION_SWITCH_SHOW_TRANSLATION = + TranslationSwitch._( + 2, _omitEnumNames ? '' : 'TRANSLATION_SWITCH_SHOW_TRANSLATION'); + static const TranslationSwitch TRANSLATION_SWITCH_SHOW_ORIGIN = + TranslationSwitch._( + 3, _omitEnumNames ? '' : 'TRANSLATION_SWITCH_SHOW_ORIGIN'); + + static const $core.List values = [ + TRANSLATION_SWITCH_UNSPECIFIED, + TRANSLATION_SWITCH_UNSUPPORTED, + TRANSLATION_SWITCH_SHOW_TRANSLATION, + TRANSLATION_SWITCH_SHOW_ORIGIN, + ]; + + static final $core.List _byValue = + $pb.ProtobufEnum.$_initByValueList(values, 3); + static TranslationSwitch? valueOf($core.int value) => + value < 0 || value >= _byValue.length ? null : _byValue[value]; + + const TranslationSwitch._(super.value, super.name); +} + class AtGroup_Type extends $pb.ProtobufEnum { static const AtGroup_Type AT_GROUP_TYPE_DEFAULT = AtGroup_Type._(0, _omitEnumNames ? '' : 'AT_GROUP_TYPE_DEFAULT'); diff --git a/lib/grpc/bilibili/main/community/reply/v1.pbjson.dart b/lib/grpc/bilibili/main/community/reply/v1.pbjson.dart index ee6b2dd07..bb0a4608e 100644 --- a/lib/grpc/bilibili/main/community/reply/v1.pbjson.dart +++ b/lib/grpc/bilibili/main/community/reply/v1.pbjson.dart @@ -133,6 +133,24 @@ final $typed_data.Uint8List userCallbackSceneDescriptor = $convert.base64Decode( 'ChFVc2VyQ2FsbGJhY2tTY2VuZRIcChhJbnNlcnRfVXNlckNhbGxiYWNrU2NlbmUQABIYChRSZW' 'NvbW1lbmRTdXBlcmJSZXBseRAB'); +@$core.Deprecated('Use translationSwitchDescriptor instead') +const TranslationSwitch$json = { + '1': 'TranslationSwitch', + '2': [ + {'1': 'TRANSLATION_SWITCH_UNSPECIFIED', '2': 0}, + {'1': 'TRANSLATION_SWITCH_UNSUPPORTED', '2': 1}, + {'1': 'TRANSLATION_SWITCH_SHOW_TRANSLATION', '2': 2}, + {'1': 'TRANSLATION_SWITCH_SHOW_ORIGIN', '2': 3}, + ], +}; + +/// Descriptor for `TranslationSwitch`. Decode as a `google.protobuf.EnumDescriptorProto`. +final $typed_data.Uint8List translationSwitchDescriptor = $convert.base64Decode( + 'ChFUcmFuc2xhdGlvblN3aXRjaBIiCh5UUkFOU0xBVElPTl9TV0lUQ0hfVU5TUEVDSUZJRUQQAB' + 'IiCh5UUkFOU0xBVElPTl9TV0lUQ0hfVU5TVVBQT1JURUQQARInCiNUUkFOU0xBVElPTl9TV0lU' + 'Q0hfU0hPV19UUkFOU0xBVElPThACEiIKHlRSQU5TTEFUSU9OX1NXSVRDSF9TSE9XX09SSUdJTh' + 'AD'); + @$core.Deprecated('Use activityDescriptor instead') const Activity$json = { '1': 'Activity', @@ -2861,7 +2879,8 @@ const ReplyControl$json = { '1': 'translation_switch', '3': 37, '4': 1, - '5': 5, + '5': 14, + '6': '.bilibili.main.community.reply.v1.TranslationSwitch', '10': 'translationSwitch' }, { @@ -2991,20 +3010,21 @@ final $typed_data.Uint8List replyControlDescriptor = $convert.base64Decode( 'aWxpLm1haW4uY29tbXVuaXR5LnJlcGx5LnYxLlJlcGx5Q29udHJvbC5FYXN0ZXJFZ2dMYWJlbF' 'IOZWFzdGVyRWdnTGFiZWwSJwoPY29udGV4dF9mZWF0dXJlGCMgASgJUg5jb250ZXh0RmVhdHVy' 'ZRJgCg1pbnNlcnRfZWZmZWN0GCQgASgLMjsuYmlsaWJpbGkubWFpbi5jb21tdW5pdHkucmVwbH' - 'kudjEuUmVwbHlDb250cm9sLkluc2VydEVmZmVjdFIMaW5zZXJ0RWZmZWN0Ei0KEnRyYW5zbGF0' - 'aW9uX3N3aXRjaBglIAEoBVIRdHJhbnNsYXRpb25Td2l0Y2gSKQoQc2hvd190cmFuc2xhdGlvbh' - 'hkIAEoCFIPc2hvd1RyYW5zbGF0aW9uGkEKDkVhc3RlckVnZ0xhYmVsEhQKBWltYWdlGAEgASgJ' - 'UgVpbWFnZRIZCghqdW1wX3VybBgCIAEoCVIHanVtcFVybBrXAQoLR3JhZGVSZWNvcmQSFAoFc2' - 'NvcmUYASABKAVSBXNjb3JlElUKBXRleHRzGAIgAygLMj8uYmlsaWJpbGkubWFpbi5jb21tdW5p' - 'dHkucmVwbHkudjEuUmVwbHlDb250cm9sLkdyYWRlUmVjb3JkLlRleHRSBXRleHRzGlsKBFRleH' - 'QSEAoDcmF3GAEgASgJUgNyYXcSQQoFc3R5bGUYAiABKAsyKy5iaWxpYmlsaS5tYWluLmNvbW11' - 'bml0eS5yZXBseS52MS5UZXh0U3R5bGVSBXN0eWxl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TdHlsZVIFc3R5bGUaPAoMSW5zZXJ0RWZmZWN0EhgKB2NvbnRlbnQY' + 'ASABKAlSB2NvbnRlbnQSEgoEaWNvbhgCIAEoCVIEaWNvbhrxAQoKVm90ZU9wdGlvbhJiCgpsYW' + 'JlbF9raW5kGAEgASgOMkMuYmlsaWJpbGkubWFpbi5jb21tdW5pdHkucmVwbHkudjEuUmVwbHlD' + 'b250cm9sLlZvdGVPcHRpb24uTGFiZWxLaW5kUglsYWJlbEtpbmQSEgoEZGVzYxgCIAEoCVIEZG' + 'VzYxIQCgNpZHgYAyABKANSA2lkeBIXCgd2b3RlX2lkGAQgASgDUgZ2b3RlSWQiQAoJTGFiZWxL' + 'aW5kEhUKEURFRkFVTFRfTGFiZWxLaW5kEAASBwoDUkVEEAESCAoEQkxVRRACEgkKBVBMQUlOEA' + 'M='); @$core.Deprecated('Use replyExtraDescriptor instead') const ReplyExtra$json = { @@ -4593,35 +4613,35 @@ const TranslateReplyReq$json = { '2': [ {'1': 'type', '3': 1, '4': 1, '5': 3, '10': 'type'}, {'1': 'oid', '3': 2, '4': 1, '5': 3, '10': 'oid'}, - {'1': 'rpid', '3': 3, '4': 3, '5': 3, '10': 'rpid'}, + {'1': 'rpids', '3': 3, '4': 3, '5': 3, '10': 'rpids'}, ], }; /// Descriptor for `TranslateReplyReq`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List translateReplyReqDescriptor = $convert.base64Decode( 'ChFUcmFuc2xhdGVSZXBseVJlcRISCgR0eXBlGAEgASgDUgR0eXBlEhAKA29pZBgCIAEoA1IDb2' - 'lkEhIKBHJwaWQYAyADKANSBHJwaWQ='); + 'lkEhQKBXJwaWRzGAMgAygDUgVycGlkcw=='); @$core.Deprecated('Use translateReplyRespDescriptor instead') const TranslateReplyResp$json = { '1': 'TranslateReplyResp', '2': [ { - '1': 'translated_reply', + '1': 'translated_replies', '3': 1, '4': 3, '5': 11, '6': - '.bilibili.main.community.reply.v1.TranslateReplyResp.TranslatedReplyEntry', - '10': 'translatedReply' + '.bilibili.main.community.reply.v1.TranslateReplyResp.TranslatedRepliesEntry', + '10': 'translatedReplies' }, ], - '3': [TranslateReplyResp_TranslatedReplyEntry$json], + '3': [TranslateReplyResp_TranslatedRepliesEntry$json], }; @$core.Deprecated('Use translateReplyRespDescriptor instead') -const TranslateReplyResp_TranslatedReplyEntry$json = { - '1': 'TranslatedReplyEntry', +const TranslateReplyResp_TranslatedRepliesEntry$json = { + '1': 'TranslatedRepliesEntry', '2': [ {'1': 'key', '3': 1, '4': 1, '5': 3, '10': 'key'}, { @@ -4638,8 +4658,8 @@ const TranslateReplyResp_TranslatedReplyEntry$json = { /// Descriptor for `TranslateReplyResp`. Decode as a `google.protobuf.DescriptorProto`. final $typed_data.Uint8List translateReplyRespDescriptor = $convert.base64Decode( - 'ChJUcmFuc2xhdGVSZXBseVJlc3ASdAoQdHJhbnNsYXRlZF9yZXBseRgBIAMoCzJJLmJpbGliaW' - 'xpLm1haW4uY29tbXVuaXR5LnJlcGx5LnYxLlRyYW5zbGF0ZVJlcGx5UmVzcC5UcmFuc2xhdGVk' - 'UmVwbHlFbnRyeVIPdHJhbnNsYXRlZFJlcGx5Gm8KFFRyYW5zbGF0ZWRSZXBseUVudHJ5EhAKA2' - 'tleRgBIAEoA1IDa2V5EkEKBXZhbHVlGAIgASgLMisuYmlsaWJpbGkubWFpbi5jb21tdW5pdHku' - 'cmVwbHkudjEuUmVwbHlJbmZvUgV2YWx1ZToCOAE='); + 'ChJUcmFuc2xhdGVSZXBseVJlc3ASegoSdHJhbnNsYXRlZF9yZXBsaWVzGAEgAygLMksuYmlsaW' + 'JpbGkubWFpbi5jb21tdW5pdHkucmVwbHkudjEuVHJhbnNsYXRlUmVwbHlSZXNwLlRyYW5zbGF0' + 'ZWRSZXBsaWVzRW50cnlSEXRyYW5zbGF0ZWRSZXBsaWVzGnEKFlRyYW5zbGF0ZWRSZXBsaWVzRW' + '50cnkSEAoDa2V5GAEgASgDUgNrZXkSQQoFdmFsdWUYAiABKAsyKy5iaWxpYmlsaS5tYWluLmNv' + 'bW11bml0eS5yZXBseS52MS5SZXBseUluZm9SBXZhbHVlOgI4AQ=='); diff --git a/lib/grpc/reply.dart b/lib/grpc/reply.dart index 1d0c7f4d3..f399eb4f3 100644 --- a/lib/grpc/reply.dart +++ b/lib/grpc/reply.dart @@ -159,7 +159,7 @@ abstract final class ReplyGrpc { TranslateReplyReq( type: type, oid: oid, - rpid: [rpid], + rpids: [rpid], ), TranslateReplyResp.fromBuffer, ); diff --git a/lib/pages/video/reply/widgets/reply_item_grpc.dart b/lib/pages/video/reply/widgets/reply_item_grpc.dart index dd6369f0d..9f17ab1d7 100644 --- a/lib/pages/video/reply/widgets/reply_item_grpc.dart +++ b/lib/pages/video/reply/widgets/reply_item_grpc.dart @@ -404,7 +404,7 @@ class ReplyItemGrpc extends StatelessWidget { rpid: replyItem.id, ); if (res case Success(:final response)) { - final item = response.translatedReply[replyItem.id]; + final item = response.translatedReplies[replyItem.id]; if (item != null && item.hasTranslatedContent()) { replyControl.showTranslation = true; replyItem.translatedContent = item.translatedContent; @@ -477,7 +477,8 @@ class ReplyItemGrpc extends StatelessWidget { ), ), const SizedBox(width: 2), - if (replyControl.translationSwitch == 2) ...[ + if (replyControl.translationSwitch == + .TRANSLATION_SWITCH_SHOW_TRANSLATION) ...[ _buildTranslateBtn( context, theme,