mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-08 12:02:33 +01:00
Update/misc (#728)
* Update basic agent check; fixes #714 * Disable swipe on long click * Remove duplicate code * Update dependencies * Update dependencies 2 * Add debug keystore * Update versions * Fix duplicate notification * Fix duplicate notification sound; addreesses #725 * Update changelog * Clean up
This commit is contained in:
parent
d68ea6d7eb
commit
fec23276e8
@ -77,6 +77,13 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
debug {
|
||||
storeFile file("../files/debug.keystore")
|
||||
storePassword "debugKey"
|
||||
keyAlias "debugKey"
|
||||
keyPassword "debugKey"
|
||||
}
|
||||
|
||||
test {
|
||||
storeFile file("../files/test.keystore")
|
||||
storePassword "testkey"
|
||||
@ -91,6 +98,7 @@ android {
|
||||
shrinkResources false
|
||||
applicationIdSuffix ".debug"
|
||||
versionNameSuffix "-debug"
|
||||
signingConfig signingConfigs.debug
|
||||
resValue "string", "frost_name", "Frost Debug"
|
||||
resValue "string", "frost_web", "Frost Web Debug"
|
||||
ext.enableCrashlytics = false
|
||||
@ -100,8 +108,8 @@ android {
|
||||
shrinkResources true
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
applicationIdSuffix ".test"
|
||||
signingConfig signingConfigs.test
|
||||
versionNameSuffix "-test"
|
||||
signingConfig signingConfigs.test
|
||||
resValue "string", "frost_name", "Frost Test"
|
||||
resValue "string", "frost_web", "Frost Web Test"
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ class AboutActivity : AboutActivityBase(null, {
|
||||
"subsamplingscaleimageview"
|
||||
)
|
||||
|
||||
val l = libs.prepareLibraries(this, include, null, false, true)
|
||||
val l = libs.prepareLibraries(this, include, null, false, true,true)
|
||||
// l.forEach { KL.d{"Lib ${it.definedName}"} }
|
||||
return l
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
|
||||
}
|
||||
|
||||
override fun collapseAppBar() {
|
||||
appBar.setExpanded(false)
|
||||
appBar.post { appBar.setExpanded(false) }
|
||||
}
|
||||
|
||||
override fun backConsumer(): Boolean {
|
||||
|
@ -65,7 +65,7 @@ class TabCustomizerActivity : BaseActivity() {
|
||||
adapter.add(tabs.map(::TabIItem))
|
||||
bindSwapper(adapter, recycler)
|
||||
|
||||
adapter.withOnClickListener { view, _, _, _ -> view.wobble(); true }
|
||||
adapter.withOnClickListener { view, _, _, _ -> view!!.wobble(); true }
|
||||
|
||||
setResult(Activity.RESULT_CANCELED)
|
||||
|
||||
|
@ -13,6 +13,9 @@ interface MainActivityContract : ActivityContract, MainFabContract {
|
||||
val fragmentSubject: PublishSubject<Int>
|
||||
fun setTitle(res: Int)
|
||||
fun setTitle(text: CharSequence)
|
||||
/**
|
||||
* Available on all threads
|
||||
*/
|
||||
fun collapseAppBar()
|
||||
fun reloadFragment(fragment: BaseFragment)
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ interface FrostContentParent : DynamicUiContract {
|
||||
|
||||
/**
|
||||
* Toggle state for allowing swipes
|
||||
* Allowed on any thread
|
||||
*/
|
||||
var swipeEnabled: Boolean
|
||||
|
||||
|
@ -34,7 +34,7 @@ interface ClickableIItemContract {
|
||||
adapter.fastAdapter.withSelectable(false)
|
||||
.withOnClickListener { v, _, item, _ ->
|
||||
if (item is ClickableIItemContract) {
|
||||
item.click(v.context)
|
||||
item.click(v!!.context)
|
||||
true
|
||||
} else
|
||||
false
|
||||
|
@ -34,10 +34,10 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) : KauI
|
||||
.withOnClickListener { v, _, item, position ->
|
||||
val notif = item.notification
|
||||
if (notif.unread) {
|
||||
FrostRunnable.markNotificationRead(v.context, notif.id, item.cookie)
|
||||
FrostRunnable.markNotificationRead(v!!.context, notif.id, item.cookie)
|
||||
adapter.set(position, NotificationIItem(notif.copy(unread = false), item.cookie))
|
||||
}
|
||||
v.context.launchWebOverlay(notif.url)
|
||||
v!!.context.launchWebOverlay(notif.url)
|
||||
true
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,6 @@ import android.app.job.JobScheduler
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.BaseBundle
|
||||
import android.os.Build
|
||||
@ -19,8 +18,6 @@ import android.support.v4.app.NotificationManagerCompat
|
||||
import ca.allanwang.kau.utils.color
|
||||
import ca.allanwang.kau.utils.dpToPx
|
||||
import ca.allanwang.kau.utils.string
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
import com.bumptech.glide.request.transition.Transition
|
||||
import com.pitchedapps.frost.BuildConfig
|
||||
import com.pitchedapps.frost.R
|
||||
import com.pitchedapps.frost.activities.FrostWebActivity
|
||||
@ -39,7 +36,6 @@ import com.pitchedapps.frost.utils.ARG_USER_ID
|
||||
import com.pitchedapps.frost.utils.L
|
||||
import com.pitchedapps.frost.utils.Prefs
|
||||
import com.pitchedapps.frost.utils.frostAnswersCustom
|
||||
import org.jetbrains.anko.runOnUiThread
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@ -75,23 +71,7 @@ fun NotificationCompat.Builder.withDefaults(ringtone: String = Prefs.notificatio
|
||||
setDefaults(defaults)
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by Allan Wang on 2017-07-08.
|
||||
*
|
||||
* Custom target to set the content view and update a given notification
|
||||
* 40dp is the size of the right avatar
|
||||
*/
|
||||
class FrostNotificationTarget(val context: Context,
|
||||
val notifId: Int,
|
||||
val notifTag: String,
|
||||
val builder: NotificationCompat.Builder
|
||||
) : SimpleTarget<Bitmap>(40.dpToPx, 40.dpToPx) {
|
||||
|
||||
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {
|
||||
builder.setLargeIcon(resource)
|
||||
NotificationManagerCompat.from(context).notify(notifTag, notifId, builder.build())
|
||||
}
|
||||
}
|
||||
private val _40_DP = 40.dpToPx
|
||||
|
||||
/**
|
||||
* Enum to handle notification creations
|
||||
@ -170,6 +150,17 @@ enum class NotificationType(
|
||||
summaryNotification(context, userId, notifCount)
|
||||
}
|
||||
|
||||
private fun debugNotification(context: Context, data: CookieModel) {
|
||||
val content = NotificationContent(data,
|
||||
System.currentTimeMillis(),
|
||||
"https://github.com/AllanWang/Frost-for-Facebook",
|
||||
"Debug Notif",
|
||||
"Test 123",
|
||||
System.currentTimeMillis() / 1000,
|
||||
"https://www.iconexperience.com/_img/v_collection_png/256x256/shadow/dog.png")
|
||||
createNotification(context, content, true)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and submit a new notification with the given [content]
|
||||
* If [withDefaults] is set, it will also add the appropriate sound, vibration, and light
|
||||
@ -198,18 +189,22 @@ enum class NotificationType(
|
||||
|
||||
if (timestamp != -1L) notifBuilder.setWhen(timestamp * 1000)
|
||||
L.v { "Notif load $content" }
|
||||
NotificationManagerCompat.from(context).notify(group, notifId, notifBuilder.build())
|
||||
|
||||
if (profileUrl != null) {
|
||||
context.runOnUiThread {
|
||||
//todo verify if context is valid?
|
||||
GlideApp.with(context)
|
||||
try {
|
||||
val profileImg = GlideApp.with(context)
|
||||
.asBitmap()
|
||||
.load(profileUrl)
|
||||
.transform(FrostGlide.circleCrop)
|
||||
.into(FrostNotificationTarget(context, notifId, group, notifBuilder))
|
||||
.submit(_40_DP, _40_DP)
|
||||
.get()
|
||||
notifBuilder.setLargeIcon(profileImg)
|
||||
} catch (e: Exception) {
|
||||
L.e { "Failed to get image $profileUrl" }
|
||||
}
|
||||
}
|
||||
|
||||
NotificationManagerCompat.from(context).notify(group, notifId, notifBuilder.build())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ inline val String?.isIndependent: Boolean
|
||||
|
||||
val dependentSegments = arrayOf(
|
||||
"photoset_token", "direct_action_execute", "messages/?pageNum", "sharer.php",
|
||||
"events/permalink",
|
||||
"events/permalink", "events/feed/watch",
|
||||
/**
|
||||
* Editing images
|
||||
*/
|
||||
|
@ -12,7 +12,6 @@ import com.pitchedapps.frost.R
|
||||
import com.pitchedapps.frost.contracts.FrostContentContainer
|
||||
import com.pitchedapps.frost.contracts.FrostContentCore
|
||||
import com.pitchedapps.frost.contracts.FrostContentParent
|
||||
import com.pitchedapps.frost.contracts.MainActivityContract
|
||||
import com.pitchedapps.frost.facebook.FbItem
|
||||
import com.pitchedapps.frost.facebook.WEB_LOAD_DELAY
|
||||
import com.pitchedapps.frost.utils.L
|
||||
@ -59,14 +58,12 @@ abstract class FrostContentView<out T> @JvmOverloads constructor(
|
||||
|
||||
protected abstract val layoutRes: Int
|
||||
|
||||
override var swipeEnabled: Boolean
|
||||
get() = refresh.isEnabled
|
||||
override var swipeEnabled = true
|
||||
set(value) {
|
||||
refresh.isEnabled = value
|
||||
if (!value) {
|
||||
// locked onto an input field; ensure content is visible
|
||||
(context as? MainActivityContract)?.collapseAppBar()
|
||||
}
|
||||
if (field == value)
|
||||
return
|
||||
field = value
|
||||
refresh.post { refresh.isEnabled = value }
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ package com.pitchedapps.frost.web
|
||||
|
||||
import android.webkit.JavascriptInterface
|
||||
import com.pitchedapps.frost.activities.MainActivity
|
||||
import com.pitchedapps.frost.contracts.MainActivityContract
|
||||
import com.pitchedapps.frost.contracts.VideoViewHolder
|
||||
import com.pitchedapps.frost.facebook.FbCookie
|
||||
import com.pitchedapps.frost.utils.*
|
||||
@ -63,6 +64,7 @@ class FrostJSI(val web: FrostWebView) {
|
||||
@JavascriptInterface
|
||||
fun longClick(start: Boolean) {
|
||||
activity?.viewPager?.enableSwipe = !start
|
||||
web.parent.swipeEnabled = !start
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +72,11 @@ class FrostJSI(val web: FrostWebView) {
|
||||
*/
|
||||
@JavascriptInterface
|
||||
fun disableSwipeRefresh(disable: Boolean) {
|
||||
web.post { web.parent.swipeEnabled = !disable }
|
||||
web.parent.swipeEnabled = !disable
|
||||
if (disable) {
|
||||
// locked onto an input field; ensure content is visible
|
||||
(context as? MainActivityContract)?.collapseAppBar()
|
||||
}
|
||||
}
|
||||
|
||||
@JavascriptInterface
|
||||
|
@ -72,6 +72,11 @@ fun FrostWebView.requestWebOverlay(url: String): Boolean {
|
||||
*/
|
||||
val messageWhitelist = setOf(FbItem.MESSAGES, FbItem.CHAT, FbItem.FEED_MOST_RECENT, FbItem.FEED_TOP_STORIES).map { it.url }.toSet()
|
||||
|
||||
val String.shouldUseBasicAgent
|
||||
get() = !contains("story.php") //we will use basic agent for anything that isn't a comment section
|
||||
// get() = (messageWhitelist.any { contains(it) }) || this == FB_URL_BASE
|
||||
val String.shouldUseBasicAgent: Boolean
|
||||
get() {
|
||||
if (contains("story.php")) // do not use basic for comment section
|
||||
return false
|
||||
if (contains("/events/")) // do not use for events (namely the map)
|
||||
return false
|
||||
return true // use for everything else
|
||||
}
|
@ -23,17 +23,4 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="?attr/actionBarSize" />
|
||||
|
||||
<!--<com.pitchedapps.frost.views.FrostRefreshView-->
|
||||
<!--android:id="@+id/overlay_frost_refresh_view"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent"-->
|
||||
<!--android:layout_marginTop="?attr/actionBarSize">-->
|
||||
|
||||
<!--<com.pitchedapps.frost.views.FrostWebView-->
|
||||
<!--android:id="@+id/overlay_frost_web_view"-->
|
||||
<!--android:layout_width="match_parent"-->
|
||||
<!--android:layout_height="match_parent" />-->
|
||||
|
||||
<!--</com.pitchedapps.frost.views.FrostRefreshView>-->
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
@ -6,11 +6,19 @@
|
||||
<item text="" />
|
||||
-->
|
||||
|
||||
<version title="v1.8.2" />
|
||||
<item text="Fix duplicate notification sounds" />
|
||||
<item text="Fix map redirecting to blackberry" />
|
||||
<item text="Fix event reservation" />
|
||||
<item text="" />
|
||||
<item text="" />
|
||||
<item text="" />
|
||||
<item text="" />
|
||||
|
||||
<version title="v1.8.1" />
|
||||
<item text="Theme new Facebook update" />
|
||||
<item text="Fix layout issue for posting messages" />
|
||||
<item text="Create FAB for posting" />
|
||||
<item text="" />
|
||||
|
||||
<version title="v1.8.0" />
|
||||
<item text="Add Chinese, Indonesian, Norwegian, Polish, Thai, and Turkish translations" />
|
||||
|
@ -1,5 +1,10 @@
|
||||
# Changelog
|
||||
|
||||
## v1.8.2
|
||||
* Fix duplicate notification sounds
|
||||
* Fix map redirecting to blackberry
|
||||
* Fix event reservation
|
||||
|
||||
## v1.8.1
|
||||
* Theme new Facebook update
|
||||
* Fix layout issue for posting messages
|
||||
|
BIN
files/debug.keystore
Normal file
BIN
files/debug.keystore
Normal file
Binary file not shown.
@ -14,23 +14,23 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro
|
||||
APP_ID=Frost
|
||||
APP_GROUP=com.pitchedapps
|
||||
|
||||
KAU=f5d6ddb
|
||||
KAU=e229146
|
||||
KOTLIN=1.2.21
|
||||
|
||||
COMMONS_TEXT=1.2
|
||||
CRASHLYTICS=2.8.0
|
||||
CRASHLYTICS=2.9.0
|
||||
DBFLOW=4.2.4
|
||||
EXOMEDIA=4.1.0
|
||||
IAB=1.0.44
|
||||
JSOUP=1.11.2
|
||||
LEAK_CANARY=1.5.4
|
||||
MATERIAL_DRAWER_KT=1.2.2
|
||||
MATERIAL_DRAWER_KT=1.3.3
|
||||
OKHTTP=3.9.1
|
||||
PAPER_PARCEL=2.0.4
|
||||
ROBOELECTRIC=3.4
|
||||
RX_ANDROID=2.0.1
|
||||
RX_BINDING=2.0.0
|
||||
RX_JAVA=2.1.8
|
||||
RX_JAVA=2.1.9
|
||||
RX_KOTLIN=2.2.0
|
||||
RX_NETWORK=0.12.1
|
||||
SCALE_IMAGE_VIEW=3.9.0
|
||||
|
Loading…
Reference in New Issue
Block a user