aboutsummaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt9
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt14
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/BiometricUtils.kt6
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt7
11 files changed, 47 insertions, 13 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
index bfb87a2f..58e7d629 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -661,7 +661,13 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
textDebounceInterval = 300
searchCallback =
- { query, _ -> launchWebOverlay("${FbItem._SEARCH.url}/?q=$query", fbCookie, prefs); true }
+ { query, _ ->
+ launchWebOverlay(
+ "${FbItem._SEARCH.url}/?q=$query",
+ fbCookie,
+ prefs
+ ); true
+ }
closeListener = { _ -> searchViewCache.clear() }
foregroundColor = prefs.textColor
backgroundColor = prefs.bgColor.withMinAlpha(200)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt
index 51b1134a..03980a21 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt
@@ -39,7 +39,6 @@ import kotlin.coroutines.resume
import kotlin.coroutines.suspendCoroutine
import kotlinx.coroutines.CoroutineExceptionHandler
import org.koin.android.ext.android.inject
-import org.koin.core.inject
/**
* Created by Allan Wang on 05/01/18.
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
index 1028287a..70f911a8 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/requests/Images.kt
@@ -36,7 +36,7 @@ suspend fun String.getFullSizedImageUrl(url: String, timeout: Long = 3000): Stri
try {
withTimeout(timeout) {
val redirect = requestBuilder().url(url).get().call()
- .execute().body?.string() ?: return@withTimeout null
+ .execute().body?.string() ?: return@withTimeout null
FB_REDIRECT_URL_MATCHER.find(redirect)[1]?.formattedFbUrl
}
} catch (e: Exception) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
index 9d3b59eb..3150ce6d 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
@@ -65,7 +65,11 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
)
}
// TODO temp fix. If url is dependent, we cannot load it directly
- v!!.context.launchWebOverlay(if (notif.url.isIndependent) notif.url else FbItem.NOTIFICATIONS.url, fbCookie, prefs)
+ v!!.context.launchWebOverlay(
+ if (notif.url.isIndependent) notif.url else FbItem.NOTIFICATIONS.url,
+ fbCookie,
+ prefs
+ )
true
}
}
@@ -96,7 +100,8 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) :
}
}
- class ViewHolder(itemView: View) : FastAdapter.ViewHolder<NotificationIItem>(itemView), KoinComponent {
+ class ViewHolder(itemView: View) : FastAdapter.ViewHolder<NotificationIItem>(itemView),
+ KoinComponent {
private val prefs: Prefs by inject()
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 18c51161..b801a871 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt
@@ -101,7 +101,8 @@ fun WebView.jsInject(vararg injectors: InjectorContract, prefs: Prefs) {
}
}
-fun FrostWebViewClient.jsInject(vararg injectors: InjectorContract, prefs: Prefs) = web.jsInject(*injectors, prefs = prefs)
+fun FrostWebViewClient.jsInject(vararg injectors: InjectorContract, prefs: Prefs) =
+ web.jsInject(*injectors, prefs = prefs)
/**
* Wrapper class to convert a function into an injector
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
index 562b1dd9..c4f71452 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
@@ -112,7 +112,12 @@ enum class NotificationType(
* Returns the number of notifications generated,
* or -1 if an error occurred
*/
- suspend fun fetch(context: Context, data: CookieEntity, prefs: Prefs, notifDao: NotificationDao): Int {
+ suspend fun fetch(
+ context: Context,
+ data: CookieEntity,
+ prefs: Prefs,
+ notifDao: NotificationDao
+ ): Int {
val response = try {
parser.parse(data.cookie)
} catch (ignored: Exception) {
@@ -306,7 +311,12 @@ data class FrostNotification(
val notif: NotificationCompat.Builder
) {
- fun withAlert(context: Context, enable: Boolean, ringtone: String, prefs: Prefs): FrostNotification {
+ fun withAlert(
+ context: Context,
+ enable: Boolean,
+ ringtone: String,
+ prefs: Prefs
+ ): FrostNotification {
notif.setFrostAlert(context, enable, ringtone, prefs)
return this
}
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 a86d4062..3a2d7732 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Notifications.kt
@@ -40,7 +40,6 @@ import com.pitchedapps.frost.utils.frostSnackbar
import com.pitchedapps.frost.utils.frostUri
import com.pitchedapps.frost.views.Keywords
import kotlinx.coroutines.launch
-import org.koin.android.ext.android.get
/**
* Created by Allan Wang on 2017-06-29.
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/BiometricUtils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/BiometricUtils.kt
index ab64ff55..21be4168 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/BiometricUtils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/BiometricUtils.kt
@@ -73,7 +73,11 @@ object BiometricUtils {
* Note that the underlying request will call [androidx.fragment.app.FragmentTransaction.commit],
* so this cannot happen after onSaveInstanceState.
*/
- fun authenticate(activity: FragmentActivity, prefs: Prefs, force: Boolean = false): BiometricDeferred {
+ fun authenticate(
+ activity: FragmentActivity,
+ prefs: Prefs,
+ force: Boolean = false
+ ): BiometricDeferred {
val deferred: BiometricDeferred = CompletableDeferred()
if (!force && !shouldPrompt(activity, prefs)) {
deferred.complete(null)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt
index 8a76c424..374488fd 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/AccountItem.kt
@@ -46,7 +46,7 @@ import org.koin.core.inject
*/
class AccountItem(val cookie: CookieEntity?) :
KauIItem<AccountItem.ViewHolder>(R.layout.view_account, { ViewHolder(it) }, R.id.item_account),
-KoinComponent {
+ KoinComponent {
private val prefs: Prefs by inject()
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
index ff8a5bb7..f2386e81 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/Keywords.kt
@@ -122,7 +122,12 @@ class KeywordItem(val keyword: String) : AbstractItem<KeywordItem.ViewHolder>()
init {
text.setTextColor(prefs.textColor)
- delete.setImageDrawable(GoogleMaterial.Icon.gmd_delete.keywordDrawable(itemView.context, prefs))
+ delete.setImageDrawable(
+ GoogleMaterial.Icon.gmd_delete.keywordDrawable(
+ itemView.context,
+ prefs
+ )
+ )
}
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
index 05248153..f7b15ed2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -81,7 +81,12 @@ class FrostJSI(val web: FrostWebView) {
@JavascriptInterface
fun contextMenu(url: String?, text: String?) {
// url will be formatted through webcontext
- web.post { context.showWebContextMenu(WebContext(url.takeIf { it.isIndependent }, text), fbCookie) }
+ web.post {
+ context.showWebContextMenu(
+ WebContext(url.takeIf { it.isIndependent }, text),
+ fbCookie
+ )
+ }
}
/**