Skip to content

Commit

Permalink
Don't show activity indicator if no community has been selected, and …
Browse files Browse the repository at this point in the history
…run tests synchronized to make them less flaky.
  • Loading branch information
clangenb committed Oct 22, 2023
1 parent 65b893f commit 369ecd3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 33 deletions.
4 changes: 1 addition & 3 deletions app/lib/common/components/logo/community_icon.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter_svg/svg.dart';
Expand Down Expand Up @@ -28,8 +27,7 @@ class CommunityIconObserver extends StatelessWidget {
return SvgPicture.asset(fallBackCommunityIcon);
}
} else {
///TODO(Azamat): Add some image saying community not selected
return const CupertinoActivityIndicator();
return SvgPicture.asset(fallBackCommunityIcon);
}
},
),
Expand Down
41 changes: 13 additions & 28 deletions app/lib/page/assets/index.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:upgrader/upgrader.dart';
import 'package:collection/collection.dart';

import 'package:encointer_wallet/l10n/l10.dart';
import 'package:encointer_wallet/common/components/loading/centered_activity_indicator.dart';
import 'package:encointer_wallet/page/assets/announcement/view/announcement_view.dart';
import 'package:encointer_wallet/common/components/address_icon.dart';
import 'package:encointer_wallet/gen/assets.gen.dart';
Expand Down Expand Up @@ -351,41 +350,27 @@ class _AssetsViewState extends State<AssetsView> {

List<AccountOrCommunityData> _allCommunities() {
final communityStores = context.read<AppStore>().encointer.communityStores?.values.toList();
if (communityStores != null && communityStores.isNotEmpty) {
return communityStores
.mapIndexed(
(i, e) => AccountOrCommunityData(
avatar: Container(
height: avatarSize,
width: avatarSize,
decoration: BoxDecoration(
color: context.colorScheme.background,
shape: BoxShape.circle,
),
child: e.communityIcon != null
? SvgPicture.string(e.communityIcon!)
: SvgPicture.asset(fallBackCommunityIcon),
),
name: e.name,
isSelected: widget.store.encointer.community?.cid == e.cid,
),
)
.toList();
} else {
return [
AccountOrCommunityData(

if (communityStores == null) return [];
return communityStores
.mapIndexed(
(i, e) => AccountOrCommunityData(
avatar: Container(
height: avatarSize,
width: avatarSize,
decoration: BoxDecoration(
color: context.colorScheme.background,
shape: BoxShape.circle,
),
child: const CenteredActivityIndicator(),
child: e.communityIcon != null
? SvgPicture.string(e.communityIcon!)
: SvgPicture.asset(fallBackCommunityIcon),
),
name: '...')
];
}
name: e.name,
isSelected: widget.store.encointer.community?.cid == e.cid,
),
)
.toList();
}

List<AccountOrCommunityData> initAllAccounts() {
Expand Down
2 changes: 0 additions & 2 deletions app/test_driver/app/home/home_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Future<void> homeInit(FlutterDriver driver) async {
}

Future<void> changeCommunity(FlutterDriver driver) async {
await driver.runUnsynchronized(() async {
await driver.tap(find.byValueKey(EWTestKeys.panelController));
await driver.tap(find.byValueKey(EWTestKeys.addCommunity));

Expand All @@ -21,7 +20,6 @@ Future<void> changeCommunity(FlutterDriver driver) async {
await Future<void>.delayed(const Duration(milliseconds: 1000));
await closePanel(driver);
await refreshWalletPage(driver);
});
}

Future<void> registerAndWait(FlutterDriver driver, ParticipantTypeTestHelper registrationType) async {
Expand Down

0 comments on commit 369ecd3

Please sign in to comment.