forked from baron/baron-sso
활성 RP 홈페이지 이동 기능 추가
This commit is contained in:
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
import '../../../../core/notifiers/auth_notifier.dart';
|
||||
import '../../../../core/services/auth_token_store.dart';
|
||||
import '../../../../core/services/http_client.dart';
|
||||
@@ -106,6 +107,7 @@ class LinkedRp {
|
||||
final String id;
|
||||
final String name;
|
||||
final String logo;
|
||||
final String url;
|
||||
final String status;
|
||||
final List<String> scopes;
|
||||
final DateTime? lastAuthenticatedAt;
|
||||
@@ -114,6 +116,7 @@ class LinkedRp {
|
||||
required this.id,
|
||||
required this.name,
|
||||
required this.logo,
|
||||
required this.url,
|
||||
required this.status,
|
||||
required this.scopes,
|
||||
required this.lastAuthenticatedAt,
|
||||
@@ -134,6 +137,7 @@ class LinkedRp {
|
||||
id: json['id']?.toString() ?? '',
|
||||
name: json['name']?.toString() ?? '',
|
||||
logo: json['logo']?.toString() ?? '',
|
||||
url: json['url']?.toString() ?? '',
|
||||
status: json['status']?.toString() ?? '',
|
||||
scopes: (json['scopes'] as List?)?.whereType<String>().toList() ?? [],
|
||||
lastAuthenticatedAt: parsedLastAuth,
|
||||
@@ -887,6 +891,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
canLogout: false,
|
||||
isRevoked: isRevoked,
|
||||
onRevoke: isRevoked ? null : () => _onRevokeLink(rp.id, name),
|
||||
url: rp.url, // URL 전달
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -945,9 +950,11 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
final borderColor = isActive ? Colors.green.withOpacity(0.5) : _border;
|
||||
final borderWidth = isActive ? 1.5 : 1.0;
|
||||
|
||||
return Opacity(
|
||||
opacity: item.isRevoked ? 0.6 : 1.0,
|
||||
child: Container(
|
||||
// 활성 상태면 클릭 가능 (URL 유무와 관계없이)
|
||||
final isClickable = isActive;
|
||||
|
||||
// 카드 컨텐츠
|
||||
final cardContent = Container(
|
||||
width: 260,
|
||||
padding: const EdgeInsets.all(16),
|
||||
decoration: BoxDecoration(
|
||||
@@ -1033,10 +1040,47 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
// Opacity 적용
|
||||
final opaqueCard = Opacity(
|
||||
opacity: item.isRevoked ? 0.6 : 1.0,
|
||||
child: cardContent,
|
||||
);
|
||||
|
||||
// 클릭 가능한 경우 InkWell로 감싸기
|
||||
if (isClickable) {
|
||||
return MouseRegion(
|
||||
cursor: SystemMouseCursors.click,
|
||||
child: GestureDetector(
|
||||
onTap: () async {
|
||||
if (item.url != null && item.url!.isNotEmpty) {
|
||||
final uri = Uri.parse(item.url!);
|
||||
if (await canLaunchUrl(uri)) {
|
||||
await launchUrl(uri);
|
||||
} else {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('해당 링크를 열 수 없습니다.')),
|
||||
);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('이동할 페이지 주소(Client URI)가 설정되지 않았습니다.')),
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
child: opaqueCard,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return opaqueCard;
|
||||
}
|
||||
|
||||
Widget _buildAccessHistory(bool isWide) {
|
||||
if (_auditLoading && _auditLogs.isEmpty) {
|
||||
return _buildHistoryContainer(
|
||||
@@ -1232,6 +1276,7 @@ class _ActivityItem {
|
||||
final String appName;
|
||||
final String lastAuthAt;
|
||||
final String status;
|
||||
final String? url;
|
||||
final bool canLogout;
|
||||
final bool isRevoked;
|
||||
final VoidCallback? onLogout;
|
||||
@@ -1243,6 +1288,7 @@ class _ActivityItem {
|
||||
required this.lastAuthAt,
|
||||
required this.status,
|
||||
required this.canLogout,
|
||||
this.url,
|
||||
this.isRevoked = false,
|
||||
this.onLogout,
|
||||
this.onRevoke,
|
||||
|
||||
Reference in New Issue
Block a user