From dc6c12ba40b179ceb11a77da8828b79d360f79eb Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 18 Nov 2018 21:28:25 -0500 Subject: Fix/personal messages (#1194) * Update dependency versions * Fix regex to support personal messages, resolves #1180 * Update download url, resolves #1131 * Update changelog * Downgrade apache dependency version * Disable travis for master pushes [skip ci] * Support java 1.8 --- .travis.yml | 1 + README.md | 2 +- app/build.gradle | 28 +++++++++++++++++++++ .../pitchedapps/frost/activities/AboutActivity.kt | 2 +- .../com/pitchedapps/frost/facebook/FbRegex.kt | 16 ++++++------ .../frost/facebook/parsers/MessageParser.kt | 2 +- .../frost/facebook/parsers/NotifParser.kt | 2 +- app/src/main/res/values/strings_no_translate.xml | 2 +- app/src/main/res/xml/frost_changelog.xml | 9 ++++--- app/src/test/kotlin/android/util/Log.java | 3 ++- docs/Changelog.md | 3 +++ gradle.properties | 29 ++++++++++++---------- 12 files changed, 69 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4d85226e..b8d8f1bd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -43,6 +43,7 @@ notifications: sudo: false branches: except: + - master - l10n_dev before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock diff --git a/README.md b/README.md index 0d22776a..ba4d6b8d 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ [![GitHub license](https://img.shields.io/badge/license-GPL--v3-blue.svg)](https://raw.githubusercontent.com/AllanWang/Frost-for-Facebook/dev/LICENSE) [Download from Github Releases](https://github.com/AllanWang/Frost-for-Facebook/releases)
-[Join the Slack Workspace](https://join.slack.com/t/frost-for-facebook/shared_invite/enQtMzQ1NzI3NzA0OTc5LWEwNjM3YzA1NDE1ZmNmMWRiNmRhNzNjYTkzNThkOTczZjZkOGRkNzc1MDU0ZDIwNWFmMjU0NWQ2NWI1NTQwNjA) +[Join the Slack Workspace](https://frost-slack.allanwang.ca) **Note** Some keystores are public for the sake of automatic builds and consistent signing across devices. This means that others can build apps with the same signature. The only valid download sources are through my github releases. diff --git a/app/build.gradle b/app/build.gradle index 19aaaaa9..34e57f84 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -128,6 +128,17 @@ android { packagingOptions { pickFirst 'META-INF/library_release.kotlin_module' } + + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + testOptions { + unitTests { + includeAndroidResources = true + } + } } repositories { @@ -223,4 +234,21 @@ dependencies { } +def kotlinResolutions = ['kotlin-reflect', + 'kotlin-stdlib', + 'kotlin-stdlib-jdk7', + 'kotlin-stdlib-jdk8', + 'kotlin-test', + 'kotlin-test-junit4', + 'kotlin-test-junit5'] + +configurations.all { + resolutionStrategy.eachDependency { DependencyResolveDetails details -> + def requested = details.requested + if (requested.group == 'org.jetbrains.kotlin' && requested.name in kotlinResolutions) { + details.useVersion KOTLIN + } + } +} + apply plugin: 'com.bugsnag.android.gradle' \ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt index 9db1747b..2261328d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -136,7 +136,7 @@ class AboutActivity : AboutActivityBase(null, { val c = itemView.context val size = c.dimenPixelSize(R.dimen.kau_avatar_bounds) images = arrayOf Unit>>( - GoogleMaterial.Icon.gmd_star to { c.startLink(R.string.xda_labs_url) }, + GoogleMaterial.Icon.gmd_arrow_downward to { c.startLink(R.string.github_downloads_url) }, CommunityMaterial.Icon.cmd_reddit to { c.startLink(R.string.reddit_url) }, CommunityMaterial.Icon.cmd_github_circle to { c.startLink(R.string.github_url) }, CommunityMaterial.Icon.cmd_slack to { c.startLink(R.string.slack_url) }, diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt index a57ced11..9b29d009 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbRegex.kt @@ -18,15 +18,15 @@ val FB_REV_MATCHER: Regex by lazy { Regex("\"app_version\":\"(.*?)\"") } /** * Matches user id from cookie */ -val FB_USER_MATCHER: Regex by lazy { Regex("c_user=([0-9]*);") } +val FB_USER_MATCHER: Regex = Regex("c_user=([0-9]*);") -val FB_EPOCH_MATCHER: Regex by lazy { Regex(":([0-9]+)") } -val FB_NOTIF_ID_MATCHER: Regex by lazy { Regex("notif_([0-9]+)") } -val FB_MESSAGE_NOTIF_ID_MATCHER: Regex by lazy { Regex("(?:thread|user)_fbid_([0-9]+)") } -val FB_CSS_URL_MATCHER: Regex by lazy { Regex("url\\([\"|']?(.*?)[\"|']?\\)") } -val FB_JSON_URL_MATCHER: Regex by lazy { Regex("\"(http.*?)\"") } -val FB_IMAGE_ID_MATCHER: Regex by lazy { Regex("fbcdn.*?/[0-9]+_([0-9]+)_") } -val FB_REDIRECT_URL_MATCHER: Regex by lazy { Regex("url=(.*?fbcdn.*?)\"") } +val FB_EPOCH_MATCHER: Regex = Regex(":([0-9]+)") +val FB_NOTIF_ID_MATCHER: Regex = Regex("notif_([0-9]+)") +val FB_MESSAGE_NOTIF_ID_MATCHER: Regex = Regex("(?:thread|user)_fbid_([0-9]+)") +val FB_CSS_URL_MATCHER: Regex = Regex("url\\([\"|']?(.*?)[\"|']?\\)") +val FB_JSON_URL_MATCHER: Regex = Regex("\"(http.*?)\"") +val FB_IMAGE_ID_MATCHER: Regex = Regex("fbcdn.*?/[0-9]+_([0-9]+)_") +val FB_REDIRECT_URL_MATCHER: Regex = Regex("url=(.*?fbcdn.*?)\"") operator fun MatchResult?.get(groupIndex: Int) = this?.groupValues?.get(groupIndex) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt index a3ebf998..27b731bc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/MessageParser.kt @@ -92,7 +92,7 @@ private class MessageParserImpl : FrostParserBase(true) { override fun parseImpl(doc: Document): FrostMessages? { val threadList = doc.getElementById("threadlist_rows") ?: return null - val threads: List = threadList.getElementsByAttributeValueContaining("id", "thread_fbid_") + val threads: List = threadList.getElementsByAttributeValueMatching("id", ".*${FB_MESSAGE_NOTIF_ID_MATCHER.pattern}.*") .mapNotNull(this::parseMessage) val seeMore = parseLink(doc.getElementById("see_older_threads")) val extraLinks = threadList.nextElementSibling().select("a") diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt index 410a0e84..8aa8e706 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/parsers/NotifParser.kt @@ -67,7 +67,7 @@ private class NotifParserImpl : FrostParserBase(false) { override fun parseImpl(doc: Document): FrostNotifs? { val notificationList = doc.getElementById("notifications_list") ?: return null val notifications = notificationList - .getElementsByAttributeValueContaining("id", "list_notif_") + .getElementsByAttributeValueMatching("id", ".*${FB_NOTIF_ID_MATCHER.pattern}.*") .mapNotNull(this::parseNotif) val seeMore = parseLink(doc.getElementsByAttributeValue("href", "/notifications.php?more").first()) return FrostNotifs(notifications, seeMore) diff --git a/app/src/main/res/values/strings_no_translate.xml b/app/src/main/res/values/strings_no_translate.xml index 7805aac1..9eb85dc2 100644 --- a/app/src/main/res/values/strings_no_translate.xml +++ b/app/src/main/res/values/strings_no_translate.xml @@ -5,10 +5,10 @@ PayPal https://crwd.in/frost-for-facebook https://github.com/AllanWang/Frost-for-Facebook + https://github.com/AllanWang/Frost-for-Facebook/releases https://www.reddit.com/r/FrostForFacebook https://frost-slack.allanwang.ca https://forum.xda-developers.com/android/apps-games/app-frost-facebook-t3685896 - https://labs.xda-developers.com/store/app/com.pitchedapps.frost Frost for Facebook: Feedback Bug Report diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml index 8182cbdc..5f047b35 100644 --- a/app/src/main/res/xml/frost_changelog.xml +++ b/app/src/main/res/xml/frost_changelog.xml @@ -6,13 +6,16 @@ --> - - - + + + + + + diff --git a/app/src/test/kotlin/android/util/Log.java b/app/src/test/kotlin/android/util/Log.java index a2f431ed..9ac82a20 100644 --- a/app/src/test/kotlin/android/util/Log.java +++ b/app/src/test/kotlin/android/util/Log.java @@ -35,7 +35,8 @@ public class Log { public static int println(int priority, String tag, String msg) { switch (priority) { case VERBOSE: - p("V", tag, msg); + // Ignore verbose logging + // p("V", tag, msg); break; case INFO: p("I", tag, msg); diff --git a/docs/Changelog.md b/docs/Changelog.md index 21adbb18..eb6d1fe3 100644 --- a/docs/Changelog.md +++ b/docs/Changelog.md @@ -1,5 +1,8 @@ # Changelog +## v2.1.2 +* Fix message notifications with just one other user + ## v2.1.1 * Fix link loading for some notifications. Some will redirect to the main notification page * Fix double back click problem diff --git a/gradle.properties b/gradle.properties index a350b51b..825b2b33 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,48 +15,51 @@ APP_ID=Frost APP_GROUP=com.pitchedapps KAU=572d470 -KOTLIN=1.3.0 +KOTLIN=1.3.10 # https://github.com/bugsnag/bugsnag-android/releases -BUGSNAG=4.8.2 +BUGSNAG=4.9.2 # https://github.com/bugsnag/bugsnag-android-gradle-plugin/releases -BUGSNAG_PLUGIN=3.4.2 +BUGSNAG_PLUGIN=3.5.0 # https://github.com/KeepSafe/dexcount-gradle-plugin/releases DEX_PLUGIN=0.8.4 # https://github.com/gladed/gradle-android-git-version/releases GIT_PLUGIN=0.4.5 # https://mvnrepository.com/artifact/org.apache.commons/commons-text +# Updates blocked due to javax.script dependency COMMONS_TEXT=1.4 # https://github.com/Raizlabs/DBFlow/releases DBFLOW=4.2.4 # https://github.com/brianwernick/ExoMedia/releases -EXOMEDIA=4.2.3 +EXOMEDIA=4.3.0 -JACKSON=2.9.6 +# https://github.com/FasterXML/jackson-core/releases +JACKSON=2.9.7 # https://github.com/jhy/jsoup/releases JSOUP=1.11.3 # https://github.com/square/leakcanary/releases -LEAK_CANARY=1.6.1 +LEAK_CANARY=1.6.2 # https://github.com/zsmb13/MaterialDrawerKt/releases -MATERIAL_DRAWER_KT=1.3.6 +MATERIAL_DRAWER_KT=1.3.7 # https://github.com/square/okhttp/releases -OKHTTP=3.11.0 -PAPER_PARCEL=2.0.5 +OKHTTP=3.12.0 +# https://github.com/grandstaish/paperparcel/releases +PAPER_PARCEL=2.0.6 # http://robolectric.org/getting-started/ -ROBOELECTRIC=3.8 +ROBOELECTRIC=4.0.2 # https://github.com/ReactiveX/RxAndroid/releases RX_ANDROID=2.1.0 # https://github.com/JakeWharton/RxBinding/releases -RX_BINDING=2.1.1 +RX_BINDING=2.2.0 # https://github.com/ReactiveX/RxJava/releases -RX_JAVA=2.2.2 +RX_JAVA=2.2.3 # https://github.com/ReactiveX/RxKotlin/releases RX_KOTLIN=2.3.0 # https://github.com/pwittchen/ReactiveNetwork/releases RX_NETWORK=2.1.0 # https://github.com/davemorrissey/subsampling-scale-image-view#quick-start SCALE_IMAGE_VIEW=3.10.0 -# https://github.com/umano/AndroidSlidingUpPanel +# https://github.com/umano/AndroidSlidingUpPanel#importing-the-library SLIDING_PANEL=3.4.0 # https://developer.android.com/training/testing/set-up-project#gradle-dependencies TEST_RULE=1.0.2 -- cgit v1.2.3