aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-09-07 21:56:46 -0700
committerAllan Wang <me@allanwang.ca>2019-09-07 21:56:46 -0700
commit4c7521d2f773424d76bfe8b4f5beb6cb8b1af815 (patch)
tree51202714ef65704ea44a5e186d6e93be0fe173b1
parent7fb7dcb5a190d65e66bf9c2dd72b94dfcb60cd1a (diff)
downloadfrost-4c7521d2f773424d76bfe8b4f5beb6cb8b1af815.tar.gz
frost-4c7521d2f773424d76bfe8b4f5beb6cb8b1af815.tar.bz2
frost-4c7521d2f773424d76bfe8b4f5beb6cb8b1af815.zip
Replace web only with native ui and auth requests
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt38
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt4
-rw-r--r--app/src/main/res/values/strings_pref_behaviour.xml2
-rw-r--r--app/src/main/res/values/strings_pref_experimental.xml2
9 files changed, 22 insertions, 48 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
index c580c9ed..50bae16c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/FragmentBase.kt
@@ -67,7 +67,7 @@ abstract class BaseFragment : Fragment(), CoroutineScope, FragmentContract, Dyna
data: FbItem,
position: Int
): BaseFragment {
- val fragment = if (useFallback || Prefs.webOnly) WebFragment() else base()
+ val fragment = if (useFallback || !Prefs.nativeUi) WebFragment() else base()
val d = if (data == FbItem.FEED) FeedSort(Prefs.feedSort).item else data
fragment.withArguments(
ARG_URL to d.url,
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt
index fe59c421..77546971 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostRequestService.kt
@@ -163,8 +163,8 @@ class FrostRequestService : BaseJobService() {
override fun onStartJob(params: JobParameters?): Boolean {
super.onStartJob(params)
- if (Prefs.webOnly) {
- L.i { "Web only; skipping request service" }
+ if (!Prefs.authRequests) {
+ L.i { "Auth requests disabled; skipping request service" }
return false
}
val bundle = params?.extras
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
index 091fbb4b..95726974 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
@@ -72,10 +72,6 @@ class NotificationService : BaseJobService() {
override fun onStartJob(params: JobParameters?): Boolean {
super.onStartJob(params)
L.i { "Fetching notifications" }
- if (Prefs.webOnly) {
- L.i { "Web only mode; skipping notification service" }
- return false
- }
launch {
try {
sendNotifications(params)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
index ba5b839b..a0a8117f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Behaviour.kt
@@ -79,6 +79,13 @@ fun SettingsActivity.getBehaviourPrefs(): KPrefAdapterBuilder.() -> Unit = {
}
}
+ checkbox(R.string.native_ui, Prefs::nativeUi, {
+ Prefs.nativeUi = it
+ shouldRestartMain()
+ }) {
+ descRes = R.string.native_ui_desc
+ }
+
checkbox(R.string.exit_confirmation, Prefs::exitConfirmation, { Prefs.exitConfirmation = it }) {
descRes = R.string.exit_confirmation_desc
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
index d0963665..2f45547d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
@@ -43,11 +43,8 @@ fun SettingsActivity.getExperimentalPrefs(): KPrefAdapterBuilder.() -> Unit = {
// Experimental content starts here ------------------
- checkbox(R.string.web_only, Prefs::webOnly, {
- Prefs.webOnly = it
- shouldRestartMain()
- }) {
- descRes = R.string.web_only_desc
+ checkbox(R.string.web_requests, Prefs::authRequests, { Prefs.authRequests = it }) {
+ descRes = R.string.web_requests_desc
}
// Experimental content ends here --------------------
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
index ccf04935..9fcf2e96 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
@@ -22,7 +22,6 @@ import android.media.RingtoneManager
import android.os.Build
import android.provider.Settings
import ca.allanwang.kau.kpref.activity.KPrefAdapterBuilder
-import ca.allanwang.kau.kpref.activity.KPrefItemActions
import ca.allanwang.kau.kpref.activity.items.KPrefText
import ca.allanwang.kau.utils.materialDialog
import ca.allanwang.kau.utils.minuteToText
@@ -48,25 +47,11 @@ import kotlinx.coroutines.launch
*/
val Prefs.hasNotifications: Boolean
- get() = !webOnly && (notificationsGeneral || notificationsInstantMessages)
+ get() = notificationsGeneral || notificationsInstantMessages
@SuppressLint("InlinedApi")
fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
- fun KPrefItemActions.leaveWebOnlyDialog() {
- if (Prefs.webOnly) {
- materialDialog {
- title(R.string.leave_web_only_title)
- message(R.string.leave_web_only_desc)
- positiveButton(R.string.kau_yes) {
- Prefs.webOnly = false
- reload()
- }
- negativeButton(R.string.kau_no)
- }
- }
- }
-
text(
R.string.notification_frequency,
Prefs::notificationFreq,
@@ -86,9 +71,6 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
}
}
}
- onDisabledClick = {
- leaveWebOnlyDialog()
- }
enabler = { Prefs.hasNotifications }
textGetter = { minuteToText(it) }
}
@@ -114,19 +96,12 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
reloadByTitle(R.string.notification_frequency)
}) {
descRes = R.string.notification_general_desc
- enabler = { !Prefs.webOnly }
- onDisabledClick = {
- leaveWebOnlyDialog()
- }
}
checkbox(R.string.notification_general_all_accounts, Prefs::notificationAllAccounts,
{ Prefs.notificationAllAccounts = it }) {
descRes = R.string.notification_general_all_accounts_desc
- enabler = { !Prefs.webOnly && Prefs.notificationsGeneral }
- onDisabledClick = {
- leaveWebOnlyDialog()
- }
+ enabler = { Prefs.notificationsGeneral }
}
checkbox(R.string.notification_messages, Prefs::notificationsInstantMessages,
@@ -137,19 +112,12 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
reloadByTitle(R.string.notification_frequency)
}) {
descRes = R.string.notification_messages_desc
- enabler = { !Prefs.webOnly }
- onDisabledClick = {
- leaveWebOnlyDialog()
- }
}
checkbox(R.string.notification_messages_all_accounts, Prefs::notificationsImAllAccounts,
{ Prefs.notificationsImAllAccounts = it }) {
descRes = R.string.notification_messages_all_accounts_desc
- enabler = { !Prefs.webOnly && Prefs.notificationsInstantMessages }
- onDisabledClick = {
- leaveWebOnlyDialog()
- }
+ enabler = { Prefs.notificationsInstantMessages }
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
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 f17645d0..522e1733 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -191,7 +191,9 @@ object Prefs : KPref() {
var showCreateFab: Boolean by kpref("show_create_fab", true)
- var webOnly: Boolean by kpref("web_only", false)
+ var authRequests: Boolean by kpref("web_requests", false)
+
+ var nativeUi: Boolean by kpref("native_ui", true)
inline val mainActivityLayout: MainActivityLayout
get() = MainActivityLayout(mainActivityLayoutType)
diff --git a/app/src/main/res/values/strings_pref_behaviour.xml b/app/src/main/res/values/strings_pref_behaviour.xml
index 32188698..aac56250 100644
--- a/app/src/main/res/values/strings_pref_behaviour.xml
+++ b/app/src/main/res/values/strings_pref_behaviour.xml
@@ -17,6 +17,8 @@
<string name="search_bar_desc">Enable the search bar instead of a search overlay</string>
<string name="force_message_bottom">Force Message Bottom</string>
<string name="force_message_bottom_desc">When loading a message thread, trigger a scroll to the bottom of the page rather than loading the page as is.</string>
+ <string name="native_ui">Native UI</string>
+ <string name="native_ui_desc">Enables native UI for certain options in the main activity. Done through parsing.</string>
<string name="enable_pip">Enable PIP</string>
<string name="enable_pip_desc">Enable picture in picture videos</string>
<string name="autoplay_settings">Autoplay Settings</string>
diff --git a/app/src/main/res/values/strings_pref_experimental.xml b/app/src/main/res/values/strings_pref_experimental.xml
index fad29ff6..b1ce508f 100644
--- a/app/src/main/res/values/strings_pref_experimental.xml
+++ b/app/src/main/res/values/strings_pref_experimental.xml
@@ -12,6 +12,8 @@
<!-- Debugging phishing warnings -->
<string name="web_only" translatable="false">Web Only</string>
<string name="web_only_desc" translatable="false">Having troubles? Enable to use web exclusive features. All parsing and background services will be disabled.</string>
+ <string name="web_requests" translatable="false">Web Requests</string>
+ <string name="web_requests_desc" translatable="false">Enables features such as marking notifications as read. Known to potentially cause phishing responses.</string>
<string name="leave_web_only_title" translatable="false">Leave web only mode</string>
<string name="leave_web_only_desc" translatable="false">Currently in web only mode. Would you like to disable it to continue?</string>
</resources> \ No newline at end of file