2022-05-18 19:09:26 +05:30
|
|
|
|
import 'dart:async';
|
2024-09-02 21:25:19 +09:00
|
|
|
|
import 'dart:io';
|
2022-05-18 19:09:26 +05:30
|
|
|
|
|
2022-11-14 22:22:41 +05:30
|
|
|
|
import 'package:connectivity_plus/connectivity_plus.dart';
|
2022-05-12 02:17:08 +05:30
|
|
|
|
import 'package:flutter/material.dart';
|
2022-11-14 22:22:41 +05:30
|
|
|
|
import 'package:flutter/services.dart';
|
2022-04-17 11:45:21 +05:30
|
|
|
|
import 'package:flutter_map/flutter_map.dart';
|
2022-05-24 20:43:41 +05:30
|
|
|
|
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
|
2024-08-22 14:35:09 +09:00
|
|
|
|
import 'package:geojson_vi/geojson_vi.dart';
|
|
|
|
|
|
import 'package:geolocator/geolocator.dart';
|
2022-04-17 11:45:21 +05:30
|
|
|
|
import 'package:get/get.dart';
|
|
|
|
|
|
import 'package:latlong2/latlong.dart';
|
2024-08-22 14:35:09 +09:00
|
|
|
|
import 'package:gifunavi/model/destination.dart';
|
|
|
|
|
|
import 'package:gifunavi/model/entry.dart';
|
|
|
|
|
|
import 'package:gifunavi/pages/destination/destination_controller.dart';
|
|
|
|
|
|
import 'package:gifunavi/pages/team/team_controller.dart';
|
|
|
|
|
|
import 'package:gifunavi/routes/app_pages.dart';
|
|
|
|
|
|
import 'package:gifunavi/services/auth_service.dart';
|
|
|
|
|
|
import 'package:gifunavi/services/location_service.dart';
|
|
|
|
|
|
import 'package:gifunavi/utils/database_helper.dart';
|
|
|
|
|
|
import 'package:gifunavi/widgets/debug_widget.dart';
|
2023-09-03 23:37:41 +05:30
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
import 'package:gifunavi/services/api_service.dart';
|
|
|
|
|
|
import 'package:gifunavi/model/user.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:gifunavi/main.dart';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:gifunavi/widgets/helper_dialog.dart';
|
|
|
|
|
|
import 'package:timezone/timezone.dart' as tz;
|
|
|
|
|
|
import 'package:timezone/data/latest.dart' as tz;
|
|
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
import '../permission/permission.dart';
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
class IndexController extends GetxController with WidgetsBindingObserver {
|
|
|
|
|
|
List<GeoJSONFeatureCollection> locations = <GeoJSONFeatureCollection>[].obs;
|
|
|
|
|
|
List<GeoJSONFeature> currentFeature = <GeoJSONFeature>[].obs;
|
2022-07-09 22:51:34 +05:30
|
|
|
|
List<Destination> currentDestinationFeature = <Destination>[].obs;
|
2022-04-17 11:45:21 +05:30
|
|
|
|
List<dynamic> perfectures = <dynamic>[].obs;
|
|
|
|
|
|
List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
|
|
|
|
|
|
List<dynamic> subPerfs = <dynamic>[].obs;
|
2022-06-06 21:15:58 +05:30
|
|
|
|
List<dynamic> areas = <dynamic>[].obs;
|
2022-06-14 14:37:59 +05:30
|
|
|
|
List<dynamic> customAreas = <dynamic>[].obs;
|
2022-05-12 02:17:08 +05:30
|
|
|
|
List<dynamic> cats = <dynamic>[].obs;
|
|
|
|
|
|
|
|
|
|
|
|
List<String> currentCat = <String>[].obs;
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
|
|
|
|
|
|
List<dynamic> currentAction = <dynamic>[].obs;
|
2022-05-24 20:43:41 +05:30
|
|
|
|
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
2022-09-22 20:36:56 +05:30
|
|
|
|
var routePointLenght = 0.obs;
|
2022-05-12 02:17:08 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
double currentLat = 0.0, currentLon = 0.0;
|
|
|
|
|
|
|
|
|
|
|
|
var isLoading = false.obs;
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
var isRogMapcontrollerLoaded = false.obs;
|
2022-07-09 22:51:34 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
var isCustomAreaSelected = false.obs;
|
|
|
|
|
|
|
|
|
|
|
|
RxBool isMapControllerReady = RxBool(false); // MapControllerの初期化状態を管理するフラグ
|
|
|
|
|
|
//final mapControllerReadyStream = Stream<bool>.value(false); // MapControllerの初期化状態を通知するためのストリーム
|
2022-07-28 19:01:45 +05:30
|
|
|
|
|
2023-03-17 11:54:12 +05:30
|
|
|
|
MapController mapController = MapController();
|
|
|
|
|
|
MapController rogMapController = MapController();
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
LogManager logManager = LogManager();
|
|
|
|
|
|
|
|
|
|
|
|
String? userToken;
|
|
|
|
|
|
|
|
|
|
|
|
//late final ApiService _apiService;
|
2024-09-02 21:25:19 +09:00
|
|
|
|
final ApiService _apiService; // = Get.find<ApiService>();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
final DatabaseHelper _dbHelper = DatabaseHelper.instance;
|
|
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
IndexController({
|
|
|
|
|
|
required ApiService apiService,
|
|
|
|
|
|
}) : _apiService = apiService;
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
// mode = 0 is map mode, mode = 1 list mode
|
2022-04-17 11:45:21 +05:30
|
|
|
|
var mode = 0.obs;
|
|
|
|
|
|
|
2022-07-14 23:10:24 +05:30
|
|
|
|
// master mode, rog or selection
|
2024-08-22 14:35:09 +09:00
|
|
|
|
var rogMode = 1.obs;
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
var desinationMode = 1.obs;
|
2022-05-24 20:43:41 +05:30
|
|
|
|
|
2022-07-10 23:50:43 +05:30
|
|
|
|
bool showPopup = true;
|
|
|
|
|
|
|
2023-09-03 23:37:41 +05:30
|
|
|
|
String dropdownValue = "9";
|
2022-04-17 11:45:21 +05:30
|
|
|
|
String subDropdownValue = "-1";
|
2022-06-06 21:15:58 +05:30
|
|
|
|
String areaDropdownValue = "-1";
|
2022-07-23 19:28:35 +05:30
|
|
|
|
String cateogory = "-all-";
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
final selectedEventName = 'add_location'.tr.obs;
|
|
|
|
|
|
|
2024-09-03 22:17:09 +09:00
|
|
|
|
RxBool isLoadingLocations = true.obs;
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
void setSelectedEventName(String eventName) {
|
|
|
|
|
|
selectedEventName.value = eventName;
|
|
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
final connectionStatus = Rx<ConnectivityResult>(ConnectivityResult.none);
|
2022-11-14 22:22:41 +05:30
|
|
|
|
var connectionStatusName = "".obs;
|
|
|
|
|
|
final Connectivity _connectivity = Connectivity();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
late StreamSubscription<List<ConnectivityResult>> _connectivitySubscription;
|
|
|
|
|
|
|
|
|
|
|
|
final Rx<DateTime> lastUserUpdateTime = DateTime.now().obs;
|
|
|
|
|
|
|
|
|
|
|
|
RxInt teamId = RxInt(-1); // チームIDを保存するための変数
|
|
|
|
|
|
|
|
|
|
|
|
//late TeamController teamController = TeamController();
|
|
|
|
|
|
/*
|
|
|
|
|
|
void updateUserInfo(Map<String, dynamic> newUserInfo) {
|
|
|
|
|
|
currentUser.clear();
|
|
|
|
|
|
currentUser.add(newUserInfo);
|
|
|
|
|
|
lastUserUpdateTime.value = DateTime.now();
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
final isReferenceMode = false.obs;
|
|
|
|
|
|
|
|
|
|
|
|
void setReferenceMode(bool value) {
|
|
|
|
|
|
isReferenceMode.value = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool canStartRoge() {
|
|
|
|
|
|
return !isReferenceMode.value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool canCheckin() {
|
|
|
|
|
|
return !isReferenceMode.value;
|
|
|
|
|
|
}
|
2022-11-14 22:22:41 +05:30
|
|
|
|
|
2023-09-03 23:37:41 +05:30
|
|
|
|
void toggleMode() {
|
|
|
|
|
|
if (mode.value == 0) {
|
2022-04-17 11:45:21 +05:30
|
|
|
|
mode += 1;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
} else {
|
2022-04-17 11:45:21 +05:30
|
|
|
|
mode -= 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 23:37:41 +05:30
|
|
|
|
void toggleDestinationMode() {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (desinationMode.value == 0) {
|
|
|
|
|
|
desinationMode.value += 1;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
} else {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
desinationMode.value -= 1;
|
2022-05-24 20:43:41 +05:30
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-03 23:37:41 +05:30
|
|
|
|
void switchPage(String page) {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
////print("######## ${currentUser[0]["user"]["id"]}");
|
2022-06-14 14:37:59 +05:30
|
|
|
|
switch (page) {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
case AppPages.INDEX:
|
2023-09-03 23:37:41 +05:30
|
|
|
|
{
|
2024-08-22 14:35:09 +09:00
|
|
|
|
rogMode.value = 0;
|
|
|
|
|
|
//print("-- rog mode is ctrl is ${rog_mode.value}");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
Get.toNamed(page);
|
|
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
break;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
case AppPages.TRAVEL:
|
|
|
|
|
|
{
|
2024-08-22 14:35:09 +09:00
|
|
|
|
rogMode.value = 1;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
//Get.back();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
//Get.off(DestnationPage(), binding: DestinationBinding());
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
case AppPages.LOGIN:
|
|
|
|
|
|
{
|
2024-08-22 14:35:09 +09:00
|
|
|
|
rogMode.value = 2;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
Get.toNamed(page);
|
|
|
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
{
|
2024-08-22 14:35:09 +09:00
|
|
|
|
rogMode.value = 1;
|
|
|
|
|
|
Get.toNamed(AppPages.INDEX);
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
Future<void> _checkLocationPermission() async {
|
|
|
|
|
|
if (Get.context == null) {
|
|
|
|
|
|
debugPrint('Get.context is null in _checkLocationPermission');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
LocationPermission permission = await Geolocator.checkPermission();
|
|
|
|
|
|
//permission = await Geolocator.requestPermission();
|
|
|
|
|
|
if (permission == LocationPermission.denied) {
|
|
|
|
|
|
debugPrint('GPS : Denied');
|
|
|
|
|
|
await showLocationPermissionDeniedDialog();
|
|
|
|
|
|
} else if (permission == LocationPermission.deniedForever) {
|
|
|
|
|
|
debugPrint('GPS : Denied forever');
|
|
|
|
|
|
await showLocationPermissionDeniedDialog();
|
|
|
|
|
|
}else if (permission == LocationPermission.whileInUse){
|
|
|
|
|
|
debugPrint('GPS : While-In-Use');
|
|
|
|
|
|
await showLocationPermissionDeniedDialog();
|
|
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
debugPrint("Permission is no problem....");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 追加
|
|
|
|
|
|
Future<void> showLocationPermissionDeniedDialog() async {
|
|
|
|
|
|
if (Get.context != null) {
|
|
|
|
|
|
print('Showing location permission denied dialog');
|
|
|
|
|
|
await showDialog(
|
|
|
|
|
|
context: Get.context!,
|
|
|
|
|
|
barrierDismissible: false,
|
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
|
return WillPopScope(
|
|
|
|
|
|
onWillPop: () async => false,
|
|
|
|
|
|
child: AlertDialog(
|
|
|
|
|
|
title: Text('location_permission_needed_title'.tr),
|
|
|
|
|
|
content: Text('location_permission_needed_main'.tr),
|
|
|
|
|
|
actions: [
|
|
|
|
|
|
TextButton(
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
logManager.addOperationLog("User tapped confirm button for location permission required.");
|
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
|
},
|
|
|
|
|
|
child: Text('confirm'.tr),
|
|
|
|
|
|
),
|
|
|
|
|
|
],
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
},
|
|
|
|
|
|
);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
print('Get.context is null in showLocationPermissionDeniedDialog');
|
|
|
|
|
|
// Get.contextがnullの場合の処理
|
|
|
|
|
|
print('Location permission denied, but context is null');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-17 11:45:21 +05:30
|
|
|
|
@override
|
|
|
|
|
|
void onInit() {
|
2024-09-10 08:12:33 +09:00
|
|
|
|
super.onInit();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
try {
|
|
|
|
|
|
initConnectivity();
|
|
|
|
|
|
_connectivitySubscription = _connectivity.onConnectivityChanged.listen(_updateConnectionStatus);
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-09-10 08:12:33 +09:00
|
|
|
|
//WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
|
|
|
|
// await PermissionController.checkAndRequestPermissions();
|
|
|
|
|
|
//});
|
2024-09-02 21:25:19 +09:00
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
WidgetsBinding.instance.addObserver(this);
|
|
|
|
|
|
_startLocationService(); // アプリ起動時にLocationServiceを開始する
|
2023-09-03 23:37:41 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
initializeApiService();
|
|
|
|
|
|
|
|
|
|
|
|
print('IndexController onInit called'); // デバッグ用の出力を追加
|
|
|
|
|
|
|
|
|
|
|
|
tz.initializeTimeZones();
|
|
|
|
|
|
//teamController = Get.find<TeamController>();
|
2024-09-03 22:17:09 +09:00
|
|
|
|
|
|
|
|
|
|
loadLocations();
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
}catch(e,stacktrace){
|
|
|
|
|
|
print('Error in IndexController.onInit: $e');
|
|
|
|
|
|
print('Stack trace: $stacktrace');
|
|
|
|
|
|
// エラーレポートサービスにエラーを送信
|
|
|
|
|
|
//ErrorService.reportError(e, stackTrace, deviceInfo, LogManager().operationLogs);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-03 22:17:09 +09:00
|
|
|
|
Future<void> loadLocations() async {
|
|
|
|
|
|
isLoadingLocations.value = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
await waitForMapControllerReady();
|
|
|
|
|
|
String eventCode = currentUser.isNotEmpty ? currentUser[0]["user"]["event_code"] ?? "" : "";
|
|
|
|
|
|
await loadLocationsBound(eventCode);
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print('Error loading locations: $e');
|
|
|
|
|
|
// エラーハンドリングを追加(例:スナックバーでユーザーに通知)
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
isLoadingLocations.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
void _updateConnectionStatus(List<ConnectivityResult> results) {
|
|
|
|
|
|
|
|
|
|
|
|
final result = results.isNotEmpty ? results.first : ConnectivityResult.none;
|
|
|
|
|
|
connectionStatus.value = result;
|
|
|
|
|
|
|
|
|
|
|
|
switch (result) {
|
|
|
|
|
|
case ConnectivityResult.wifi:
|
|
|
|
|
|
connectionStatusName.value = "WiFi";
|
|
|
|
|
|
break;
|
|
|
|
|
|
case ConnectivityResult.mobile:
|
2024-09-02 21:25:19 +09:00
|
|
|
|
connectionStatusName.value = "mobile";
|
2024-08-22 14:35:09 +09:00
|
|
|
|
break;
|
|
|
|
|
|
case ConnectivityResult.none:
|
2024-09-02 21:25:19 +09:00
|
|
|
|
connectionStatusName.value = "offline";
|
2024-08-22 14:35:09 +09:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
connectionStatusName.value = "不明";
|
|
|
|
|
|
break;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2022-11-14 22:22:41 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
logManager.addOperationLog("Connection status changed to: ${connectionStatusName.value}");
|
|
|
|
|
|
|
|
|
|
|
|
if (result != ConnectivityResult.none) {
|
|
|
|
|
|
_handleConnectionRestored();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-11-14 22:22:41 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
Future<void> _handleConnectionRestored() async {
|
|
|
|
|
|
await _syncPendingData();
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
Future<void> initConnectivity() async {
|
|
|
|
|
|
try {
|
|
|
|
|
|
final result = await _connectivity.checkConnectivity();
|
|
|
|
|
|
_updateConnectionStatus(result); // リストとして渡す
|
|
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
|
|
print('Couldn\'t check connectivity status: ${e.message}');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 保留中のデータを同期する例のメソッド
|
|
|
|
|
|
Future<void> _syncPendingData() async {
|
|
|
|
|
|
// ここに保留中のデータを同期するロジックを実装
|
|
|
|
|
|
// 例: ローカルDBに保存された未送信のデータをサーバーに送信する
|
|
|
|
|
|
try {
|
|
|
|
|
|
// 同期処理
|
|
|
|
|
|
logManager.addOperationLog("Syncing pending data");
|
|
|
|
|
|
// 同期ロジックをここに実装
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
logManager.addOperationLog("Error syncing pending data: $e");
|
|
|
|
|
|
// エラーハンドリング
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> initializeApiService() async {
|
|
|
|
|
|
if (currentUser.isNotEmpty) {
|
|
|
|
|
|
// 既にログインしている場合
|
|
|
|
|
|
await Get.putAsync(() => ApiService().init());
|
|
|
|
|
|
//await Get.putAsync(() => ApiService().init());
|
|
|
|
|
|
// 必要に応じて追加の初期化処理
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
void checkPermission()
|
|
|
|
|
|
{
|
|
|
|
|
|
debugPrint("MapControllerの初期化が完了したら、位置情報の許可をチェックする");
|
|
|
|
|
|
_checkLocationPermission();
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2023-09-03 23:37:41 +05:30
|
|
|
|
@override
|
|
|
|
|
|
void onClose() {
|
2022-11-14 22:22:41 +05:30
|
|
|
|
_connectivitySubscription.cancel();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
WidgetsBinding.instance.removeObserver(this);
|
|
|
|
|
|
_stopLocationService(); // アプリ終了時にLocationServiceを停止する
|
2022-11-14 22:22:41 +05:30
|
|
|
|
super.onClose();
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2022-11-14 22:22:41 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
@override
|
|
|
|
|
|
void didChangeAppLifecycleState(AppLifecycleState state) {
|
|
|
|
|
|
|
|
|
|
|
|
if (state == AppLifecycleState.resumed) {
|
|
|
|
|
|
if (!_isLocationServiceRunning()) {
|
|
|
|
|
|
_startLocationService();
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if (state == AppLifecycleState.paused) {
|
|
|
|
|
|
_stopLocationService();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool _isLocationServiceRunning() {
|
|
|
|
|
|
// LocationServiceが実行中かどうかを確認する処理を実装する
|
|
|
|
|
|
// 例えば、SharedPreferencesにサービスの状態を保存するなど
|
|
|
|
|
|
// ここでは簡単のために、常にfalseを返すようにしています
|
|
|
|
|
|
return false;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2022-11-14 22:22:41 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
void _startLocationService() async {
|
2024-09-02 21:25:19 +09:00
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
|
const platform = MethodChannel('location');
|
|
|
|
|
|
try {
|
|
|
|
|
|
logManager.addOperationLog("Called start location service.");
|
|
|
|
|
|
await platform.invokeMethod('startLocationService');
|
|
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
|
|
print("Failed to start location service: '${e.message}'.");
|
|
|
|
|
|
}
|
|
|
|
|
|
}else if (Platform.isIOS) {
|
|
|
|
|
|
// iOSの位置情報サービス開始ロジック
|
|
|
|
|
|
// 例: geolocatorプラグインを使用する場合
|
|
|
|
|
|
try {
|
|
|
|
|
|
bool serviceEnabled = await Geolocator.isLocationServiceEnabled();
|
|
|
|
|
|
if (!serviceEnabled) {
|
|
|
|
|
|
// 位置情報サービスが無効の場合の処理
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 位置情報の権限確認と取得開始
|
|
|
|
|
|
LocationPermission permission = await Geolocator.checkPermission();
|
|
|
|
|
|
if (permission == LocationPermission.denied) {
|
|
|
|
|
|
permission = await Geolocator.requestPermission();
|
|
|
|
|
|
if (permission == LocationPermission.denied) {
|
|
|
|
|
|
// 権限が拒否された場合の処理
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
// 位置情報の取得開始
|
|
|
|
|
|
Geolocator.getPositionStream().listen((Position position) {
|
|
|
|
|
|
// 位置情報を使用した処理
|
|
|
|
|
|
});
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print('Error starting iOS location service: $e');
|
|
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void _stopLocationService() async {
|
2024-09-02 21:25:19 +09:00
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
|
const platform = MethodChannel('location');
|
|
|
|
|
|
try {
|
|
|
|
|
|
logManager.addOperationLog("Called stop location service.");
|
|
|
|
|
|
await platform.invokeMethod('stopLocationService');
|
|
|
|
|
|
} on PlatformException catch (e) {
|
|
|
|
|
|
print("Failed to stop location service: '${e.message}'.");
|
|
|
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
|
|
|
debugPrint("stopLocation for iOS");
|
2024-08-22 14:35:09 +09:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
@override
|
|
|
|
|
|
void onReady() async {
|
|
|
|
|
|
await readUserToken();
|
|
|
|
|
|
final token = userToken;
|
|
|
|
|
|
if (token != null && token.isNotEmpty) {
|
|
|
|
|
|
await loadUserDetailsForToken(token);
|
|
|
|
|
|
fixMapBound(token);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// ユーザートークンが存在しない場合はログイン画面にリダイレクト
|
|
|
|
|
|
Get.offAllNamed(AppPages.LOGIN);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 地図のイベントリスナーを設定
|
|
|
|
|
|
indexController.mapController.mapEventStream.listen((MapEvent mapEvent) {
|
|
|
|
|
|
if (mapEvent is MapEventMoveEnd) {
|
|
|
|
|
|
indexController.loadLocationsBound();
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
super.onReady();
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
2023-09-03 23:37:41 +05:30
|
|
|
|
Future<void> initConnectivity() async {
|
2022-11-14 22:22:41 +05:30
|
|
|
|
late ConnectivityResult result;
|
|
|
|
|
|
// Platform messages may fail, so we use a try/catch PlatformException.
|
|
|
|
|
|
try {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
connectionStatus = (await _connectivity.checkConnectivity()) as ConnectivityResult;
|
|
|
|
|
|
await _updateConnectionStatus(connectionStatus);
|
|
|
|
|
|
} on PlatformException catch (_) {
|
|
|
|
|
|
//print('Couldn\'t check connectivity status --- $e');
|
2022-11-14 22:22:41 +05:30
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
//return _updateConnectionStatus(result);
|
2022-11-14 22:22:41 +05:30
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
*/
|
|
|
|
|
|
|
2023-09-03 23:37:41 +05:30
|
|
|
|
LatLngBounds boundsFromLatLngList(List<LatLng> list) {
|
|
|
|
|
|
double? x0, x1, y0, y1;
|
|
|
|
|
|
for (LatLng latLng in list) {
|
|
|
|
|
|
if (x0 == null || x1 == null || y0 == null || y1 == null) {
|
|
|
|
|
|
x0 = x1 = latLng.latitude;
|
|
|
|
|
|
y0 = y1 = latLng.longitude;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (latLng.latitude > x1) x1 = latLng.latitude;
|
|
|
|
|
|
if (latLng.latitude < x0) x0 = latLng.latitude;
|
|
|
|
|
|
if (latLng.longitude > y1) y1 = latLng.longitude;
|
|
|
|
|
|
if (latLng.longitude < y0) y0 = latLng.longitude;
|
|
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
logManager.addOperationLog("Called boundsFromLatLngList (${x1!},${y1!})-(${x0!},${y0!}).");
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
return LatLngBounds(LatLng(x1, y1), LatLng(x0, y0));
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
// 要検討:エラーハンドリングが行われていますが、エラーメッセージをローカライズすることを検討してください。
|
|
|
|
|
|
//
|
2024-09-02 21:25:19 +09:00
|
|
|
|
Future<void> login(String email, String password) async {
|
|
|
|
|
|
try {
|
|
|
|
|
|
final value = await AuthService.login(email, password);
|
|
|
|
|
|
if (value.isNotEmpty && value['token'] != null) {
|
|
|
|
|
|
await changeUser(value);
|
|
|
|
|
|
await _initializeUserData();
|
|
|
|
|
|
Get.offAllNamed(AppPages.INDEX);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Get.snackbar('Login Failed', 'Invalid credentials');
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print('Login error: $e');
|
|
|
|
|
|
Get.snackbar('Login Failed', 'An error occurred. Please try again.');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
Future<void> _initializeUserData() async {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await fetchUserEventInfo();
|
|
|
|
|
|
await fetchTeamData();
|
|
|
|
|
|
// 他の必要なデータ取得処理
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print('Error initializing user data: $e');
|
|
|
|
|
|
Get.snackbar('Error', 'Failed to load user data. Please try again.');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
|
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
Future<void> login_old(String email, String password, BuildContext context) async{
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
try {
|
|
|
|
|
|
AuthService.login(email, password).then((value) async {
|
|
|
|
|
|
print("------- logged in user details ######## $value ###### --------");
|
|
|
|
|
|
if (value.isNotEmpty && value['token']!=null) {
|
|
|
|
|
|
logManager.addOperationLog("User logged in : $value.");
|
|
|
|
|
|
|
|
|
|
|
|
// Navigator.pop(context);
|
|
|
|
|
|
print("--------- user details login ----- $value");
|
|
|
|
|
|
// ログイン成功後、api_serviceを初期化
|
|
|
|
|
|
await Get.putAsync(() => ApiService().init());
|
|
|
|
|
|
|
|
|
|
|
|
// ユーザー情報の完全性をチェック
|
|
|
|
|
|
if (await checkUserInfoComplete()) {
|
|
|
|
|
|
Get.offAllNamed(AppPages.INDEX);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
Get.offAllNamed(AppPages.USER_DETAILS_EDIT);
|
|
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
} else {
|
2024-09-02 21:25:19 +09:00
|
|
|
|
logManager.addOperationLog("User failed login : $email , $password.");
|
|
|
|
|
|
isLoading.value = false;
|
|
|
|
|
|
Get.snackbar(
|
|
|
|
|
|
"login_failed".tr,
|
|
|
|
|
|
"check_login_id_or_password".tr,
|
2024-08-22 14:35:09 +09:00
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
|
|
colorText: Colors.white,
|
|
|
|
|
|
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
2024-09-02 21:25:19 +09:00
|
|
|
|
snackPosition: SnackPosition.TOP,
|
|
|
|
|
|
duration: const Duration(seconds: 3),
|
|
|
|
|
|
//backgroundColor: Colors.yellow,
|
|
|
|
|
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} catch(e ){
|
|
|
|
|
|
print('Login error: $e');
|
|
|
|
|
|
Get.snackbar('Login Failed', 'An error occurred. Please try again.');
|
|
|
|
|
|
}
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
|
|
|
|
|
// 要検討:エラーハンドリングが行われていますが、エラーメッセージをローカライズすることを検討してください。
|
|
|
|
|
|
//
|
2023-09-03 23:37:41 +05:30
|
|
|
|
void changePassword(
|
|
|
|
|
|
String oldpassword, String newpassword, BuildContext context) {
|
|
|
|
|
|
String token = currentUser[0]['token'];
|
2024-08-22 14:35:09 +09:00
|
|
|
|
////print("------- change password ######## ${currentUser[0]['token']} ###### --------");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
AuthService.changePassword(oldpassword, newpassword, token).then((value) {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
////print("------- change password ######## $value ###### --------");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
if (value.isNotEmpty) {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
logManager.addOperationLog("User successed to change password : $oldpassword , $newpassword.");
|
|
|
|
|
|
isLoading.value = false;
|
2022-10-12 21:46:17 +05:30
|
|
|
|
Navigator.pop(context);
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (rogMode.value == 1) {
|
2022-10-12 21:46:17 +05:30
|
|
|
|
switchPage(AppPages.TRAVEL);
|
2023-09-03 23:37:41 +05:30
|
|
|
|
} else {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
switchPage(AppPages.INDEX);
|
2022-10-12 21:46:17 +05:30
|
|
|
|
}
|
2023-09-03 23:37:41 +05:30
|
|
|
|
} else {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
logManager.addOperationLog("User failed to change password : $oldpassword , $newpassword.");
|
2022-10-12 21:46:17 +05:30
|
|
|
|
Get.snackbar(
|
2023-09-03 23:37:41 +05:30
|
|
|
|
'failed'.tr,
|
|
|
|
|
|
'password_change_failed_please_try_again'.tr,
|
2024-08-22 14:35:09 +09:00
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
|
|
colorText: Colors.white,
|
|
|
|
|
|
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
2023-09-03 23:37:41 +05:30
|
|
|
|
snackPosition: SnackPosition.TOP,
|
|
|
|
|
|
duration: const Duration(milliseconds: 800),
|
2024-08-22 14:35:09 +09:00
|
|
|
|
//backgroundColor: Colors.yellow,
|
2023-09-03 23:37:41 +05:30
|
|
|
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-08-22 14:35:09 +09:00
|
|
|
|
isLoading.value = false;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
/*
|
2023-09-03 23:37:41 +05:30
|
|
|
|
void logout() async {
|
2022-09-22 20:36:56 +05:30
|
|
|
|
locations.clear();
|
|
|
|
|
|
DatabaseHelper db = DatabaseHelper.instance;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
db.deleteAllDestinations().then((value) {
|
|
|
|
|
|
DestinationController destinationController =
|
|
|
|
|
|
Get.find<DestinationController>();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
destinationController.populateDestinations();
|
2022-09-22 20:36:56 +05:30
|
|
|
|
});
|
|
|
|
|
|
currentUser.clear();
|
2022-10-12 21:46:17 +05:30
|
|
|
|
cats.clear();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
|
|
|
|
|
// ユーザートークンをデバイスから削除
|
|
|
|
|
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
|
|
|
|
await prefs.remove("user_token");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
*/
|
2022-09-22 20:36:56 +05:30
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
Future<void> logout() async {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
logManager.addOperationLog("User logout : $currentUser .");
|
|
|
|
|
|
saveGameState();
|
|
|
|
|
|
locations.clear();
|
|
|
|
|
|
DatabaseHelper db = DatabaseHelper.instance;
|
2024-09-02 21:25:19 +09:00
|
|
|
|
db.deleteAllDestinationsExceptTodayCheckins().then((value) {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
DestinationController destinationController =
|
|
|
|
|
|
Get.find<DestinationController>();
|
|
|
|
|
|
destinationController.populateDestinations();
|
|
|
|
|
|
});
|
|
|
|
|
|
currentUser.clear();
|
|
|
|
|
|
cats.clear();
|
|
|
|
|
|
|
|
|
|
|
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
|
|
|
|
await prefs.remove("user_token");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 要検討:エラーハンドリングが行われていますが、エラーメッセージをローカライズすることを検討してください。
|
|
|
|
|
|
//
|
|
|
|
|
|
void register(String email, String password, String password2, BuildContext context) {
|
|
|
|
|
|
AuthService.register(email, password,password2).then((value) {
|
|
|
|
|
|
if (value.containsKey("error")) {
|
|
|
|
|
|
String errMessage = value["error"];
|
|
|
|
|
|
debugPrint("ユーザー登録失敗:$email, $password,$errMessage");
|
|
|
|
|
|
logManager.addOperationLog("User failed to register new account : $email , $password ,$errMessage.");
|
|
|
|
|
|
isLoading.value = false;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
Get.snackbar(
|
2024-08-22 14:35:09 +09:00
|
|
|
|
'user_registration_failed_please_try_again'.tr, // ユーザー登録に失敗しました。
|
|
|
|
|
|
errMessage,
|
|
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
|
|
colorText: Colors.white,
|
2023-09-03 23:37:41 +05:30
|
|
|
|
icon: const Icon(Icons.error, size: 40.0, color: Colors.blue),
|
|
|
|
|
|
snackPosition: SnackPosition.TOP,
|
2024-08-22 14:35:09 +09:00
|
|
|
|
duration: const Duration(seconds: 3),
|
|
|
|
|
|
//backgroundColor: Colors.yellow,
|
2023-09-03 23:37:41 +05:30
|
|
|
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
|
|
|
|
|
);
|
2024-08-22 14:35:09 +09:00
|
|
|
|
}else{
|
|
|
|
|
|
debugPrint("ユーザー登録成功:$email, $password");
|
|
|
|
|
|
logManager.addOperationLog("User tried to register new account : $email , $password .");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
currentUser.clear();
|
|
|
|
|
|
//currentUser.add(value);
|
|
|
|
|
|
isLoading.value = false;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
// ユーザー登録成功メッセージを表示
|
|
|
|
|
|
Get.snackbar(
|
|
|
|
|
|
'success'.tr,
|
|
|
|
|
|
'user_registration_successful'.tr,
|
|
|
|
|
|
backgroundColor: Colors.green,
|
|
|
|
|
|
colorText: Colors.white,
|
|
|
|
|
|
snackPosition: SnackPosition.TOP,
|
|
|
|
|
|
duration: const Duration(seconds: 3),
|
|
|
|
|
|
);
|
2022-05-12 02:17:08 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
//Navigator.pop(context);
|
|
|
|
|
|
Get.toNamed(AppPages.LOGIN);
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2022-05-18 19:09:26 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
void saveToDevice(String val) async {
|
|
|
|
|
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
|
|
|
|
await prefs.setString("user_token", val);
|
|
|
|
|
|
print("saveToDevice: $val");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
2022-05-18 19:09:26 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
/*
|
|
|
|
|
|
void changeUser(Map<String, dynamic> value, {bool replace = true}) {
|
|
|
|
|
|
print("---- change user to $value -----");
|
|
|
|
|
|
currentUser.clear();
|
|
|
|
|
|
currentUser.add(value);
|
|
|
|
|
|
if (replace) {
|
|
|
|
|
|
saveToDevice(currentUser[0]["token"]);
|
|
|
|
|
|
}
|
|
|
|
|
|
isLoading.value = false;
|
2022-05-18 19:09:26 +05:30
|
|
|
|
loadLocationsBound();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (currentUser.isNotEmpty) {
|
|
|
|
|
|
rogMode.value = 0;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
rogMode.value = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
print('--- c rog mode --- ${rogMode.value}');
|
|
|
|
|
|
Get.toNamed(AppPages.INDEX);
|
2022-06-14 14:37:59 +05:30
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
*/
|
|
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
Future<void> changeUser(Map<String, dynamic> value, {bool replace = true}) async{
|
|
|
|
|
|
try {
|
|
|
|
|
|
if (value['user'] == null || value['token'] == null) {
|
|
|
|
|
|
throw Exception('Invalid user data');
|
|
|
|
|
|
}
|
|
|
|
|
|
currentUser.clear();
|
|
|
|
|
|
currentUser.add(value);
|
|
|
|
|
|
if (replace) {
|
|
|
|
|
|
saveToDevice(currentUser[0]["token"]);
|
|
|
|
|
|
}
|
|
|
|
|
|
isLoading.value = false;
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
// ユーザーのイベント情報を取得
|
|
|
|
|
|
await fetchUserEventInfo();
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
loadLocationsBound(currentUser[0]["user"]["event_code"]);
|
|
|
|
|
|
if (currentUser.isNotEmpty) {
|
|
|
|
|
|
rogMode.value = 0;
|
|
|
|
|
|
restoreGame();
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
2024-09-02 21:25:19 +09:00
|
|
|
|
// チームデータを取得
|
|
|
|
|
|
await fetchTeamData();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
rogMode.value = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
Get.toNamed(AppPages.INDEX);
|
|
|
|
|
|
} catch( e ){
|
|
|
|
|
|
print('Error in changeUser: $e');
|
|
|
|
|
|
Get.snackbar('Error', 'Failed to update user information');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Future<bool> checkUserInfoComplete() async {
|
|
|
|
|
|
try {
|
|
|
|
|
|
final user = await ApiService.to.getCurrentUser();
|
|
|
|
|
|
return user.firstname.isNotEmpty &&
|
|
|
|
|
|
user.lastname.isNotEmpty &&
|
|
|
|
|
|
user.dateOfBirth != null;
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print('Error checking user info: $e');
|
|
|
|
|
|
return false;
|
2022-06-14 14:37:59 +05:30
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
Future<void> fetchUserEventInfo() async {
|
|
|
|
|
|
try {
|
|
|
|
|
|
final List<Entry> entries = await _apiService.getEntries();
|
2022-06-14 14:37:59 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (entries.isNotEmpty) {
|
|
|
|
|
|
final Entry latestEntry = entries.last;
|
2022-06-06 21:15:58 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
final tokyo = tz.getLocation('Asia/Tokyo');
|
|
|
|
|
|
final eventDate = latestEntry.date!.toUtc();
|
|
|
|
|
|
//final eventDate = tz.TZDateTime.from(utcDate, tokyo);
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
final eventDateOnly = tz.TZDateTime(tokyo, eventDate.year, eventDate.month, eventDate.day);
|
|
|
|
|
|
|
|
|
|
|
|
currentUser[0]['user']['event_date'] = eventDateOnly.toIso8601String().split('T')[0];
|
|
|
|
|
|
currentUser[0]['user']['event_code'] = latestEntry.event.eventName;
|
|
|
|
|
|
currentUser[0]['user']['team_name'] = latestEntry.team.teamName;
|
|
|
|
|
|
currentUser[0]['user']['group'] = latestEntry.team.category.categoryName;
|
|
|
|
|
|
currentUser[0]['user']['zekken_number'] = latestEntry.zekkenNumber;
|
|
|
|
|
|
|
|
|
|
|
|
// 最後のゴール日時を取得
|
|
|
|
|
|
final lastGoalTime = await getLastGoalTime();
|
|
|
|
|
|
currentUser[0]['user']['last_goal_time'] = lastGoalTime?.toIso8601String();
|
|
|
|
|
|
|
|
|
|
|
|
print('Updated user event info: ${currentUser[0]['user']}');
|
|
|
|
|
|
} else {
|
|
|
|
|
|
print('No entries found for the user');
|
|
|
|
|
|
_clearUserEventInfo();
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print('Error fetching user event info: $e');
|
|
|
|
|
|
_clearUserEventInfo();
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
Future<DateTime?> getLastGoalTime() async {
|
|
|
|
|
|
try {
|
|
|
|
|
|
final userId = currentUser[0]['user']['id'];
|
|
|
|
|
|
return await _apiService.getLastGoalTime(userId);
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print('Error getting last goal time: $e');
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
void _clearUserEventInfo() {
|
|
|
|
|
|
currentUser[0]['user']['event_date'] = null;
|
|
|
|
|
|
currentUser[0]['user']['event_code'] = null;
|
|
|
|
|
|
currentUser[0]['user']['team_name'] = null;
|
|
|
|
|
|
currentUser[0]['user']['group'] = null;
|
|
|
|
|
|
currentUser[0]['user']['zekken_number'] = null;
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
Future<void> fetchTeamData() async {
|
|
|
|
|
|
try {
|
2024-09-02 21:25:19 +09:00
|
|
|
|
Get.put(TeamController(apiService:Get.find<ApiService>()));
|
2024-08-22 14:35:09 +09:00
|
|
|
|
// \"TeamController\" not found. You need to call \"Get.put(TeamController())\" or \"Get.lazyPut(()=>TeamController())\"
|
|
|
|
|
|
final teamController = Get.find<TeamController>();
|
|
|
|
|
|
await teamController.fetchTeams();
|
|
|
|
|
|
if (teamController.teams.isNotEmpty) {
|
|
|
|
|
|
teamId.value = teamController.teams.first.id;
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
print("Error fetching team data: $e");
|
2022-09-01 19:14:18 +05:30
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadUserDetailsForToken(String token) async {
|
|
|
|
|
|
AuthService.userForToken(token).then((value) {
|
|
|
|
|
|
print("----token val-- $value ------");
|
|
|
|
|
|
if (value![0]["user"].isEmpty) {
|
|
|
|
|
|
Get.toNamed(AppPages.LOGIN);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
changeUser(value[0], replace: false);
|
2022-06-06 21:15:58 +05:30
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
/* Old code
|
2023-09-03 23:37:41 +05:30
|
|
|
|
void loadLocationsBound() {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (isCustomAreaSelected.value == true) {
|
2022-07-28 19:01:45 +05:30
|
|
|
|
return;
|
|
|
|
|
|
}
|
2022-09-01 19:14:18 +05:30
|
|
|
|
locations.clear();
|
2022-05-18 19:09:26 +05:30
|
|
|
|
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
|
2023-09-03 23:37:41 +05:30
|
|
|
|
if (currentCat.isNotEmpty && currentCat[0] == "-all-") {
|
2022-09-01 19:14:18 +05:30
|
|
|
|
cat = "";
|
|
|
|
|
|
}
|
2023-09-03 23:37:41 +05:30
|
|
|
|
LatLngBounds bounds = mapController.bounds!;
|
2022-06-29 18:25:19 +05:30
|
|
|
|
currentBound.clear();
|
|
|
|
|
|
currentBound.add(bounds);
|
2024-08-22 14:35:09 +09:00
|
|
|
|
////print(currentCat);
|
2023-09-03 23:37:41 +05:30
|
|
|
|
LocationService.loadLocationsBound(
|
|
|
|
|
|
bounds.southWest.latitude,
|
|
|
|
|
|
bounds.southWest.longitude,
|
|
|
|
|
|
bounds.northWest.latitude,
|
|
|
|
|
|
bounds.northWest.longitude,
|
|
|
|
|
|
bounds.northEast.latitude,
|
|
|
|
|
|
bounds.northEast.longitude,
|
|
|
|
|
|
bounds.southEast.latitude,
|
|
|
|
|
|
bounds.southEast.longitude,
|
|
|
|
|
|
cat)
|
|
|
|
|
|
.then((value) {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
////print("---value length ------ ${value!.collection.length}");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
if (value == null) {
|
2022-05-18 19:09:26 +05:30
|
|
|
|
return;
|
|
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (value.features.isEmpty) {
|
2023-09-03 23:37:41 +05:30
|
|
|
|
if (showPopup == false) {
|
2022-07-10 23:50:43 +05:30
|
|
|
|
return;
|
|
|
|
|
|
}
|
2022-06-27 12:15:54 +05:30
|
|
|
|
Get.snackbar(
|
2023-09-03 23:37:41 +05:30
|
|
|
|
"Too many Points",
|
|
|
|
|
|
"please zoom in",
|
|
|
|
|
|
icon: const Icon(Icons.assistant_photo_outlined,
|
|
|
|
|
|
size: 40.0, color: Colors.blue),
|
|
|
|
|
|
snackPosition: SnackPosition.TOP,
|
2024-08-22 14:35:09 +09:00
|
|
|
|
duration: const Duration(seconds: 2),
|
2023-09-03 23:37:41 +05:30
|
|
|
|
backgroundColor: Colors.yellow,
|
|
|
|
|
|
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
|
|
|
|
|
);
|
2022-07-10 23:50:43 +05:30
|
|
|
|
showPopup = false;
|
2022-06-27 12:15:54 +05:30
|
|
|
|
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
|
2022-05-18 19:09:26 +05:30
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (value.features.isNotEmpty) {
|
|
|
|
|
|
////print("---- added---");
|
2023-09-03 23:37:41 +05:30
|
|
|
|
locations.add(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2022-05-18 19:09:26 +05:30
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2024-04-03 Akira .. Update the code . See ticket 2800.
|
|
|
|
|
|
//
|
|
|
|
|
|
// 2024-4-8 Akira : See 2809
|
|
|
|
|
|
// IndexControllerクラスでは、Future.delayedの呼び出しをunawaitedで囲んで、
|
|
|
|
|
|
// 非同期処理の結果を待たずに先に進むようにしました。これにより、メモリリークを防ぐことができます
|
|
|
|
|
|
//
|
|
|
|
|
|
// 要検討:Future.delayedを使用して非同期処理を待たずに先に進むようにしていますが、
|
|
|
|
|
|
// これによってメモリリークが発生する可能性があります。非同期処理の結果を適切に処理することを検討してください。
|
|
|
|
|
|
//
|
2024-09-03 22:17:09 +09:00
|
|
|
|
Future<void> loadLocationsBound(String eventCode) async {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (isCustomAreaSelected.value == true) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// MapControllerの初期化が完了するまで待機
|
|
|
|
|
|
await waitForMapControllerReady();
|
|
|
|
|
|
|
2024-09-03 22:17:09 +09:00
|
|
|
|
// null チェックを追加
|
|
|
|
|
|
if (mapController.bounds == null) {
|
|
|
|
|
|
print("MapController bounds are null");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// バウンドが有効かどうかを確認する
|
|
|
|
|
|
LatLngBounds bounds = mapController.bounds!;
|
|
|
|
|
|
if (!_isValidBounds(bounds)) {
|
|
|
|
|
|
print("MapController bounds are not valid");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
locations.clear();
|
|
|
|
|
|
String cat = currentCat.isNotEmpty ? currentCat[0] : "";
|
|
|
|
|
|
if (currentCat.isNotEmpty && currentCat[0] == "-all-") {
|
|
|
|
|
|
cat = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
|
|
// Akira Add 2024-4-6
|
|
|
|
|
|
if( mapController.controller == null ) {
|
|
|
|
|
|
print("操作が完了する前にMapControllerまたはウィジェットが破棄されました。");
|
|
|
|
|
|
isLoading.value = true; // ローディング状態をtrueに設定
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
//
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2024-09-03 22:17:09 +09:00
|
|
|
|
//LatLngBounds bounds = mapController.bounds!;
|
2022-05-18 19:09:26 +05:30
|
|
|
|
|
2022-04-17 11:45:21 +05:30
|
|
|
|
currentBound.clear();
|
|
|
|
|
|
currentBound.add(bounds);
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
|
|
|
|
|
//isLoading.value = true; // ローディング状態をtrueに設定
|
|
|
|
|
|
|
|
|
|
|
|
//print("bounds --- (${bounds.southWest.latitude},${bounds.southWest.longitude}),(${bounds.northWest.latitude},${bounds.northWest.longitude}),(${bounds.northEast.latitude},${bounds.northEast.longitude}),(${bounds.southEast.latitude},${bounds.southEast.longitude})");
|
|
|
|
|
|
|
|
|
|
|
|
// 要検討:APIからのレスポンスがnullの場合のエラーハンドリングが不十分です。適切なエラーメッセージを表示するなどの処理を追加してください。
|
|
|
|
|
|
try {
|
|
|
|
|
|
final eventCode = currentUser[0]["user"]["event_code"];
|
|
|
|
|
|
final value = await LocationService.loadLocationsBound(
|
|
|
|
|
|
bounds.southWest.latitude,
|
|
|
|
|
|
bounds.southWest.longitude,
|
|
|
|
|
|
bounds.northWest.latitude,
|
|
|
|
|
|
bounds.northWest.longitude,
|
|
|
|
|
|
bounds.northEast.latitude,
|
|
|
|
|
|
bounds.northEast.longitude,
|
|
|
|
|
|
bounds.southEast.latitude,
|
|
|
|
|
|
bounds.southEast.longitude,
|
|
|
|
|
|
cat,
|
|
|
|
|
|
eventCode
|
|
|
|
|
|
);
|
|
|
|
|
|
/*
|
|
|
|
|
|
if (value == null) {
|
|
|
|
|
|
// APIからのレスポンスがnullの場合
|
|
|
|
|
|
print("LocationService.loadLocationsBound からの回答がnullのため、マップをリロード");
|
|
|
|
|
|
DestinationController destinationController = Get.find<DestinationController>(); // 追加
|
|
|
|
|
|
final tk = currentUser[0]["token"]; // 追加
|
|
|
|
|
|
if (tk != null) { // 追加
|
|
|
|
|
|
destinationController.fixMapBound(tk); // 追加
|
|
|
|
|
|
} // 追加
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
isLoading.value = false; // ローディング状態をfalseに設定
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
if (value == null) {
|
|
|
|
|
|
// APIからのレスポンスがnullの場合
|
|
|
|
|
|
print("LocationService.loadLocationsBound からの回答がnullです");
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (value.features.isEmpty) {
|
|
|
|
|
|
if (showPopup == false) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
Get.snackbar(
|
|
|
|
|
|
"Too many Points",
|
|
|
|
|
|
"please zoom in",
|
|
|
|
|
|
backgroundColor: Colors.yellow,
|
|
|
|
|
|
colorText: Colors.white,
|
|
|
|
|
|
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
|
|
|
|
|
snackPosition: SnackPosition.TOP,
|
|
|
|
|
|
duration: const Duration(seconds: 3),
|
|
|
|
|
|
);
|
|
|
|
|
|
showPopup = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (value.features.isNotEmpty) {
|
|
|
|
|
|
locations.add(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
|
|
|
|
if (value != null && value.features.isEmpty) {
|
|
|
|
|
|
if (showPopup == false) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
Get.snackbar(
|
|
|
|
|
|
"Too many Points",
|
|
|
|
|
|
"please zoom in",
|
|
|
|
|
|
backgroundColor: Colors.yellow,
|
|
|
|
|
|
colorText: Colors.white,
|
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
|
Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
|
|
|
|
|
snackPosition: SnackPosition.TOP,
|
|
|
|
|
|
duration: const Duration(seconds: 3),
|
|
|
|
|
|
//backgroundColor: Colors.yellow,
|
|
|
|
|
|
);
|
|
|
|
|
|
showPopup = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (value != null && value.features.isNotEmpty) {
|
|
|
|
|
|
locations.add(value);
|
|
|
|
|
|
}
|
|
|
|
|
|
*/
|
|
|
|
|
|
} catch ( e) {
|
|
|
|
|
|
print("Error in loadLocationsBound: $e");
|
|
|
|
|
|
// エラーが発生した場合のリトライ処理や適切なエラーメッセージの表示を行う
|
|
|
|
|
|
// 例えば、一定時間後に再度loadLocationsBound()を呼び出すなど
|
|
|
|
|
|
}
|
2023-09-03 23:37:41 +05:30
|
|
|
|
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-03 22:17:09 +09:00
|
|
|
|
// バウンドが有効かどうかを確認するヘルパーメソッド
|
|
|
|
|
|
bool _isValidBounds(LatLngBounds bounds) {
|
|
|
|
|
|
// 緯度と経度が有効な範囲内にあるかチェック
|
|
|
|
|
|
return bounds.southWest.latitude.abs() <= 90 &&
|
|
|
|
|
|
bounds.southWest.longitude.abs() <= 180 &&
|
|
|
|
|
|
bounds.northEast.latitude.abs() <= 90 &&
|
|
|
|
|
|
bounds.northEast.longitude.abs() <= 180 &&
|
|
|
|
|
|
bounds.southWest.latitude < bounds.northEast.latitude;
|
|
|
|
|
|
}
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
//===Akira 追加:2024-4-6 #2800
|
|
|
|
|
|
// 要検討:MapControllerの初期化が完了するまで待機していますが、タイムアウトを設定することを検討してください。
|
|
|
|
|
|
// 初期化に時間がかかりすぎる場合、ユーザーにわかりやすいメッセージを表示するようにしてください。
|
|
|
|
|
|
//
|
|
|
|
|
|
Future<void> waitForMapControllerReady() async {
|
|
|
|
|
|
if (!isMapControllerReady.value) {
|
|
|
|
|
|
await Future.doWhile(() async {
|
|
|
|
|
|
await Future.delayed(const Duration(milliseconds: 100));
|
|
|
|
|
|
return !isMapControllerReady.value;
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
//===Akira 追加:2024-4-6 #2800
|
2022-04-17 11:45:21 +05:30
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
void setBound(LatLngBounds bounds) {
|
|
|
|
|
|
currentBound.clear();
|
|
|
|
|
|
currentBound.add(bounds);
|
2022-06-06 21:15:58 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
GeoJSONFeature? getFeatureForLatLong(double lat, double long) {
|
2023-09-03 23:37:41 +05:30
|
|
|
|
if (locations.isNotEmpty) {
|
2024-08-22 14:35:09 +09:00
|
|
|
|
GeoJSONFeature? foundFeature;
|
|
|
|
|
|
|
|
|
|
|
|
for (var i in locations[0].features) {
|
|
|
|
|
|
GeoJSONMultiPoint p = i!.geometry as GeoJSONMultiPoint;
|
|
|
|
|
|
if (p.coordinates[0][1] == lat && p.coordinates[0][0] == long) {
|
|
|
|
|
|
foundFeature = i;
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
|
|
|
|
|
return foundFeature;
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|
|
|
|
|
|
return null;
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
|
|
|
|
|
|
void reloadMap( String eventCode ) {
|
|
|
|
|
|
// マップをリロードするロジックを実装
|
|
|
|
|
|
// 例: 現在の位置情報を再取得し、マップを更新する
|
|
|
|
|
|
loadLocationsBound( eventCode );
|
2022-05-12 02:17:08 +05:30
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
Future<void> checkEntryData() async {
|
|
|
|
|
|
// エントリーデータの有無をチェックするロジック
|
2024-09-02 21:25:19 +09:00
|
|
|
|
final teamController = TeamController(apiService:Get.find<ApiService>());
|
2024-08-22 14:35:09 +09:00
|
|
|
|
bool hasEntryData = teamController.checkIfUserHasEntryData();
|
|
|
|
|
|
if (!hasEntryData) {
|
|
|
|
|
|
await showHelperDialog(
|
|
|
|
|
|
'イベントに参加するには、チーム登録・メンバー登録及びエントリーが必要になります。',
|
|
|
|
|
|
'entry_check'
|
|
|
|
|
|
);
|
|
|
|
|
|
// ドロワーを表示するロジック
|
|
|
|
|
|
Get.toNamed('/drawer');
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-22 14:35:09 +09:00
|
|
|
|
void updateCurrentUser(User updatedUser) {
|
|
|
|
|
|
currentUser[0]['user'] = updatedUser.toJson();
|
|
|
|
|
|
update();
|
2022-04-17 11:45:21 +05:30
|
|
|
|
}
|
2023-09-03 23:37:41 +05:30
|
|
|
|
}
|