diff --git a/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java b/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java
index afacabb89..8857c6fee 100644
--- a/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java
+++ b/app/src/main/java/com/hippo/ehviewer/client/EhEngine.java
@@ -30,6 +30,7 @@ import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.client.data.PreviewSet;
import com.hippo.ehviewer.client.exception.CancelledException;
import com.hippo.ehviewer.client.exception.EhException;
+import com.hippo.ehviewer.client.exception.NoHAtHClientException;
import com.hippo.ehviewer.client.exception.ParseException;
import com.hippo.ehviewer.client.parser.ArchiveParser;
import com.hippo.ehviewer.client.parser.FavoritesParser;
@@ -57,6 +58,8 @@ import org.jsoup.nodes.Document;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import okhttp3.Call;
import okhttp3.FormBody;
@@ -79,6 +82,8 @@ public class EhEngine {
public static final MediaType MEDIA_TYPE_JSON = MediaType.parse("application/json; charset=utf-8");
private static final MediaType MEDIA_TYPE_JPEG = MediaType.parse("image/jpeg");
+ private static final Pattern PATTERN_NEED_HATH_CLIENT = Pattern.compile("(You must have a H@H client assigned to your account to use this feature\\.)");
+
public static EhFilter sEhFilter;
public static void initialize() {
@@ -665,6 +670,11 @@ public class EhEngine {
throw e;
}
+ Matcher m = PATTERN_NEED_HATH_CLIENT.matcher(body);
+ if (m.find()) {
+ throw new NoHAtHClientException("No H@H client");
+ }
+
return null;
}
diff --git a/app/src/main/java/com/hippo/ehviewer/client/exception/NoHAtHClientException.java b/app/src/main/java/com/hippo/ehviewer/client/exception/NoHAtHClientException.java
new file mode 100644
index 000000000..8cc627f3c
--- /dev/null
+++ b/app/src/main/java/com/hippo/ehviewer/client/exception/NoHAtHClientException.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2016 Hippo Seven
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hippo.ehviewer.client.exception;
+
+public class NoHAtHClientException extends EhException {
+
+ public NoHAtHClientException(String detailMessage) {
+ super(detailMessage);
+ }
+
+}
diff --git a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java
index b3938db36..501e413fe 100644
--- a/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java
+++ b/app/src/main/java/com/hippo/ehviewer/ui/scene/GalleryDetailScene.java
@@ -74,6 +74,7 @@ import com.hippo.ehviewer.client.data.GalleryInfo;
import com.hippo.ehviewer.client.data.GalleryTagGroup;
import com.hippo.ehviewer.client.data.ListUrlBuilder;
import com.hippo.ehviewer.client.data.PreviewSet;
+import com.hippo.ehviewer.client.exception.NoHAtHClientException;
import com.hippo.ehviewer.client.parser.RateGalleryParser;
import com.hippo.ehviewer.dao.DownloadInfo;
import com.hippo.ehviewer.dao.Filter;
@@ -1585,7 +1586,11 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
@Override
public void onFailure(Exception e) {
- showTip(R.string.download_archive_failure, LENGTH_SHORT);
+ if (e instanceof NoHAtHClientException) {
+ showTip(R.string.download_archive_failure_no_hath, LENGTH_SHORT);
+ } else {
+ showTip(R.string.download_archive_failure, LENGTH_SHORT);
+ }
}
@Override
diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml
index d287617f9..1e8597425 100644
--- a/app/src/main/res/values-zh-rCN/strings.xml
+++ b/app/src/main/res/values-zh-rCN/strings.xml
@@ -610,5 +610,6 @@
归档下载开始
无法起始归档下载
下载归档
+ 归档下载需要 H@H 客户端
diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml
index 29154f73f..9c269a88d 100644
--- a/app/src/main/res/values-zh-rHK/strings.xml
+++ b/app/src/main/res/values-zh-rHK/strings.xml
@@ -610,5 +610,6 @@
檔案下載開始
無法開始檔案下載
下載檔案
+ 檔案下載需要 H@H 客戶端
diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml
index 8ed423341..9f61b97e3 100644
--- a/app/src/main/res/values-zh-rTW/strings.xml
+++ b/app/src/main/res/values-zh-rTW/strings.xml
@@ -610,5 +610,6 @@
檔案下載開始
無法開始檔案下載
下載檔案
+ 檔案下載需要 H@H 客戶端
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 8a6d67245..10514b34b 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -660,5 +660,6 @@
Archive download started
Failed to download archive
Archive
+ Need H@H client for archive download