1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 04:52:38 +01:00

Test against proguard and fix minor details (#67)

* Reenable enum in proguard rules

* Add missing permission and upload to beta

* Use kau permission const
This commit is contained in:
Allan Wang 2017-07-16 20:23:42 -07:00 committed by GitHub
parent d90cb9b61c
commit 7bf93ea74b
7 changed files with 26 additions and 30 deletions

View File

@ -10,7 +10,7 @@ apply plugin: 'com.github.triplet.play'
play {
jsonFile = file('../files/gplay-keys.json')
track = 'alpha'
track = 'beta'
errorOnSizeLimit = true
uploadImages = false
untrackOld = true

View File

@ -7,7 +7,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--<uses-permission android:name="android.permission.VIBRATE" />-->
<!--<uses-permission android:name="android.permission.USE_FINGERPRINT" />-->

View File

@ -85,7 +85,7 @@ class ImageActivity : AppCompatActivity() {
setContentView(if (!text.isNullOrBlank()) R.layout.activity_image else R.layout.activity_image_textless)
container.setBackgroundColor(Prefs.bgColor.withMinAlpha(222))
caption?.setTextColor(Prefs.textColor)
caption?.setBackgroundColor(Prefs.bgColor.colorToForeground(0.1f).withAlpha(255))
caption?.setBackgroundColor(Prefs.bgColor.colorToForeground(0.2f).withAlpha(255))
caption?.text = text
progress.tint(Prefs.accentColor)
panel?.addPanelSlideListener(object : SlidingUpPanelLayout.SimplePanelSlideListener() {
@ -174,16 +174,13 @@ class ImageActivity : AppCompatActivity() {
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
val imageFileName = "Frost_" + timeStamp + "_"
val storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES)
return File.createTempFile(
imageFileName, /* prefix */
".png", /* suffix */
storageDir /* directory */
)
return File.createTempFile(imageFileName, ".png", storageDir)
}
internal fun downloadImage() {
kauRequestPermissions(PERMISSION_WRITE_EXTERNAL_STORAGE) {
granted, _ ->
L.d("Download image callback granted: $granted")
if (granted) {
doAsync {
val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss").format(Date())
@ -199,6 +196,7 @@ class ImageActivity : AppCompatActivity() {
} catch (e: Exception) {
success = false
} finally {
L.d("Download image async finished: $success")
uiThread {
snackbar(if (success) R.string.image_download_success else R.string.image_download_fail)
if (success) {
@ -230,7 +228,7 @@ class ImageActivity : AppCompatActivity() {
}
}
internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.textColor, val backgroundTint: Int = Prefs.accentBackgroundColor.withAlpha(255)) {
internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.iconColor, val backgroundTint: Int = Prefs.iconBackgroundColor.withAlpha(255)) {
ERROR(GoogleMaterial.Icon.gmd_error, Color.WHITE, Color.RED) {
override fun onClick(activity: ImageActivity) {
//todo add something
@ -240,9 +238,7 @@ internal enum class FabStates(val iicon: IIcon, val iconColor: Int = Prefs.textC
override fun onClick(activity: ImageActivity) {}
},
DOWNLOAD(GoogleMaterial.Icon.gmd_file_download) {
override fun onClick(activity: ImageActivity) {
activity.downloadImage()
}
override fun onClick(activity: ImageActivity) = activity.downloadImage()
},
SHARE(GoogleMaterial.Icon.gmd_share) {
override fun onClick(activity: ImageActivity) {

View File

@ -65,16 +65,10 @@ object Prefs : KPref() {
get() = if (headerColor.isColorVisibleOn(bgColor, 100)) headerColor else textColor
/**
* Ensures that the color is visible against both the foreground and background
* Ensures that the color is visible against the background
*/
val accentBackgroundColor: Int
get() {
if (headerColor.isColorVisibleOn(textColor, 100)) {
if (headerColor.isColorVisibleOn(bgColor, 100)) return headerColor
else return headerColor.colorToForeground(0.2f)
}
return bgColor.colorToForeground(0.2f)
}
val iconBackgroundColor: Int
get() = if (headerColor.isColorVisibleOn(bgColor)) headerColor else headerColor.colorToForeground(0.2f)
val themeInjector: InjectorContract
get() = t.injector

View File

@ -158,13 +158,18 @@ private fun SettingsActivity.finishRestore(snackbar: Snackbar, hasPro: Boolean)
*/
fun Activity.validatePro() {
L.d("Play Store Validate pro")
try {
getInventory(Prefs.pro, false, { if (Prefs.pro) playStoreNoLongerPro() }) {
inv, helper ->
val proSku = inv.hasPurchase(FROST_PRO)
L.d("Play Store Validation finished: ${Prefs.pro} should be $proSku")
if (!proSku && Prefs.pro) playStoreNoLongerPro()
else if (proSku && !Prefs.pro) playStoreFoundPro()
helper.disposeWhenFinished()
IAB.dispose(helper)
}
} catch (e: Exception) {
L.e(e, "Play store validation exception")
IAB.dispose()
}
}

View File

@ -2,7 +2,8 @@
## Beta Updates
* Update IAB helper
* Implemented image viewing and downloading; long press any image!
* Create image viewing and downloading; long press any image!
* Start filtering out unnecessary loads
## v1.3
* Create toggle for notifications only from primary account

View File

@ -17,7 +17,7 @@ MIN_SDK=21
TARGET_SDK=26
BUILD_TOOLS=26.0.0
KAU=e6daff7
KAU=eddaded
KOTLIN=1.1.3-2
CRASHLYTICS=2.6.8
DBFLOW=4.0.4