Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(quick): UI fixes round 2 #2301

Merged
merged 9 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets
7 changes: 7 additions & 0 deletions lib/common/injector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ import 'package:web3dart/web3dart.dart';
final injector = GetIt.instance;
final testnetInjector = GetIt.asNewInstance();

const iapApiTimeout5secInstanceName = 'iapApiTimeout5sec';

Future<void> setupLogger() async {
await FileLogger.initializeLogging();

Expand Down Expand Up @@ -212,6 +214,11 @@ Future<void> setupInjector() async {
injector.registerLazySingleton(() => ChatAuthService(injector()));
injector.registerLazySingleton(
() => IAPApi(authenticatedDio, baseUrl: Environment.autonomyAuthURL));

injector.registerLazySingleton(
() => IAPApi(dio, baseUrl: Environment.autonomyAuthURL),
instanceName: iapApiTimeout5secInstanceName);

injector.registerLazySingleton(
() => UserApi(dio, baseUrl: Environment.autonomyAuthURL));

Expand Down
2 changes: 1 addition & 1 deletion lib/model/additional_data/additional_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class AdditionalData {
return defaultAdditionalData;
}
return CsViewThread(
issueId: issueId,
issueId: issueId.toString(),
notificationType: notificationType,
announcementContentId: announcementContentId,
);
Expand Down
16 changes: 10 additions & 6 deletions lib/screen/alumni_details/alumni_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,16 @@ class _AlumniDetailsPageState extends State<AlumniDetailsPage> {
height: 24,
),
],
if (alumni.website != null && alumni.website!.isNotEmpty) ...[
_alumniUrl(context, alumni.website!),
const SizedBox(
height: 12,
),
],
if (alumni.websiteUrl.isNotEmpty)
...alumni.websiteUrl
.map((url) => [
_alumniUrl(context, url),
const SizedBox(
height: 12,
)
])
.expand((element) => element),

if (alumni.instagramUrl != null && alumni.instagramUrl!.isNotEmpty) ...[
_alumniUrl(context, alumni.instagramUrl!, title: 'instagram'.tr()),
const SizedBox(
Expand Down
2 changes: 1 addition & 1 deletion lib/screen/customer_support/support_thread_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class _SupportThreadPageState extends State<SupportThreadPage> {
});
}
case NewIssueFromAnnouncementPayload:
_reportIssueType = ReportIssueType.Announcement;
_reportIssueType = ReportIssueType.ChatWithFeralfile;
case DetailIssuePayload:
_reportIssueType = (payload as DetailIssuePayload).reportIssueType;
_status = payload.status;
Expand Down
28 changes: 14 additions & 14 deletions lib/screen/feralfile_home/feralfile_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

enum FeralfileHomeTab {
featured,
artworks,
exhibitions,
artworks,
featured,
artists,
curators,
rAndD;
Expand Down Expand Up @@ -127,7 +127,7 @@ class FeralfileHomePageState extends State<FeralfileHomePage>
super.initState();
_canvasDeviceBloc = injector.get<CanvasDeviceBloc>();
context.read<FeralfileHomeBloc>().add(FeralFileHomeFetchDataEvent());
_selectedIndex = FeralfileHomeTab.featured.index;
_selectedIndex = FeralfileHomeTab.exhibitions.index;
}

Widget _castButton(BuildContext context, List<Artwork> featuredArtworks) {
Expand Down Expand Up @@ -234,13 +234,14 @@ class FeralfileHomePageState extends State<FeralfileHomePage>
final numberFormater = NumberFormat('#,###', 'en_US');
return [
Item(
id: FeralfileHomeTab.featured.index.toString(),
title: 'featured'.tr(),
subtitle: state.featuredArtworks != null
? numberFormater.format(state.featuredArtworks!.length)
id: FeralfileHomeTab.exhibitions.index.toString(),
title: 'exhibitions'.tr(),
subtitle: state.exploreStatisticsData != null
? numberFormater
.format(state.exploreStatisticsData!.totalExhibition)
: '-',
onSelected: () {
_selectTab(FeralfileHomeTab.featured);
_selectTab(FeralfileHomeTab.exhibitions);
},
),
Item(
Expand All @@ -254,14 +255,13 @@ class FeralfileHomePageState extends State<FeralfileHomePage>
},
),
Item(
id: FeralfileHomeTab.exhibitions.index.toString(),
title: 'exhibitions'.tr(),
subtitle: state.exploreStatisticsData != null
? numberFormater
.format(state.exploreStatisticsData!.totalExhibition)
id: FeralfileHomeTab.featured.index.toString(),
title: 'featured'.tr(),
subtitle: state.featuredArtworks != null
? numberFormater.format(state.featuredArtworks!.length)
: '-',
onSelected: () {
_selectTab(FeralfileHomeTab.exhibitions);
_selectTab(FeralfileHomeTab.featured);
},
),
Item(
Expand Down
4 changes: 3 additions & 1 deletion lib/service/iap_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,9 @@ class IAPServiceImpl implements IAPService {
@override
Future<String> getStripeUrl() async {
try {
final res = await injector<IAPApi>().portalUrl() as Map<String, dynamic>;
final res =
await injector<IAPApi>(instanceName: iapApiTimeout5secInstanceName)
.portalUrl() as Map<String, dynamic>;
return res['url'] as String;
} catch (error) {
log.warning('Error when getting stripe portal url: $error');
Expand Down
5 changes: 4 additions & 1 deletion lib/util/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,10 @@ class ReportIssueType {
static const Exception = 'exception';
static const Announcement = 'announcement';
static const MerchandiseIssue = 'merchandise postcard';
static const ChatWithFeralfile = 'chat with Feral File';

static List<String> get getList =>
[Bug, Exception, Announcement, MerchandiseIssue];
[Bug, Exception, Announcement, MerchandiseIssue, ChatWithFeralfile];

static List<String> get getSuggestList => [Bug];

Expand All @@ -298,6 +299,8 @@ class ReportIssueType {
return 'Report a bug';
case Announcement:
return 'announcement'.tr();
case ChatWithFeralfile:
return 'chat_with_feralfile'.tr();
case MerchandiseIssue:
return 'Merchandise issue';
case Bug:
Expand Down
14 changes: 14 additions & 0 deletions lib/util/feralfile_alumni_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,20 @@ extension AlumniAccountExt on AlumniAccount {
? getFFUrl(avatarURI!)
: null;

List<String> get websiteUrl {
final listRawWebsite =
website?.split('&').map((e) => e.trim()).where((e) => e.isNotEmpty) ??
[];
final listWebsite = listRawWebsite.map((e) {
if (e.startsWith('http')) {
return e;
}

return 'http://$e';
}).toList();
return listWebsite;
}

String? get instagramUrl {
final instagramID = socialNetworks?.instagramID;
if (instagramID == null || instagramID.isEmpty) {
Expand Down
15 changes: 9 additions & 6 deletions lib/view/alumni_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,15 @@ class AlumniProfile extends StatelessWidget {
height: 24,
),
],
if (alumni.website != null && alumni.website!.isNotEmpty) ...[
_alumniUrl(context, alumni.website!),
const SizedBox(
height: 12,
),
],
if (alumni.websiteUrl.isNotEmpty)
...alumni.websiteUrl
.map((url) => [
_alumniUrl(context, url),
const SizedBox(
height: 12,
)
])
.expand((element) => element),
if (alumni.instagramUrl != null && alumni.instagramUrl!.isNotEmpty) ...[
_alumniUrl(context, alumni.instagramUrl!, title: 'Instagram'),
const SizedBox(
Expand Down
6 changes: 3 additions & 3 deletions lib/view/ff_exhibition_participants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ List<TextSpan> exhibitionParticipantSpans(List<AlumniAccount> participants) {
.openFeralFileCuratorPage(alumni.slug!)
: injector<NavigationService>()
.openFeralFileArtistPage(alumni.slug!));
} else if (alumni.website != null) {
await launchUrl(Uri.parse(alumni.website!));
} else if (alumni.websiteUrl.isNotEmpty) {
await launchUrl(Uri.parse(alumni.websiteUrl.first));
}
},
text: alumni.displayAlias,
style: TextStyle(
decoration: alumni.slug != null || alumni.website != null
decoration: alumni.slug != null || alumni.websiteUrl.isNotEmpty
? TextDecoration.underline
: TextDecoration.none,
),
Expand Down
Loading