Skip to content

Commit

Permalink
el/add-greenbay-link-to-ceremony-box (#1004)
Browse files Browse the repository at this point in the history
* try add greenbay link for info icon button

* changed onPressedInfo to onInfoPressed

* fix README.md file

* added real greenbay cid to case
  • Loading branch information
Eldar2021 authored Feb 20, 2023
1 parent 9576853 commit 91e0c27
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 16 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ You may build the App with Flutter's [Deployment Documentation](https://flutter.

In order to build a fat APK, you can do
```shell
melos build-apk
melos build-apk-fdroid
# windows
pub global run melos build-apk
pub global run melos build-apk-fdroid
```
and find the output in `build/app/outputs/apk/fdroid/release/app-fdroid-release.apk`

Expand All @@ -147,13 +147,13 @@ The following file contains the supported flutter version:
* run all tests from the command line:`./flutterw test`
* exclude e2e-tests that need a running encointer node:
```shell
melos unit-test-encointer-exclude-node-e2e
melos unit-test-app-exclude-encointer-node-e2e
```
* run e2e-tests that need a running encointer node:
```shell
melos unit-test-encointer-node-e2e
melos unit-test-app-with-encointer-node-e2e
# windows
pub global run melos unit-test-encointer-node-e2e
pub global run melos unit-test-app-with-encointer-node-e2e
```

### Integration tests
Expand Down Expand Up @@ -244,9 +244,9 @@ e.g. `@JsonSerializable` or the mobx annotations. Whenever annotations are added
command must be run to update the `*.g` files.

```shell
melos generate-build-runner
melos run-build-runner
# windows
pub global run melos generate-build-runner
pub global run melos run-build-runner
```

## GitHub Actions Hints
Expand Down
11 changes: 9 additions & 2 deletions app/lib/config/consts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,20 @@ const int secondOfYear = 365 * 24 * 60 * 60; // seconds of one year
const localePlaceHolder = 'LOCALE_PLACEHOLDER';
const ceremonyInfoLinkBase = 'https://leu.zuerich/$localePlaceHolder/#zeremonien';
const _leuZurichLink = 'https://leu.zuerich/$localePlaceHolder';
const _greenbayLink = 'http://greenbaydollar.com/';
const meetupNotificationLink = 'https://encointer.github.io/feed/community_messages/$localePlaceHolder/cm.json';
const encointerLink = 'https://wallet.encointer.org/app/';

String toDeepLink([String? linkText]) => '$encointerLink${linkText?.replaceAll('\n', '_')}';

String ceremonyInfoLink(String locale) {
return replaceLocalePlaceholder(ceremonyInfoLinkBase, locale);
String ceremonyInfoLink(String locale, String cid) {
switch (cid) {
case 'dpcmj33LUs9':
case 'dpcm5272THU':
return _greenbayLink;
default:
return replaceLocalePlaceholder(ceremonyInfoLinkBase, locale);
}
}

String leuZurichLink(String locale) {
Expand Down
13 changes: 10 additions & 3 deletions app/lib/page-encointer/ceremony_box/ceremony_info.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'package:encointer_wallet/common/theme.dart';
import 'package:encointer_wallet/config/consts.dart';
import 'package:encointer_wallet/models/index.dart';
import 'package:encointer_wallet/page-encointer/ceremony_box/components/ceremony_info_and_calendar.dart';
import 'package:encointer_wallet/page-encointer/ceremony_box/components/ceremony_progress_bar.dart';
import 'package:encointer_wallet/page-encointer/ceremony_box/components/ceremony_schedule.dart';
import 'package:encointer_wallet/service/launch/app_launch.dart';
import 'package:encointer_wallet/store/app.dart';
import 'package:encointer_wallet/utils/translations/index.dart';

class CeremonyInfo extends StatelessWidget {
Expand All @@ -32,8 +35,6 @@ class CeremonyInfo extends StatelessWidget {
final languageCode = Localizations.localeOf(context).languageCode;
final dic = I18n.of(context)!.translationsForLocale();

final infoLink = ceremonyInfoLink(languageCode);

return Container(
child: meetupTime != null
? Column(
Expand Down Expand Up @@ -62,8 +63,14 @@ class CeremonyInfo extends StatelessWidget {
),
CeremonyInfoAndCalendar(
nextCeremonyDate: DateTime.fromMillisecondsSinceEpoch(meetupTime!),
infoLink: infoLink,
devMode: devMode,
onInfoPressed: () async {
final infoLink = ceremonyInfoLink(
languageCode,
context.read<AppStore>().encointer.community?.cid.toFmtString() ?? '',
);
await AppLaunch.launchURL(infoLink);
},
),
],
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import 'package:flutter/material.dart';
import 'package:iconsax/iconsax.dart';

import 'package:encointer_wallet/page-encointer/ceremony_box/ceremony_box_service.dart';
import 'package:encointer_wallet/service/launch/app_launch.dart';
import 'package:encointer_wallet/utils/translations/index.dart';

class CeremonyInfoAndCalendar extends StatelessWidget {
const CeremonyInfoAndCalendar({
required this.nextCeremonyDate,
this.infoLink,
this.onInfoPressed,
this.devMode = false,
super.key,
});
Expand All @@ -20,7 +19,7 @@ class CeremonyInfoAndCalendar extends StatelessWidget {
final DateTime nextCeremonyDate;

/// open this Uri in a browser to give the user background information
final String? infoLink;
final void Function()? onInfoPressed;

@override
Widget build(BuildContext context) {
Expand All @@ -34,7 +33,7 @@ class CeremonyInfoAndCalendar extends StatelessWidget {
quarterTurns: 2,
child: Icon(Iconsax.info_circle),
),
onPressed: () => AppLaunch.launchURL(infoLink!),
onPressed: onInfoPressed,
),
if (showAddToCalendarIconButton)
IconButton(
Expand Down

0 comments on commit 91e0c27

Please sign in to comment.