aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/build.gradle30
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt9
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt27
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt18
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt4
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt2
11 files changed, 71 insertions, 39 deletions
diff --git a/app/build.gradle b/app/build.gradle
index b64e5a74..6c4f05bf 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,3 +1,6 @@
+import org.eclipse.jgit.api.Git
+import org.eclipse.jgit.storage.file.FileRepositoryBuilder
+
plugins {
id 'com.gladed.androidgitversion' version '0.3.4'
}
@@ -6,16 +9,24 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
+apply plugin: 'com.github.triplet.play'
android {
compileSdkVersion Integer.parseInt(project.TARGET_SDK)
buildToolsVersion project.BUILD_TOOLS
androidGitVersion {
- codeFormat = 'MMNNPP'
+// baseCode ext.commitCount()
+ codeFormat = 'MMNNPPP'
prefix 'v'
}
+ playAccountConfigs {
+ defaultAccountConfig {
+ jsonFile = file('./files/gplay-keys.json')
+ }
+ }
+
defaultConfig {
applicationId "${project.APP_GROUP}." + project.APP_ID.toLowerCase()
minSdkVersion Integer.parseInt(project.MIN_SDK)
@@ -34,6 +45,17 @@ android {
}
signingConfigs {
+
+ def releaseProps = new Properties()
+ file("../files/play.properties").withInputStream { releaseProps.load(it) }
+
+ release {
+ storeFile file("../files/play.keystore")
+ storePassword releaseProps.getProperty('storePassword')
+ keyAlias releaseProps.getProperty('keyAlias')
+ keyPassword releaseProps.getProperty('keyPassword')
+ }
+
test {
storeFile file("../files/test.keystore")
storePassword "testkey"
@@ -65,6 +87,7 @@ android {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ signingConfig signingConfigs.release
resValue "string", "app_name", "Frost"
resValue "string", "frost_web", "Frost Web"
}
@@ -133,4 +156,9 @@ dependencies {
compile("com.crashlytics.sdk.android:crashlytics:${CRASHLYTICS}@aar") {
transitive = true;
}
+
+}
+
+play {
+ track = 'alpha'
} \ No newline at end of file
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index f2fb9c29..b8d47027 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -43,7 +43,6 @@ import com.pitchedapps.frost.facebook.FbTab
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
import com.pitchedapps.frost.fragments.WebFragment
import com.pitchedapps.frost.utils.*
-import com.pitchedapps.frost.utils.iab.IAB
import com.pitchedapps.frost.utils.iab.validatePro
import com.pitchedapps.frost.views.BadgedIcon
import com.pitchedapps.frost.web.FrostWebViewSearch
@@ -395,6 +394,14 @@ class MainActivity : BaseActivity(), FrostWebViewSearch.SearchContract {
FbCookie.switchBackUser { }
}
+ override fun onStart() {
+ //validate some pro features
+ if (!Prefs.pro) {
+ if (Prefs.theme == Theme.CUSTOM.ordinal) Prefs.theme = Theme.DEFAULT.ordinal
+ }
+ super.onStart()
+ }
+
override fun onBackPressed() {
if (searchView?.onBackPressed() ?: false) return
if (currentFragment.onBackPressed()) return
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
index bf100895..e67fc949 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
@@ -69,7 +69,7 @@ class SettingsActivity : KPrefActivity(), IabBroadcastReceiver.IabBroadcastListe
}
plainText(R.string.restore_purchases) {
- descRes = R.string.restore_purchases
+ descRes = R.string.restore_purchases_desc
iicon = GoogleMaterial.Icon.gmd_refresh
onClick = { _, _, _ -> this@SettingsActivity.restorePurchases(); true }
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
index bd8b58ab..b76925f5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt
@@ -6,7 +6,7 @@ import android.support.v4.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import ca.allanwang.kau.utils.withBundle
+import ca.allanwang.kau.utils.withArguments
import com.pitchedapps.frost.MainActivity
import com.pitchedapps.frost.facebook.FbTab
import com.pitchedapps.frost.facebook.FeedSort
@@ -28,19 +28,18 @@ class WebFragment : Fragment() {
private const val ARG_URL_ENUM = "arg_url_enum"
private const val ARG_POSITION = "arg_position"
- operator fun invoke(data: FbTab, position: Int) = WebFragment().withBundle {
- putString(ARG_URL, data.url)
- putInt(ARG_POSITION, position)
- putSerializable(ARG_URL_ENUM, when (data) {
- //If is feed, check if sorting method is specified
- FbTab.FEED -> when (FeedSort(Prefs.feedSort)) {
- FeedSort.DEFAULT -> data
- FeedSort.MOST_RECENT -> FbTab.FEED_MOST_RECENT
- FeedSort.TOP -> FbTab.FEED_TOP_STORIES
- }
- else -> data
- })
- }
+ operator fun invoke(data: FbTab, position: Int) = WebFragment().withArguments(
+ ARG_URL to data.url,
+ ARG_POSITION to position,
+ ARG_URL_ENUM to when (data) {
+ //If is feed, check if sorting method is specified
+ FbTab.FEED -> when (FeedSort(Prefs.feedSort)) {
+ FeedSort.DEFAULT -> data
+ FeedSort.MOST_RECENT -> FbTab.FEED_MOST_RECENT
+ FeedSort.TOP -> FbTab.FEED_TOP_STORIES
+ }
+ else -> data
+ })
}
// val refresh: SwipeRefreshLayout by lazy { frostWebView.refresh }
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
index d25e0939..135e621f 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/settings/Appearance.kt
@@ -85,7 +85,7 @@ fun SettingsActivity.getAppearancePrefs(): KPrefAdapterBuilder.() -> Unit = {
colorPicker(R.string.header_color, { Prefs.customHeaderColor }, {
Prefs.customHeaderColor = it
- if (Prefs.tintNavBar) frostNavigationBar()
+ frostNavigationBar()
toolbarCanvas.ripple(it, RippleCanvas.MIDDLE, RippleCanvas.END, duration = 500L)
reload()
shouldRestartMain()
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
index f8060d9d..5f0bdc41 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Prefs.kt
@@ -89,8 +89,10 @@ object Prefs : KPref() {
/**
* Cache like value to determine if user has or had pro
* In most cases, [com.pitchedapps.frost.utils.iab.IS_FROST_PRO] should be looked at instead
+ * This has been renamed to pro for short, but keep in mind that it only reflects the value
+ * of when it was previously verified
*/
- var previouslyPro: Boolean by kpref("previously_pro", false)
+ var pro: Boolean by kpref("previously_pro", false)
var debugPro: Boolean by kpref("debug_pro", false)
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 6a99021d..b255c59c 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Utils.kt
@@ -106,7 +106,7 @@ fun Activity.setFrostTheme(forceTransparent: Boolean = false) {
fun Activity.setFrostColors(toolbar: Toolbar? = null, themeWindow: Boolean = true,
texts: Array<TextView> = arrayOf(), headers: Array<View> = arrayOf(), backgrounds: Array<View> = arrayOf()) {
statusBarColor = Prefs.headerColor.darken(0.1f).withAlpha(255)
- navigationBarColor = Prefs.headerColor
+ if (Prefs.tintNavBar) navigationBarColor = Prefs.headerColor
if (themeWindow) window.setBackgroundDrawable(ColorDrawable(Prefs.bgColor))
toolbar?.setBackgroundColor(Prefs.headerColor)
toolbar?.setTitleTextColor(Prefs.iconColor)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
index d511f773..b4f8af64 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IAB.kt
@@ -86,7 +86,7 @@ object IAB {
private const val FROST_PRO = "frost_pro"
val IS_FROST_PRO: Boolean
- get() = (BuildConfig.DEBUG && Prefs.debugPro) || Prefs.previouslyPro
+ get() = (BuildConfig.DEBUG && Prefs.debugPro) || Prefs.pro
private val Context.isFrostPlay: Boolean
get() = isFromGooglePlay || BuildConfig.DEBUG
@@ -99,15 +99,15 @@ fun SettingsActivity.restorePurchases() {
}
//called if inventory is not properly retrieved
val reset = {
- if (Prefs.previouslyPro) {
- Prefs.previouslyPro = false
+ if (Prefs.pro) {
+ Prefs.pro = false
Prefs.theme = Theme.DEFAULT.ordinal
}
finishRestore(restore)
}
getInventory(false, true, reset) {
val proSku = it.getSkuDetails(FROST_PRO)
- Prefs.previouslyPro = proSku != null
+ Prefs.pro = proSku != null
finishRestore(restore)
}
}
@@ -116,7 +116,7 @@ private fun SettingsActivity.finishRestore(snackbar: Snackbar?) {
snackbar?.dismiss()
materialDialogThemed {
title(R.string.purchases_restored)
- content(if (Prefs.previouslyPro) R.string.purchases_restored_with_pro else R.string.purchases_restored_without_pro)
+ content(if (Prefs.pro) R.string.purchases_restored_with_pro else R.string.purchases_restored_without_pro)
positiveText(R.string.reload)
dismissListener { adapter.notifyAdapterDataSetChanged() }
}
@@ -126,10 +126,10 @@ private fun SettingsActivity.finishRestore(snackbar: Snackbar?) {
* If user has pro, check if it's valid and destroy the helper
*/
fun Activity.validatePro() {
- getInventory(Prefs.previouslyPro, true, { if (Prefs.previouslyPro) playStoreNoLongerPro() }) {
+ getInventory(Prefs.pro, true, { if (Prefs.pro) playStoreNoLongerPro() }) {
val proSku = it.getSkuDetails(FROST_PRO)
- if (proSku == null && Prefs.previouslyPro) playStoreNoLongerPro()
- else if (proSku != null && !Prefs.previouslyPro) playStoreFoundPro()
+ if (proSku == null && Prefs.pro) playStoreNoLongerPro()
+ else if (proSku != null && !Prefs.pro) playStoreFoundPro()
}
}
@@ -153,7 +153,7 @@ fun Activity.openPlayProPurchase(code: Int) {
if (!IS_FROST_PRO)
playStoreProNotAvailable()
else openPlayPurchase(FROST_PRO, code) {
- Prefs.previouslyPro = true
+ Prefs.pro = true
}
}
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt
index 54355d3e..58c21be4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/iab/IABDialogs.kt
@@ -30,7 +30,7 @@ private fun Activity.playRestart() {
fun Activity.playStoreNoLongerPro() {
- Prefs.previouslyPro = false
+ Prefs.pro = false
playStoreLog("No Longer Pro")
materialDialogThemed {
title(R.string.uh_oh)
@@ -43,7 +43,7 @@ fun Activity.playStoreNoLongerPro() {
}
fun Activity.playStoreFoundPro() {
- Prefs.previouslyPro = true
+ Prefs.pro = true
L.d("Found pro")
materialDialogThemed {
title(R.string.found_pro)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
index f12212ed..709ab7ac 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt
@@ -2,9 +2,7 @@ package com.pitchedapps.frost.web
import android.content.Context
import android.graphics.Bitmap
-import android.view.KeyEvent
import android.webkit.WebResourceRequest
-import android.webkit.WebResourceResponse
import android.webkit.WebView
import android.webkit.WebViewClient
import com.pitchedapps.frost.LoginActivity
@@ -52,8 +50,8 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : WebViewClient() {
}
view.jsInject(JsActions.LOGIN_CHECK,
CssAssets.ROUND_ICONS.maybe(Prefs.showRoundedIcons),
- CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends),
- CssHider.ADS.maybe(!Prefs.showFacebookAds),
+ CssHider.PEOPLE_YOU_MAY_KNOW.maybe(!Prefs.showSuggestedFriends && Prefs.pro),
+ CssHider.ADS.maybe(!Prefs.showFacebookAds && Prefs.pro),
JsAssets.HEADER_BADGES.maybe(webCore.baseEnum != null))
onPageFinishedActions(url)
}
@@ -67,9 +65,7 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : WebViewClient() {
webCore.jsInject(CssHider.HEADER,
Prefs.themeInjector,
JsAssets.CLICK_A.maybe(webCore.baseEnum != null),
- callback = {
- refreshObservable.onNext(false)
- })
+ callback = { refreshObservable.onNext(false) })
}
open fun handleHtml(html: String) {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
index b953e092..c2a53837 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewCore.kt
@@ -44,7 +44,7 @@ class FrostWebViewCore @JvmOverloads constructor(
var baseUrl: String? = null
- var baseEnum: FbTab? = null
+ var baseEnum: FbTab? = null //only viewpager items should pass the base enum
internal var frostWebClient: FrostWebViewClient? = null
init {