mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
Duo keeps conversations and Settings details open across closed, book and flat postures. Book mode splits at the fold; flattening restores the sidebar. Native rail controls, full-width navigation backdrops and sheet-local safe areas keep content aligned. Ordinary iPhones remain single-pane in portrait and landscape; tablet and Duo split layouts remain enabled. Includes the recovered preview's matching pane widths, Buzz empty-pane mark, stable Settings chevrons, Bestie pane routing and Duo-only upward New menu attachment. Current main's Activity redesign, Search content fade and unread-navigation button are retained. Menu selection checks sit beside their labels. Shared mobile changes remain in scope: the native iOS status editor, Appearance preview layout, avatar crop preservation, onboarding footer layout, profile/invite sheet geometry and nested conversation navigation. This PR is not exclusively Duo-gated. Nested navigator observers preserve recording cancellation and navigation callbacks; crop resizing preserves the selected image region. iOS 27.1 APIs remain compile-time and runtime gated. Validation on the reconciled source: Flutter analysis, Activity/Home journeys, the full mobile test suite, file-size checks and Swift package tests. The iPhone single-pane fix was also exercised on an iPhone 18 Pro simulator before reconciliation. Fresh hosted CI and physical-device confirmation of the reconciled build are separate and remain pending. --------- Signed-off-by: kenny lopez <klopez4212@gmail.com> Signed-off-by: Tom Brow <tomb@squareup.com> Co-authored-by: Terp <5856f6900e8e0a4e0ea1f4f8d2ee33e4753d2119bc122f94ecafc660b46c0511@buzz.block.builderlab.xyz> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Tom Brow <tomb@block.xyz> Co-authored-by: Tom Brow <tomb@squareup.com>
554 lines
20 KiB
Dart
554 lines
20 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:buzz/features/invites/invite_create_page.dart';
|
|
import 'package:buzz/features/invites/invite_create_provider.dart';
|
|
import 'package:buzz/shared/community/community_membership_provider.dart';
|
|
import 'package:buzz/shared/relay/relay.dart';
|
|
import 'package:buzz/shared/theme/theme.dart';
|
|
import 'package:buzz/shared/utils/string_utils.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
import 'package:duo_kit/duo_kit.dart';
|
|
import 'package:buzz/shared/widgets/duo_toolbar.dart';
|
|
import 'package:buzz/shared/widgets/ios_navigation_bar.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:buzz/shared/theme/buzz_icons.dart';
|
|
import 'package:nostr/nostr.dart' as nostr;
|
|
|
|
void main() {
|
|
const owner =
|
|
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
|
|
const alice =
|
|
'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb';
|
|
|
|
testWidgets('unfolded invite splits title and controls clear of either rail', (
|
|
tester,
|
|
) async {
|
|
debugDefaultTargetPlatformOverride = TargetPlatform.iOS;
|
|
addTearDown(() => debugDefaultTargetPlatformOverride = null);
|
|
tester.view.devicePixelRatio = 1;
|
|
tester.view.physicalSize = const Size(951, 669);
|
|
addTearDown(tester.view.reset);
|
|
try {
|
|
for (final left in [false, true]) {
|
|
await tester.pumpWidget(const SizedBox.shrink());
|
|
final actions = _FakeInviteActions();
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
communityInviteActionsProvider.overrideWithValue(actions),
|
|
myPubkeyProvider.overrideWithValue(owner),
|
|
communityMembershipProvider.overrideWith(
|
|
(ref) async => const CommunityMembershipSnapshot(
|
|
snapshotFound: true,
|
|
members: [
|
|
CommunityMember(
|
|
pubkey: owner,
|
|
role: CommunityMemberRole.owner,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
currentCommunityRoleProvider.overrideWithValue(
|
|
const AsyncData<CommunityMemberRole?>(
|
|
CommunityMemberRole.owner,
|
|
),
|
|
),
|
|
],
|
|
child: MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: DuoToolbarScope(
|
|
active: true,
|
|
strip: FoldStrip(
|
|
side: left ? FoldStripSide.left : FoldStripSide.right,
|
|
rect: Rect.fromLTWH(left ? 0 : 875, 0, 76, 669),
|
|
topClearance: 110,
|
|
bottomClearance: 0,
|
|
isClearanceEstimated: true,
|
|
),
|
|
child: const CommunityInvitePage(),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
final title = tester.getRect(
|
|
find.byKey(const ValueKey('invite-title-pane')),
|
|
);
|
|
final controls = tester.getRect(
|
|
find.byKey(const ValueKey('invite-controls-pane')),
|
|
);
|
|
expect(title.left, left ? 76 : 0);
|
|
expect(controls.right, left ? 951 : 875);
|
|
expect(title.width, 375);
|
|
expect(controls.width, 499);
|
|
expect(controls.left, closeTo(title.right + 1, 0.01));
|
|
expect(
|
|
tester
|
|
.widget<IosNavigationBar>(find.byType(IosNavigationBar).first)
|
|
.standaloneLargeTitle,
|
|
isTrue,
|
|
);
|
|
for (final setting in ['expiry', 'max-uses']) {
|
|
await tester.tap(
|
|
find.byKey(Key('community-invite-$setting-setting')),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
final sheet = tester.getRect(find.byType(BottomSheet));
|
|
expect(sheet.left, greaterThanOrEqualTo(controls.left));
|
|
expect(sheet.right, lessThanOrEqualTo(controls.right));
|
|
expect(
|
|
find.byKey(const ValueKey('invite-title-pane')),
|
|
findsOneWidget,
|
|
);
|
|
final barrier = tester.getRect(find.byType(ModalBarrier).last);
|
|
expect(barrier.left, greaterThanOrEqualTo(controls.left));
|
|
expect(barrier.right, lessThanOrEqualTo(controls.right));
|
|
await tester.tap(
|
|
find.byKey(
|
|
Key(
|
|
'community-invite-option-${setting == 'expiry' ? '1-day' : '3-uses'}',
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(find.byType(BottomSheet), findsNothing);
|
|
}
|
|
expect(actions.mintRequests.last, (86400, 3));
|
|
tester.view.physicalSize = const Size(800, 1100);
|
|
await tester.pumpAndSettle();
|
|
expect(find.byKey(const ValueKey('invite-title-pane')), findsNothing);
|
|
expect(
|
|
find.byKey(const ValueKey('invite-controls-pane')),
|
|
findsNothing,
|
|
);
|
|
expect(find.text('Share'), findsOneWidget);
|
|
tester.view.devicePixelRatio = 1;
|
|
tester.view.physicalSize = const Size(951, 669);
|
|
await tester.pumpAndSettle();
|
|
expect(tester.takeException(), isNull);
|
|
}
|
|
} finally {
|
|
debugDefaultTargetPlatformOverride = null;
|
|
}
|
|
});
|
|
|
|
testWidgets('owner can invite a pasted npub and share generated link', (
|
|
tester,
|
|
) async {
|
|
tester.view.physicalSize = const Size(430, 1100);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
final actions = _FakeInviteActions();
|
|
String? sharedUrl;
|
|
final hapticCalls = <MethodCall>[];
|
|
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
.setMockMethodCallHandler(SystemChannels.platform, (call) async {
|
|
if (call.method == 'HapticFeedback.vibrate') hapticCalls.add(call);
|
|
return null;
|
|
});
|
|
addTearDown(
|
|
() => TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
|
.setMockMethodCallHandler(SystemChannels.platform, null),
|
|
);
|
|
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
currentCommunityRoleProvider.overrideWithValue(
|
|
const AsyncData<CommunityMemberRole?>(CommunityMemberRole.owner),
|
|
),
|
|
communityMembershipProvider.overrideWith(
|
|
(ref) async => const CommunityMembershipSnapshot(
|
|
snapshotFound: true,
|
|
members: [
|
|
CommunityMember(pubkey: owner, role: CommunityMemberRole.owner),
|
|
],
|
|
),
|
|
),
|
|
myPubkeyProvider.overrideWithValue(owner),
|
|
communityInviteProfileProvider.overrideWith(
|
|
(ref, pubkey) async => CommunityInviteDirectoryUser(
|
|
pubkey: pubkey,
|
|
displayName: 'Resolved person',
|
|
nip05Handle: 'person@example.com',
|
|
),
|
|
),
|
|
communityInviteActionsProvider.overrideWithValue(actions),
|
|
shareCommunityInviteProvider.overrideWithValue((url, origin) async {
|
|
sharedUrl = url;
|
|
}),
|
|
],
|
|
child: MaterialApp(
|
|
theme: AppTheme.light().copyWith(platform: TargetPlatform.iOS),
|
|
home: const CommunityInvitePage(),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(actions.mintRequests, [(defaultCommunityInviteTtlSeconds, null)]);
|
|
expect(
|
|
find.text('Add someone directly or share a link they can use to join.'),
|
|
findsNothing,
|
|
);
|
|
expect(find.text('Invite people'), findsNothing);
|
|
expect(find.text('Search by name or paste an npub.'), findsNothing);
|
|
expect(find.text('Alice'), findsNothing);
|
|
expect(
|
|
find.byKey(const Key('community-invite-person-$alice')),
|
|
findsNothing,
|
|
);
|
|
expect(find.text('https://relay.example.com/invite/1'), findsNothing);
|
|
expect(find.text('Invite link ready'), findsNothing);
|
|
expect(find.text('Invite link'), findsNothing);
|
|
expect(find.text('Creating invite link…'), findsNothing);
|
|
expect(find.text('Or use npub'), findsOneWidget);
|
|
expect(find.text('Search npub'), findsOneWidget);
|
|
expect(find.text('Copy'), findsOneWidget);
|
|
expect(find.text('Share'), findsOneWidget);
|
|
expect(find.text('Messages'), findsNothing);
|
|
expect(find.text('Mail'), findsNothing);
|
|
expect(find.text('WhatsApp'), findsNothing);
|
|
expect(find.text('Gmail'), findsNothing);
|
|
expect(find.text('Telegram'), findsNothing);
|
|
expect(find.text('X'), findsNothing);
|
|
expect(
|
|
tester.getSize(find.byKey(const Key('community-invite-search'))).width,
|
|
greaterThan(350),
|
|
);
|
|
final shareSize = tester.getSize(
|
|
find.byKey(const Key('community-invite-share-link')),
|
|
);
|
|
final copySize = tester.getSize(
|
|
find.byKey(const Key('community-invite-copy-link')),
|
|
);
|
|
expect(shareSize, copySize);
|
|
expect(shareSize.height, 68 + (Grid.xxs * 2));
|
|
expect(
|
|
tester
|
|
.getTopLeft(find.byKey(const Key('community-invite-share-link')))
|
|
.dx,
|
|
lessThan(
|
|
tester
|
|
.getTopLeft(find.byKey(const Key('community-invite-copy-link')))
|
|
.dx,
|
|
),
|
|
);
|
|
expect(tester.widget<Icon>(find.byIcon(BuzzIcons.share2)).size, 22);
|
|
expect(tester.widget<Icon>(find.byIcon(BuzzIcons.copy)).size, 22);
|
|
final settingsDivider = find.descendant(
|
|
of: find.byKey(const Key('community-invite-link-settings')),
|
|
matching: find.byType(Divider),
|
|
);
|
|
final divider = tester.widget<Divider>(settingsDivider);
|
|
expect(divider.indent, Grid.xs);
|
|
expect(divider.endIndent, Grid.xs);
|
|
expect(
|
|
tester.getRect(settingsDivider).left + divider.indent!,
|
|
closeTo(tester.getRect(find.text('Expires after')).left, 0.5),
|
|
);
|
|
|
|
const pastedPubkey =
|
|
'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
|
|
final npub = nostr.Nip19.encode(
|
|
prefix: nostr.Nip19Prefix.npub,
|
|
data: pastedPubkey,
|
|
);
|
|
await tester.enterText(
|
|
find.byKey(const Key('community-invite-search')),
|
|
npub,
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(
|
|
find.byKey(const Key('community-invite-resolved-$pastedPubkey')),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.text(shortPubkey(pastedPubkey)), findsOneWidget);
|
|
expect(find.text('Resolved person'), findsNothing);
|
|
expect(find.text('person@example.com'), findsNothing);
|
|
expect(
|
|
find.byKey(const Key('community-invite-person-$pastedPubkey')),
|
|
findsNothing,
|
|
);
|
|
expect(find.text('Role'), findsOneWidget);
|
|
expect(find.byIcon(BuzzIcons.shield), findsNothing);
|
|
final personDivider = find.descendant(
|
|
of: find.byKey(const Key('community-invite-person-card')),
|
|
matching: find.byType(Divider),
|
|
);
|
|
expect(personDivider, findsOneWidget);
|
|
final personDividerWidget = tester.widget<Divider>(personDivider);
|
|
expect(personDividerWidget.indent, Grid.xs);
|
|
expect(personDividerWidget.endIndent, Grid.xs);
|
|
await tester.tap(find.byKey(const Key('community-invite-submit')));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(actions.memberInvites, hasLength(1));
|
|
expect(actions.memberInvites.single.$1, [pastedPubkey]);
|
|
expect(actions.memberInvites.single.$2, CommunityMemberRole.member);
|
|
|
|
await tester.ensureVisible(
|
|
find.byKey(const Key('community-invite-share-link')),
|
|
);
|
|
await tester.tap(find.byKey(const Key('community-invite-share-link')));
|
|
await tester.pumpAndSettle();
|
|
expect(sharedUrl, 'https://relay.example.com/invite/1');
|
|
|
|
await tester.ensureVisible(
|
|
find.byKey(const Key('community-invite-copy-link')),
|
|
);
|
|
await tester.tap(find.byKey(const Key('community-invite-copy-link')));
|
|
await tester.pumpAndSettle();
|
|
expect(hapticCalls.map((call) => call.arguments), [
|
|
'HapticFeedbackType.mediumImpact',
|
|
'HapticFeedbackType.lightImpact',
|
|
'HapticFeedbackType.lightImpact',
|
|
'HapticFeedbackType.mediumImpact',
|
|
]);
|
|
// Invite confirmation, Share tap, Copy tap, and Copy confirmation.
|
|
expect(hapticCalls, hasLength(4));
|
|
});
|
|
|
|
testWidgets('pasted npub remains inviteable without profile metadata', (
|
|
tester,
|
|
) async {
|
|
tester.view.physicalSize = const Size(430, 1100);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
final actions = _FakeInviteActions();
|
|
final profileResolution = Completer<CommunityInviteDirectoryUser?>();
|
|
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
currentCommunityRoleProvider.overrideWithValue(
|
|
const AsyncData<CommunityMemberRole?>(CommunityMemberRole.admin),
|
|
),
|
|
communityMembershipProvider.overrideWith(
|
|
(ref) async => const CommunityMembershipSnapshot(
|
|
snapshotFound: true,
|
|
members: [],
|
|
),
|
|
),
|
|
myPubkeyProvider.overrideWithValue(owner),
|
|
communityInviteProfileProvider.overrideWith(
|
|
(ref, pubkey) => profileResolution.future,
|
|
),
|
|
communityInviteActionsProvider.overrideWithValue(actions),
|
|
],
|
|
child: MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: const CommunityInvitePage(),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
const pastedPubkey =
|
|
'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
|
|
final npub = nostr.Nip19.encode(
|
|
prefix: nostr.Nip19Prefix.npub,
|
|
data: pastedPubkey,
|
|
);
|
|
await tester.enterText(
|
|
find.byKey(const Key('community-invite-search')),
|
|
npub,
|
|
);
|
|
await tester.pump();
|
|
|
|
expect(
|
|
find.byKey(const Key('community-invite-resolving-$pastedPubkey')),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.byKey(const Key('community-invite-submit')), findsNothing);
|
|
expect(actions.memberInvites, isEmpty);
|
|
|
|
profileResolution.complete(
|
|
const CommunityInviteDirectoryUser(pubkey: pastedPubkey),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(
|
|
find.byKey(const Key('community-invite-resolved-$pastedPubkey')),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.text('Profile not found'), findsNothing);
|
|
expect(find.text(shortPubkey(pastedPubkey)), findsOneWidget);
|
|
expect(find.byKey(const Key('community-invite-submit')), findsOneWidget);
|
|
|
|
await tester.tap(find.byKey(const Key('community-invite-submit')));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(actions.memberInvites, hasLength(1));
|
|
expect(actions.memberInvites.single.$1, [pastedPubkey]);
|
|
expect(actions.memberInvites.single.$2, CommunityMemberRole.member);
|
|
});
|
|
|
|
testWidgets('invite completion does not update state after page disposal', (
|
|
tester,
|
|
) async {
|
|
tester.view.physicalSize = const Size(430, 1100);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
final actions = _FakeInviteActions()
|
|
..memberInviteCompleter = Completer<void>();
|
|
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
currentCommunityRoleProvider.overrideWithValue(
|
|
const AsyncData<CommunityMemberRole?>(CommunityMemberRole.admin),
|
|
),
|
|
communityMembershipProvider.overrideWith(
|
|
(ref) async => const CommunityMembershipSnapshot(
|
|
snapshotFound: true,
|
|
members: [],
|
|
),
|
|
),
|
|
myPubkeyProvider.overrideWithValue(owner),
|
|
communityInviteProfileProvider.overrideWith(
|
|
(ref, pubkey) async => CommunityInviteDirectoryUser(pubkey: pubkey),
|
|
),
|
|
communityInviteActionsProvider.overrideWithValue(actions),
|
|
],
|
|
child: MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: const CommunityInvitePage(),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
const pastedPubkey =
|
|
'cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc';
|
|
final npub = nostr.Nip19.encode(
|
|
prefix: nostr.Nip19Prefix.npub,
|
|
data: pastedPubkey,
|
|
);
|
|
await tester.enterText(
|
|
find.byKey(const Key('community-invite-search')),
|
|
npub,
|
|
);
|
|
await tester.pumpAndSettle();
|
|
await tester.tap(find.byKey(const Key('community-invite-submit')));
|
|
await tester.pump();
|
|
|
|
await tester.pumpWidget(const SizedBox.shrink());
|
|
actions.memberInviteCompleter!.complete();
|
|
await tester.pump();
|
|
|
|
expect(tester.takeException(), isNull);
|
|
});
|
|
|
|
testWidgets('link settings remint with desktop expiry and use options', (
|
|
tester,
|
|
) async {
|
|
tester.view.physicalSize = const Size(430, 1100);
|
|
tester.view.devicePixelRatio = 1;
|
|
addTearDown(tester.view.resetPhysicalSize);
|
|
addTearDown(tester.view.resetDevicePixelRatio);
|
|
final actions = _FakeInviteActions();
|
|
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
currentCommunityRoleProvider.overrideWithValue(
|
|
const AsyncData<CommunityMemberRole?>(CommunityMemberRole.admin),
|
|
),
|
|
communityMembershipProvider.overrideWith(
|
|
(ref) async => const CommunityMembershipSnapshot(
|
|
snapshotFound: true,
|
|
members: [],
|
|
),
|
|
),
|
|
communityInviteActionsProvider.overrideWithValue(actions),
|
|
],
|
|
child: MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: const CommunityInvitePage(),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
await tester.tap(
|
|
find.byKey(const Key('community-invite-max-uses-setting')),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('Limit number of uses'), findsNWidgets(2));
|
|
expect(find.byIcon(BuzzIcons.check), findsOneWidget);
|
|
await tester.tap(find.byKey(const Key('community-invite-option-5-uses')));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(actions.mintRequests, [
|
|
(defaultCommunityInviteTtlSeconds, null),
|
|
(defaultCommunityInviteTtlSeconds, 5),
|
|
]);
|
|
|
|
await tester.tap(find.byKey(const Key('community-invite-expiry-setting')));
|
|
await tester.pumpAndSettle();
|
|
expect(find.text('Expires after'), findsNWidgets(2));
|
|
expect(find.byIcon(BuzzIcons.check), findsOneWidget);
|
|
await tester.tap(find.byKey(const Key('community-invite-option-7-days')));
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(actions.mintRequests.last, (7 * 24 * 60 * 60, 5));
|
|
});
|
|
|
|
testWidgets('plain members cannot open invite tools', (tester) async {
|
|
await tester.pumpWidget(
|
|
ProviderScope(
|
|
overrides: [
|
|
currentCommunityRoleProvider.overrideWithValue(
|
|
const AsyncData<CommunityMemberRole?>(CommunityMemberRole.member),
|
|
),
|
|
],
|
|
child: MaterialApp(
|
|
theme: AppTheme.light(),
|
|
home: const CommunityInvitePage(),
|
|
),
|
|
),
|
|
);
|
|
await tester.pumpAndSettle();
|
|
|
|
expect(find.text('Invite access required'), findsOneWidget);
|
|
expect(find.byKey(const Key('community-invite-search')), findsNothing);
|
|
});
|
|
}
|
|
|
|
class _FakeInviteActions implements CommunityInviteActions {
|
|
final List<(int, int?)> mintRequests = [];
|
|
final List<(List<String>, CommunityMemberRole)> memberInvites = [];
|
|
Completer<void>? memberInviteCompleter;
|
|
|
|
@override
|
|
Future<void> inviteMembers({
|
|
required Iterable<String> pubkeys,
|
|
required CommunityMemberRole role,
|
|
}) async {
|
|
memberInvites.add((pubkeys.toList(), role));
|
|
await memberInviteCompleter?.future;
|
|
}
|
|
|
|
@override
|
|
Future<MintedCommunityInvite> mintInvite({
|
|
required int ttlSeconds,
|
|
required int? maxUses,
|
|
}) async {
|
|
mintRequests.add((ttlSeconds, maxUses));
|
|
return MintedCommunityInvite(
|
|
code: '${mintRequests.length}',
|
|
expiresAt: 12345,
|
|
url: 'https://relay.example.com/invite/${mintRequests.length}',
|
|
maxUses: maxUses,
|
|
usesRemaining: maxUses,
|
|
);
|
|
}
|
|
}
|