Skip to content

Commit

Permalink
Merge pull request #163 from virskor/hotfix/review
Browse files Browse the repository at this point in the history
Hotfix/review
  • Loading branch information
virskor authored Jan 17, 2021
2 parents 57a42f7 + f64402c commit 08de15f
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 40 deletions.
2 changes: 1 addition & 1 deletion mobile/.packages
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by pub on 2021-01-16 11:55:17.200790.
# Generated by pub on 2021-01-17 11:34:03.144915.
archive:file:///Users/virs/.fvm/versions/1.22.5-stable/.pub-cache/hosted/pub.flutter-io.cn/archive-2.0.13/lib/
args:file:///Users/virs/.fvm/versions/1.22.5-stable/.pub-cache/hosted/pub.flutter-io.cn/args-1.6.0/lib/
assets_audio_player:../packages/flutter_assetsAudioPlayer/lib/
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.zhangxiaogou.zhangxiaogou"
applicationId "com.discuzq.example"
minSdkVersion 20
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhangxiaogou.zhangxiaogou">
package="com.discuzq.example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.zhangxiaogou.zhangxiaogou">
package="com.discuzq.example">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.zhangxiaogou.zhangxiaogou;
package com.discuzq.example;

import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity;
Expand Down
2 changes: 1 addition & 1 deletion mobile/android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.zhangxiaogou.zhangxiaogou">
package="com.discuzq.example">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
Binary file modified mobile/assets/images/app.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions mobile/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.zhangxiaogou.zhangxiaogou;
PRODUCT_BUNDLE_IDENTIFIER = com.discuzq.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down Expand Up @@ -527,7 +527,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.zhangxiaogou.zhangxiaogou;
PRODUCT_BUNDLE_IDENTIFIER = com.discuzq.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
Expand Down Expand Up @@ -558,7 +558,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.zhangxiaogou.zhangxiaogou;
PRODUCT_BUNDLE_IDENTIFIER = com.discuzq.example;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
Expand Down
20 changes: 0 additions & 20 deletions mobile/lib/core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import 'package:discuzq/providers/forumProvider.dart';
import 'package:discuzq/providers/categoriesProvider.dart';
import 'package:discuzq/providers/editorProvider.dart';
import 'package:discuzq/widgets/update/upgrader.dart';
import 'package:discuzq/widgets/settings/privacyConfirm.dart';

///
/// 执行
Expand Down Expand Up @@ -81,30 +80,11 @@ class DiscuzQ extends StatelessWidget {

/// 加载本地的用户信息
await AuthHelper.getUserFromLocal(context: context);

await _userPrivaciesNotice(context);
}

/// 加载本地的配置
Future<bool> _initAppSettings() async =>
await AppConfigurations().initAppSetting();


/// 弹出用户隐私提示
void _userPrivaciesNotice(BuildContext context) {
final dynamic appConf = context.read<AppConfigProvider>().appConf;
if (appConf['confrimedPrivacy'] != null &&
appConf['confrimedPrivacy'] == false) {
showModalBottomSheet(
context: context,
isDismissible: false,
enableDrag: false,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return const PrivacyConfirm();
});
}
}
}

///
Expand Down
20 changes: 19 additions & 1 deletion mobile/lib/discuz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'package:discuzq/api/forum.dart';
import 'package:discuzq/router/routers.dart';
import 'package:discuzq/views/exploreDelagate.dart';
import 'package:discuzq/providers/appConfigProvider.dart';

import 'package:discuzq/widgets/settings/privacyConfirm.dart';
import 'widgets/ui/ui.dart';

class Discuz extends StatefulWidget {
Expand Down Expand Up @@ -204,6 +204,8 @@ class __DiscuzAppDelegateState extends State<_DiscuzAppDelegate> {
@override
void initState() {
this._getForumData();
Future.delayed(const Duration(seconds: 1))
.then((_) async => await _userPrivaciesNotice(context));
super.initState();
}

Expand Down Expand Up @@ -262,4 +264,20 @@ class __DiscuzAppDelegateState extends State<_DiscuzAppDelegate> {
_loaded = true;
});
}

