Skip to content
代码片段 群组 项目
提交 14672693 编辑于 作者: Neil Wang's avatar Neil Wang
浏览文件

feat: #655 使用落后系统的用户不允许发帖

上级 c4a02b60
No related branches found
No related tags found
无相关合并请求
......@@ -18,6 +18,7 @@ class LowSystemVersionView extends StatelessWidget {
children: [
const SizedBox(height: 14),
SvgPicture.asset("assets/images/warning.svg", height: 30, width: 30),
const SizedBox(height: 4),
Text(title, style: const TextStyle(color: Color(0xFF1A1B36), fontSize: 16, fontWeight: FontWeight.w600), textAlign: TextAlign.center),
const SizedBox(height: 8),
SizedBox(width: 268, child: Text(systemType.description(isForGeek), style: const TextStyle(color: Color(0xFF1A1B36), fontSize: 14, fontWeight: FontWeight.w400), textAlign: TextAlign.center))
......
......@@ -3,11 +3,13 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:jihu_gitlab_app/core/load_state.dart';
import 'package:jihu_gitlab_app/core/loader.dart';
import 'package:jihu_gitlab_app/core/system_version_detector.dart';
import 'package:jihu_gitlab_app/core/user_provider/user_provider.dart';
import 'package:jihu_gitlab_app/core/widgets/common_app_bar.dart';
import 'package:jihu_gitlab_app/core/widgets/connect_jihu_page.dart';
import 'package:jihu_gitlab_app/core/widgets/input_field_with_title.dart';
import 'package:jihu_gitlab_app/core/widgets/loading_view.dart';
import 'package:jihu_gitlab_app/core/widgets/low_system_version_view.dart';
import 'package:jihu_gitlab_app/core/widgets/markdown/markdown_input_box.dart';
import 'package:jihu_gitlab_app/core/widgets/streaming_container.dart';
import 'package:jihu_gitlab_app/core/widgets/toast.dart';
......@@ -38,6 +40,9 @@ class _FaqCreationPageState extends State<FaqCreationPage> {
@override
void initState() {
super.initState();
SystemVersionDetector.instance().detect().then((value) => setState(() {
_model.systemType = value;
}));
_model.init(widget.arguments['projectId'], widget.arguments['fullPath']);
_timer = Timer.periodic(const Duration(milliseconds: 5000), (timer) {
if (ConnectionProvider().communityConnection.authorized) _model.saveAsDraft(_issueTitleController.text, _issueDescriptionController.text);
......@@ -65,10 +70,13 @@ class _FaqCreationPageState extends State<FaqCreationPage> {
return Scaffold(
appBar: CommonAppBar(
showLeading: true,
title: Text(JiHuLocalizations.dictionary().requestAccess),
title: _model.systemType == SystemType.unmaintainable ? const Text("") : Text(JiHuLocalizations.dictionary().requestAccess),
),
body: RequestAccessPage(projectId: _model.projectId));
}
if (_model.systemType == SystemType.unmaintainable) {
return Scaffold(appBar: CommonAppBar(showLeading: true), body: const LowSystemVersionView(systemType: SystemType.unmaintainable, isForGeek: false));
}
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
......
......@@ -5,6 +5,7 @@ import 'package:jihu_gitlab_app/core/load_state.dart';
import 'package:jihu_gitlab_app/core/log_helper.dart';
import 'package:jihu_gitlab_app/core/net/api.dart';
import 'package:jihu_gitlab_app/core/net/http_client.dart';
import 'package:jihu_gitlab_app/core/system_version_detector.dart';
import 'package:jihu_gitlab_app/core/user_provider/user.dart';
import 'package:jihu_gitlab_app/core/user_provider/user_provider.dart';
import 'package:jihu_gitlab_app/modules/issues/manage/models/issue_draft_entity.dart';
......@@ -27,6 +28,7 @@ class FaqCreationModel {
bool _requestAccessEnabled = false;
FaqType? _selectedFaqType;
String? _title;
SystemType systemType = SystemType.latest;
void init(int projectId, String fullPath) {
_projectId = projectId;
......
......@@ -3,12 +3,14 @@ import 'package:jihu_gitlab_app/core/global_keys.dart';
import 'package:jihu_gitlab_app/core/log_helper.dart';
import 'package:jihu_gitlab_app/core/net/api.dart';
import 'package:jihu_gitlab_app/core/net/http_client.dart';
import 'package:jihu_gitlab_app/core/system_version_detector.dart';
import 'package:jihu_gitlab_app/core/user_provider/user_provider.dart';
import 'package:jihu_gitlab_app/core/widgets/toast.dart';
import 'package:jihu_gitlab_app/l10n/jihu_localizations.dart';
class RequestAccessModel {
late int _faqProjectId;
SystemType systemType = SystemType.latest;
bool _requestInProgress = false;
......
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:jihu_gitlab_app/core/system_version_detector.dart';
import 'package:jihu_gitlab_app/core/themes/project_style.dart';
import 'package:jihu_gitlab_app/core/widgets/loading_button.dart';
import 'package:jihu_gitlab_app/core/widgets/low_system_version_view.dart';
import 'package:jihu_gitlab_app/l10n/jihu_localizations.dart';
import 'models/request_access_model.dart';
......@@ -21,12 +23,18 @@ class _RequestAccessPageState extends State<RequestAccessPage> {
@override
void initState() {
SystemVersionDetector.instance().detect().then((value) => setState(() {
_model.systemType = value;
}));
_model.init(widget.projectId).then((value) => setState(() {}));
super.initState();
}
@override
Widget build(BuildContext context) {
if (_model.systemType == SystemType.unmaintainable) {
return const LowSystemVersionView(systemType: SystemType.unmaintainable, isForGeek: false);
}
return Center(
heightFactor: 3,
child: SizedBox(
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册