fix(android): show password action only for locked channels

This commit is contained in:
Edison Jwa
2026-05-20 14:52:34 +09:00
parent 273eaf21c1
commit f8b6485390
8 changed files with 38 additions and 11 deletions
+8 -7
View File
@@ -2152,13 +2152,14 @@ class _SnapshotView extends StatelessWidget {
: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
icon: const Icon(Icons.lock_outline),
tooltip: l10n.channelPasswordTitle,
onPressed: hasJoinPending
? null
: () => onJoinChannelWithPassword(ch),
),
if (ch.hasPassword)
IconButton(
icon: const Icon(Icons.lock_outline),
tooltip: l10n.channelPasswordTitle,
onPressed: hasJoinPending
? null
: () => onJoinChannelWithPassword(ch),
),
IconButton(
icon: Icon(
ch.id == pendingVoiceChannelId
+11 -2
View File
@@ -314,16 +314,24 @@ class BridgeChannel {
/// Server-side ordering hint.
final PlatformInt64 order;
/// True when the server marks the channel as password-protected.
final bool hasPassword;
const BridgeChannel({
required this.id,
required this.parent,
required this.name,
required this.order,
required this.hasPassword,
});
@override
int get hashCode =>
id.hashCode ^ parent.hashCode ^ name.hashCode ^ order.hashCode;
id.hashCode ^
parent.hashCode ^
name.hashCode ^
order.hashCode ^
hasPassword.hashCode;
@override
bool operator ==(Object other) =>
@@ -333,7 +341,8 @@ class BridgeChannel {
id == other.id &&
parent == other.parent &&
name == other.name &&
order == other.order;
order == other.order &&
hasPassword == other.hasPassword;
}
/// Client as seen by Dart.
@@ -1157,13 +1157,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
BridgeChannel dco_decode_bridge_channel(dynamic raw) {
// Codec=Dco (DartCObject based), see doc to use other codecs
final arr = raw as List<dynamic>;
if (arr.length != 4)
throw Exception('unexpected arr length: expect 4 but see ${arr.length}');
if (arr.length != 5)
throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
return BridgeChannel(
id: dco_decode_u_64(arr[0]),
parent: dco_decode_u_64(arr[1]),
name: dco_decode_String(arr[2]),
order: dco_decode_i_64(arr[3]),
hasPassword: dco_decode_bool(arr[4]),
);
}
@@ -1518,11 +1519,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
var var_parent = sse_decode_u_64(deserializer);
var var_name = sse_decode_String(deserializer);
var var_order = sse_decode_i_64(deserializer);
var var_hasPassword = sse_decode_bool(deserializer);
return BridgeChannel(
id: var_id,
parent: var_parent,
name: var_name,
order: var_order,
hasPassword: var_hasPassword,
);
}