aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/dbflow/FbTabsDb.kt5
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt2
7 files changed, 15 insertions, 7 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/dbflow/FbTabsDb.kt b/app/src/main/kotlin/com/pitchedapps/frost/dbflow/FbTabsDb.kt
index 2182f9ff..69c7f3d5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/dbflow/FbTabsDb.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/dbflow/FbTabsDb.kt
@@ -24,11 +24,6 @@ object FbTabsDb {
@Table(database = FbTabsDb::class, allFields = true)
data class FbTabModel(@PrimaryKey var position: Int = -1, var tab: FbTab = FbTab.FEED) : BaseModel()
-//const val FB_URL_BASE = "https://touch.facebook.com/"
-
-//BOOKMARKS("https://touch.facebook.com/bookmarks"),
-//SEARCH("https://touch.facebook.com/search"),
-
fun loadFbTabs(): List<FbTab> {
val tabs: List<FbTabModel>? = SQLite.select().from(FbTabModel::class).orderBy(FbTabModel_Table.position, true).queryList()
if (tabs?.isNotEmpty() ?: false) return tabs!!.map { it.tab }
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 655da3ff..a83e87dc 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt
@@ -5,6 +5,8 @@ import com.pitchedapps.frost.utils.L
/**
* Created by Allan Wang on 2017-05-31.
+ *
+ * List of elements to hide
*/
enum class CssHider(vararg val items: String) : InjectorContract {
CORE("[data-sigil=m_login_upsell]"),
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt
index 70df1bfa..4c44c1bf 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt
@@ -5,6 +5,8 @@ import com.pitchedapps.frost.facebook.FB_URL_BASE
/**
* Created by Allan Wang on 2017-05-31.
+ *
+ * Collection of short js functions that are embedded directly
*/
enum class JsActions(body: String) : InjectorContract {
/**
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
index 3ef1430d..132d1968 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
@@ -7,7 +7,6 @@ import com.pitchedapps.frost.utils.L
* Created by Allan Wang on 2017-05-31.
* Mapping of the available assets
* The enum name must match the css file name
- * //TODO add folder mapping using Prefs
*/
enum class JsAssets : InjectorContract {
MENU, CLICK_A, CLICK_INTERCEPTOR, HEADER_BADGES, SEARCH
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 deb6c0be..1f35464b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
@@ -34,6 +34,9 @@ class JsBuilder {
}
}
+/**
+ * Contract for all injectors to allow it to interact properly with a webview
+ */
interface InjectorContract {
fun inject(webView: WebView) = inject(webView, null)
fun inject(webView: WebView, callback: ((String) -> Unit)?)
@@ -58,6 +61,9 @@ fun WebView.jsInject(vararg injectors: InjectorContract, callback: ((Array<Strin
fun FrostWebViewClient.jsInject(vararg injectors: InjectorContract, callback: ((Array<String>) -> Unit) = {}) = webCore.jsInject(*injectors, callback = callback)
+/**
+ * Wrapper class to convert a function into an injector
+ */
class JsInjector(val function: String) : InjectorContract {
override fun inject(webView: WebView, callback: ((String) -> Unit)?) {
webView.evaluateJavascript(function, { value -> callback?.invoke(value) })
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 23bf7f96..d00ca8f0 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/NotificationService.kt
@@ -28,6 +28,9 @@ import java.util.concurrent.Future
/**
* Created by Allan Wang on 2017-06-14.
+ *
+ * Service to manage notifications
+ * Will periodically check through all accounts in the db and send notifications when appropriate
*/
class NotificationService : JobService() {
@@ -41,7 +44,6 @@ class NotificationService : JobService() {
override fun onStartJob(params: JobParameters?): Boolean {
future = doAsync {
- // debugNotification("Load notifs")
loadFbCookiesSync().forEach {
data ->
L.i("Handle notifications for $data")
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt
index c40750ef..a239e58f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/UpdateReceiver.kt
@@ -9,6 +9,8 @@ import com.pitchedapps.frost.utils.scheduleNotifications
/**
* Created by Allan Wang on 2017-05-31.
+ *
+ * Receiver that is triggered whenever the app updates so it can bind the notifications again
*/
class UpdateReceiver : BroadcastReceiver() {