aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2018-02-16 21:51:02 -0500
committerGitHub <noreply@github.com>2018-02-16 21:51:02 -0500
commitfec23276e8290d4600ef79c54b5fcb00673daa83 (patch)
treec1e7710e91b4152bf40f736294aef12a635535b2
parentd68ea6d7eb8cadf687308fa3204386b79df0556b (diff)
downloadfrost-fec23276e8290d4600ef79c54b5fcb00673daa83.tar.gz
frost-fec23276e8290d4600ef79c54b5fcb00673daa83.tar.bz2
frost-fec23276e8290d4600ef79c54b5fcb00673daa83.zip
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
-rw-r--r--app/build.gradle10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt3
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt47
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt13
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt8
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt11
-rw-r--r--app/src/main/res/layout/activity_web_overlay.xml13
-rw-r--r--app/src/main/res/xml/frost_changelog.xml10
-rw-r--r--docs/Changelog.md5
-rw-r--r--files/debug.keystorebin0 -> 2611 bytes
-rw-r--r--gradle.properties8
18 files changed, 79 insertions, 64 deletions
diff --git a/app/build.gradle b/app/build.gradle
index 08556f9e..3c9ceaa0 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -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"
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt
index f0956ec7..a4d98d8a 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt
@@ -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
}
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 54fa0b8c..02f9134c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -426,7 +426,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
override fun collapseAppBar() {
- appBar.setExpanded(false)
+ appBar.post { appBar.setExpanded(false) }
}
override fun backConsumer(): Boolean {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
index 554eaa00..7b2cfbf2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt
@@ -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)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt
index 7dce6c6e..43463752 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/ActivityContract.kt
@@ -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)
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt
index ab3a40ec..613295e6 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt
@@ -55,6 +55,7 @@ interface FrostContentParent : DynamicUiContract {
/**
* Toggle state for allowing swipes
+ * Allowed on any thread
*/
var swipeEnabled: Boolean
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
index 625ecff9..1211b742 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/GenericIItems.kt
@@ -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
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 d1f9eaf4..e5dcd8a4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/iitems/NotificationIItem.kt
@@ -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
}
}
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 286bce4f..08cf321c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/services/FrostNotifications.kt
@@ -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())
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
index 144e65ef..3e102671 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -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
*/
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
index 43653382..4622971b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt
@@ -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 }
}
/**
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 4a3fa2a2..564b0e04 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -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
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
index 8df5b065..7e5f1632 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostUrlOverlayValidator.kt
@@ -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 \ No newline at end of file
+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
+ } \ No newline at end of file
diff --git a/app/src/main/res/layout/activity_web_overlay.xml b/app/src/main/res/layout/activity_web_overlay.xml
index fe223811..55456fae 100644
--- a/app/src/main/res/layout/activity_web_overlay.xml
+++ b/app/src/main/res/layout/activity_web_overlay.xml
@@ -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>
diff --git a/app/src/main/res/xml/frost_changelog.xml b/app/src/main/res/xml/frost_changelog.xml
index 6eb8d795..7d479852 100644
--- a/app/src/main/res/xml/frost_changelog.xml
+++ b/app/src/main/res/xml/frost_changelog.xml
@@ -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" />
diff --git a/docs/Changelog.md b/docs/Changelog.md
index d6370e18..d025fc5e 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -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
diff --git a/files/debug.keystore b/files/debug.keystore
new file mode 100644
index 00000000..2f9e1542
--- /dev/null
+++ b/files/debug.keystore
Binary files differ
diff --git a/gradle.properties b/gradle.properties
index e3c29781..4b9a631a 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -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