From 6411b72594c1d02cb3e0e63504c7950ec6472367 Mon Sep 17 00:00:00 2001 From: Ryuya Ikeda Date: Sun, 26 Feb 2023 10:09:47 +0900 Subject: [PATCH] =?UTF-8?q?v0.1.2=20=E3=81=AE=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9=20(#103)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: add policy link * :adhesive_bandage: fix lint --- android/app/build.gradle | 5 ++- lib/ui/pages/settings/settings_page.dart | 48 ++++++++++++++++++++++++ pubspec.lock | 28 ++++++++++++++ pubspec.yaml | 3 +- 4 files changed, 82 insertions(+), 2 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 7df93a3a..fa27ec0c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -68,7 +68,7 @@ android { // https://firebase.google.com/docs/android/setup?hl=ja#register-app => 31 // 2022/10現在、最新のバージョン(Android13) compileSdkVersion 33 - ndkVersion flutter.ndkVersion + ndkVersion "25.2.9519653" compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -132,6 +132,9 @@ android { buildTypes { release { signingConfig signingConfigs.release + ndk { + debugSymbolLevel 'SYMBOL_TABLE' + } } } } diff --git a/lib/ui/pages/settings/settings_page.dart b/lib/ui/pages/settings/settings_page.dart index 187bf6f3..f9b7aabe 100644 --- a/lib/ui/pages/settings/settings_page.dart +++ b/lib/ui/pages/settings/settings_page.dart @@ -4,6 +4,7 @@ import 'package:settings_ui/settings_ui.dart'; import 'package:virtualpilgrimage/ui/components/bottom_navigation.dart'; import 'package:virtualpilgrimage/ui/components/my_app_bar.dart'; import 'package:virtualpilgrimage/ui/pages/settings/settings_presenter.dart'; +import 'package:webview_flutter/webview_flutter.dart'; class SettingsPage extends ConsumerWidget { const SettingsPage({super.key}); @@ -21,6 +22,8 @@ class SettingsPage extends ConsumerWidget { class _SettingsPageBody extends StatelessWidget { const _SettingsPageBody(this._ref); + static const policyUrl = 'https://courageous-gumption-d7fd12.netlify.app/policy/'; + final WidgetRef _ref; @override @@ -70,6 +73,14 @@ class _SettingsPageBody extends StatelessWidget { SettingsSection( title: const Text('その他'), tiles: [ + SettingsTile( + leading: const Icon(Icons.account_circle_outlined), + title: const Text('プライバシーポリシー'), + onPressed: (BuildContext context) => Navigator.push( + context, + MaterialPageRoute(builder: (context) => _PolicyWebView(url: policyUrl)), + ), + ), SettingsTile( leading: const Icon(Icons.mail_outline), title: const Text('問い合わせ'), @@ -82,3 +93,40 @@ class _SettingsPageBody extends StatelessWidget { ); } } + +class _PolicyWebView extends StatelessWidget { + _PolicyWebView({required this.url}) { + controller = WebViewController() + ..setJavaScriptMode(JavaScriptMode.unrestricted) + ..setBackgroundColor(const Color(0x00000000)) + ..setNavigationDelegate( + NavigationDelegate( + onProgress: (int progress) { + // Update loading bar. + }, + onPageStarted: (String url) {}, + onPageFinished: (String url) {}, + onWebResourceError: (WebResourceError error) {}, + onNavigationRequest: (NavigationRequest request) { + if (request.url.startsWith(url)) { + return NavigationDecision.prevent; + } + return NavigationDecision.navigate; + }, + ), + ) + ..loadRequest(Uri.parse(url)); + } + + final String url; + + late final WebViewController controller; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: const MyAppBar(), + body: SafeArea(child: WebViewWidget(controller: controller)), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 0021dfe0..143c8443 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -994,6 +994,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.2.0" + webview_flutter: + dependency: "direct main" + description: + name: webview_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.5" + webview_flutter_android: + dependency: transitive + description: + name: webview_flutter_android + url: "https://pub.dartlang.org" + source: hosted + version: "3.3.1" + webview_flutter_platform_interface: + dependency: transitive + description: + name: webview_flutter_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" win32: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b95e6f24..d6878ece 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.1.1+3 +version: 0.1.2+4 environment: sdk: ">=2.17.6 <3.0.0" @@ -60,6 +60,7 @@ dependencies: maps_toolkit: ^2.0.1 package_info: ^2.0.2 url_launcher: ^6.1.7 + webview_flutter: ^4.0.5 # ui google_maps_flutter: ^2.2.1