From a0bacc4d8814f22cb45b526220bcab995874b4ff Mon Sep 17 00:00:00 2001 From: Ryotaro Onoue <73390859+YumNumm@users.noreply.github.com> Date: Wed, 17 Apr 2024 23:41:04 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=90=E3=82=B0=E4=BF=AE=E6=AD=A3=20(#651)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: glsl * fix: EEW警報のイベント終了を短縮 * fix: earthquake history * fix --- .../core/provider/eew/eew_alive_telegram.dart | 8 +-- .../earthquake_history_details_notifier.dart | 6 +- .../home/component/eew/eew_widget.dart | 62 +------------------ app/lib/feature/settings/settings_screen.dart | 60 ++++-------------- app/shaders/introduction.glsl | 2 +- 5 files changed, 21 insertions(+), 117 deletions(-) diff --git a/app/lib/core/provider/eew/eew_alive_telegram.dart b/app/lib/core/provider/eew/eew_alive_telegram.dart index 50eda41be..a144cc0d7 100644 --- a/app/lib/core/provider/eew/eew_alive_telegram.dart +++ b/app/lib/core/provider/eew/eew_alive_telegram.dart @@ -77,14 +77,10 @@ class EewAliveChecker { final happenedDiff = now.toUtc().difference(happenedTime).inSeconds; final depth = eew.depth; - // EEW警報の場合、420秒でイベント終了と判定する + // M6.0以上 or EEW警報の場合、360秒でイベント終了と判定する final isWarning = eew.isWarning ?? eew.headline?.contains('強い揺れ') ?? false; - if (isWarning) { - return happenedDiff > 420; - } - // M6.0以上の場合、360秒でイベント終了と判定する final magnitude = eew.magnitude; - if (magnitude != null && magnitude >= 6.0) { + if ((magnitude != null && magnitude >= 6.0) || isWarning) { return happenedDiff > 360; } // 深さ不明/150km未満の場合、地震発生/検知から250秒でイベント終了と判定する diff --git a/app/lib/feature/earthquake_history_details/data/earthquake_history_details_notifier.dart b/app/lib/feature/earthquake_history_details/data/earthquake_history_details_notifier.dart index 9009409af..c03d1ff82 100644 --- a/app/lib/feature/earthquake_history_details/data/earthquake_history_details_notifier.dart +++ b/app/lib/feature/earthquake_history_details/data/earthquake_history_details_notifier.dart @@ -29,7 +29,11 @@ class EarthquakeHistoryDetailsNotifier (earthquake) => earthquake.eventId == eventId, ); if (target != null) { - state = AsyncData(target); + if (target.intensityRegions != null) { + state = AsyncData(target); + } else { + ref.invalidateSelf(); + } } } }); diff --git a/app/lib/feature/home/component/eew/eew_widget.dart b/app/lib/feature/home/component/eew/eew_widget.dart index 560ec6c86..3e184a672 100644 --- a/app/lib/feature/home/component/eew/eew_widget.dart +++ b/app/lib/feature/home/component/eew/eew_widget.dart @@ -7,11 +7,9 @@ import 'package:eqmonitor/core/component/intenisty/jma_forecast_lg_intensity_ico import 'package:eqmonitor/core/provider/config/theme/intensity_color/intensity_color_provider.dart'; import 'package:eqmonitor/core/provider/config/theme/intensity_color/model/intensity_color_model.dart'; import 'package:eqmonitor/core/provider/eew/eew_alive_telegram.dart'; -import 'package:eqmonitor/core/provider/websocket/websocket_provider.dart'; import 'package:eqmonitor/core/theme/build_theme.dart'; import 'package:eqmonitor/gen/fonts.gen.dart'; import 'package:extensions/extensions.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:intl/intl.dart'; @@ -40,65 +38,7 @@ class EewWidgets extends ConsumerWidget { ); }, ); - - return Column( - children: [ - if (kDebugMode) - Wrap( - spacing: 8, - runSpacing: 4, - children: [ - FilledButton.tonal( - child: const Text('SAMPLE EEW Telegram'), - onPressed: () { - ref.read(websocketProvider).send('sample/eew'); - }, - ), - FilledButton.tonal( - child: const Text('キャンセル報'), - onPressed: () { - ref.read(websocketProvider).send('sample/eew-cancel'); - }, - ), - FilledButton.tonal( - onPressed: () async { - final earthquake = - RealtimePostgresInsertPayload( - schema: 'public', - table: 'earthquake', - commitTimestamp: DateTime.now(), - errors: [], - newData: EarthquakeV1( - eventId: int.parse( - DateFormat('yyyyMMddHHmmss').format(DateTime.now()), - ), - status: 'test', - arrivalTime: DateTime.now(), - depth: 40, - epicenterCode: 101, - longitude: 40, - latitude: 140, - magnitude: 4.5, - maxIntensity: JmaIntensity.fiveLower, - maxLpgmIntensity: JmaLgIntensity.one, - originTime: DateTime.now(), - ), - ); - final json = { - ...earthquake.toJson( - (p0) => p0.toJson(), - ), - 'eventType': 'INSERT', - }; - ref.read(websocketMessagesProvider.notifier).emit(json); - }, - child: const Text('EEW TEST'), - ), - ], - ), - body, - ], - ); + return body; } } diff --git a/app/lib/feature/settings/settings_screen.dart b/app/lib/feature/settings/settings_screen.dart index b8f826c46..96b960cf5 100644 --- a/app/lib/feature/settings/settings_screen.dart +++ b/app/lib/feature/settings/settings_screen.dart @@ -114,7 +114,6 @@ class SettingsScreen extends HookConsumerWidget { title: const Text('このアプリケーションについて'), subtitle: const Text('利用規約やプライバシーポリシーを確認できます'), leading: const Icon(Icons.description), - onTap: () => const AboutThisAppRoute().push(context), ), ListTile( @@ -161,25 +160,6 @@ class SettingsScreen extends HookConsumerWidget { } Future _onInquiryTap(BuildContext context, WidgetRef ref) async { - // 問い合わせ方法を選択するダイアログを表示 - final result = await showModalActionSheet( - context: context, - title: 'お問い合わせ方法を選択してください', - cancelLabel: 'キャンセル', - actions: [ - const SheetAction( - key: true, - label: 'メールで問い合わせ', - ), - const SheetAction( - key: false, - label: 'Xで問い合わせ', - ), - ], - ); - if (result == null || !context.mounted) { - return; - } unawaited( showDialog( barrierDismissible: false, @@ -216,34 +196,18 @@ Future _onInquiryTap(BuildContext context, WidgetRef ref) async { .join('&'); } - if (result) { - // メール - final uri = Uri( - scheme: 'mailto', - path: 'contacts@eqmonitor.app', - query: encodeQueryParameters( - { - 'subject': 'EQMonitor 問い合わせ: ', - 'body': '\n[こちらに内容を記載してください]\n\n$base', - }, - ), - ); - await launchUrl(uri); - } else { - // X - final uri = Uri( - scheme: 'https', - host: 'twitter.com', - path: 'messages/compose', - query: encodeQueryParameters( - { - 'recipient_id': '1443896594529619970', - 'text': '\n[こちらに内容を記載してください]\n\n$base', - }, - ), - ); - await launchUrl(uri, mode: LaunchMode.externalNonBrowserApplication); - } + // メール + final uri = Uri( + scheme: 'mailto', + path: 'contacts@eqmonitor.app', + query: encodeQueryParameters( + { + 'subject': 'EQMonitor 問い合わせ: ', + 'body': '\n[こちらに内容を記載してください]\n\n$base', + }, + ), + ); + await launchUrl(uri); if (!context.mounted) { return; } diff --git a/app/shaders/introduction.glsl b/app/shaders/introduction.glsl index 202fef9d1..71f8e0330 100644 --- a/app/shaders/introduction.glsl +++ b/app/shaders/introduction.glsl @@ -64,7 +64,7 @@ void main(void){ vec2 st = FlutterFragCoord().xy/resolution.xy; st.x *= resolution.x/resolution.y; - float f = fbm(st*3.0 + time/50) / 4.0; + float f = fbm(st*3.0 + time/20) / 3.0; vec3 v = vec3( f,