refactor(sf_shared): move brand links to Firebase Remote Config
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:firebase_core/firebase_core.dart';
|
|||||||
import 'package:firebase_performance/firebase_performance.dart';
|
import 'package:firebase_performance/firebase_performance.dart';
|
||||||
import 'package:firebase_remote_config/firebase_remote_config.dart';
|
import 'package:firebase_remote_config/firebase_remote_config.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:sf_shared/sf_shared.dart';
|
||||||
import 'package:sf_tracking/sf_tracking.dart';
|
import 'package:sf_tracking/sf_tracking.dart';
|
||||||
|
|
||||||
import '../config/env/environment_enum.dart';
|
import '../config/env/environment_enum.dart';
|
||||||
@@ -56,6 +57,10 @@ Future<void> setupFirebase(EnvironmentEnum env) async {
|
|||||||
RemoteConfigKeys.updateUrlIos: 'https://apps.apple.com/app/id6759875039',
|
RemoteConfigKeys.updateUrlIos: 'https://apps.apple.com/app/id6759875039',
|
||||||
RemoteConfigKeys.updateUrlAndroid:
|
RemoteConfigKeys.updateUrlAndroid:
|
||||||
'https://play.google.com/store/apps/details?id=com.savefamily.app',
|
'https://play.google.com/store/apps/details?id=com.savefamily.app',
|
||||||
|
BrandLinksKeys.privacyPolicyUrl:
|
||||||
|
'https://savefamilygps.com/pages/politica-de-privacidad-reloj-gps-infantil-localizador-savefamily',
|
||||||
|
BrandLinksKeys.corporateWebsiteUrl: 'https://www.savefamilygps.com/',
|
||||||
|
BrandLinksKeys.supportEmail: 'info@savefamilygps.com',
|
||||||
});
|
});
|
||||||
try {
|
try {
|
||||||
await remoteConfig.fetchAndActivate();
|
await remoteConfig.fetchAndActivate();
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import 'widgets/reg_code_dialog.dart';
|
|||||||
|
|
||||||
class AccountSettingsScreen extends ConsumerWidget {
|
class AccountSettingsScreen extends ConsumerWidget {
|
||||||
final NavigationContract navigationContract;
|
final NavigationContract navigationContract;
|
||||||
static const _privacyUrl =
|
|
||||||
'https://savefamilygps.com/pages/politica-de-privacidad-reloj-gps-infantil-localizador-savefamily';
|
|
||||||
|
|
||||||
const AccountSettingsScreen({super.key, required this.navigationContract});
|
const AccountSettingsScreen({super.key, required this.navigationContract});
|
||||||
|
|
||||||
@@ -90,7 +88,7 @@ class AccountSettingsScreen extends ConsumerWidget {
|
|||||||
_item(
|
_item(
|
||||||
context,
|
context,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final Uri url = Uri.parse(_privacyUrl);
|
final Uri url = Uri.parse(BrandLinks.privacyPolicy);
|
||||||
if (!await launchUrl(url)) {
|
if (!await launchUrl(url)) {
|
||||||
throw Exception('Could not launch $url');
|
throw Exception('Could not launch $url');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|||||||
import 'package:legacy_ui/legacy_ui.dart';
|
import 'package:legacy_ui/legacy_ui.dart';
|
||||||
import 'package:navigation/navigation.dart';
|
import 'package:navigation/navigation.dart';
|
||||||
import 'package:sf_localizations/sf_localizations.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
|
import 'package:sf_shared/sf_shared.dart';
|
||||||
import 'package:utils/utils.dart';
|
import 'package:utils/utils.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ class CustomerServiceScreen extends ConsumerWidget {
|
|||||||
children: [
|
children: [
|
||||||
SectionButton(
|
SectionButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final Uri url = Uri.parse('https://www.savefamilygps.com/');
|
final Uri url = Uri.parse(BrandLinks.corporateWebsite);
|
||||||
if (!await launchUrl(url)) {
|
if (!await launchUrl(url)) {
|
||||||
throw Exception('Could not launch $url');
|
throw Exception('Could not launch $url');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'package:customer_service/src/presentation/state/contact_view_state.dart'
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:sf_localizations/sf_localizations.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
|
import 'package:sf_shared/sf_shared.dart';
|
||||||
import 'package:sf_tracking/sf_tracking.dart';
|
import 'package:sf_tracking/sf_tracking.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
@@ -94,7 +95,7 @@ class ContactViewModel extends Notifier<ContactViewState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void sendEmail() async {
|
void sendEmail() async {
|
||||||
final receiver = 'info@savefamilygps.com';
|
final receiver = BrandLinks.supportEmail;
|
||||||
|
|
||||||
final name = state.name;
|
final name = state.name;
|
||||||
final country = state.country;
|
final country = state.country;
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ dependencies:
|
|||||||
path: ../../../../packages/navigation
|
path: ../../../../packages/navigation
|
||||||
sf_localizations:
|
sf_localizations:
|
||||||
path: ../../../../packages/sf_localizations
|
path: ../../../../packages/sf_localizations
|
||||||
|
sf_shared:
|
||||||
|
path: ../../../../packages/sf_shared
|
||||||
sf_infrastructure:
|
sf_infrastructure:
|
||||||
path: ../../../../packages/sf_infrastructure
|
path: ../../../../packages/sf_infrastructure
|
||||||
utils:
|
utils:
|
||||||
|
|||||||
@@ -72,3 +72,4 @@ export 'src/providers/devices_remote_datasource_repository_provider.dart';
|
|||||||
export 'src/providers/devices_repository_provider.dart';
|
export 'src/providers/devices_repository_provider.dart';
|
||||||
export 'src/providers/legacy_devices_provider.dart';
|
export 'src/providers/legacy_devices_provider.dart';
|
||||||
export 'src/providers/selected_device_provider.dart';
|
export 'src/providers/selected_device_provider.dart';
|
||||||
|
export 'src/remote_config/brand_links.dart';
|
||||||
|
|||||||
22
packages/sf_shared/lib/src/remote_config/brand_links.dart
Normal file
22
packages/sf_shared/lib/src/remote_config/brand_links.dart
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import 'package:firebase_remote_config/firebase_remote_config.dart';
|
||||||
|
|
||||||
|
class BrandLinksKeys {
|
||||||
|
const BrandLinksKeys._();
|
||||||
|
|
||||||
|
static const privacyPolicyUrl = 'privacy_policy_url';
|
||||||
|
static const corporateWebsiteUrl = 'corporate_website_url';
|
||||||
|
static const supportEmail = 'support_email';
|
||||||
|
}
|
||||||
|
|
||||||
|
class BrandLinks {
|
||||||
|
const BrandLinks._();
|
||||||
|
|
||||||
|
static String get privacyPolicy =>
|
||||||
|
FirebaseRemoteConfig.instance.getString(BrandLinksKeys.privacyPolicyUrl);
|
||||||
|
|
||||||
|
static String get corporateWebsite => FirebaseRemoteConfig.instance
|
||||||
|
.getString(BrandLinksKeys.corporateWebsiteUrl);
|
||||||
|
|
||||||
|
static String get supportEmail =>
|
||||||
|
FirebaseRemoteConfig.instance.getString(BrandLinksKeys.supportEmail);
|
||||||
|
}
|
||||||
@@ -34,6 +34,7 @@ dependencies:
|
|||||||
flutter_riverpod: ^3.0.3
|
flutter_riverpod: ^3.0.3
|
||||||
dio: ^5.9.2
|
dio: ^5.9.2
|
||||||
firebase_messaging: ^16.1.3
|
firebase_messaging: ^16.1.3
|
||||||
|
firebase_remote_config: ^6.3.0
|
||||||
freezed_annotation: ^3.1.0
|
freezed_annotation: ^3.1.0
|
||||||
freezed: ^3.2.3
|
freezed: ^3.2.3
|
||||||
json_annotation: ^4.9.0
|
json_annotation: ^4.9.0
|
||||||
|
|||||||
Reference in New Issue
Block a user