diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReporter.java b/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReporter.java
index b9907e93..67ba0395 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReporter.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/utils/CrashReporter.java
@@ -17,8 +17,8 @@ public class CrashReporter {
public static void reportForumInfo(Document document) {
ParseHelpers.Theme theme = ParseHelpers.parseTheme(document);
ParseHelpers.Language language = ParseHelpers.Language.getLanguage(document);
- String themeKey = "forum theme", themeValue = null;
- String languageKey = "forum language", languageValue = null;
+ String themeKey = "forum theme", themeValue;
+ String languageKey = "forum language", languageValue;
switch (theme) {
case SCRIBBLES2:
themeValue = "Scribbles2";
@@ -32,19 +32,17 @@ public class CrashReporter {
case HELIOS_MULTI:
themeValue = "Helios_Multi";
break;
- case THEME_UNKNOWN:
+ default:
themeValue = "Unknown theme";
- break;
- }
- switch (language) {
- case GREEK:
- languageValue = "Greek";
- break;
- case ENGLISH:
- languageValue = "English";
- break;
}
+ if (language == ParseHelpers.Language.GREEK)
+ languageValue = "Greek";
+ else if (language == ParseHelpers.Language.ENGLISH)
+ languageValue = "English";
+ else
+ languageValue = "Unknown";
+
Crashlytics.setString(themeKey, themeValue);
Crashlytics.setString(languageKey, languageValue);
Crashlytics.setBool("isLoggedIn", BaseApplication.getInstance().getSessionManager().isLoggedIn());
diff --git a/app/src/main/java/gr/thmmy/mthmmy/utils/parsing/ParseHelpers.java b/app/src/main/java/gr/thmmy/mthmmy/utils/parsing/ParseHelpers.java
index 62380f80..206d4c3b 100644
--- a/app/src/main/java/gr/thmmy/mthmmy/utils/parsing/ParseHelpers.java
+++ b/app/src/main/java/gr/thmmy/mthmmy/utils/parsing/ParseHelpers.java
@@ -23,7 +23,7 @@ public class ParseHelpers {
/**
* An enum describing a forum page's language by defining the types:
* - {@link #PAGE_INCOMPLETE}
- * - {@link #UNDEFINED_LANGUAGE}
+ * - {@link #UNKNOWN_LANGUAGE}
* - {@link #ENGLISH}
* - {@link #GREEK}
*
@@ -42,9 +42,9 @@ public class ParseHelpers {
*/
PAGE_INCOMPLETE,
/**
- * Page language is not (yet) supported.
+ * Page language could not be determined/ not (yet) supported.
*/
- UNDEFINED_LANGUAGE;
+ UNKNOWN_LANGUAGE;
/**
* Returns one of the supported forum languages.
@@ -57,13 +57,12 @@ public class ParseHelpers {
Element welcoming = page.select("h3").first();
if (welcoming == null) {
Element welcomingGuest = page.select("div[id=myuser]").first();
- if (welcomingGuest != null) {
- if (welcomingGuest.text().contains("Welcome")) return ENGLISH;
- }
+ if (welcomingGuest != null && welcomingGuest.text().contains("Welcome"))
+ return ENGLISH;
return PAGE_INCOMPLETE;
} else if (welcoming.text().contains("Καλώς ορίσατε")) return GREEK;
else if (welcoming.text().contains("Hey")) return ENGLISH;
- else return UNDEFINED_LANGUAGE;
+ else return UNKNOWN_LANGUAGE;
}
}
@@ -77,16 +76,17 @@ public class ParseHelpers {
public static Theme parseTheme(Document page) {
Element stylesheet = page.select("link[rel=stylesheet]").first();
- if (stylesheet.attr("href").contains("scribbles2"))
- return Theme.SCRIBBLES2;
- else if (stylesheet.attr("href").contains("helios_multi"))
- return Theme.HELIOS_MULTI;
- else if (stylesheet.attr("href").contains("smfone"))
- return Theme.SMFONE_BLUE;
- else if (stylesheet.attr("href").contains("default"))
- return Theme.SMF_DEFAULT;
- else
- return Theme.THEME_UNKNOWN;
+ if(stylesheet!=null){
+ if (stylesheet.attr("href").contains("scribbles2"))
+ return Theme.SCRIBBLES2;
+ else if (stylesheet.attr("href").contains("helios_multi"))
+ return Theme.HELIOS_MULTI;
+ else if (stylesheet.attr("href").contains("smfone"))
+ return Theme.SMFONE_BLUE;
+ else if (stylesheet.attr("href").contains("default"))
+ return Theme.SMF_DEFAULT;
+ }
+ return Theme.THEME_UNKNOWN;
}
/**
diff --git a/build.gradle b/build.gradle
index 108b8fa6..65830711 100644
--- a/build.gradle
+++ b/build.gradle
@@ -10,7 +10,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
- classpath 'com.google.gms:google-services:4.2.0'
+ classpath 'com.google.gms:google-services:4.3.0'
classpath 'io.fabric.tools:gradle:1.29.0'
classpath 'org.ajoberstar.grgit:grgit-core:3.1.1' // Also change in app/gradle/grgit.gradle
classpath "com.github.ben-manes:gradle-versions-plugin:0.21.0"