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

PE-4874: Release Flutter App v2.21.0 #1442

Merged
merged 15 commits into from
Oct 24, 2023
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
1 change: 1 addition & 0 deletions android/fastlane/metadata/android/en-US/changelogs/71.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Enhanced the login flow analytics with Plausible to better understand and optimize user experience
128 changes: 104 additions & 24 deletions lib/authentication/login/views/login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import 'package:ardrive/utils/app_platform.dart';
import 'package:ardrive/utils/io_utils.dart';
import 'package:ardrive/utils/logger/logger.dart';
import 'package:ardrive/utils/open_url.dart';
import 'package:ardrive/utils/plausible_event_tracker.dart';
import 'package:ardrive/utils/pre_cache_assets.dart';
import 'package:ardrive/utils/show_general_dialog.dart';
import 'package:ardrive/utils/split_localizations.dart';
Expand All @@ -44,6 +45,13 @@ class LoginPage extends StatefulWidget {
}

class _LoginPageState extends State<LoginPage> {
@override
void initState() {
super.initState();

PlausibleEventTracker.track(event: PlausibleEvent.welcomePage);
}

@override
Widget build(BuildContext context) {
return BlocProvider<LoginBloc>(
Expand Down Expand Up @@ -671,6 +679,13 @@ class PromptPasswordView extends StatefulWidget {
}

class _PromptPasswordViewState extends State<PromptPasswordView> {
@override
void initState() {
super.initState();

PlausibleEventTracker.track(event: PlausibleEvent.welcomeBackPage);
}

final _passwordController = TextEditingController();

bool _isPasswordValid = false;
Expand Down Expand Up @@ -799,6 +814,10 @@ class _CreatePasswordViewState extends State<CreatePasswordView> {
@override
void initState() {
super.initState();

PlausibleEventTracker.track(
event: PlausibleEvent.createAndConfirmPasswordPage,
);
}

@override
Expand Down Expand Up @@ -1016,6 +1035,10 @@ class _CreatePasswordViewState extends State<CreatePasswordView> {
return;
}

PlausibleEventTracker.track(
event: PlausibleEvent.createdAndConfirmedPassword,
);

context.read<LoginBloc>().add(
CreatePassword(
password: _passwordController.text,
Expand All @@ -1039,13 +1062,22 @@ class OnBoardingView extends StatefulWidget {
class OnBoardingViewState extends State<OnBoardingView> {
int _currentPage = 0;

@override
void initState() {
super.initState();

PlausibleEventTracker.track(event: PlausibleEvent.onboardingPage).then(
(value) {
PlausibleEventTracker.track(event: PlausibleEvent.tutorialsPage1);
},
);
}

List<_OnBoarding> get _list => [
_OnBoarding(
primaryButtonText: appLocalizationsOf(context).next,
primaryButtonAction: () {
setState(() {
_currentPage++;
});
_goToNextPage();
},
secundaryButtonHasIcon: false,
secundaryButtonText: appLocalizationsOf(context).skip,
Expand All @@ -1055,6 +1087,7 @@ class OnBoardingViewState extends State<OnBoardingView> {
wallet: widget.wallet,
),
);
PlausibleEventTracker.track(event: PlausibleEvent.tutorialSkipped);
},
title: appLocalizationsOf(context).onboarding1Title,
description: appLocalizationsOf(context).onboarding1Description,
Expand All @@ -1063,15 +1096,11 @@ class OnBoardingViewState extends State<OnBoardingView> {
_OnBoarding(
primaryButtonText: appLocalizationsOf(context).next,
primaryButtonAction: () {
setState(() {
_currentPage++;
});
_goToNextPage();
},
secundaryButtonText: appLocalizationsOf(context).backButtonOnboarding,
secundaryButtonAction: () {
setState(() {
_currentPage--;
});
_goToPreviousPage();
},
title: appLocalizationsOf(context).onboarding2Title,
description: appLocalizationsOf(context).onboarding2Description,
Expand All @@ -1088,16 +1117,36 @@ class OnBoardingViewState extends State<OnBoardingView> {
},
secundaryButtonText: appLocalizationsOf(context).backButtonOnboarding,
secundaryButtonAction: () {
setState(() {
_currentPage--;
});
_goToPreviousPage();
},
title: appLocalizationsOf(context).onboarding3Title,
description: appLocalizationsOf(context).onboarding3Description,
illustration: AssetImage(Resources.images.login.gridImage),
),
];

void _goToNextPage() {
_goToPage(_currentPage + 1);
}

void _goToPreviousPage() {
_goToPage(_currentPage - 1);
}

void _goToPage(int page) {
setState(() {
_currentPage = page;
});

if (_currentPage == 0) {
PlausibleEventTracker.track(event: PlausibleEvent.tutorialsPage1);
} else if (_currentPage == 1) {
PlausibleEventTracker.track(event: PlausibleEvent.tutorialsPage2);
} else if (_currentPage == 2) {
PlausibleEventTracker.track(event: PlausibleEvent.tutorialsPage3);
}
}

@override
Widget build(BuildContext context) {
return ScreenTypeLayout.builder(
Expand Down Expand Up @@ -1201,13 +1250,13 @@ class OnBoardingViewState extends State<OnBoardingView> {
}

class _OnBoardingContent extends StatelessWidget {
final _OnBoarding onBoarding;

const _OnBoardingContent({
super.key,
required this.onBoarding,
});

final _OnBoarding onBoarding;

@override
Widget build(BuildContext context) {
return Column(
Expand Down Expand Up @@ -1358,20 +1407,19 @@ const double _defaultLoginCardMaxHeight = 489;
class EnterSeedPhraseView extends StatefulWidget {
const EnterSeedPhraseView({super.key});

// final Wallet wallet;

@override
State<EnterSeedPhraseView> createState() => _EnterSeedPhraseViewState();
}

class _EnterSeedPhraseViewState extends State<EnterSeedPhraseView> {
final _seedPhraseController = ArDriveMultlineObscureTextController();
final _formKey = GlobalKey<ArDriveFormState>();
// var _seedPhraseFormatIsValid = false;

@override
void initState() {
super.initState();

PlausibleEventTracker.track(event: PlausibleEvent.enterSeedPhrasePage);
}

@override
Expand Down Expand Up @@ -1533,6 +1581,8 @@ class _GenerateWalletViewState extends State<GenerateWalletView> {
void initState() {
super.initState();

PlausibleEventTracker.track(event: PlausibleEvent.walletGenerationPage);

// TODO: create/update localization key
_message = 'Did you know?\n\n${_messages[0]}';

Expand Down Expand Up @@ -1641,6 +1691,13 @@ class DownloadWalletView extends StatefulWidget {
}

class _DownloadWalletViewState extends State<DownloadWalletView> {
@override
void initState() {
super.initState();

PlausibleEventTracker.track(event: PlausibleEvent.walletDownloadPage);
}

@override
Widget build(BuildContext context) {
return MaxDeviceSizesConstrainedBox(
Expand Down Expand Up @@ -1695,6 +1752,9 @@ class _DownloadWalletViewState extends State<DownloadWalletView> {
child: GestureDetector(
onTap: () {
_onDownload();
PlausibleEventTracker.track(
event: PlausibleEvent.walletDownloaded,
);
},
child: Container(
decoration: BoxDecoration(
Expand Down Expand Up @@ -1834,7 +1894,7 @@ class CreateNewWalletViewState extends State<CreateNewWalletView> {
});
}

void advancePage() async {
void goNextPage() async {
if (_currentPage == 2) {
context
.read<LoginBloc>()
Expand All @@ -1845,19 +1905,37 @@ class CreateNewWalletViewState extends State<CreateNewWalletView> {
_wordsAreCorrect = false;
_currentPage++;
});
_trackPlausible();
}
}

void back() {
_isBlurredSeedPhrase = true;
_wordsAreCorrect = false;
void goPrevPage() {
setState(() {
_isBlurredSeedPhrase = true;
_wordsAreCorrect = false;
});
if (_currentPage == 0) {
// Navigator.pop(context);
context.read<LoginBloc>().add(const ForgetWallet());
} else {
setState(() {
_currentPage--;
});
_trackPlausible();
}
}

void _trackPlausible() {
switch (_currentPage) {
case 1:
PlausibleEventTracker.track(
event: PlausibleEvent.writeDownSeedPhrasePage,
);
break;
case 2:
PlausibleEventTracker.track(
event: PlausibleEvent.verifySeedPhrasePage,
);
break;
}
}

Expand Down Expand Up @@ -1959,7 +2037,7 @@ class CreateNewWalletViewState extends State<CreateNewWalletView> {
return colors.themeFgDefault.withOpacity(0.1);
}),
),
onPressed: back,
onPressed: goPrevPage,
child: Center(
// TODO: create/update localization key
child: Text('Back',
Expand Down Expand Up @@ -1987,7 +2065,7 @@ class CreateNewWalletViewState extends State<CreateNewWalletView> {
maxWidth: double.maxFinite,
borderRadius: 0,
text: text,
onPressed: advancePage));
onPressed: goNextPage));
}

Widget _buildCard(List<String> cardInfo) {
Expand Down Expand Up @@ -2470,6 +2548,8 @@ class CreateNewWalletViewState extends State<CreateNewWalletView> {
}

Widget _buildGettingStarted() {
PlausibleEventTracker.track(event: PlausibleEvent.gettingStartedPage);

// TODO: create/update localization keys
var cardInfos = [
[
Expand Down
8 changes: 6 additions & 2 deletions lib/components/profile_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:ardrive/turbo/topup/components/turbo_balance_widget.dart';
import 'package:ardrive/user/download_wallet/download_wallet_modal.dart';
import 'package:ardrive/utils/app_localizations_wrapper.dart';
import 'package:ardrive/utils/open_url_utils.dart';
import 'package:ardrive/utils/plausible_event_tracker.dart';
import 'package:ardrive/utils/truncate_string.dart';
import 'package:ardrive_ui/ardrive_ui.dart';
import 'package:arweave/utils.dart' as utils;
Expand Down Expand Up @@ -370,8 +371,11 @@ class __LogoutButtonState extends State<_LogoutButton> {
child: InkWell(
onTap: () {
context.read<ArDriveAuth>().logout().then(
(value) => context.read<ProfileCubit>().logoutProfile(),
);
(value) {
context.read<ProfileCubit>().logoutProfile();
PlausibleEventTracker.track(event: PlausibleEvent.logout);
},
);
},
child: Container(
color: _isHovering
Expand Down
18 changes: 13 additions & 5 deletions lib/pages/app_router_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ class AppRouterDelegate extends RouterDelegate<AppRoutePath>
},
builder: (context, _) => BlocConsumer<ProfileCubit, ProfileState>(
listener: (context, state) {
// Clear state to prevent the last drive from being attached on new login
// Clear state to prevent the last drive from being attached on new
// login.
if (state is ProfileLoggingOut) {
logger.d('Logging out. Clearing state.');

Expand All @@ -91,8 +92,8 @@ class AppRouterDelegate extends RouterDelegate<AppRoutePath>
final anonymouslyShowDriveDetail =
state is! ProfileLoggedIn && canAnonymouslyShowDriveDetail(state);

// If the user is not already signing in, not viewing a shared file and not anonymously viewing a drive,
// redirect them to sign in.
// If the user is not already signing in, not viewing a shared file
// and not anonymously viewing a drive, redirect them to sign in.
//
// Additionally, redirect the user to sign in if they are logging out.
final showingAnonymousRoute =
Expand Down Expand Up @@ -153,8 +154,15 @@ class AppRouterDelegate extends RouterDelegate<AppRoutePath>
Widget? shellPage;
if (state is DrivesLoadSuccess) {
shellPage = !state.hasNoDrives
? const DriveDetailPage()
: const NoDrivesPage();
? DriveDetailPage(
anonymouslyShowDriveDetail:
anonymouslyShowDriveDetail,
)
: NoDrivesPage(
anonymouslyShowDriveDetail:
anonymouslyShowDriveDetail,
);

driveId = state.selectedDriveId;
}

Expand Down
Loading
Loading