debug: Add debug logging for Google Drive upload issues

Added debug logging to:
1. main.dart - Log IS_PRO_VERSION value at startup
2. main_screen.dart - Log IS_PRO_VERSION and isBusiness in screen build
3. pdf_preview_screen.dart - Log PDF Drive upload process with file ID verification

This will help diagnose why Google Drive uploads appear to succeed but files
are not visible in Drive.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ponshu Developer 2026-01-31 01:00:37 +09:00
parent a1b25bf3a7
commit 494dafe3f2
3 changed files with 17 additions and 2 deletions

View File

@ -20,7 +20,10 @@ const bool isProVersion = bool.fromEnvironment('IS_PRO_VERSION', defaultValue: t
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
// 🔍 DEBUG: Check IS_PRO_VERSION flag
debugPrint('🔍 IS_PRO_VERSION = $isProVersion');
// Initialize Hive // Initialize Hive
await Hive.initFlutter(); await Hive.initFlutter();

View File

@ -46,6 +46,9 @@ class _MainScreenState extends ConsumerState<MainScreen> {
final isBusiness = userProfile.isBusinessMode; final isBusiness = userProfile.isBusinessMode;
final t = Translations(userProfile.locale); // Translation helper final t = Translations(userProfile.locale); // Translation helper
// 🔍 DEBUG: Check IS_PRO_VERSION flag
debugPrint('🔍 MainScreen: IS_PRO_VERSION = $isProVersion, isBusiness = $isBusiness');
// Define Screens for each mode // Define Screens for each mode
// Pro版かLite版かで画面を切り替え // Pro版かLite版かで画面を切り替え
final List<Widget> screens = isBusiness final List<Widget> screens = isBusiness

View File

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart'; // debugPrint
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:printing/printing.dart'; import 'package:printing/printing.dart';
import 'package:pdf/pdf.dart'; import 'package:pdf/pdf.dart';
@ -284,7 +285,8 @@ class PdfPreviewScreen extends ConsumerWidget {
..name = fileName ..name = fileName
..mimeType = 'application/pdf'; ..mimeType = 'application/pdf';
await driveApi.files.create( debugPrint('[PDF_DRIVE] 📤 アップロード開始: $fileName (${bytes.length} bytes)');
final uploadedFile = await driveApi.files.create(
driveFile, driveFile,
uploadMedia: drive.Media( uploadMedia: drive.Media(
Stream.value(bytes.toList()), Stream.value(bytes.toList()),
@ -292,6 +294,13 @@ class PdfPreviewScreen extends ConsumerWidget {
), ),
); );
if (uploadedFile.id == null) {
debugPrint('[PDF_DRIVE] ❌ アップロード失敗: ID取得不可');
throw Exception('アップロードに失敗しましたIDなし');
}
debugPrint('[PDF_DRIVE] ✅ アップロード完了: ID=${uploadedFile.id}');
// 5. Success notification // 5. Success notification
if (context.mounted) { if (context.mounted) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(