diff options
author | Allan Wang <me@allanwang.ca> | 2017-10-07 15:15:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-07 15:15:10 -0400 |
commit | 1369aa283a2167cf2a9525bd856edd48c39eea21 (patch) | |
tree | 95230383143d2c9997b245058776425f62202e0f /app/src/main | |
parent | 6bca83c464337c37ebcbabe47f8a8e2e44dd4794 (diff) | |
download | frost-1369aa283a2167cf2a9525bd856edd48c39eea21.tar.gz frost-1369aa283a2167cf2a9525bd856edd48c39eea21.tar.bz2 frost-1369aa283a2167cf2a9525bd856edd48c39eea21.zip |
Add more css hiders (#373)
* Add more css hiders
* Add toggles and injectors
* Fix composer hider
* Update changelog
Diffstat (limited to 'app/src/main')
7 files changed, 94 insertions, 57 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt index a926c8ac..5b26ebac 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt @@ -15,6 +15,8 @@ enum class CssHider(vararg val items: String) : InjectorContract { "article[data-store*=sponsor]" ), PEOPLE_YOU_MAY_KNOW("article._d2r"), + SUGGESTED_GROUPS("article[data-ft*=\"ei\":]"), + COMPOSER("#MComposer"), MESSENGER("._s15", "[data-testid=info_panel]", "js_i"), NON_RECENT("article:not([data-store*=actor_name])") ; diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt index 9fafbf88..a29ff55e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt @@ -1,6 +1,7 @@ package com.pitchedapps.frost.injectors import android.webkit.WebView +import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.web.FrostWebViewClient import io.reactivex.Observable import io.reactivex.android.schedulers.AndroidSchedulers @@ -55,9 +56,10 @@ fun WebView.jsInject(vararg injectors: InjectorContract, callback: ((Array<Strin val validInjectors = injectors.filter { it != JsActions.EMPTY } if (validInjectors.isEmpty()) return callback(emptyArray()) val observables = Array(validInjectors.size, { SingleSubject.create<String>() }) - Observable.zip<String, Array<String>>(observables.map { it.toObservable() }, { it.map { it.toString() }.toTypedArray() }).subscribeOn(AndroidSchedulers.mainThread()).subscribe({ - callback(it) - }) + L.d("Injecting ${observables.size} items") + Observable.zip<String, Array<String>>(observables.map(SingleSubject<String>::toObservable), + { it.map(Any::toString).toTypedArray() }) + .subscribeOn(AndroidSchedulers.mainThread()).subscribe({ callback(it) }) (0 until validInjectors.size).forEach { i -> validInjectors[i].inject(this, { observables[i].onSuccess(it) }) } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt index 3676d39c..3c7b385d 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Feed.kt @@ -46,6 +46,13 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = { onClick = { _, _, _ -> launchWebOverlay("https://touch.facebook.com/settings/videos"); true } } + checkbox(R.string.composer, { Prefs.showComposer }, { + Prefs.showComposer = it + setFrostResult(MainActivity.REQUEST_REFRESH) + }) { + descRes = R.string.composer_desc + } + header(R.string.pro_features) checkbox(R.string.suggested_friends, { Prefs.showSuggestedFriends }, { @@ -56,6 +63,14 @@ fun SettingsActivity.getFeedPrefs(): KPrefAdapterBuilder.() -> Unit = { dependsOnPro() } + checkbox(R.string.suggested_groups, { Prefs.showSuggestedGroups }, { + Prefs.showSuggestedGroups = it + setFrostResult(MainActivity.REQUEST_REFRESH) + }) { + descRes = R.string.suggested_groups_desc + dependsOnPro() + } + checkbox(R.string.facebook_ads, { Prefs.showFacebookAds }, { Prefs.showFacebookAds = it setFrostResult(MainActivity.REQUEST_REFRESH) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt index 68b4b80d..70144f9e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt @@ -90,8 +90,12 @@ object Prefs : KPref() { var showRoundedIcons: Boolean by kpref("rounded_icons", true) + var showComposer: Boolean by kpref("status_composer_feed", true) + var showSuggestedFriends: Boolean by kpref("suggested_friends_feed", true) + var showSuggestedGroups: Boolean by kpref("suggested_groups_feed", true) + var showFacebookAds: Boolean by kpref("facebook_ads", true) var animate: Boolean by kpref("fancy_animations", true) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt index 31aaaa6f..3275b2a6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -76,7 +76,9 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons), CssHider.HEADER, CssHider.CORE, + CssHider.COMPOSER.maybe(!Prefs.showComposer), CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends && IS_FROST_PRO), + CssHider.SUGGESTED_GROUPS.maybe(!Prefs.showSuggestedGroups && IS_FROST_PRO), Prefs.themeInjector, CssHider.NON_RECENT.maybe((webCore.url?.contains("?sk=h_chr") ?: false) && Prefs.aggressiveRecents)) diff --git a/app/src/main/res/values/strings_pref_feed.xml b/app/src/main/res/values/strings_pref_feed.xml index 42aefbbc..cc11f850 100644 --- a/app/src/main/res/values/strings_pref_feed.xml +++ b/app/src/main/res/values/strings_pref_feed.xml @@ -7,9 +7,14 @@ <string name="aggressive_recents_desc">Filter out additional old posts from Facebook\'s original most recents feed. Disable this if your feed is empty.</string> <string name="autoplay_settings">Video Autoplay Settings</string> <string name="autoplay_settings_desc">Enable/disable video autoplays on data or at all times.\nThese settings are independent of your settings for desktop.</string> + <string name="composer">Status Composer</string> + <string name="composer_desc">Show status composer in the feed</string> + <string name="pro_features">Pro Features</string> <string name="suggested_friends">Suggested Friends</string> <string name="suggested_friends_desc">Show "People You May Know" in the feed</string> + <string name="suggested_groups">Suggested Groups</string> + <string name="suggested_groups_desc">Show "Suggested Groups" in the feed</string> <string name="facebook_ads">Facebook Ads</string> <string name="facebook_ads_desc">Show native Facebook ads</string> diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml index 8cf6b685..d45ad9be 100644 --- a/app/src/main/res/xml/frost_changelog.xml +++ b/app/src/main/res/xml/frost_changelog.xml @@ -2,51 +2,58 @@ <resources> <!-- - <version title="v"/> + <version title="v" /> <item text="" /> --> - <version title="v1.5.6"/> + <version title="v1.5.7" /> + <item text="Allow hiding of composer and groups you may knnow" /> + <item text="" /> + <item text="" /> + <item text="" /> + <item text="" /> + + <version title="v1.5.6" /> <item text="Greatly improve background notification fetcher" /> <item text="Support fetching messages from all accounts" /> <item text="Update theme" /> - - <version title="v1.5.5"/> - <item text="Numerous bug fixes in KAU" /> - <item text="Set background back to white on non facebook pages" /> - <item text="Make read notification/message colors more obvious" /> - <item text="Clean up and small bug fixes" /> - <item text="Fix facebook link parsing issue for many links" /> - - <version title="v1.5.2"/> - <item text="Add default download manager to download all files" /> - <item text="Limit notification sounds when multiple notifications come in" /> - <item text="Check that job scheduler exists before scheduling notifications" /> - - <version title="v1.5.1"/> - <item text="Release day is here!" /> - <item text="Add full support for messaging in overlays. We will dynamically launch new overlays when required to." /> - <item text="Prevent bad messenger intent from launching" /> - <item text="Add toggle for recents feed. Aggressive loading removes extra posts that are not really recent, whereas disabling it will show exactly what you get on Facebook" /> - <item text="Add contextual menu items. Easily go to your full list of notifications or messages from the overlay." /> - <item text="Ensure that bottom bar layout does not hide the web content" /> - <item text="Add option to share external links to Frost" /> - <item text="Trigger notification service on each app start" /> - - <version title="v1.4.13"/> - <item text="Prevent image loading from trimming too many characters" /> - <item text="Fix most recent mode for news feed" /> - <item text="Add link to disable video autoplay in settings > newsfeed" /> - <item text="Update theme" /> - - <version title="v1.4.12"/> - <item text="Fix new messages not showing" /> - <item text="Fix theme for sharing and new messages" /> - <item text="Prevent search bar settings from disabling itself if auto suggestions fail" /> - <item text="Fix numerous crashes relating to search bar layouts" /> - <item text="Add debugging for menu" /> - - <version title="v1.4.11"/> + + <version title="v1.5.5" /> + <item text="Numerous bug fixes in KAU" /> + <item text="Set background back to white on non facebook pages" /> + <item text="Make read notification/message colors more obvious" /> + <item text="Clean up and small bug fixes" /> + <item text="Fix facebook link parsing issue for many links" /> + + <version title="v1.5.2" /> + <item text="Add default download manager to download all files" /> + <item text="Limit notification sounds when multiple notifications come in" /> + <item text="Check that job scheduler exists before scheduling notifications" /> + + <version title="v1.5.1" /> + <item text="Release day is here!" /> + <item text="Add full support for messaging in overlays. We will dynamically launch new overlays when required to." /> + <item text="Prevent bad messenger intent from launching" /> + <item text="Add toggle for recents feed. Aggressive loading removes extra posts that are not really recent, whereas disabling it will show exactly what you get on Facebook" /> + <item text="Add contextual menu items. Easily go to your full list of notifications or messages from the overlay." /> + <item text="Ensure that bottom bar layout does not hide the web content" /> + <item text="Add option to share external links to Frost" /> + <item text="Trigger notification service on each app start" /> + + <version title="v1.4.13" /> + <item text="Prevent image loading from trimming too many characters" /> + <item text="Fix most recent mode for news feed" /> + <item text="Add link to disable video autoplay in settings > newsfeed" /> + <item text="Update theme" /> + + <version title="v1.4.12" /> + <item text="Fix new messages not showing" /> + <item text="Fix theme for sharing and new messages" /> + <item text="Prevent search bar settings from disabling itself if auto suggestions fail" /> + <item text="Fix numerous crashes relating to search bar layouts" /> + <item text="Add debugging for menu" /> + + <version title="v1.4.11" /> <item text="Fix url loading bug and add option to launch urls in default browser (behaviour setting)" /> <item text="Allow for bottom bar tabs (appearance setting)" /> <item text="Allow custom ringtones for notifications and messages (notification setting)" /> @@ -55,9 +62,9 @@ <item text="Fix initial login not sticking" /> <item text="Allow back press in login activity" /> <item text="Update themes" /> - - <version title="v1.4.7"/> - <item text="Update secondary background for transparent themes to be more visible." /> + + <version title="v1.4.7" /> + <item text="Update secondary background for transparent themes to be more visible." /> <item text="Pressing enter when searching will launch the full search page" /> <item text="Add different backgrounds for news feed articles." /> <item text="Add option to get image/video from default camera or gallery app." /> @@ -65,31 +72,31 @@ <item text="Remove error dialog for IAB. It will now depend solely on the google services dialogs." /> <item text="Fix loading issue for old conversations" /> <item text="Add debugger for failed image activities" /> - - <version title="v1.4.5"/> - <item text="Create more robust IM notification fetcher with a timeout" /> + + <version title="v1.4.5" /> + <item text="Create more robust IM notification fetcher with a timeout" /> <item text="Add hidden debugging options for certain views" /> <item text="Separate IM and general notification groups" /> <item text="Add click actions to group notifications. They will launch the message page or the notification page respectively" /> <item text="Add behaviour setting to force message threads to scroll to the bottom after loading." /> <item text="Add faq for disabling video auto play" /> - - <version title="v1.4.2"/> + + <version title="v1.4.2" /> <item text="Experimental: Add notifications for messages; report to me if this drains your battery" /> <item text="Add FAQ in the about section" /> <item text="Add video uploading" /> <item text="Add open link option in context menu" /> <item text="Add geolocation" /> <item text="Update theme" /> - <item text="Fix notification titles" /> + <item text="Fix notification titles" /> <item text="ALPHA: Add support for downloading videos (hit the download button)" /> <item text="Deny intents for login so the page loads properly (thank you @Zenexer)" /> <item text="Reduce injection offset and move injectors to an earlier method" /> <item text="Add option to disable media loading on metered network" /> <item text="Fix menu section" /> <item text="Add more background setters to help transparent themes" /> - - <version title="v1.4.1"/> + + <version title="v1.4.1" /> <item text="Add intro pages" /> <item text="Style new comment highlights" /> <item text="Style reaction background" /> @@ -99,16 +106,16 @@ <item text="Update IAB helper" /> <item text="Create image viewing and downloading; long press any image!" /> <item text="Start filtering out unnecessary loads" /> - <item text="Fix notification duplicates" /> + <item text="Fix notification duplicates" /> <item text="Fix long pressing album images" /> - <item text="Add friend request tab in nav bar" /> + <item text="Add friend request tab in nav bar" /> <item text="Aggressively filter nonrecent posts in recents mode" /> <item text="Add download option for full sized images" /> <item text="Fix rounded icons" /> - <item text="Fix regex bug for some devices" /> + <item text="Fix regex bug for some devices" /> <item text="Fix notification text" /> <item text="Update round icons" /> - <item text="Allow for multiple result flags in settings to better reload the main view" /> + <item text="Allow for multiple result flags in settings to better reload the main view" /> <item text="Add custom image picker" /> <item text="Check if activities can open intent before loading in browser" /> <item text="Add url debugging. Long press a button and press debug link to send me an email" /> |