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

@ -108,7 +108,22 @@ class AuthService {
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
} else {
debugPrint('Response body: ${response.body}');
print('Login failed with status code: ${response.statusCode}');
var errorMessage = 'ログインに失敗しました。';
if (response.statusCode == 400) {
var errorBody = json.decode(utf8.decode(response.bodyBytes));
errorMessage = errorBody['non_field_errors']?[0] ?? 'パスワードが正しくありません。';
}
Get.snackbar(
"エラー",
errorMessage,
backgroundColor: Colors.red,
colorText: Colors.white,
snackPosition: SnackPosition.TOP,
duration: const Duration(seconds: 3),
);
cats = {};
}
} catch( e ){

View File

@ -80,7 +80,7 @@ class ExternalService {
<String, String>{'team_name': team, 'event_code': eventCode}),
);
//print("---- start rogianing api status ---- ${response.statusCode}");
print("---- start rogianing api status ---- ${response.statusCode}");
if (response.statusCode == 200) {
res = json.decode(utf8.decode(response.bodyBytes));

View File

@ -0,0 +1,29 @@
import 'package:flutter/services.dart';
import 'dart:io';
class MotionService {
static const MethodChannel _channel = MethodChannel('net.sumasen.gifunavi/motion');
static Future<void> startMotionUpdates() async {
if (Platform.isIOS) {
try {
await _channel.invokeMethod('startMotionUpdates');
} on PlatformException catch (e) {
print("Failed to start motion updates: '${e.message}'.");
}
} else{
// Android の場合は何もしない、またはAndroid向けの代替実装を行う
print("Motion updates not supported on this platform");
}
}
static Future<void> stopMotionUpdates() async {
if (Platform.isIOS) {
try {
await _channel.invokeMethod('stopMotionUpdates');
} on PlatformException catch (e) {
print("Failed to stop motion updates: '${e.message}'.");
}
}
}
}