aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-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.kt15
-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/kotlin/com/pitchedapps/frost/utils/Showcase.kt5
8 files changed, 19 insertions, 60 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..5647584e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Experimental.kt
@@ -23,7 +23,6 @@ import com.pitchedapps.frost.R
import com.pitchedapps.frost.activities.SettingsActivity
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.REQUEST_RESTART_APPLICATION
-import com.pitchedapps.frost.utils.Showcase
/**
* Created by Allan Wang on 2017-06-29.
@@ -34,20 +33,10 @@ fun SettingsActivity.getExperimentalPrefs(): KPrefAdapterBuilder.() -> Unit = {
descRes = R.string.experimental_disclaimer_info
}
- checkbox(
- R.string.experimental_by_default,
- Showcase::experimentalDefault,
- { Showcase.experimentalDefault = it }) {
- descRes = R.string.experimental_by_default_desc
- }
-
// Experimental content starts here ------------------
- checkbox(R.string.web_only, Prefs::webOnly, {
- Prefs.webOnly = it
- shouldRestartMain()
- }) {
- descRes = R.string.web_only_desc
+ checkbox(R.string.auth_requests, Prefs::authRequests, { Prefs.authRequests = it }) {
+ descRes = R.string.auth_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/kotlin/com/pitchedapps/frost/utils/Showcase.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
index df48bfbc..f69af40b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt
@@ -30,8 +30,5 @@ object Showcase : KPref() {
val intro: Boolean by kprefSingle("intro_pages")
- //not a showcase but cannot be in the same file as Prefs
- var experimentalDefault: Boolean by kpref("experimental_by_default", false)
-
- override fun deleteKeys() = arrayOf("shown_release")
+ override fun deleteKeys() = arrayOf("shown_release", "experimental_by_default")
}