diff --git a/lib/screens/license_screen.dart b/lib/screens/license_screen.dart index 4671f85..8242c46 100644 --- a/lib/screens/license_screen.dart +++ b/lib/screens/license_screen.dart @@ -102,7 +102,7 @@ class _LicenseScreenState extends ConsumerState { ), const SizedBox(height: 16), Text( - 'AI解析を無制限にご利用いただけます。\nご購入ありがとうございました。', + 'すべてのPro機能をご利用いただけます。\nご購入ありがとうございました。', textAlign: TextAlign.center, style: TextStyle(color: colors.textSecondary, height: 1.5), ), diff --git a/lib/services/license_service.dart b/lib/services/license_service.dart index 1a0e34a..9807b6e 100644 --- a/lib/services/license_service.dart +++ b/lib/services/license_service.dart @@ -27,7 +27,7 @@ enum LicenseStatus { /// 2. オフライン時: SharedPreferencesのキャッシュを使用 (Pro状態を維持) /// /// ## ライセンスキー形式 -/// PONSHU-XXXX-XXXX-XXXX (16バイト hex, 大文字) +/// PONSHU-XXXX-XXXX-XXXX (6バイト = 12hex文字, 大文字) class LicenseService { static const _prefLicenseKey = 'ponshu_license_key'; static const _prefCachedStatus = 'ponshu_license_status_cache'; @@ -45,6 +45,11 @@ class LicenseService { if (savedKey.isNotEmpty) { try { final status = await _validateKeyWithServer(savedKey); + if (status == LicenseStatus.offline) { + // ネットワーク不通: キャッシュを上書きせずに返す + debugPrint('[License] Server unreachable, using cache'); + return _getCachedStatus(prefs); + } await _cacheStatus(prefs, status); return status; } catch (e) { @@ -82,6 +87,10 @@ class LicenseService { return (success: false, message: 'このライセンスは無効化されています。\nサポートにお問い合わせください。'); } + if (status == LicenseStatus.offline) { + return (success: false, message: 'サーバーに接続できませんでした。\nネットワーク接続を確認してください。'); + } + return (success: false, message: 'ライセンスキーが見つかりません。\nご購入時のメールをご確認ください。'); }