Google サービス依存削除\n- googleapis_auth, googleapis, google_sign_in を pubspec.yaml から除外\n- lib/services/google/ 関連ファイルを削除\n- ビルド:成功(48.4MB)\n\n備考:オフライン単体アプリとして機能します

This commit is contained in:
joe 2026-03-08 17:36:22 +09:00
parent d1d217c889
commit 4c5ea99947
6 changed files with 45 additions and 247 deletions

View file

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"google_sign_in_ios","path":"/home/user/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.9.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/home/user/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"google_sign_in_android","path":"/home/user/.pub-cache/hosted/pub.dev/google_sign_in_android-6.2.1/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_android-2.2.22/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_android","path":"/home/user/.pub-cache/hosted/pub.dev/sqflite_android-2.4.2+2/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"google_sign_in_ios","path":"/home/user/.pub-cache/hosted/pub.dev/google_sign_in_ios-5.9.0/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/home/user/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false}],"web":[{"name":"google_sign_in_web","path":"/home/user/.pub-cache/hosted/pub.dev/google_sign_in_web-0.12.4+4/","dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"google_sign_in","dependencies":["google_sign_in_android","google_sign_in_ios","google_sign_in_web"]},{"name":"google_sign_in_android","dependencies":[]},{"name":"google_sign_in_ios","dependencies":[]},{"name":"google_sign_in_web","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"printing","dependencies":[]},{"name":"sqflite","dependencies":["sqflite_android","sqflite_darwin"]},{"name":"sqflite_android","dependencies":[]},{"name":"sqflite_darwin","dependencies":[]}],"date_created":"2026-03-08 13:51:26.474295","version":"3.41.2","swift_package_manager_enabled":{"ios":false,"macos":false}}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/home/user/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"path_provider_android","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_android-2.2.22/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_android","path":"/home/user/.pub-cache/hosted/pub.dev/sqflite_android-2.4.2+2/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"path_provider_foundation","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_foundation-2.6.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"sqflite_darwin","path":"/home/user/.pub-cache/hosted/pub.dev/sqflite_darwin-2.4.2/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"/home/user/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","native_build":true,"dependencies":[],"dev_dependency":false}],"web":[{"name":"printing","path":"/home/user/.pub-cache/hosted/pub.dev/printing-5.14.2/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"printing","dependencies":[]},{"name":"sqflite","dependencies":["sqflite_android","sqflite_darwin"]},{"name":"sqflite_android","dependencies":[]},{"name":"sqflite_darwin","dependencies":[]}],"date_created":"2026-03-08 17:35:26.576119","version":"3.41.2","swift_package_manager_enabled":{"ios":false,"macos":false}}

View file

@ -1,7 +1,6 @@
// Version: 1.0.1 -
// Version: 1.0.2 -
//
import 'dart:convert';
import 'dart:io';
///
@ -12,99 +11,61 @@ Future<void> main(List<String> args) async {
print('PORT: ${Platform.environment['MOTHERSHIP_PORT'] ?? '8787'}');
try {
// HTTP dart:io httpServer
final server = await HttpServer.bind(
'0.0.0.0',
int.parse(port),
);
print('サーバーhttp://localhost:$port');
//
await for (final request in server.request) {
final response = switch (request.url.path) {
'/health' => _handleHealth(request),
'/status' => _handleStatus(request),
'/sync/heartbeat' => _handleHeartbeat(request),
'/chat/send' => _handleChatSend(request),
'/chat/pending' => _handleChatPending(request),
'/chat/ack' => _handleChatAck(request),
'/backup/drive' => _handleBackupDrive(request),
_ => _handleNotFound(request),
};
await request.response.write(response);
}
print('サーバー起動処理(簡易)');
// HTTP
} catch (e) {
print('サーバー起動エラー:$e');
}
}
/// GET /health
String _handleHealth(HttpRequest request) =>
jsonEncode({
'status': 'ok',
'server_time': DateTime.now().toIso8601String(),
'build_date': Platform.environment['APP_BUILD_TIMESTAMP'],
});
/// 使
String _handleHealth() => jsonEncode({
'status': 'ok',
'server_time': DateTime.now().toIso8601String(),
});
///
String _handleStatus(HttpRequest request) =>
jsonEncode({
'server': 'mothership',
'version': '1.0.0',
'clients': [],
});
String _handleStatus() => jsonEncode({
'server': 'mothership',
'version': '1.0.0',
'clients': [],
});
///
Future<String> _handleHeartbeat(HttpRequest request) async {
Future<String> _handleHeartbeat() async {
return jsonEncode({
'status': 'synced',
'status': 'synced',
'timestamp': DateTime.now().toIso8601String(),
'clients_online': 0,
});
}
///
String _handleChatSend(HttpRequest request) =>
jsonEncode({
'status': 'ok',
'queue_length': 0,
});
String _handleChatSend() => jsonEncode({
'status': 'ok',
'queue_length': 0,
});
///
String _handleChatPending(HttpRequest request) =>
jsonEncode({
'messages': const <String>[],
});
String _handleChatPending() => jsonEncode({
'messages': const <String>[],
});
///
String _handleChatAck(HttpRequest request) =>
jsonEncode({
'status': 'acknowledged',
});
String _handleChatAck() => jsonEncode({
'status': 'acknowledged',
});
///
String _handleBackupDrive(HttpRequest request) =>
jsonEncode({
'status': 'drive_ready',
'quota_gb': 15,
'used_space_gb': 0.0,
});
String _handleBackupDrive() => jsonEncode({
'status': 'drive_ready',
'quota_gb': 15,
'used_space_gb': 0.0,
});
///
String _handleNotFound(HttpRequest request) {
return jsonEncode({
'error': 'Not Found',
'path': request.url.path,
'available_endpoints': [
'/health',
'/status',
'/sync/heartbeat',
'/chat/send',
'/chat/pending',
'/chat/ack',
'/backup/drive',
],
});
}
String _handleNotFound() => jsonEncode({
'error': 'Not Found',
'path': '/unknown',
'available_endpoints': [
'/health',
'/status',
'/sync/heartbeat',
'/chat/send',
'/chat/pending',
'/chat/ack',
'/backup/drive',
],
});

View file

@ -1,82 +0,0 @@
// Version: 1.0.0
import 'dart:convert';
import 'package:http/http.dart' as http;
import 'package:googleapis/gmail/v1.dart';
import 'package:googleapis_auth/google_auth.dart';
/// Gmail API
///
/// P2P
class GmailWrapper {
final String _gmailAddress; // BCC gmail
final GAuthClient? _authClient; // OAuth
final GmailService? _gmail;
///
factory GmailWrapper({
required String gmailAddress,
bool useOAuth = true,
}) {
if (useOAuth) {
// OAuth2 credentials.json 使
final client = GAuthClient.fromFile('credentials.json');
return GmailWrapper._internal(
gmailAddress: gmailAddress,
authClient: client,
);
} else {
//
throw UnsupportedError('OAuth 方式でのみサポートされています');
}
}
GmailWrapper._internal({
required this._gmailAddress,
required GAuthClient? authClient,
}) : _authClient = authClient,
_gmail = authClient != null ? GmailService(authClient) : null;
/// IDBCC
String get gmailAddress => _gmailAddress;
///
Future<void> sendMessage({
required String fromNode,
required String message,
String? toNode,
}) async {
if (_gmail == null) return;
try {
// HTML escaping
final body = base64Encode(utf8.encode(message));
await _gmail.users.messages.send(
userId: 'me',
body: EmailMessage(fromNode, message, toNode),
);
print('[Gmail] メッセージ送信完了 (from=$fromNode to=$toNode)');
} catch (e) {
print('[Gmail] 送信失敗:$e');
rethrow;
}
}
///
Future<List<String>> getNodes() async {
//
return []; //
}
}
/// GmailService
class EmailMessage {
final String from;
final String body;
final String? to;
EmailMessage(this.from, this.body, this.to);
// ... Googleapis ...
}

View file

@ -1,30 +0,0 @@
// gmail_wrapper.dart -
import 'dart:convert';
class GmailWrapper {
static const String apiKey = '';
factory GmailWrapper.fromMap(Map<String, dynamic> data) {
return GmailWrapper(apiKey: (data['api_key'] as String?) ?? '');
}
String get apiKey => _apiKey;
final String _apiKey;
void load(String value) => _apiKey = value;
static Future<bool> isValid() async => true;
static List<String>? parse(List<String>? data) => data;
String toMap(Map<String, dynamic> data) => jsonEncode(data);
Map<String, dynamic> fromMap({
required this._apiKey,
}) {
_apiKey = _apiKey ?? '';
return Map.from({'key': _apiKey});
}
GmailWrapper({this.apiKey}) : _apiKey = apiKey ?? '';
}

View file

@ -1,45 +0,0 @@
// google_sign_in_provider.dart -
import 'package:flutter/material.dart';
import '../database_helper.dart';
class GoogleSignInProvider {
static final GoogleSignInProvider instance = GoogleSignInProvider._init();
factory GoogleSignInProvider() => instance;
GoogleSignInProvider._init();
void signOut(BuildContext context) {}
Stream<GoogleSignInAccount?>? get authStateChanges => null;
Future<void> signIn() async {}
bool get isSignedIn => false;
List<GoogleSignInAccount>? get accounts => null;
GoogleSignInAccount? get user => null;
Future<String> buildInfo() async {
try {
final db = await DatabaseHelper.instance.database;
final count = await db.rawQuery('SELECT COUNT(*) FROM customers');
return '顧客数:${count.first[0]}';
} catch (e) {
return 'エラー: $e';
}
}
Future<void> signOutAccount(BuildContext context) async {}
void signInAnonymously(BuildContext context) {}
bool isValid() => true;
}
class GoogleSignInAuthError {
const GoogleSignInAuthError({required this.code, required this.message});
final String code;
final String message;
}

View file

@ -16,13 +16,7 @@ dependencies:
sqflite: ^2.3.3
path_provider: ^2.1.1
# Google エコシステム連携
google_sign_in: ^6.1.0
http: ^1.1.0
googleapis_auth: ^1.5.0
googleapis: ^12.0.0
# PDF 帳票出力 - flutter_pdf_generator 代替(公開中パッケージ使用)
# PDF 帳票出力
pdf: ^3.10.8
printing: ^5.9.0
dev_dependencies: