refactor with updated urls

This commit is contained in:
Adam Velebil 2022-10-24 14:18:31 +02:00
parent 8e4e38f239
commit d203a6a00f
No known key found for this signature in database
GPG Key ID: AC6D6B9D715FC084
3 changed files with 78 additions and 25 deletions

View File

@ -21,17 +21,17 @@ import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:logging/logging.dart';
import 'package:url_launcher/url_launcher.dart';
import 'android/state.dart';
import 'app/app_url_launcher.dart';
import 'app/logging.dart';
import 'app/message.dart';
import 'app/state.dart';
import 'core/state.dart';
import 'android/state.dart';
import 'desktop/state.dart';
import 'version.dart';
import 'widgets/responsive_dialog.dart';
import 'widgets/choice_filter_chip.dart';
import 'widgets/responsive_dialog.dart';
final _log = Logger('about');
@ -70,11 +70,7 @@ class AboutPage extends ConsumerWidget {
const TextStyle(decoration: TextDecoration.underline),
),
onPressed: () {
launchUrl(
Uri.parse(
'https://www.yubico.com/support/terms-conditions/yubico-license-agreement/'),
mode: LaunchMode.externalApplication,
);
launchTermsUrl();
},
),
TextButton(
@ -84,11 +80,7 @@ class AboutPage extends ConsumerWidget {
const TextStyle(decoration: TextDecoration.underline),
),
onPressed: () {
launchUrl(
Uri.parse(
'https://www.yubico.com/support/terms-conditions/privacy-notice/'),
mode: LaunchMode.externalApplication,
);
launchPrivacyUrl();
},
),
],
@ -128,14 +120,7 @@ class AboutPage extends ConsumerWidget {
const TextStyle(decoration: TextDecoration.underline),
),
onPressed: () {
launchUrl(
Platform.isAndroid
// Android Beta feedback form
? Uri.parse('https://forms.gle/2J81Kh8rnzBrtNc69')
// Desktop Beta feedback form
: Uri.parse('https://forms.gle/nYPVWcFnqoprZX1S9'),
mode: LaunchMode.externalApplication,
);
launchFeedbackUrl();
},
),
TextButton(
@ -145,10 +130,7 @@ class AboutPage extends ConsumerWidget {
const TextStyle(decoration: TextDecoration.underline),
),
onPressed: () {
launchUrl(
Uri.parse('https://support.yubico.com/support/home'),
mode: LaunchMode.externalApplication,
);
launchHelpUrl();
},
),
],

31
lib/app/app_url.dart Normal file
View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2022 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'dart:io';
class AppUrl {
static final String feedbackUrl = Platform.isAndroid
? 'https://yubi.co/ya-feedback-android'
: 'https://yubi.co/ya-feedback-desktop';
static final String helpUrl = Platform.isAndroid
? 'https://yubi.co/ya-help-android'
: 'https://yubi.co/ya-help-desktop';
static String termsUrl = 'https://yubi.co/terms';
static String privacyUrl = 'https://yubi.co/privacy';
}

View File

@ -0,0 +1,40 @@
/*
* Copyright (C) 2022 Yubico.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import 'package:url_launcher/url_launcher.dart';
import 'app_url.dart';
Future<bool> _launchUrl(String url) => launchUrl(
Uri.parse(url),
mode: LaunchMode.externalApplication,
);
Future<bool> launchFeedbackUrl() async {
return _launchUrl(AppUrl.feedbackUrl);
}
Future<bool> launchHelpUrl() async {
return _launchUrl(AppUrl.helpUrl);
}
Future<bool> launchTermsUrl() async {
return _launchUrl(AppUrl.termsUrl);
}
Future<bool> launchPrivacyUrl() async {
return _launchUrl(AppUrl.privacyUrl);
}