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 {
|
test {
|
||||||
storeFile file("../files/test.keystore")
|
storeFile file("../files/test.keystore")
|
||||||
storePassword "testkey"
|
storePassword "testkey"
|
||||||
@ -91,6 +98,7 @@ android {
|
|||||||
shrinkResources false
|
shrinkResources false
|
||||||
applicationIdSuffix ".debug"
|
applicationIdSuffix ".debug"
|
||||||
versionNameSuffix "-debug"
|
versionNameSuffix "-debug"
|
||||||
|
signingConfig signingConfigs.debug
|
||||||
resValue "string", "frost_name", "Frost Debug"
|
resValue "string", "frost_name", "Frost Debug"
|
||||||
resValue "string", "frost_web", "Frost Web Debug"
|
resValue "string", "frost_web", "Frost Web Debug"
|
||||||
ext.enableCrashlytics = false
|
ext.enableCrashlytics = false
|
||||||
@ -100,8 +108,8 @@ android {
|
|||||||
shrinkResources true
|
shrinkResources true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
applicationIdSuffix ".test"
|
applicationIdSuffix ".test"
|
||||||
signingConfig signingConfigs.test
|
|
||||||
versionNameSuffix "-test"
|
versionNameSuffix "-test"
|
||||||
|
signingConfig signingConfigs.test
|
||||||
resValue "string", "frost_name", "Frost Test"
|
resValue "string", "frost_name", "Frost Test"
|
||||||
resValue "string", "frost_web", "Frost Web Test"
|
resValue "string", "frost_web", "Frost Web Test"
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ class AboutActivity : AboutActivityBase(null, {
|
|||||||
"subsamplingscaleimageview"
|
"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}"} }
|
// l.forEach { KL.d{"Lib ${it.definedName}"} }
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
@ -426,7 +426,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun collapseAppBar() {
|
override fun collapseAppBar() {
|
||||||
appBar.setExpanded(false)
|
appBar.post { appBar.setExpanded(false) }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun backConsumer(): Boolean {
|
override fun backConsumer(): Boolean {
|
||||||
|
@ -65,7 +65,7 @@ class TabCustomizerActivity : BaseActivity() {
|
|||||||
adapter.add(tabs.map(::TabIItem))
|
adapter.add(tabs.map(::TabIItem))
|
||||||
bindSwapper(adapter, recycler)
|
bindSwapper(adapter, recycler)
|
||||||
|
|
||||||
adapter.withOnClickListener { view, _, _, _ -> view.wobble(); true }
|
adapter.withOnClickListener { view, _, _, _ -> view!!.wobble(); true }
|
||||||
|
|
||||||
setResult(Activity.RESULT_CANCELED)
|
setResult(Activity.RESULT_CANCELED)
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@ interface MainActivityContract : ActivityContract, MainFabContract {
|
|||||||
val fragmentSubject: PublishSubject<Int>
|
val fragmentSubject: PublishSubject<Int>
|
||||||
fun setTitle(res: Int)
|
fun setTitle(res: Int)
|
||||||
fun setTitle(text: CharSequence)
|
fun setTitle(text: CharSequence)
|
||||||
|
/**
|
||||||
|
* Available on all threads
|
||||||
|
*/
|
||||||
fun collapseAppBar()
|
fun collapseAppBar()
|
||||||
fun reloadFragment(fragment: BaseFragment)
|
fun reloadFragment(fragment: BaseFragment)
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@ interface FrostContentParent : DynamicUiContract {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle state for allowing swipes
|
* Toggle state for allowing swipes
|
||||||
|
* Allowed on any thread
|
||||||
*/
|
*/
|
||||||
var swipeEnabled: Boolean
|
var swipeEnabled: Boolean
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ interface ClickableIItemContract {
|
|||||||
adapter.fastAdapter.withSelectable(false)
|
adapter.fastAdapter.withSelectable(false)
|
||||||
.withOnClickListener { v, _, item, _ ->
|
.withOnClickListener { v, _, item, _ ->
|
||||||
if (item is ClickableIItemContract) {
|
if (item is ClickableIItemContract) {
|
||||||
item.click(v.context)
|
item.click(v!!.context)
|
||||||
true
|
true
|
||||||
} else
|
} else
|
||||||
false
|
false
|
||||||
|
@ -34,10 +34,10 @@ class NotificationIItem(val notification: FrostNotif, val cookie: String) : KauI
|
|||||||
.withOnClickListener { v, _, item, position ->
|
.withOnClickListener { v, _, item, position ->
|
||||||
val notif = item.notification
|
val notif = item.notification
|
||||||
if (notif.unread) {
|
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))
|
adapter.set(position, NotificationIItem(notif.copy(unread = false), item.cookie))
|
||||||
}
|
}
|
||||||
v.context.launchWebOverlay(notif.url)
|
v!!.context.launchWebOverlay(notif.url)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ import android.app.job.JobScheduler
|
|||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.Bitmap
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.BaseBundle
|
import android.os.BaseBundle
|
||||||
import android.os.Build
|
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.color
|
||||||
import ca.allanwang.kau.utils.dpToPx
|
import ca.allanwang.kau.utils.dpToPx
|
||||||
import ca.allanwang.kau.utils.string
|
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.BuildConfig
|
||||||
import com.pitchedapps.frost.R
|
import com.pitchedapps.frost.R
|
||||||
import com.pitchedapps.frost.activities.FrostWebActivity
|
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.L
|
||||||
import com.pitchedapps.frost.utils.Prefs
|
import com.pitchedapps.frost.utils.Prefs
|
||||||
import com.pitchedapps.frost.utils.frostAnswersCustom
|
import com.pitchedapps.frost.utils.frostAnswersCustom
|
||||||
import org.jetbrains.anko.runOnUiThread
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -75,23 +71,7 @@ fun NotificationCompat.Builder.withDefaults(ringtone: String = Prefs.notificatio
|
|||||||
setDefaults(defaults)
|
setDefaults(defaults)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private val _40_DP = 40.dpToPx
|
||||||
* 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())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enum to handle notification creations
|
* Enum to handle notification creations
|
||||||
@ -170,6 +150,17 @@ enum class NotificationType(
|
|||||||
summaryNotification(context, userId, notifCount)
|
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]
|
* Create and submit a new notification with the given [content]
|
||||||
* If [withDefaults] is set, it will also add the appropriate sound, vibration, and light
|
* 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)
|
if (timestamp != -1L) notifBuilder.setWhen(timestamp * 1000)
|
||||||
L.v { "Notif load $content" }
|
L.v { "Notif load $content" }
|
||||||
NotificationManagerCompat.from(context).notify(group, notifId, notifBuilder.build())
|
|
||||||
|
|
||||||
if (profileUrl != null) {
|
if (profileUrl != null) {
|
||||||
context.runOnUiThread {
|
try {
|
||||||
//todo verify if context is valid?
|
val profileImg = GlideApp.with(context)
|
||||||
GlideApp.with(context)
|
|
||||||
.asBitmap()
|
.asBitmap()
|
||||||
.load(profileUrl)
|
.load(profileUrl)
|
||||||
.transform(FrostGlide.circleCrop)
|
.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(
|
val dependentSegments = arrayOf(
|
||||||
"photoset_token", "direct_action_execute", "messages/?pageNum", "sharer.php",
|
"photoset_token", "direct_action_execute", "messages/?pageNum", "sharer.php",
|
||||||
"events/permalink",
|
"events/permalink", "events/feed/watch",
|
||||||
/**
|
/**
|
||||||
* Editing images
|
* Editing images
|
||||||
*/
|
*/
|
||||||
|
@ -12,7 +12,6 @@ import com.pitchedapps.frost.R
|
|||||||
import com.pitchedapps.frost.contracts.FrostContentContainer
|
import com.pitchedapps.frost.contracts.FrostContentContainer
|
||||||
import com.pitchedapps.frost.contracts.FrostContentCore
|
import com.pitchedapps.frost.contracts.FrostContentCore
|
||||||
import com.pitchedapps.frost.contracts.FrostContentParent
|
import com.pitchedapps.frost.contracts.FrostContentParent
|
||||||
import com.pitchedapps.frost.contracts.MainActivityContract
|
|
||||||
import com.pitchedapps.frost.facebook.FbItem
|
import com.pitchedapps.frost.facebook.FbItem
|
||||||
import com.pitchedapps.frost.facebook.WEB_LOAD_DELAY
|
import com.pitchedapps.frost.facebook.WEB_LOAD_DELAY
|
||||||
import com.pitchedapps.frost.utils.L
|
import com.pitchedapps.frost.utils.L
|
||||||
@ -59,14 +58,12 @@ abstract class FrostContentView<out T> @JvmOverloads constructor(
|
|||||||
|
|
||||||
protected abstract val layoutRes: Int
|
protected abstract val layoutRes: Int
|
||||||
|
|
||||||
override var swipeEnabled: Boolean
|
override var swipeEnabled = true
|
||||||
get() = refresh.isEnabled
|
|
||||||
set(value) {
|
set(value) {
|
||||||
refresh.isEnabled = value
|
if (field == value)
|
||||||
if (!value) {
|
return
|
||||||
// locked onto an input field; ensure content is visible
|
field = value
|
||||||
(context as? MainActivityContract)?.collapseAppBar()
|
refresh.post { refresh.isEnabled = value }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,6 +2,7 @@ package com.pitchedapps.frost.web
|
|||||||
|
|
||||||
import android.webkit.JavascriptInterface
|
import android.webkit.JavascriptInterface
|
||||||
import com.pitchedapps.frost.activities.MainActivity
|
import com.pitchedapps.frost.activities.MainActivity
|
||||||
|
import com.pitchedapps.frost.contracts.MainActivityContract
|
||||||
import com.pitchedapps.frost.contracts.VideoViewHolder
|
import com.pitchedapps.frost.contracts.VideoViewHolder
|
||||||
import com.pitchedapps.frost.facebook.FbCookie
|
import com.pitchedapps.frost.facebook.FbCookie
|
||||||
import com.pitchedapps.frost.utils.*
|
import com.pitchedapps.frost.utils.*
|
||||||
@ -63,6 +64,7 @@ class FrostJSI(val web: FrostWebView) {
|
|||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun longClick(start: Boolean) {
|
fun longClick(start: Boolean) {
|
||||||
activity?.viewPager?.enableSwipe = !start
|
activity?.viewPager?.enableSwipe = !start
|
||||||
|
web.parent.swipeEnabled = !start
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,7 +72,11 @@ class FrostJSI(val web: FrostWebView) {
|
|||||||
*/
|
*/
|
||||||
@JavascriptInterface
|
@JavascriptInterface
|
||||||
fun disableSwipeRefresh(disable: Boolean) {
|
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
|
@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 messageWhitelist = setOf(FbItem.MESSAGES, FbItem.CHAT, FbItem.FEED_MOST_RECENT, FbItem.FEED_TOP_STORIES).map { it.url }.toSet()
|
||||||
|
|
||||||
val String.shouldUseBasicAgent
|
val String.shouldUseBasicAgent: Boolean
|
||||||
get() = !contains("story.php") //we will use basic agent for anything that isn't a comment section
|
get() {
|
||||||
// get() = (messageWhitelist.any { contains(it) }) || this == FB_URL_BASE
|
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_height="match_parent"
|
||||||
android:layout_marginTop="?attr/actionBarSize" />
|
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>
|
</android.support.design.widget.CoordinatorLayout>
|
||||||
|
@ -6,11 +6,19 @@
|
|||||||
<item text="" />
|
<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" />
|
<version title="v1.8.1" />
|
||||||
<item text="Theme new Facebook update" />
|
<item text="Theme new Facebook update" />
|
||||||
<item text="Fix layout issue for posting messages" />
|
<item text="Fix layout issue for posting messages" />
|
||||||
<item text="Create FAB for posting" />
|
<item text="Create FAB for posting" />
|
||||||
<item text="" />
|
|
||||||
|
|
||||||
<version title="v1.8.0" />
|
<version title="v1.8.0" />
|
||||||
<item text="Add Chinese, Indonesian, Norwegian, Polish, Thai, and Turkish translations" />
|
<item text="Add Chinese, Indonesian, Norwegian, Polish, Thai, and Turkish translations" />
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v1.8.2
|
||||||
|
* Fix duplicate notification sounds
|
||||||
|
* Fix map redirecting to blackberry
|
||||||
|
* Fix event reservation
|
||||||
|
|
||||||
## v1.8.1
|
## v1.8.1
|
||||||
* Theme new Facebook update
|
* Theme new Facebook update
|
||||||
* Fix layout issue for posting messages
|
* 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_ID=Frost
|
||||||
APP_GROUP=com.pitchedapps
|
APP_GROUP=com.pitchedapps
|
||||||
|
|
||||||
KAU=f5d6ddb
|
KAU=e229146
|
||||||
KOTLIN=1.2.21
|
KOTLIN=1.2.21
|
||||||
|
|
||||||
COMMONS_TEXT=1.2
|
COMMONS_TEXT=1.2
|
||||||
CRASHLYTICS=2.8.0
|
CRASHLYTICS=2.9.0
|
||||||
DBFLOW=4.2.4
|
DBFLOW=4.2.4
|
||||||
EXOMEDIA=4.1.0
|
EXOMEDIA=4.1.0
|
||||||
IAB=1.0.44
|
IAB=1.0.44
|
||||||
JSOUP=1.11.2
|
JSOUP=1.11.2
|
||||||
LEAK_CANARY=1.5.4
|
LEAK_CANARY=1.5.4
|
||||||
MATERIAL_DRAWER_KT=1.2.2
|
MATERIAL_DRAWER_KT=1.3.3
|
||||||
OKHTTP=3.9.1
|
OKHTTP=3.9.1
|
||||||
PAPER_PARCEL=2.0.4
|
PAPER_PARCEL=2.0.4
|
||||||
ROBOELECTRIC=3.4
|
ROBOELECTRIC=3.4
|
||||||
RX_ANDROID=2.0.1
|
RX_ANDROID=2.0.1
|
||||||
RX_BINDING=2.0.0
|
RX_BINDING=2.0.0
|
||||||
RX_JAVA=2.1.8
|
RX_JAVA=2.1.9
|
||||||
RX_KOTLIN=2.2.0
|
RX_KOTLIN=2.2.0
|
||||||
RX_NETWORK=0.12.1
|
RX_NETWORK=0.12.1
|
||||||
SCALE_IMAGE_VIEW=3.9.0
|
SCALE_IMAGE_VIEW=3.9.0
|
||||||
|
Loading…
Reference in New Issue
Block a user