Skip to content

Commit

Permalink
Added follow menu in account.
Browse files Browse the repository at this point in the history
  • Loading branch information
jigar-f committed Mar 21, 2024
1 parent 1840fb5 commit 2498af8
Show file tree
Hide file tree
Showing 6 changed files with 157 additions and 46 deletions.
10 changes: 10 additions & 0 deletions assets/images/thumb_up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions assets/locales/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -1481,4 +1481,19 @@ msgstr "Terms of Service"
msgid "invalid_verification_code"
msgstr "Invalid verification code"

msgid "follow_us"
msgstr "Follow Us"

msgid "follow_us_telegram"
msgstr "Follow us Telegram "

msgid "follow_us_instagram"
msgstr "Follow us Instagram"

msgid "follow_us_facebook"
msgstr "Follow us Facebook "

msgid "follow_us_x"
msgstr "Follow us X "


110 changes: 65 additions & 45 deletions lib/account/account.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'package:lantern/account/follow_us.dart';
import 'package:lantern/common/common.dart';
import 'package:lantern/messaging/messaging_model.dart';

@RoutePage<void>(name: 'Account')
class AccountMenu extends StatelessWidget {
const AccountMenu({Key? key}) : super(key: key);
const AccountMenu({Key? key}) : super(key: key);

Future<void> authorizeDeviceForPro(BuildContext context) async =>
await context.pushRoute(AuthorizePro());
Expand All @@ -23,31 +24,44 @@ class AccountMenu extends StatelessWidget {
void upgradeToLanternPro(BuildContext context) async =>
await context.pushRoute(const PlansPage());

void showSocialBottomSheet(BuildContext context) {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16), topRight: Radius.circular(16))),
builder: (context) {
return FollowUs();
},
);
}

List<Widget> freeItems(BuildContext context, SessionModel sessionModel) {
return [
if (Platform.isAndroid) messagingModel.getOnBoardingStatus(
(context, hasBeenOnboarded, child) => hasBeenOnboarded == true
? messagingModel.getCopiedRecoveryStatus(
(
BuildContext context,
bool hasCopiedRecoveryKey,
Widget? child,
) =>
ListItemFactory.settingsItem(
icon: ImagePaths.account,
content: 'account_management'.i18n,
onTap: () async =>
await context.pushRoute(AccountManagement(isPro: false)),
trailingArray: [
if (!hasCopiedRecoveryKey)
const CAssetImage(
path: ImagePaths.badge,
),
],
),
)
: const SizedBox(),
),
if (Platform.isAndroid)
messagingModel.getOnBoardingStatus(
(context, hasBeenOnboarded, child) => hasBeenOnboarded == true
? messagingModel.getCopiedRecoveryStatus(
(
BuildContext context,
bool hasCopiedRecoveryKey,
Widget? child,
) =>
ListItemFactory.settingsItem(
icon: ImagePaths.account,
content: 'account_management'.i18n,
onTap: () async => await context
.pushRoute(AccountManagement(isPro: false)),
trailingArray: [
if (!hasCopiedRecoveryKey)
const CAssetImage(
path: ImagePaths.badge,
),
],
),
)
: const SizedBox(),
),
if (Platform.isAndroid)
ListItemFactory.settingsItem(
key: AppKeys.upgrade_lantern_pro,
Expand Down Expand Up @@ -79,23 +93,21 @@ class AccountMenu extends StatelessWidget {
return [
messagingModel.getOnBoardingStatus(
(context, hasBeenOnboarded, child) =>
messagingModel.getCopiedRecoveryStatus(
(BuildContext context, bool hasCopiedRecoveryKey, Widget? child) =>
ListItemFactory.settingsItem(
key: AppKeys.account_management,
icon: ImagePaths.account,
content: 'account_management'.i18n,
onTap: () async => await context
.pushRoute(AccountManagement(isPro: true)),
trailingArray: [
if (!hasCopiedRecoveryKey && hasBeenOnboarded == true)
const CAssetImage(
path: ImagePaths.badge,
),
],
)

),
messagingModel.getCopiedRecoveryStatus((BuildContext context,
bool hasCopiedRecoveryKey, Widget? child) =>
ListItemFactory.settingsItem(
key: AppKeys.account_management,
icon: ImagePaths.account,
content: 'account_management'.i18n,
onTap: () async =>
await context.pushRoute(AccountManagement(isPro: true)),
trailingArray: [
if (!hasCopiedRecoveryKey && hasBeenOnboarded == true)
const CAssetImage(
path: ImagePaths.badge,
),
],
)),
),
ListItemFactory.settingsItem(
icon: ImagePaths.star,
Expand All @@ -116,11 +128,19 @@ class AccountMenu extends StatelessWidget {

List<Widget> commonItems(BuildContext context) {
return [
if (Platform.isAndroid) ListItemFactory.settingsItem(
icon: ImagePaths.desktop,
content: 'desktop_version'.i18n,
if (isMobile())
ListItemFactory.settingsItem(
icon: ImagePaths.desktop,
content: 'desktop_version'.i18n,
onTap: () {
openDesktopVersion(context);
},
),
ListItemFactory.settingsItem(
icon: ImagePaths.thumbUp,
content: 'follow_us'.i18n,
onTap: () {
openDesktopVersion(context);
showSocialBottomSheet(context);
},
),
ListItemFactory.settingsItem(
Expand Down
66 changes: 66 additions & 0 deletions lib/account/follow_us.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import '../common/common.dart';

enum _social {
facebook,
x,
instagram,
telegram,
}

class FollowUs extends StatelessWidget {
const FollowUs({super.key});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const SizedBox(height: 5),
CText('follow_us'.i18n, style: tsHeading1),
const SizedBox(height: 5),
const CDivider(),
ListItemFactory.settingsItem(
icon: ImagePaths.thumbUp,
content: 'follow_us_telegram'.i18n,
height: 60,
onTap: () => onSocialTap(_social.telegram),
),
ListItemFactory.settingsItem(
icon: ImagePaths.thumbUp,
content: 'follow_us_x'.i18n,
height: 60,
onTap: () => onSocialTap(_social.x),
),
ListItemFactory.settingsItem(
icon: ImagePaths.thumbUp,
content: 'follow_us_instagram'.i18n,
height: 60,
onTap: () => onSocialTap(_social.instagram),
),
ListItemFactory.settingsItem(
icon: ImagePaths.thumbUp,
content: 'follow_us_facebook'.i18n,
height: 60,
onTap: () => onSocialTap(_social.facebook),
),
const SizedBox(height: 20),
],
),
);
}

void onSocialTap(_social social) {
switch (social) {
case _social.facebook:
// TODO: Handle this case.
case _social.x:
// TODO: Handle this case.
case _social.instagram:
// TODO: Handle this case.
case _social.telegram:
// TODO: Handle this case.
}
}
}
1 change: 0 additions & 1 deletion lib/common/ui/custom/list_item_factory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ class ListItemFactory extends StatelessWidget {
key: key,
color: transparent,
child: CInkWell(

disableSplash: disableSplash ?? false,
overrideColor: overrideColor,
onTap: onTap ?? () {},
Expand Down
1 change: 1 addition & 0 deletions lib/common/ui/image_paths.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ImagePaths {
static const forum = 'assets/images/forum.svg';
static const webMoney = 'assets/images/webmoney.svg';
static const bitcoin = 'assets/images/bitcoin.svg';
static const thumbUp = 'assets/images/thumb_up.svg';

// Messaging
static const more_vert = 'assets/images/more_vert.svg';
Expand Down

0 comments on commit 2498af8

Please sign in to comment.