fix: セルフコードレビュー修正 — ライセンス管理バグ4件

- license_service.dart: オフライン時にProキャッシュを上書きしないよう修正
  (offline statusを受け取ったらキャッシュフォールバックを使う)
- license_service.dart: activate()でoffline状態を明示的にハンドル
  (「キーが見つかりません」ではなく「接続できません」と表示)
- license_service.dart: ライセンスキーのバイト数コメントを修正 (16→6バイト)
- license_screen.dart: Pro画面の誤ったテキスト修正
  (「AI解析無制限」→「すべてのPro機能」)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Ponshu Developer 2026-04-11 06:42:35 +09:00
parent 659e81628a
commit 7b3249791e
2 changed files with 11 additions and 2 deletions

View File

@ -102,7 +102,7 @@ class _LicenseScreenState extends ConsumerState<LicenseScreen> {
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
Text( Text(
'AI解析を無制限にご利用いただけます。\nご購入ありがとうございました。', 'すべてのPro機能をご利用いただけます。\nご購入ありがとうございました。',
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle(color: colors.textSecondary, height: 1.5), style: TextStyle(color: colors.textSecondary, height: 1.5),
), ),

View File

@ -27,7 +27,7 @@ enum LicenseStatus {
/// 2. : SharedPreferencesのキャッシュを使用 (Pro状態を維持) /// 2. : SharedPreferencesのキャッシュを使用 (Pro状態を維持)
/// ///
/// ## /// ##
/// PONSHU-XXXX-XXXX-XXXX (16 hex, ) /// PONSHU-XXXX-XXXX-XXXX (6 = 12hex文字, )
class LicenseService { class LicenseService {
static const _prefLicenseKey = 'ponshu_license_key'; static const _prefLicenseKey = 'ponshu_license_key';
static const _prefCachedStatus = 'ponshu_license_status_cache'; static const _prefCachedStatus = 'ponshu_license_status_cache';
@ -45,6 +45,11 @@ class LicenseService {
if (savedKey.isNotEmpty) { if (savedKey.isNotEmpty) {
try { try {
final status = await _validateKeyWithServer(savedKey); final status = await _validateKeyWithServer(savedKey);
if (status == LicenseStatus.offline) {
// :
debugPrint('[License] Server unreachable, using cache');
return _getCachedStatus(prefs);
}
await _cacheStatus(prefs, status); await _cacheStatus(prefs, status);
return status; return status;
} catch (e) { } catch (e) {
@ -82,6 +87,10 @@ class LicenseService {
return (success: false, message: 'このライセンスは無効化されています。\nサポートにお問い合わせください。'); return (success: false, message: 'このライセンスは無効化されています。\nサポートにお問い合わせください。');
} }
if (status == LicenseStatus.offline) {
return (success: false, message: 'サーバーに接続できませんでした。\nネットワーク接続を確認してください。');
}
return (success: false, message: 'ライセンスキーが見つかりません。\nご購入時のメールをご確認ください。'); return (success: false, message: 'ライセンスキーが見つかりません。\nご購入時のメールをご確認ください。');
} }