/// 弹出用户隐私提示
void _userPrivaciesNotice(BuildContext context) {
final dynamic appConf = context.read<AppConfigProvider>().appConf;
if (appConf['confrimedPrivacy'] != null &&
appConf['confrimedPrivacy'] == false) {
showModalBottomSheet(
context: context,
isDismissible: false,
enableDrag: false,
backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return const PrivacyConfirm();
});
}
}
}
3 changes: 3 additions & 0 deletions mobile/lib/views/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,14 @@ class Editor extends StatefulWidget {
/// 回复的时候,需要关联帖子数据,是不能少的
final ThreadModel thread;

final bool isFirstPost;

Editor(
{@required this.type,
this.post,
this.defaultCategory,
this.thread,
this.isFirstPost = true,
this.onPostSuccess});

@override
Expand Down
4 changes: 3 additions & 1 deletion mobile/lib/widgets/editor/discuzEditorHelper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,13 @@ class DiscuzEditorHelper {
///
/// 回复工具类
DiscuzEditorHelper({this.context});


///
/// 打开编辑器回复指定评论
///
Future<DiscuzEditorRequestResult> reply(
{@required PostModel post, @required ThreadModel thread}) async {
{@required PostModel post, @required ThreadModel thread, bool isFirstPost = true}) async {
DiscuzEditorRequestResult result;

/// 弹出前,要检测用户是否已经登录
Expand All @@ -56,6 +57,7 @@ class DiscuzEditorHelper {
type: DiscuzEditorInputTypes.reply,
post: post,
thread: thread,
isFirstPost: isFirstPost,
onPostSuccess: (DiscuzEditorRequestResult res) {
///
/// 用户成功回复,取得回复时接口反馈的数据
Expand Down
2 changes: 1 addition & 1 deletion mobile/lib/widgets/editor/discuzEditorInputTypes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
///
class DiscuzEditorInputTypes {
///
/// 用户输入后,要进行的操作是发布主题
/// 用户输入后,要进行的操作是发布动态
///
static const DiscuzEditorInputType text = DiscuzEditorInputType(
formatType: DiscuzEditorInputType.formatTypesString, name: '主题');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class DiscuzEditorDataFormater {
/// 当 isBuildForCreatingPost 为true时 会过滤掉 非发帖下必填的字段
///
static Future<dynamic> toDynamic(DiscuzEditorData data,
{CaptchaModel captcha, bool isBuildForCreatingPost = false}) async {
{CaptchaModel captcha, bool isBuildForCreatingPost = false, bool isFirstPost = true}) async {
List<dynamic> attachments = const [];

if (data.relationships != null &&
Expand Down Expand Up @@ -118,7 +118,7 @@ class DiscuzEditorDataFormater {
/// 但是注意:
/// 回复主题的时候,是不需要要的!
///
if (isBuildForCreatingPost) {
if (isBuildForCreatingPost && !isFirstPost) {
attributes.addAll({"replyId": data.attributes.replyId.toString()});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class _DiscuzEditorCategorySelectorState
Container(
padding: const EdgeInsets.all(10),
child: const DiscuzText(
'选择要发布的分类',
'动态的类型',
fontWeight: FontWeight.bold,
textScaleFactor: 1.3,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ class _DiscuzEditorImageUploaderState extends State<DiscuzEditorImageUploader> {
return;
}

final File imageFile =
await ImagePicker.pickImage(source: ImageSource.gallery);
final File imageFile = await ImagePicker.pickImage(
source: ImageSource.gallery, imageQuality: 50);

if (imageFile != null) {
final Function close = DiscuzToast.loading(context: context);
Expand Down Expand Up @@ -143,6 +143,7 @@ class _DiscuzEditorImageUploaderState extends State<DiscuzEditorImageUploader> {
}
} catch (e) {
close();
DiscuzToast.failed(context: context, message: '上传失败');
throw e;
}
}
Expand Down Expand Up @@ -233,7 +234,8 @@ class _DiscuzEditorImageUploaderThumb extends StatelessWidget {
child: GestureDetector(
child: Container(
decoration: const BoxDecoration(
borderRadius: const BorderRadius.all(const Radius.circular(50)),
borderRadius:
const BorderRadius.all(const Radius.circular(50)),
color: Colors.white),
child: const DiscuzIcon(
CupertinoIcons.minus_circle_fill,
Expand Down
6 changes: 4 additions & 2 deletions mobile/lib/widgets/posts/postFloorCard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,10 @@ class _PostFloorCardState extends State<PostFloorCard>
),
onPressed: () async {
final DiscuzEditorRequestResult res =
await DiscuzEditorHelper(context: context)
.reply(post: widget.post, thread: widget.thread);
await DiscuzEditorHelper(context: context).reply(
post: widget.post,
thread: widget.thread,
isFirstPost: false);
if (res != null) {
widget.threadsCacher.posts = res.posts;
widget.threadsCacher.users = res.users;
Expand Down

0 comments on commit 08de15f

Please sign in to comment.