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

feat: 4510 - new "enroll in the beta" contribute item #4938

Merged
merged 5 commits into from
Jan 8, 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
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ class AppleAppStore extends AppStore {
await _inAppReview.requestReview();
return true;
}

@override
String getEnrollInBetaURL() =>
'https://appstoreconnect.apple.com/apps/588797948/testflight/ios';
}
4 changes: 4 additions & 0 deletions packages/app_store/google_play/lib/src/google_play.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ class GooglePlayStore extends AppStore {
await _inAppReview.requestReview();
return true;
}

@override
String getEnrollInBetaURL() =>
'https://play.google.com/console/u/0/developers/4712693179220384697/app/4972942602078310258/tracks/internal-testing';
}
2 changes: 2 additions & 0 deletions packages/app_store/shared/lib/src/app_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ abstract class AppStore {

/// Open a screen/dialog… (depending on the store) to rate the app
Future<bool> openAppReview();

String? getEnrollInBetaURL() => null;
}
4 changes: 4 additions & 0 deletions packages/smooth_app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,10 @@
"contribute_develop_dev_mode_subtitle": "Activate the DEV Mode",
"contribute_donate_header": "Donate to Open Food Facts",
"@contribute_donate_header": {},
"contribute_enroll_alpha": "Enroll in internal alpha version",
"@contribute_enroll_alpha": {},
"contribute_enroll_alpha_warning": "Please acknowledge that with the internal alpha version, complete loss of data is possible, and the app may become unusable at any time !",
"@contribute_enroll_alpha_warning": {},
"contribute_improve_ProductsToBeCompleted": "Products to be completed",
"@contribute_improve_ProductsToBeCompleted": {
"description": "Button label: Shows a list of products which aren't completed"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:convert';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:http/http.dart' as http;
Expand All @@ -10,6 +11,7 @@ import 'package:smooth_app/data_models/preferences/user_preferences.dart';
import 'package:smooth_app/database/local_database.dart';
import 'package:smooth_app/generic_lib/design_constants.dart';
import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart';
import 'package:smooth_app/helpers/global_vars.dart';
import 'package:smooth_app/helpers/launch_url_helper.dart';
import 'package:smooth_app/pages/hunger_games/question_page.dart';
import 'package:smooth_app/pages/preferences/abstract_user_preferences.dart';
Expand Down Expand Up @@ -108,6 +110,39 @@ class UserPreferencesContribute extends AbstractUserPreferences {
UserPreferencesListTile.getTintedIcon(Icons.open_in_new, context),
externalLink: true,
),
if (GlobalVars.appStore.getEnrollInBetaURL() != null)
_getListTile(
appLocalizations.contribute_enroll_alpha,
() async {
final bool? result = await showDialog<bool>(
context: context,
builder: (BuildContext context) => SmoothAlertDialog(
title: appLocalizations.contribute_enroll_alpha,
body: Text(appLocalizations.contribute_enroll_alpha_warning),
negativeAction: SmoothActionButton(
text: appLocalizations.close,
onPressed: () => Navigator.pop(context, false),
),
positiveAction: SmoothActionButton(
text: appLocalizations.okay,
onPressed: () => Navigator.pop(context, true),
),
),
);
if (result == true) {
await LaunchUrlHelper.launchURL(
GlobalVars.appStore.getEnrollInBetaURL()!,
false,
);
}
},
CupertinoIcons.lab_flask_solid,
icon: UserPreferencesListTile.getTintedIcon(
Icons.open_in_new,
context,
),
externalLink: true,
),
_getListTile(
appLocalizations.contributors_label,
() async => _contributors(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:app_store_shared/app_store_shared.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
Expand All @@ -6,6 +7,7 @@ import 'package:smooth_app/data_models/preferences/user_preferences.dart';
import 'package:smooth_app/data_models/product_preferences.dart';
import 'package:smooth_app/data_models/user_management_provider.dart';
import 'package:smooth_app/generic_lib/dialogs/smooth_alert_dialog.dart';
import 'package:smooth_app/helpers/global_vars.dart';
import 'package:smooth_app/pages/preferences/user_preferences_page.dart';
import 'package:smooth_app/themes/color_provider.dart';
import 'package:smooth_app/themes/contrast_provider.dart';
Expand All @@ -15,6 +17,8 @@ import '../../tests_utils/goldens.dart';
import '../../tests_utils/mocks.dart';

void main() {
GlobalVars.appStore = const MockedAppStore();

group(
'Dialogs on Contribute Page looks as expected',
() {
Expand All @@ -24,7 +28,7 @@ void main() {
'Software development',
'Translate',
// 'Contributors'
// Currently can't make real http calls from the test librbay and since this dialog depends on an api call
// Currently can't make real http calls from the test library and since this dialog depends on an api call
// So omitting this one for now
];
for (final String dialogType in dialogTypes) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/smooth_app/test/users/goldens/login_page-amoled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/smooth_app/test/users/goldens/login_page-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/smooth_app/test/users/goldens/login_page-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/smooth_app/test/users/goldens/signup_page-amoled.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/smooth_app/test/users/goldens/signup_page-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/smooth_app/test/users/goldens/signup_page-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.