Skip to content

Commit ec93fd0

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # pubspec.lock
2 parents dc01aaf + d2437a2 commit ec93fd0

File tree

4 files changed

+204
-163
lines changed

4 files changed

+204
-163
lines changed

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@
459459
inputPaths = (
460460
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
461461
"${BUILT_PRODUCTS_DIR}/FMDB/FMDB.framework",
462-
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
462+
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
463463
"${BUILT_PRODUCTS_DIR}/Reachability/Reachability.framework",
464464
"${BUILT_PRODUCTS_DIR}/connectivity/connectivity.framework",
465465
"${BUILT_PRODUCTS_DIR}/device_info/device_info.framework",

lib/common/net/Api.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ class HttpManager {
5353
option.headers = headers;
5454
}
5555

56+
///超时
57+
option.connectTimeout = 15000;
58+
5659
Dio dio = new Dio();
5760
Response response;
5861
try {

lib/common/utils/HtmlUtils.dart

Lines changed: 41 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,39 +17,57 @@ class HtmlUtils {
1717
if (mdData == null) {
1818
return "";
1919
}
20-
RegExp exp = new RegExp("<code(([\\s\\S])*?)<\/code>");
21-
Iterable<Match> tags = exp.allMatches(mdData);
2220
String mdDataCode = mdData;
23-
for (Match m in tags) {
24-
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
25-
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
26-
}
21+
String regExCode = "<[\\s]*?code[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?code[\\s]*?>";
22+
String regExPre = "<[\\s]*?pre[^>]*?>[\\s\\S]*?<[\\s]*?\\/[\\s]*?pre[\\s]*?>";
23+
2724

28-
exp = new RegExp("<pre(([\\s\\S])*?)<\/pre>");
29-
tags = exp.allMatches(mdDataCode);
30-
for (Match m in tags) {
31-
if (m.group(0).indexOf("<code>") < 0) {
25+
try {
26+
RegExp exp = new RegExp(regExCode);
27+
Iterable<Match> tags = exp.allMatches(mdData);
28+
for (Match m in tags) {
3229
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
3330
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
3431
}
32+
} catch (e) {
33+
print(e);
3534
}
36-
37-
exp = new RegExp("<pre>(([\\s\\S])*?)<\/pre>");
38-
tags = exp.allMatches(mdDataCode);
39-
for (Match m in tags) {
40-
if (m.group(0).indexOf("<code>") < 0) {
41-
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
42-
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
35+
try {
36+
RegExp exp = new RegExp(regExPre);
37+
Iterable<Match> tags = exp.allMatches(mdDataCode);
38+
for (Match m in tags) {
39+
if (m.group(0).indexOf("<code>") < 0) {
40+
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
41+
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
42+
}
4343
}
44+
} catch (e) {
45+
print(e);
4446
}
4547

46-
exp = new RegExp("href=\"(.*?)\"");
47-
tags = exp.allMatches(mdDataCode);
48-
for (Match m in tags) {
49-
String capture = m.group(0);
50-
if (capture.indexOf("http://") < 0 && capture.indexOf("https://") < 0 && capture.indexOf("#") != 0) {
51-
mdDataCode = mdDataCode.replaceAll(m.group(0), "gsygithub://" + capture);
48+
try {
49+
RegExp exp = new RegExp("<pre>(([\\s\\S])*?)<\/pre>");
50+
Iterable<Match> tags = exp.allMatches(mdDataCode);
51+
for (Match m in tags) {
52+
if (m.group(0).indexOf("<code>") < 0) {
53+
String match = m.group(0).replaceAll(new RegExp("\n"), "\n\r<br>");
54+
mdDataCode = mdDataCode.replaceAll(m.group(0), match);
55+
}
5256
}
57+
} catch (e) {
58+
print(e);
59+
}
60+
try {
61+
RegExp exp = new RegExp("href=\"(.*?)\"");
62+
Iterable<Match> tags = exp.allMatches(mdDataCode);
63+
for (Match m in tags) {
64+
String capture = m.group(0);
65+
if (capture.indexOf("http://") < 0 && capture.indexOf("https://") < 0 && capture.indexOf("#") != 0) {
66+
mdDataCode = mdDataCode.replaceAll(m.group(0), "gsygithub://" + capture);
67+
}
68+
}
69+
} catch (e) {
70+
print(e);
5371
}
5472

5573
return generateCodeHtml(mdDataCode, false, backgroundColor: backgroundColor, actionColor: GSYColors.actionBlueString, userBR: userBR);
@@ -203,7 +221,6 @@ class HtmlUtils {
203221
return builder;
204222
}
205223

206-
207224
static resolveHtmlFile(var res, String defaultLang) {
208225
if (res != null && res.result) {
209226
String startTag = "class=\"instapaper_body ";

0 commit comments

Comments
 (0)