20240903 pre release

This commit is contained in:
2024-09-03 22:17:09 +09:00
parent fe46d46ab6
commit 2c0bb06e74
44 changed files with 610 additions and 154 deletions

View File

@ -139,16 +139,23 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
Future<void> saveTemporaryImage(Destination destination) async {
final serverUrl = ConstValues.currentServer();
final imagePath = '$serverUrl/media/compressed/${destination.photos}';
try {
final serverUrl = ConstValues.currentServer();
final imagePath = '$serverUrl/media/compressed/${destination.photos}';
final tempDir = await getTemporaryDirectory();
final tempFile = await File('${tempDir.path}/temp_image.jpg').create(recursive: true);
final response = await http.get(Uri.parse(imagePath));
await tempFile.writeAsBytes(response.bodyBytes);
debugPrint("imagePath = $imagePath");
destinationController.photos.clear();
destinationController.photos.add(tempFile);
final tempDir = await getTemporaryDirectory();
final tempFile = await File('${tempDir.path}/temp_image.jpg').create(
recursive: true);
final response = await http.get(Uri.parse(imagePath));
await tempFile.writeAsBytes(response.bodyBytes);
destinationController.photos.clear();
destinationController.photos.add(tempFile);
} catch( e ) {
debugPrint("saveTemporaryImage error : $e");
}
}
// アクションボタン(チェックイン、ゴールなど)を表示するためのメソッドです。
@ -239,12 +246,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
return;
}
destinationController.isInRog.value = true;
// Show confirmation dialog
Get.dialog(
AlertDialog(
@ -270,6 +273,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
// Clear data and start game logic here
destinationController.resetRogaining();
// ここでチェックインもしている。
destinationController.addToRogaining(
destinationController.currentLat,
destinationController.currentLon,
@ -996,15 +1000,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Obx((() => indexController.rogMode.value == 1
? ElevatedButton(
onPressed: () async {
Destination dest =
indexController.currentDestinationFeature[0];
//print("~~~~ before checking button ~~~~");
Destination dest = indexController.currentDestinationFeature[0];
print("~~~~ before checking button ~~~~");
//print("------ curent destination is ${dest!.checkedIn}-------");
destinationController.makeCheckin(
dest, !dest.checkedin!, "");
destinationController.makeCheckin( dest, !dest.checkedin!, "");
},
child: indexController
.currentDestinationFeature[0].checkedin ==
child: indexController.currentDestinationFeature[0].checkedin ==
false
? const Text("チェックイン")
: const Text("チェックアウト"))

View File

@ -140,12 +140,25 @@ class _MapWidgetState extends State<MapWidget> with WidgetsBindingObserver {
*/
// _centerMapOnUser を10秒間でコール
void _startIdleTimer() {
Future<void> _startIdleTimer() async {
//debugPrint("_startIdleTimer ....");
final settingsController = Get.find<SettingsController>();
SettingsController settingsController;
// SettingsControllerが利用可能になるまで待機
while (true) {
try {
settingsController = Get.find<SettingsController>();
break; // SettingsControllerが見つかったらループを抜ける
} catch (e) {
// SettingsControllerがまだ利用可能でない場合は少し待ってから再試行
await Future.delayed(const Duration(milliseconds: 100));
}
}
if (!settingsController.autoReturnDisabled.value) {
_timer = Timer(settingsController.timerDuration.value, _centerMapOnUser);
}
}
// タイマーをリセットして_startIdleTimer をコール
@ -173,7 +186,16 @@ class _MapWidgetState extends State<MapWidget> with WidgetsBindingObserver {
Future<List<Marker>> _getMarkers() async {
debugPrint('Getting markers...');
List<Marker> markers = [];
if (indexController.isLoadingLocations.value) {
await Future.doWhile(() async {
await Future.delayed(const Duration(milliseconds: 100));
return indexController.isLoadingLocations.value;
});
}
debugPrint('Getting markers...');
List<Marker> markers = [];
if (indexController.locations.isNotEmpty && indexController.locations[0].features.isNotEmpty) {
for (var feature in indexController.locations[0].features) {
GeoJSONMultiPoint point = feature!.geometry as GeoJSONMultiPoint;