diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
6 files changed, 34 insertions, 10 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt index 4fabf8b8..1b714ddb 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/FrostApp.kt @@ -15,6 +15,7 @@ import com.crashlytics.android.answers.Answers import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader import com.mikepenz.materialdrawer.util.DrawerImageLoader import com.pitchedapps.frost.facebook.FbCookie +import com.pitchedapps.frost.services.scheduleNotifications import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.Showcase @@ -48,6 +49,7 @@ class FrostApp : Application() { KL.debug(BuildConfig.DEBUG) L.debug(BuildConfig.DEBUG) Prefs.verboseLogging = false + L.i("Begin Frost for Facebook") FbCookie() if (Prefs.installDate == -1L) Prefs.installDate = System.currentTimeMillis() if (Prefs.identifier == -1) Prefs.identifier = Random().nextInt(Int.MAX_VALUE) @@ -55,6 +57,8 @@ class FrostApp : Application() { super.onCreate() + applicationContext.scheduleNotifications(Prefs.notificationFreq) + /** * Drawer profile loading logic * Reload the image on every version update diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt index 32f7c793..2893afeb 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt @@ -48,7 +48,6 @@ import com.pitchedapps.frost.contracts.FileChooserContract import com.pitchedapps.frost.contracts.FileChooserDelegate import com.pitchedapps.frost.dbflow.loadFbCookie import com.pitchedapps.frost.dbflow.loadFbTabs -import com.pitchedapps.frost.enums.OverlayContext import com.pitchedapps.frost.enums.Theme import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbCookie.switchUser @@ -126,6 +125,17 @@ class MainActivity : BaseActivity(), SearchWebView.SearchContract, "Build type" to BuildConfig.BUILD_TYPE, "Frost id" to Prefs.frostId) } + if (!Showcase.shownRelease && Prefs.installDate < 1503201600000L) {//08/20/2017 + materialDialogThemed { + title("The time has come!") + content("Frost for Facebook has been officially released. We thank you immensely for being with us from the start, and for allowing us to grow to what we are now." + + "\nYou are now free to opt out of beta and get monthly stable updates, or stick with the beta channel and help squash bugs. It will also be amazing if you can give us a rating, and help others find this great open source alternative." + + "\n\nRegards,\nAllan Wang") + neutralText(R.string.kau_rate) + onNeutral { _, _ -> startPlayStoreLink(R.string.play_store_package_id) } + positiveText(R.string.kau_great) + } + } } setContentView(Prefs.mainActivityLayout.layoutRes) setSupportActionBar(toolbar) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt index aa8b87de..a237e3f5 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt @@ -117,7 +117,7 @@ open class WebOverlayActivityBase(private val forceBasicAgent: Boolean) : KauBas override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (urlTest == null) { - L.eThrow("Empty link on web overlay") + L.e("Empty link on web overlay") toast(R.string.null_url_overlay) finish() return diff --git a/app/src/main/kotlin/com/pitchedapps/frost/enums/Support.kt b/app/src/main/kotlin/com/pitchedapps/frost/enums/Support.kt index 85c8bc76..a624e429 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/enums/Support.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/enums/Support.kt @@ -6,6 +6,7 @@ import ca.allanwang.kau.email.sendEmail import ca.allanwang.kau.utils.string import com.pitchedapps.frost.R import com.pitchedapps.frost.utils.Prefs +import com.pitchedapps.frost.utils.iab.IS_FROST_PRO /** * Created by Allan Wang on 2017-06-29. @@ -19,7 +20,8 @@ enum class Support(@StringRes val title: Int) { fun sendEmail(context: Context) { with(context) { this.sendEmail(string(R.string.dev_email), "${string(R.string.frost_prefix)} ${string(title)}") { - addItem("Random Frost ID", Prefs.frostId) + val proTag = if (IS_FROST_PRO) "TY" else "FP" + addItem("Random Frost ID", "${Prefs.frostId}-$proTag") } } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt index b3601dfb..bed42ebc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Showcase.kt @@ -18,5 +18,7 @@ object Showcase : KPref() { //not a showcase but cannot be in the same file as Prefs var experimentalDefault: Boolean by kpref("experimental_by_default", false) + + val shownRelease: Boolean by kprefSingle("shown_release") } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt index 16d9f4bf..d45c2cf6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/SearchWebView.kt @@ -11,6 +11,7 @@ import com.pitchedapps.frost.facebook.USER_AGENT_BASIC import com.pitchedapps.frost.injectors.JsAssets import com.pitchedapps.frost.injectors.JsBuilder import com.pitchedapps.frost.utils.L +import io.reactivex.rxkotlin.subscribeBy import io.reactivex.schedulers.Schedulers import io.reactivex.subjects.PublishSubject import org.jetbrains.anko.runOnUiThread @@ -71,13 +72,18 @@ class SearchWebView(context: Context, val contract: SearchContract) : WebView(co } .filter { it.isNotEmpty() } .filter { Pair(it.last().second, it.size) != previousResult } - .subscribe { content: List<Pair<List<String>, String>> -> - saveResultFrame(content) - L.d("Search element count ${content.size}") - contract.emitSearchResponse(content.map { (texts, href) -> - SearchItem(href, texts[0], texts.getOrNull(1)) - }) - } + .subscribeBy( + onNext = { content: List<Pair<List<String>, String>> -> + saveResultFrame(content) + L.d("Search element count ${content.size}") + contract.emitSearchResponse(content.map { (texts, href) -> + SearchItem(href, texts[0], texts.getOrNull(1)) + }) + }, + onError = { throwable -> + L.e(throwable, "SearchSubject error") + } + ) reload() } |