手戻り修正、APK出力

This commit is contained in:
2024-04-24 11:30:38 +09:00
parent 4d40a10f9a
commit 8945748d07
9 changed files with 213 additions and 52 deletions

View File

@ -450,8 +450,8 @@ class CameraPage extends StatelessWidget {
// buyPointPhotoがtrueの場合は、BuyPointCameraウィジェットを返します。
//print("--- buy point camera ${destination.toString()}");
return BuyPointCamera(destination: destination);
}else if(destination.use_qr_code){
return QRCodeScannerPage(destination: destination);
//}else if(destination.use_qr_code){
// return QRCodeScannerPage(destination: destination);
} else if (destinationController.isInRog.value) {
// isInRogがtrueの場合は、カメラページのUIを構築します。
// AppBarには、目的地の情報を表示します。

View File

@ -32,6 +32,7 @@ import 'package:rogapp/widgets/debug_widget.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:image_gallery_saver/image_gallery_saver.dart';
import 'package:rogapp/utils/const.dart';
// 目的地に関連する状態管理とロジックを担当するクラスです。
//
@ -405,30 +406,35 @@ class DestinationController extends GetxController {
// print("~~~~ calling start ~~~~");
print("---- in start -----");
chekcs = 1; // スタート地点で前のゴールから24時間経過
chekcs = 1; // スタート地点で前のゴールから24時間経過
isInCheckin.value = true;
isAtStart.value = true;
if (shouldShowBottomSheet) {
shouldShowBottomSheet = false; // bottom_sheet を起動させない。
shouldShowBottomSheet = false; // bottom_sheet を起動させない。
Widget bottomSheet = BottomSheetNew(destination: d);
await showModalBottomSheet(
constraints:
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
context: Get.context!,
isScrollControlled: true,
builder: ((context) => bottomSheet)
).whenComplete(() {
shouldShowBottomSheet = true; // bottom_sheet 起動許可
skipGps = false;
chekcs = 0; // ボトムシートモード=1,
chekcs = 0; // ボトムシートモード=1,
isAtStart.value = false;
isInCheckin.value = false;
});
}
return;
// 以下の条件分岐を追加
} else if (ds.isNotEmpty && ds[0].checkedin == true) {
// 目的地がDBに存在し、すでにチェックインしている場合は自動ポップアップを表示しない
debugPrint("チェックイン済み");
return;
} else if (isInRog.value == true &&
indexController.rogMode.value == 1 &&
@ -597,7 +603,7 @@ class DestinationController extends GetxController {
// print(
// "==== date diff is ${DateTime.now().difference(last_goal_at).inHours} ====");
if (isuserLoggedIn &&
(d.cp == -2 || d.cp == 0 ) && // Goal CP
(d.cp == -2 || d.cp == 0 || d.cp == -1 ) && // Goal CP
locationAlreadyCheckedIn &&
skip_10s == false) {
//check for rogaining
@ -763,7 +769,7 @@ class DestinationController extends GetxController {
if (autoCheckin) {
if (!checkingIn) {
makeCheckin(d, true, "");
if (d.cp != -1) {
if (d.cp != -1 && d.cp != 0 && d.cp != -2) {
rogainingCounted.value = true;
}
}
@ -774,7 +780,7 @@ class DestinationController extends GetxController {
if (d.hidden_location != null &&
d.hidden_location == 0 &&
isInRog.value == true &&
d.cp != -1) {
d.cp != -1 && d.cp != 0 && d.cp != -2) {
chekcs = 3;
isInCheckin.value = true;
photos.clear();
@ -887,7 +893,10 @@ class DestinationController extends GetxController {
LatLng(currentLat, currentLon));
Destination des = festuretoDestination(fs);
if (distFs <= des.checkin_radious! && skipGps == false) {
if (distFs <= des.checkin_radious!
&& skipGps == false
//&& des.isCheckedIn == false
&& des.cp!=0 && des.cp!=-1 && des.cp!=-2) {
await startTimerLocation(fs, distFs);
// Note: You cannot break out of forEach. If you need to stop processing, you might have to reconsider using forEach.
}
@ -1015,7 +1024,15 @@ class DestinationController extends GetxController {
// print("~~~~ inserted into db ~~~~");
}
await _saveImageFromPath(imageurl);
if (imageurl == null || imageurl.isEmpty) {
if (photos.isNotEmpty) {
// imageurlが空の場合は、destinationのcheckin_imageプロパティを使用する
debugPrint("photos = ${photos}");
imageurl = photos[0].path;
}
debugPrint("imageurl = ${imageurl}");
await _saveImageFromPath(imageurl!);
}
populateDestinations();

View File

@ -131,6 +131,30 @@ class IndexController extends GetxController {
super.onClose();
}
/*
@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();
}
*/
Future<void> _updateConnectionStatus(ConnectivityResult result) async {
connectionStatus = result;
connectionStatusName.value = result.name;
@ -232,6 +256,10 @@ class IndexController extends GetxController {
});
currentUser.clear();
cats.clear();
// ユーザートークンをデバイスから削除
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.remove("user_token");
}
// 要検討:エラーハンドリングが行われていますが、エラーメッセージをローカライズすることを検討してください。
@ -361,6 +389,9 @@ class IndexController extends GetxController {
return;
}
// MapControllerの初期化が完了するまで待機
await waitForMapControllerReady();
// Akira 追加:2024-4-6 #2800
//await waitForMapControllerReady(); // MapControllerの初期化が完了するまで待機
// Akira 追加:2024-4-6 #2800
@ -451,7 +482,7 @@ class IndexController extends GetxController {
Future<void> waitForMapControllerReady() async {
if (!isMapControllerReady.value) {
await Future.doWhile(() async {
await Future.delayed(const Duration(milliseconds: 500));
await Future.delayed(const Duration(milliseconds: 100));
return !isMapControllerReady.value;
});
}