Google サービス依存削除\n- googleapis_auth, googleapis, google_sign_in を pubspec.yaml から除外\n- lib/services/google/ 関連ファイルを削除\n- ビルド:成功(48.4MB)\n\n備考:オフライン単体アプリとして機能します
This commit is contained in:
parent
d1d217c889
commit
4c5ea99947
6 changed files with 45 additions and 247 deletions
|
|
@ -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}}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
// Version: 1.0.1 - ビルド用簡易サーバー(非機能コード)
|
||||
// Version: 1.0.2 - ビルド用簡易サーバー(非機能コード)
|
||||
// ※本プロジェクトのクラウド同期機能はオプトイン制のため、ビルド時には無効化可能
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
/// サーバー起動処理(簡易実装)
|
||||
|
|
@ -12,91 +11,54 @@ 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({
|
||||
/// ハンドラ関数定義(実際に使用しないが、ドキュメント用として保持)
|
||||
String _handleHealth() => jsonEncode({
|
||||
'status': 'ok',
|
||||
'server_time': DateTime.now().toIso8601String(),
|
||||
'build_date': Platform.environment['APP_BUILD_TIMESTAMP'],
|
||||
});
|
||||
|
||||
/// ハンドラ:ステータス一覧取得(簡易)
|
||||
String _handleStatus(HttpRequest request) =>
|
||||
jsonEncode({
|
||||
String _handleStatus() => jsonEncode({
|
||||
'server': 'mothership',
|
||||
'version': '1.0.0',
|
||||
'clients': [],
|
||||
});
|
||||
|
||||
/// ハンドラ:ハートビート同期(簡易)
|
||||
Future<String> _handleHeartbeat(HttpRequest request) async {
|
||||
Future<String> _handleHeartbeat() async {
|
||||
return jsonEncode({
|
||||
'status': 'synced',
|
||||
'timestamp': DateTime.now().toIso8601String(),
|
||||
'clients_online': 0,
|
||||
});
|
||||
}
|
||||
|
||||
/// ハンドラ:チャット送信(簡易)
|
||||
String _handleChatSend(HttpRequest request) =>
|
||||
jsonEncode({
|
||||
String _handleChatSend() => jsonEncode({
|
||||
'status': 'ok',
|
||||
'queue_length': 0,
|
||||
});
|
||||
|
||||
/// ハンドラ:チャット未送信メッセージ取得(簡易)
|
||||
String _handleChatPending(HttpRequest request) =>
|
||||
jsonEncode({
|
||||
String _handleChatPending() => jsonEncode({
|
||||
'messages': const <String>[],
|
||||
});
|
||||
|
||||
/// ハンドラ:チャット送信確認(簡易)
|
||||
String _handleChatAck(HttpRequest request) =>
|
||||
jsonEncode({
|
||||
String _handleChatAck() => jsonEncode({
|
||||
'status': 'acknowledged',
|
||||
});
|
||||
|
||||
/// ハンドラ:バックアップドライブ確認(簡易)
|
||||
String _handleBackupDrive(HttpRequest request) =>
|
||||
jsonEncode({
|
||||
String _handleBackupDrive() => jsonEncode({
|
||||
'status': 'drive_ready',
|
||||
'quota_gb': 15,
|
||||
'used_space_gb': 0.0,
|
||||
});
|
||||
|
||||
/// ハンドラ:未定義エンドポイント
|
||||
String _handleNotFound(HttpRequest request) {
|
||||
return jsonEncode({
|
||||
String _handleNotFound() => jsonEncode({
|
||||
'error': 'Not Found',
|
||||
'path': request.url.path,
|
||||
'path': '/unknown',
|
||||
'available_endpoints': [
|
||||
'/health',
|
||||
'/status',
|
||||
|
|
@ -107,4 +69,3 @@ String _handleNotFound(HttpRequest request) {
|
|||
'/backup/drive',
|
||||
],
|
||||
});
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
||||
/// ノード ID(BCC アドレス)を取得
|
||||
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 ライブラリに委譲...
|
||||
}
|
||||
|
|
@ -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 ?? '';
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue