Skip to content

Commit

Permalink
Merge branch 'main' into auto-format-dc78511
Browse files Browse the repository at this point in the history
  • Loading branch information
YumNumm authored Oct 10, 2022
2 parents ee826ab + 73eaa7f commit f87458a
Show file tree
Hide file tree
Showing 18 changed files with 2,402 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .dart_tool/package_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@
"languageVersion": "2.17"
}
],
"generated": "2022-10-09T13:31:49.313659Z",
"generated": "2022-10-10T04:57:46.109966Z",
"generator": "pub",
"generatorVersion": "2.17.6"
}
47 changes: 14 additions & 33 deletions .github/workflows/android-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
#ビルド環境
runs-on: ubuntu-latest
# タイムアウト時間を設定
timeout-minutes: 15
timeout-minutes: 45

steps:
#リポジトリからソースをダンロード
Expand All @@ -27,6 +27,9 @@ jobs:
java-version: "17"
cache: "gradle"

- name: Add Homebrew to PATH
run: echo "/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH

- name: Install fvm
run: |
brew tap leoafarias/fvm
Expand All @@ -35,61 +38,39 @@ jobs:
- name: Setup flutter
run: fvm install

- name: Cache pubspec dependencies
uses: actions/cache@v2
with:
path: |
${{ env.FLUTTER_HOME }}/.pub-cache
**/.packages
**/.flutter-plugins
**/.flutter-plugin-dependencies
**/.dart_tool/package_config.json
key: build-pubspec-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
build-pubspec-
- name: Cache build runner
uses: actions/cache@v2
with:
path: |
**/.dart_tool/build
key: build-runner-${{ hashFiles('**/asset_graph.json') }}-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
build-runner-
- name: Flutter version
run: flutter --version
run: fvm flutter --version

- name: Flutter dependencies install
#ライブラリーの導入
run: flutter pub get
run: fvm flutter pub get

- name: Generate codes with build_runner
run: flutter pub run build_runner build --delete-conflicting-outputs
run: |
echo '${{ secrets.ENV }}' | base64 -d > .env
fvm flutter pub run build_runner build --delete-conflicting-outputs
- name: Generate LauncherIcon
run: flutter pub run flutter_launcher_icons:main
run: fvm flutter pub run flutter_launcher_icons:main

- name: Generate NativeSplash
run: flutter pub run flutter_native_splash:create
run: fvm flutter pub run flutter_native_splash:create

- name: Analyze
run: flutter analyze .
run: fvm flutter analyze .
continue-on-error: true

- name: Accept Android License
run: yes | flutter doctor --android-licenses
run: yes | fvm flutter doctor --android-licenses

- name: Build apk
run: |
echo '${{ secrets.SIGNING_KEY }}' | base64 -d > android/app/key.jks
echo '${{ secrets.FIREBASE_ANDROID }}' | base64 -d > android/app/google-services.json
echo '${{ secrets.PRIVATE_KEYS }}' | base64 -d > lib/private/keys.dart
#echo '${{ secrets.PARAMETER_EARTHQUAKE }}' | base64 -d > assets/parameter-earthquake.json
export KEYSTORE_PASSWORD='${{ secrets.KEYSTORE_PASSWORD }}'
export KEY_ALIAS='${{ secrets.KEY_ALIAS }}'
export KEY_PASSWORD='${{ secrets.KEY_PASSWORD }}'
flutter build apk --release --obfuscate --split-debug-info=obfuscate/android
fvm flutter build apk --release --obfuscate --split-debug-info=obfuscate/android
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/auto-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:
jobs:
auto-format:
runs-on: ubuntu-latest
timeout-minutes: 10
timeout-minutes: 15

steps:
- name: checkout
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ flutter pub run build_runner build --delete-conflicting-outputs
flutter pub run flutter_launcher_icons:main
flutter pub run flutter_native_splash:create
# RELEASE BUILD
flutter build apk --release --obfuscate --split-debug-info=obfuscate/android
flutter build apk --release --obfuscate --split-debug-info=obfuscate/android/v0.x.x/split -v --split-per-abi
flutter build apk --release --obfuscate --split-debug-info=obfuscate/android/v0.x.x/no-split -v
# DEBUG BUILD
flutter build apk --debug
```
Expand Down
1,917 changes: 1,917 additions & 0 deletions assets/maps/AreaInformationCityQuake.json

Large diffs are not rendered by default.

196 changes: 0 additions & 196 deletions assets/maps/areas.json

This file was deleted.

11 changes: 10 additions & 1 deletion changelog.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
{
"items": [
{
"isBreakingChange": false,
"buildId": 365,
"version": "V0.5.8",
"date": "2022-10-10T14:15:00+09:00",
"comment": "- 市区町村単位の地震履歴に対応\n- 震度速報の表示改善\n- 緊急地震速報時の震央表示を改善",
"url": "https://github.com/EQMonitor/EQMonitor/releases/tag/v0.5.78-beta"
},
{
"isBreakingChange": true,
"buildId": 360,
"version": "V0.5.7",
"date": "2022-10-09T23:00:00+09:00",
"comment": "- 走時表の実装を修正\n- 緊急地震速報のUIに関する軽微な変更\n-通知条件の挙動修正",
"url": "https://github.com/EQMonitor/EQMonitor/releases/tag/v0.5.7-beta"
},{
},
{
"isBreakingChange": false,
"buildId": 358,
"version": "V0.5.6",
Expand Down
53 changes: 52 additions & 1 deletion lib/api/remote/supabase/telegram.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// ignore_for_file: avoid_classes_with_only_static_members

import 'dart:io';

import 'package:dio/dio.dart';
import 'package:eqmonitor/schema/remote/supabase/telegram.dart';
import 'package:supabase_flutter/supabase_flutter.dart';

Expand Down Expand Up @@ -79,7 +82,55 @@ class TelegramApi {
return telegrams;
}

Future<int> getAllTelegramCount() async {
static Future<List<Telegram>> getTestData() async {
final urls = <String>[
'https://sample.dmdata.jp/conversion/json/schema/earthquake-information/vxse53_rjtd_20210213231302.json',
'https://sample.dmdata.jp/conversion/json/schema/earthquake-information/vxse53_rjtd_20210213231800.json',
'https://sample.dmdata.jp/conversion/json/schema/earthquake-information/vxse53_rjtd_20210320181304.json',
'https://sample.dmdata.jp/conversion/json/schema/earthquake-information/vxse51_rtjt_20210320181229.json',
'https://sample.dmdata.jp/conversion/json/schema/earthquake-information/vxse52_rjtd_20210213231144.json',
'https://sample.dmdata.jp/conversion/json/schema/earthquake-information/vxse62_rjtd_20201121023330.json',
];
final telegrams = <Telegram>[];
final futures = <Future<void>>[];
for (final url in urls) {
futures.add(
Dio()
.get(
url,
)
.then(
(res) => telegrams.add(
Telegram(
data: res.data as Map<String, dynamic>,
type: 'VXSE53',
time: DateTime.now(),
url:
url,
depth: null,
depthCondition: null,
eventId: (202102132318000 + url.hashCode ~/ 1000).toString(),
hash: '',
headline: '',
hypoName: null,
id: null,
imageUrl: null,
lat: null,
lon: null,
magnitude: null,
magnitudeCondition: null,
maxint: null,
serialNo: null,
),
),
),
);
}
await Future.wait(futures);
return telegrams;
}

static Future<int> getAllTelegramCount() async {
final res = await Supabase.instance.client
.from('telegram')
.select('id')
Expand Down
6 changes: 6 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'package:eqmonitor/provider/init/device_info.dart';
import 'package:eqmonitor/provider/init/kyoshin_kansokuten.dart';
import 'package:eqmonitor/provider/init/map_area_forecast_local_e.dart';
import 'package:eqmonitor/provider/init/map_area_forecast_local_eew.dart';
import 'package:eqmonitor/provider/init/map_area_information_city_quake.dart';
import 'package:eqmonitor/provider/init/map_area_tsunami_forecast.dart';
import 'package:eqmonitor/provider/init/parameter_earthquake.dart';
import 'package:eqmonitor/provider/init/secure_storage.dart';
Expand Down Expand Up @@ -78,6 +79,7 @@ Future<void> main() async {
late List<MapPolygon> mapAreaForecastLocalE;
late List<MapPolygon> mapAreaForecastLocalEew;
late List<MapAreaTsunami> mapAreaTsunamiForecast;
late List<MapAreaInformationCityQuakePolygon> mapAreaInformationCityQuake;
late List<TravelTimeTable> travelTimeTable;
late Directory dir;
// late Isar isar;
Expand All @@ -90,6 +92,8 @@ Future<void> main() async {
loadMapAreaTsunamiForecast().then((e) => mapAreaTsunamiForecast = e),
loadMapAreaForecastLocalE().then((e) => mapAreaForecastLocalE = e),
loadMapAreaForecastLocalEew().then((e) => mapAreaForecastLocalEew = e),
loadMapAreaInformationCityQuake()
.then((e) => mapAreaInformationCityQuake = e),
loadTravelTimeTable().then((e) => travelTimeTable = e),
getApplicationSupportDirectory().then((e) => dir = e),
Supabase.initialize(
Expand Down Expand Up @@ -134,6 +138,8 @@ Future<void> main() async {
.overrideWithValue(mapAreaForecastLocalEew),
mapAreaTsunamiForecastProvider
.overrideWithValue(mapAreaTsunamiForecast),
mapAreaInformationCityQuakeProvider
.overrideWithValue(mapAreaInformationCityQuake),
if (parameterEarthquake != null)
parameterEarthquakeProvider.overrideWithValue(parameterEarthquake),
sharedPreferencesProvder.overrideWithValue(prefs),
Expand Down
15 changes: 12 additions & 3 deletions lib/provider/earthquake/earthquake_controller.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import 'dart:developer';

import 'package:collection/collection.dart';
import 'package:eqmonitor/api/remote/supabase/telegram.dart';
import 'package:eqmonitor/provider/setting/developer_mode.dart';
import 'package:eqmonitor/schema/remote/supabase/telegram.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

final earthquakeHistoryFutureProvider =
FutureProvider<Map<int, List<Telegram>>>(
(ref) async {
final telegrams = await TelegramApi.getTelegramsWithLimit();
final testTelegram = <Telegram>[];
if (kDebugMode || ref.read(developerModeProvider).isDeveloper) {
final telegram = await TelegramApi.getTestData();
testTelegram.addAll(telegram);
}

final grouped = telegrams
final grouped = [
...telegrams,
if (kDebugMode) ...testTelegram,
]
.where(
(element) => <String>['VXSE51', 'VXSE52', 'VXSE53', 'VXSE61']
.contains(element.type),
Expand All @@ -22,6 +30,7 @@ final earthquakeHistoryFutureProvider =
),
)
.groupListsBy((element) => int.parse(element.eventId.toString()));

return grouped;
},
);
103 changes: 103 additions & 0 deletions lib/provider/init/map_area_information_city_quake.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import 'dart:convert';

import 'package:eqmonitor/schema/local/prefecture/map_polygon.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:geojson/geojson.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:logger/logger.dart';

import '../../utils/map/map_global_offset.dart';

/// 市町村等(地震津波関係)
final mapAreaInformationCityQuakeProvider =
Provider<List<MapAreaInformationCityQuakePolygon>>((ref) {
throw UnimplementedError();
});

class MapAreaInformationCityQuakePolygon extends MapPolygon {
const MapAreaInformationCityQuakePolygon({
required super.code,
required super.name,
required super.path,
required super.points,
required this.regionname,
});

final String regionname;
}

Future<List<MapAreaInformationCityQuakePolygon>>
loadMapAreaInformationCityQuake() async {
final stopwatch = Stopwatch()..start();
final geo = GeoJson();
final logger = Logger();

final mapPaths = <MapAreaInformationCityQuakePolygon>[];

geo.processedFeatures.listen((feature) {
if (feature.type == GeoJsonFeatureType.multipolygon) {
final geometry = feature.geometry as GeoJsonMultiPolygon;
for (final polygon in geometry.polygons) {
for (final geoSeries in polygon.geoSeries) {
if (feature.properties!['regioncode'] == null) {
continue;
}
final tmpPoints = <Offset>[];
for (final geoPoint in geoSeries.geoPoints) {
final offset = MapGlobalOffset.latLonToGlobalPoint(geoPoint.point)
.toLocalOffset(const Size(476, 927.4));
tmpPoints.add(offset);
}
mapPaths.add(
MapAreaInformationCityQuakePolygon(
code: int.parse(feature.properties!['regioncode'].toString()),
name: feature.properties!['name'].toString(),
path: Path()..addPolygon(tmpPoints, true),
points: tmpPoints,
regionname: feature.properties!['regionname'].toString(),
),
);
}
}
} else if (feature.type == GeoJsonFeatureType.polygon) {
final geometry = feature.geometry as GeoJsonPolygon;
for (final geoSeries in geometry.geoSeries) {
if (feature.properties!['regioncode'] == null) {
continue;
}
final tmpPoints = <Offset>[];
for (final geoPoint in geoSeries.geoPoints) {
final offset = MapGlobalOffset.latLonToGlobalPoint(geoPoint.point)
.toLocalOffset(const Size(476, 927.4));
tmpPoints.add(offset);
}
mapPaths.add(
MapAreaInformationCityQuakePolygon(
code: int.parse(feature.properties!['regioncode'].toString()),
name: feature.properties!['name'].toString(),
path: Path()..addPolygon(tmpPoints, true),
points: tmpPoints,
regionname: feature.properties!['regionname'].toString(),
),
);
}
}
});
geo.endSignal.listen((_) {
stopwatch.stop();
logger.i(
'mapAreaInformationCityQuakeを読み込みました: '
'${stopwatch.elapsedMicroseconds / 1000}ms\n'
'読み込んだ数: ${mapPaths.length}',
);
});
await geo.parse(
utf8.decode(
(await rootBundle.load('assets/maps/AreaInformationCityQuake.json'))
.buffer
.asUint8List(),
),
);
return mapPaths;
}
4 changes: 2 additions & 2 deletions lib/schema/remote/supabase/telegram.dart
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class Telegram {
});

factory Telegram.fromJson(Map<String, dynamic> j) => Telegram(
id: int.parse(j['id'].toString()),
id: int.tryParse(j['id'].toString()) ?? 0,
hash: j['hash'].toString(),
type: j['type'].toString(),
time: DateTime.parse(j['time'].toString()),
time: DateTime.tryParse(j['time'].toString()) ?? DateTime.now(),
url: j['url'].toString(),
imageUrl: j['image_url'] as String?,
headline: j['headline'] as String?,
Expand Down
Loading

0 comments on commit f87458a

Please sign in to comment.