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

Reminder For Merging Email and Phone number in the profile section #1932

Merged
merged 1 commit into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 6 additions & 3 deletions mobile/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@
"youWouldBeRequiredToAddYourEmailToYourProfileOnTheMobileAppToEnableYouAccessThe" :" You would be required to add your email to your profile on the mobile app to enable you access the ",
"withOneAccount":" with one account.",
"addMyEmail":"Add my email",
"remindMeLater":"Remind me later"

}
"remindMeLater":"Remind me later",
"addMyEmailToMyProfile":"Add my email to my profile",
"addYourEmailToYourProfileToEnableYouToAccessThe" : "Add your email to your profile to enable you to access the ",
"accessDeeperAirQualityInsights":"Access deeper Air Quality insights",
"usingYourAirQoMobileAppAccount":"using your AirQo mobile app account"
}
6 changes: 5 additions & 1 deletion mobile/lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,9 @@
"youWouldBeRequiredToAddYourEmailToYourProfileOnTheMobileAppToEnableYouAccessThe" : " Vous devrez ajouter votre e-mail à votre profil sur l'application mobile pour vous permettre d'accéder au ",
"withOneAccount":" avec un compte.",
"addMyEmail":"ajouter mon e-mail",
"remindMeLater":"Rappelez-moi plus tard"
"remindMeLater":"Rappelez-moi plus tard",
"addMyEmailToMyProfile":"Ajoutez mon e-mail à mon profil",
"addYourEmailToYourProfileToEnableYouToAccessThe" : "Ajoutez votre e-mail à votre profil pour vous permettre d'accéder au ",
"accessDeeperAirQualityInsights":"Accéder à des informations plus approfondies sur la qualité de l'air",
"usingYourAirQoMobileAppAccount":"En utilisant votre compte AirQo Mobile App"
}
7 changes: 5 additions & 2 deletions mobile/lib/l10n/app_lg.arb
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@
"youWouldBeRequiredToAddYourEmailToYourProfileOnTheMobileAppToEnableYouAccessThe":" Wandibadde weetaaga okwongera email yo ku profile yo ku app y'essimu okukusobozesa okuyingira mu ",
"withOneAccount":" nga erina akawunti emu.",
"addMyEmail":"Yongerako email yange",
"remindMeLater":"Nzijukiza oluvannyuma"

"remindMeLater":"Nzijukiza oluvannyuma",
"addMyEmailToMyProfile":"Yongerako email yange ku profile yange",
"addYourEmailToYourProfileToEnableYouToAccessThe" : "Yongerako email yo ku profile yo okukusobozesa okuyingira mu ",
"accessDeeperAirQualityInsights":"okwekenenya okw'omutindo gw'empewo",
"usingYourAirQoMobileAppAccount":"okuva ku akawunti yo ku app ya AirQo"
}
6 changes: 5 additions & 1 deletion mobile/lib/l10n/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -353,5 +353,9 @@
"youWouldBeRequiredToAddYourEmailToYourProfileOnTheMobileAppToEnableYouAccessThe":" Você deverá adicionar seu e-mail ao seu perfil no aplicativo móvel para permitir o acesso ao ",
"withOneAccount":" com uma conta.",
"addMyEmail":"Adicionar meu e-mail",
"remindMeLater":"Lembre-me mais tarde"
"remindMeLater":"Lembre-me mais tarde",
"addMyEmailToMyProfile":"Adicionar meu e-mail ao meu perfil",
"addYourEmailToYourProfileToEnableYouToAccessThe" : "Adicione seu e-mail ao seu perfil para permitir o acesso ao ",
"accessDeeperAirQualityInsights":"acesso a insights mais profundos sobre a qualidade do ar",
"usingYourAirQoMobileAppAccount":"Usando sua conta do aplicativo móvel AirQo"
}
6 changes: 5 additions & 1 deletion mobile/lib/l10n/app_sw.arb
Original file line number Diff line number Diff line change
Expand Up @@ -354,5 +354,9 @@
"youWouldBeRequiredToAddYourEmailToYourProfileOnTheMobileAppToEnableYouAccessThe":" Utahitajika kuongeza barua pepe yako kwenye wasifu wako kwenye programu ya simu ili kukuwezesha kufikia ",
"withOneAccount":" na akaunti moja.",
"addMyEmail":"Ongeza barua pepe yangu",
"remindMeLater":"Nikumbushe baadaye"
"remindMeLater":"Nikumbushe baadaye",
"addMyEmailToMyProfile":"Ongeza barua pepe yangu kwenye wasifu wangu",
"addYourEmailToYourProfileToEnableYouToAccessThe" : "Ongeza barua pepe yako kwenye wasifu wako ili uweze kufikia ",
"accessDeeperAirQualityInsights":"fikia maelezo zaidi ya ubora wa hewa",
"usingYourAirQoMobileAppAccount":"Kwa kutumia akaunti yako ya programu ya simu ya AirQo"
}
19 changes: 11 additions & 8 deletions mobile/lib/screens/email_link/email_link_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
bool shouldShowBottomSheet = true;
int remindMeLaterTimestamp = prefs.getInt('remindMeLaterTimestamp') ?? 0;

