Skip to content

Commit d50223e

Browse files
authored
Merge branch 'main' into 2041-implement-account-tests
2 parents 07b8b91 + 680b2aa commit d50223e

File tree

67 files changed

+1443
-1128
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+1443
-1128
lines changed

.config/dictionaries/project.dic

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ libatspi
179179
libavcodec
180180
libcatalyst
181181
libdrm
182+
libsqlite3
182183
libflutter
183184
libgbm
184185
libnss

catalyst_voices/apps/voices/lib/configs/bootstrap.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ Future<BootstrapArgs> bootstrap({
5858
// TODO(damian-molinski): enable it after after docs sync is ready.
5959
/*await Dependencies.instance.get<CatalystDatabase>().clear();
6060
61-
Dependencies.instance.get<SyncManager>().start().ignore();*/
61+
Dependencies.instance.get<SyncManager>().start().ignore(); */
6262

6363
return BootstrapArgs(routerConfig: router);
6464
}

catalyst_voices/apps/voices/lib/dependency/dependencies.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ final class Dependencies extends DependencyProvider {
244244
registerLazySingleton<ProposalService>(() {
245245
return ProposalService(
246246
get<ProposalRepository>(),
247-
get<DocumentRepository>(),
248247
get<UserService>(),
249248
get<KeyDerivationService>(),
249+
get<CampaignRepository>(),
250250
);
251251
});
252252
registerLazySingleton<ConfigService>(() {

catalyst_voices/apps/voices/lib/pages/discovery/sections/most_recent_proposals.dart

+23-18
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,6 @@ class _LatestProposalsState extends State<MostRecentProposals> {
3030
late final ScrollController _scrollController;
3131
late double _scrollPercentage;
3232

33-
@override
34-
void initState() {
35-
super.initState();
36-
_scrollController = ScrollController();
37-
_scrollController.addListener(_onScroll);
38-
_scrollPercentage = 0.0;
39-
}
40-
41-
@override
42-
void dispose() {
43-
_scrollController.dispose();
44-
super.dispose();
45-
}
46-
4733
@override
4834
Widget build(BuildContext context) {
4935
return Container(
@@ -83,18 +69,23 @@ class _LatestProposalsState extends State<MostRecentProposals> {
8369
itemCount: widget.proposals.length,
8470
itemBuilder: (context, index) {
8571
final proposal = widget.proposals[index];
86-
final id = proposal.id;
72+
final ref = proposal.ref;
8773
return Skeletonizer(
8874
enabled: widget.isLoading,
8975
child: PendingProposalCard(
90-
key: Key('PendingProposalCard_$id'),
76+
key: Key('PendingProposalCard_$ref'),
9177
proposal: proposal,
9278
onTap: () {
9379
unawaited(
94-
ProposalRoute(proposalId: id).push(context),
80+
ProposalRoute(
81+
proposalId: ref.id,
82+
version: ref.version,
83+
).push(context),
9584
);
9685
},
97-
onFavoriteChanged: (value) {},
86+
onFavoriteChanged: (value) {
87+
// TODO(LynxLynxx): add on change logic
88+
},
9889
),
9990
);
10091
},
@@ -129,6 +120,20 @@ class _LatestProposalsState extends State<MostRecentProposals> {
129120
);
130121
}
131122

123+
@override
124+
void dispose() {
125+
_scrollController.dispose();
126+
super.dispose();
127+
}
128+
129+
@override
130+
void initState() {
131+
super.initState();
132+
_scrollController = ScrollController();
133+
_scrollController.addListener(_onScroll);
134+
_scrollPercentage = 0.0;
135+
}
136+
132137
void _onHorizontalDrag(DragUpdateDetails details) {
133138
final offset = _scrollController.offset - details.delta.dx;
134139
final overMax = offset > _scrollController.position.maxScrollExtent;

catalyst_voices/apps/voices/lib/pages/funded_projects/funded_projects_page.dart

+64-63
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import 'package:catalyst_cardano_serialization/catalyst_cardano_serialization.da
22
import 'package:catalyst_voices/widgets/widgets.dart';
33
import 'package:catalyst_voices_assets/catalyst_voices_assets.dart';
44
import 'package:catalyst_voices_localization/catalyst_voices_localization.dart';
5+
import 'package:catalyst_voices_models/catalyst_voices_models.dart';
56
import 'package:catalyst_voices_shared/catalyst_voices_shared.dart';
67
import 'package:catalyst_voices_view_models/catalyst_voices_view_models.dart';
78
import 'package:flutter/material.dart';
89

10+
final _favoriteProposals = ValueNotifier<List<FundedProposal>>([]);
11+
912
final _proposalDescription = """
1013
Zanzibar is becoming one of the hotspots for DID's through
1114
World Mobile and PRISM, but its potential is only barely exploited.
@@ -14,9 +17,16 @@ and PRISM, but its potential is only barely exploited.
1417
"""
1518
.replaceAll('\n', ' ');
1619

20+
final _proposalImages = {
21+
for (final (index, proposal) in _proposals.indexed)
22+
proposal.ref: index.isEven
23+
? VoicesAssets.images.proposalBackground1
24+
: VoicesAssets.images.proposalBackground2,
25+
};
26+
1727
final _proposals = [
1828
FundedProposal(
19-
id: 'f14/0',
29+
ref: SignedDocumentRef.generateFirstRef(),
2030
campaignName: 'F14',
2131
category: 'Cardano Use Cases / MVP',
2232
title: 'Proposal Title that rocks the world',
@@ -26,7 +36,7 @@ final _proposals = [
2636
description: _proposalDescription,
2737
),
2838
FundedProposal(
29-
id: 'f14/1',
39+
ref: SignedDocumentRef.generateFirstRef(),
3040
campaignName: 'F14',
3141
category: 'Cardano Use Cases / MVP',
3242
title: 'Proposal Title that rocks the world',
@@ -36,7 +46,7 @@ final _proposals = [
3646
description: _proposalDescription,
3747
),
3848
FundedProposal(
39-
id: 'f14/2',
49+
ref: SignedDocumentRef.generateFirstRef(),
4050
campaignName: 'F14',
4151
category: 'Cardano Use Cases / MVP',
4252
title: 'Proposal Title that rocks the world',
@@ -47,14 +57,15 @@ final _proposals = [
4757
),
4858
];
4959

50-
final _proposalImages = {
51-
for (final (index, proposal) in _proposals.indexed)
52-
proposal.id: index.isEven
53-
? VoicesAssets.images.proposalBackground1
54-
: VoicesAssets.images.proposalBackground2,
55-
};
56-
57-
final _favoriteProposals = ValueNotifier<List<FundedProposal>>([]);
60+
void _onFavoriteChanged(FundedProposal proposal, bool isFavorite) {
61+
final proposals = Set.of(_favoriteProposals.value);
62+
if (isFavorite) {
63+
proposals.add(proposal);
64+
} else {
65+
proposals.remove(proposal);
66+
}
67+
_favoriteProposals.value = proposals.toList();
68+
}
5869

5970
class FundedProjectsPage extends StatelessWidget {
6071
const FundedProjectsPage({super.key});
@@ -76,49 +87,6 @@ class FundedProjectsPage extends StatelessWidget {
7687
}
7788
}
7889

79-
class _Tabs extends StatelessWidget {
80-
const _Tabs();
81-
82-
@override
83-
Widget build(BuildContext context) {
84-
return DefaultTabController(
85-
length: 2,
86-
child: Column(
87-
mainAxisSize: MainAxisSize.min,
88-
crossAxisAlignment: CrossAxisAlignment.start,
89-
children: [
90-
TabBar(
91-
isScrollable: true,
92-
tabAlignment: TabAlignment.start,
93-
tabs: [
94-
Tab(
95-
text: context.l10n.noOfFundedProposals(_proposals.length),
96-
),
97-
Tab(
98-
child: Row(
99-
children: [
100-
VoicesAssets.icons.plusCircleOutlined.buildIcon(),
101-
const SizedBox(width: 8),
102-
Text(context.l10n.followed),
103-
],
104-
),
105-
),
106-
],
107-
),
108-
const SizedBox(height: 24),
109-
const TabBarStackView(
110-
children: [
111-
_AllProposals(),
112-
_FavoriteProposals(),
113-
],
114-
),
115-
const SizedBox(height: 12),
116-
],
117-
),
118-
);
119-
}
120-
}
121-
12290
class _AllProposals extends StatelessWidget {
12391
const _AllProposals();
12492

@@ -133,7 +101,7 @@ class _AllProposals extends StatelessWidget {
133101
children: [
134102
for (final proposal in _proposals)
135103
FundedProposalCard(
136-
image: _proposalImages[proposal.id]!,
104+
image: _proposalImages[proposal.ref]!,
137105
proposal: proposal,
138106
isFavorite: favoriteProposals.contains(proposal),
139107
onFavoriteChanged: (isFavorite) =>
@@ -160,7 +128,7 @@ class _FavoriteProposals extends StatelessWidget {
160128
children: [
161129
for (final proposal in favoriteProposals)
162130
FundedProposalCard(
163-
image: _proposalImages[proposal.id]!,
131+
image: _proposalImages[proposal.ref]!,
164132
proposal: proposal,
165133
isFavorite: true,
166134
onFavoriteChanged: (isFavorite) =>
@@ -173,12 +141,45 @@ class _FavoriteProposals extends StatelessWidget {
173141
}
174142
}
175143

176-
void _onFavoriteChanged(FundedProposal proposal, bool isFavorite) {
177-
final proposals = Set.of(_favoriteProposals.value);
178-
if (isFavorite) {
179-
proposals.add(proposal);
180-
} else {
181-
proposals.remove(proposal);
144+
class _Tabs extends StatelessWidget {
145+
const _Tabs();
146+
147+
@override
148+
Widget build(BuildContext context) {
149+
return DefaultTabController(
150+
length: 2,
151+
child: Column(
152+
mainAxisSize: MainAxisSize.min,
153+
crossAxisAlignment: CrossAxisAlignment.start,
154+
children: [
155+
TabBar(
156+
isScrollable: true,
157+
tabAlignment: TabAlignment.start,
158+
tabs: [
159+
Tab(
160+
text: context.l10n.noOfFundedProposals(_proposals.length),
161+
),
162+
Tab(
163+
child: Row(
164+
children: [
165+
VoicesAssets.icons.plusCircleOutlined.buildIcon(),
166+
const SizedBox(width: 8),
167+
Text(context.l10n.followed),
168+
],
169+
),
170+
),
171+
],
172+
),
173+
const SizedBox(height: 24),
174+
const TabBarStackView(
175+
children: [
176+
_AllProposals(),
177+
_FavoriteProposals(),
178+
],
179+
),
180+
const SizedBox(height: 12),
181+
],
182+
),
183+
);
182184
}
183-
_favoriteProposals.value = proposals.toList();
184185
}

catalyst_voices/apps/voices/lib/pages/overall_spaces/space/discovery_overview.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class _PublishedProposals extends StatelessWidget {
133133
duration: 6,
134134
author: 'Alex Wells',
135135
updateDate: DateTime.now(),
136-
versionCount: 1,
136+
versions: const [],
137137
);
138138
return Column(
139139
mainAxisSize: MainAxisSize.min,

catalyst_voices/apps/voices/lib/pages/overall_spaces/space/workspace_overview.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class _NotPublishedProposals extends StatelessWidget {
9191
duration: 6,
9292
author: 'Alex Wells',
9393
updateDate: DateTime.now(),
94-
versionCount: 1,
94+
versions: const [],
9595
);
9696
return Column(
9797
mainAxisSize: MainAxisSize.min,

catalyst_voices/apps/voices/lib/pages/proposals/proposals_pagination.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,24 @@ class _ProposalsPaginationState extends State<ProposalsPagination> {
7575
builder: (context, item) =>
7676
BlocSelector<ProposalsCubit, ProposalsState, bool>(
7777
selector: (state) {
78-
return state.isFavorite(item.id);
78+
return state.isFavorite(item.ref.id);
7979
},
8080
builder: (context, state) {
8181
return ProposalCard(
82-
key: ValueKey(item.id),
82+
key: ValueKey(item.ref),
8383
proposal: item,
8484
isFavorite: widget.usersFavorite ? item.isFavorite : state,
8585
onTap: () {
8686
final route = ProposalRoute(
87-
proposalId: item.id,
87+
proposalId: item.ref.id,
8888
local: item.isLocal,
8989
);
9090

9191
unawaited(route.push(context));
9292
},
9393
onFavoriteChanged: (isFavorite) async {
9494
await context.read<ProposalsCubit>().onChangeFavoriteProposal(
95-
item.id,
95+
item.ref.id,
9696
isFavorite: isFavorite,
9797
);
9898
},
@@ -177,7 +177,7 @@ class _ProposalsPaginationState extends State<ProposalsPagination> {
177177
final request = ProposalPaginationRequest(
178178
pageKey: newPageKey,
179179
pageSize: pageSize,
180-
lastId: lastItem?.id,
180+
lastId: lastItem?.ref.id,
181181
stage: widget.stage,
182182
categoryId: widget.categoryId,
183183
usersProposals: widget.userProposals,

catalyst_voices/apps/voices/lib/pages/voting/voting_page.dart

+3-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:catalyst_voices_shared/catalyst_voices_shared.dart';
99
import 'package:catalyst_voices_view_models/catalyst_voices_view_models.dart';
1010
import 'package:flutter/material.dart';
1111
import 'package:flutter_bloc/flutter_bloc.dart';
12-
import 'package:uuid_plus/uuid_plus.dart';
1312

1413
final _favoriteProposals = ValueNotifier<List<PendingProposal>>([]);
1514

@@ -23,7 +22,7 @@ and PRISM, but its potential is only barely exploited.
2322

2423
final _proposals = [
2524
PendingProposal(
26-
id: const Uuid().v7(),
25+
ref: SignedDocumentRef.generateFirstRef(),
2726
campaignName: 'F14',
2827
category: 'Cardano Use Cases / MVP',
2928
title: 'Proposal Title that rocks the world',
@@ -37,7 +36,7 @@ final _proposals = [
3736
author: 'Alex Wells',
3837
),
3938
PendingProposal(
40-
id: const Uuid().v7(),
39+
ref: SignedDocumentRef.generateFirstRef(),
4140
campaignName: 'F14',
4241
category: 'Cardano Use Cases / MVP',
4342
title: 'Proposal Title that rocks the world',
@@ -51,7 +50,7 @@ final _proposals = [
5150
author: 'Alex Wells',
5251
),
5352
PendingProposal(
54-
id: const Uuid().v7(),
53+
ref: SignedDocumentRef.generateFirstRef(),
5554
campaignName: 'F14',
5655
category: 'Cardano Use Cases / MVP',
5756
title: 'Proposal Title that rocks the world',

0 commit comments

Comments
 (0)