if (remindMeLaterTimestamp > 0) {
if (remindMeLaterTimestamp > 3) {

Check warning on line 20 in mobile/lib/screens/email_link/email_link_page.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_page.dart#L20

Added line #L20 was not covered by tests
DateTime lastRemindTimestamp =
DateTime.fromMillisecondsSinceEpoch(remindMeLaterTimestamp);
DateTime now = DateTime.now();
Expand Down Expand Up @@ -84,7 +84,8 @@
width: 295.53,
height: 67,
child: AutoSizeText(
AppLocalizations.of(context)!.weAreShufflingThingsAroundForYou,
AppLocalizations.of(context)!
.weAreShufflingThingsAroundForYou,

Check warning on line 88 in mobile/lib/screens/email_link/email_link_page.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_page.dart#L87-L88

Added lines #L87 - L88 were not covered by tests
textAlign: TextAlign.center,
style: TextStyle(
color: CustomColors.quizColorBlack,
Expand All @@ -101,8 +102,9 @@
textAlign: TextAlign.center,
text: TextSpan(
children: [
TextSpan(
text:AppLocalizations.of(context)!.youWouldBeRequiredToAddYourEmailToYourProfileOnTheMobileAppToEnableYouAccessThe,
TextSpan(
text: AppLocalizations.of(context)!
.youWouldBeRequiredToAddYourEmailToYourProfileOnTheMobileAppToEnableYouAccessThe,

Check warning on line 107 in mobile/lib/screens/email_link/email_link_page.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_page.dart#L105-L107

Added lines #L105 - L107 were not covered by tests
style: const TextStyle(
color: Color(0xFF485972),
fontSize: 13.24,
Expand Down Expand Up @@ -131,8 +133,9 @@
}
},
),
TextSpan(
text: AppLocalizations.of(context)!.withOneAccount,
TextSpan(
text: AppLocalizations.of(context)!
.withOneAccount,

Check warning on line 138 in mobile/lib/screens/email_link/email_link_page.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_page.dart#L136-L138

Added lines #L136 - L138 were not covered by tests
style: const TextStyle(
color: Color(0xFF485972),
fontSize: 13.24,
Expand All @@ -152,7 +155,7 @@
},
));
},
child: EmailLinkActionButton(
child: EmailLinkActionButton(

Check warning on line 158 in mobile/lib/screens/email_link/email_link_page.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_page.dart#L158

Added line #L158 was not covered by tests
text: AppLocalizations.of(context)!.addMyEmail,
),
),
Expand All @@ -165,7 +168,7 @@
DateTime.now().millisecondsSinceEpoch,
);
},
child: EmailLinkSkipButton(
child: EmailLinkSkipButton(

Check warning on line 171 in mobile/lib/screens/email_link/email_link_page.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_page.dart#L171

Added line #L171 was not covered by tests
text: AppLocalizations.of(context)!.remindMeLater,
),
),
Expand Down
21 changes: 15 additions & 6 deletions mobile/lib/screens/email_link/email_link_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:shared_preferences/shared_preferences.dart';

class EmailLinkActionButton extends StatelessWidget {
const EmailLinkActionButton({
Expand Down Expand Up @@ -115,7 +116,7 @@
),
Expanded(
child: AutoSizeText(
'Your Email is already registered ',
AppLocalizations.of(context)!.yourEmailIsAlreadyRegistered,

Check warning on line 119 in mobile/lib/screens/email_link/email_link_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_widgets.dart#L119

Added line #L119 was not covered by tests
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
Expand Down Expand Up @@ -189,12 +190,20 @@
children: [
const SizedBox(height: 8),
GestureDetector(
onTap: () {
Navigator.push(
onTap: () async {

Check warning on line 193 in mobile/lib/screens/email_link/email_link_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_widgets.dart#L193

Added line #L193 was not covered by tests
SharedPreferences prefs =
await SharedPreferences.getInstance();
prefs.setInt(

Check warning on line 196 in mobile/lib/screens/email_link/email_link_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_widgets.dart#L195-L196

Added lines #L195 - L196 were not covered by tests
'remindMeLaterTimestamp',
DateTime.now().millisecondsSinceEpoch,

Check warning on line 198 in mobile/lib/screens/email_link/email_link_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_widgets.dart#L198

Added line #L198 was not covered by tests
);
Navigator.pop(context);
Navigator.pushAndRemoveUntil(

Check warning on line 201 in mobile/lib/screens/email_link/email_link_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_widgets.dart#L200-L201

Added lines #L200 - L201 were not covered by tests
context,
MaterialPageRoute(
builder: (context) => const HomePage(),
),
MaterialPageRoute(builder: (context) {

Check warning on line 203 in mobile/lib/screens/email_link/email_link_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_widgets.dart#L203

Added line #L203 was not covered by tests
return const HomePage();
}),
(r) => true,

Check warning on line 206 in mobile/lib/screens/email_link/email_link_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/email_link/email_link_widgets.dart#L206

Added line #L206 was not covered by tests
);
},
child: Text(
Expand Down
1 change: 0 additions & 1 deletion mobile/lib/screens/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,6 @@ class _HomePageState extends State<HomePage> {
} else if (user.isAnonymous) {
return;
}
await Future.delayed(const Duration(seconds: 2));
if (mounted) {
await bottomSheetEmailLink(context);
}
Expand Down
21 changes: 19 additions & 2 deletions mobile/lib/screens/profile/profile_view.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:app/blocs/blocs.dart';
import 'package:app/models/models.dart';
import 'package:app/services/firebase_service.dart';
import 'package:app/themes/theme.dart';
import 'package:app/widgets/widgets.dart';
import 'package:flutter/material.dart';
Expand All @@ -14,6 +15,16 @@

@override
Widget build(BuildContext context) {
final user = CustomAuth.getUser();

Check warning on line 18 in mobile/lib/screens/profile/profile_view.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_view.dart#L18

Added line #L18 was not covered by tests
bool showLinkAccountReminder = false;

if (user != null && user.phoneNumber != null) {
if (user.email != null) {
} else if (user.isAnonymous) {

Check warning on line 23 in mobile/lib/screens/profile/profile_view.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_view.dart#L21-L23

Added lines #L21 - L23 were not covered by tests
} else {
showLinkAccountReminder = true;
}
}
return BlocBuilder<ProfileBloc, Profile>(
builder: (context, profile) {
if (profile.isAnonymous) {
Expand All @@ -24,9 +35,15 @@
appBar: ProfileViewAppBar(profile),
body: AppSafeArea(
horizontalPadding: 16,
child: Column(
child: ListView(

Check warning on line 38 in mobile/lib/screens/profile/profile_view.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_view.dart#L38

Added line #L38 was not covered by tests
children: <Widget>[
const SizedBox(height: 10),
//TODO new feature loading
Visibility(

Check warning on line 42 in mobile/lib/screens/profile/profile_view.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_view.dart#L42

Added line #L42 was not covered by tests
visible: showLinkAccountReminder,
child: const LinkAccountReminder(),
),
const SizedBox(height: 6),
ProfileSection(profile),
const SizedBox(height: 16),
CardSection(
Expand All @@ -37,7 +54,7 @@
isBottomItem: true,
isTopItem: true,
),
const Spacer(),
const SizedBox(height: 10),
const SignOutButton(),
const SizedBox(height: 10),
],
Expand Down
129 changes: 129 additions & 0 deletions mobile/lib/screens/profile/profile_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
import 'package:app/blocs/blocs.dart';
import 'package:app/constants/constants.dart';
import 'package:app/models/models.dart';
import 'package:app/screens/email_link/confirm_account_details.dart';
import 'package:app/screens/notification/notification_page.dart';
import 'package:app/services/services.dart';
import 'package:app/themes/theme.dart';
import 'package:app/utils/utils.dart';
import 'package:app/widgets/widgets.dart';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_svg/svg.dart';
import 'package:image_picker/image_picker.dart';
import 'package:url_launcher/url_launcher.dart';

import '../favourite_places/favourite_places_page.dart';
import '../feedback/feedback_page.dart';
Expand Down Expand Up @@ -1080,3 +1084,128 @@
);
}
}

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

@override

Check warning on line 1091 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1091

Added line #L1091 was not covered by tests
Widget build(BuildContext context) {
return Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),

Check warning on line 1095 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1093-L1095

Added lines #L1093 - L1095 were not covered by tests
),
color: const Color.fromARGB(255, 184, 217, 255),
elevation: 1,
child: Padding(

Check warning on line 1099 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1099

Added line #L1099 was not covered by tests
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
child: SizedBox(
child: Column(

Check warning on line 1102 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1101-L1102

Added lines #L1101 - L1102 were not covered by tests
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
AppLocalizations.of(context)!.accessDeeperAirQualityInsights,

Check warning on line 1107 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1105-L1107

Added lines #L1105 - L1107 were not covered by tests
style: const TextStyle(
color: Color.fromARGB(197, 0, 0, 0),
fontSize: 18,
fontWeight: FontWeight.w600,
),
),
const SizedBox(height: 4),
RichText(

Check warning on line 1115 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1115

Added line #L1115 was not covered by tests
textAlign: TextAlign.start,
text: TextSpan(
children: [
TextSpan(
text: AppLocalizations.of(context)!
.addYourEmailToYourProfileToEnableYouToAccessThe,

Check warning on line 1121 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1117-L1121

Added lines #L1117 - L1121 were not covered by tests
style: const TextStyle(
color: Color(0xFF485972),
fontSize: 13.24,
fontWeight: FontWeight.w400,
),
),
TextSpan(

Check warning on line 1128 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1128

Added line #L1128 was not covered by tests
text: "AirQo analytics ",
style: TextStyle(
color: CustomColors.appColorBlue,

Check warning on line 1131 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1130-L1131

Added lines #L1130 - L1131 were not covered by tests
fontSize: 13.24,
fontWeight: FontWeight.w400,
decoration: TextDecoration.underline,
),
recognizer: TapGestureRecognizer()
..onTap = () async {
Uri url = Uri.parse('https://platform.airqo.net');
if (await canLaunchUrl(url)) {
await launchUrl(

Check warning on line 1140 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1136-L1140

Added lines #L1136 - L1140 were not covered by tests
url,
mode: LaunchMode.inAppBrowserView,
);
} else {
throw 'Could not launch $url';

Check warning on line 1145 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1145

Added line #L1145 was not covered by tests
}
},
),
TextSpan(
text: AppLocalizations.of(context)!
.usingYourAirQoMobileAppAccount,

Check warning on line 1151 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1149-L1151

Added lines #L1149 - L1151 were not covered by tests
style: const TextStyle(
color: Color(0xFF485972),
fontSize: 13.24,
fontWeight: FontWeight.w400,
),
),
],
),
),
const SizedBox(height: 8),
MaterialButton(

Check warning on line 1162 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1162

Added line #L1162 was not covered by tests
height: 40,
color: CustomColors.appBodyColor,
onPressed: () async {
Navigator.push(context, MaterialPageRoute(
builder: (context) {

Check warning on line 1167 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1164-L1167

Added lines #L1164 - L1167 were not covered by tests
return const EmailLinkScreen();
},
));
},
padding: const EdgeInsets.only(top: 8, bottom: 8),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),

Check warning on line 1174 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1173-L1174

Added lines #L1173 - L1174 were not covered by tests
),
child: Row(
children: [
Padding(

Check warning on line 1178 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1176-L1178

Added lines #L1176 - L1178 were not covered by tests
padding: const EdgeInsets.only(left: 16, right: 10),
child: Text(
AppLocalizations.of(context)!.addMyEmailToMyProfile,
style: TextStyle(
color: CustomColors.appColorBlue,

Check warning on line 1183 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1180-L1183

Added lines #L1180 - L1183 were not covered by tests
fontSize: 14,
fontWeight: FontWeight.w400,
)),
),
const SizedBox(width: 10),
Container(

Check warning on line 1189 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1189

Added line #L1189 was not covered by tests
height: 35,
width: 35,
decoration: const BoxDecoration(
color: Color.fromARGB(255, 184, 217, 255),
shape: BoxShape.circle,
),
child: Icon(

Check warning on line 1196 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1196

Added line #L1196 was not covered by tests
Icons.arrow_forward_ios_rounded,
size: 18,
color: CustomColors.appColorBlue,

Check warning on line 1199 in mobile/lib/screens/profile/profile_widgets.dart

View check run for this annotation

Codecov / codecov/patch

mobile/lib/screens/profile/profile_widgets.dart#L1199

Added line #L1199 was not covered by tests
),
),
],
),
),
],
),
),
),
);
}
}
Loading
Loading