From 793ffd663eae239f004492d7a4e83ba9f1697403 Mon Sep 17 00:00:00 2001 From: k0shk0sh Date: Sat, 11 Nov 2017 11:26:05 +0100 Subject: [PATCH] releasing 4.5.5 --- app/build.gradle | 11 +- app/src/main/java/com/fastaccess/App.java | 2 +- .../java/com/fastaccess/helper/Bundler.java | 40 +++- .../com/fastaccess/helper/PrefHelper.java | 3 +- .../provider/fabric/FabricProvider.java | 33 ---- .../provider/fabric/FabricProvider.kt | 41 ++++ .../provider/scheme/SchemeParser.java | 2 +- .../modules/main/donation/DonateActivity.kt | 14 +- .../main/donation/DonationActivity.java | 2 +- .../modules/main/premium/PremiumActivity.kt | 61 +++++- .../extras/license/RepoLicenseBottomSheet.kt | 3 +- .../issue/details/IssuePagerPresenter.java | 4 +- .../ui/modules/user/UserPagerActivity.java | 14 +- .../fastaccess/ui/widgets/FontTextView.java | 1 + .../prettifier/pretty/PrettifyWebView.java | 5 + app/src/main/res/drawable/ic_block.xml | 9 + .../layout/edit_repo_file_layout.xml | 184 ++++++++++-------- .../layout/pro_features_layout.xml | 3 + app/src/main/res/raw/changelog.html | 2 +- app/src/main/res/values/strings.xml | 3 +- build.gradle | 5 +- 21 files changed, 300 insertions(+), 142 deletions(-) delete mode 100644 app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.java create mode 100644 app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt create mode 100644 app/src/main/res/drawable/ic_block.xml diff --git a/app/build.gradle b/app/build.gradle index 35179eb3..ff32ad8c 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -29,8 +29,8 @@ android { applicationId "com.fastaccess.github" minSdkVersion 21 targetSdkVersion 26 - versionCode 453 - versionName "4.5.3" + versionCode 455 + versionName "4.5.5" buildConfigString "GITHUB_CLIENT_ID", (buildProperties.secrets['github_client_id'] | buildProperties.notThere['github_client_id']).string buildConfigString "GITHUB_SECRET", (buildProperties.secrets['github_secret'] | buildProperties.notThere['github_secret']).string buildConfigString "IMGUR_CLIENT_ID", (buildProperties.secrets['imgur_client_id'] | buildProperties.notThere['imgur_client_id']).string @@ -129,7 +129,7 @@ dependencies { implementation "com.squareup.retrofit2:retrofit:${retrofit}" implementation "com.squareup.retrofit2:converter-gson:${retrofit}" implementation "com.squareup.retrofit2:adapter-rxjava2:${retrofit}" - implementation "com.github.bumptech.glide:glide:3.7.0" + implementation "com.github.bumptech.glide:glide:${glideVersion}" implementation 'cn.gavinliu.android.lib:ShapedImageView:0.8.3' implementation "com.jakewharton:butterknife:${butterKnifeVersion}" implementation 'it.sephiroth.android.library.bottomnavigation:bottom-navigation:2.0.2' @@ -152,6 +152,7 @@ dependencies { implementation "com.atlassian.commonmark:commonmark-ext-gfm-tables:${commonmark}" implementation "com.atlassian.commonmark:commonmark-ext-ins:${commonmark}" implementation "com.atlassian.commonmark:commonmark-ext-yaml-front-matter:${commonmark}" + implementation "com.google.firebase:firebase-core:${gms}" implementation "com.google.firebase:firebase-messaging:${gms}" implementation "com.google.firebase:firebase-database:${gms}" implementation "com.google.android.gms:play-services-base:${gms}" @@ -182,8 +183,8 @@ dependencies { testImplementation "org.assertj:assertj-core:${assertjVersion}" androidTestImplementation "com.android.support:support-annotations:${supportVersion}" androidTestImplementation "org.mockito:mockito-core:${mockitoVersion}" - androidTestImplementation 'com.android.support.test:runner:0.5' - androidTestImplementation 'com.android.support.test:rules:0.5' + androidTestImplementation 'com.android.support.test:runner:1.0.1' + androidTestImplementation 'com.android.support.test:rules:1.0.1' androidTestImplementation "com.android.support.test.espresso:espresso-intents:${espresseVersion}" androidTestImplementation "com.android.support.test.espresso:espresso-core:${espresseVersion}" } diff --git a/app/src/main/java/com/fastaccess/App.java b/app/src/main/java/com/fastaccess/App.java index 5c3f8ab2..dcd6f6a2 100644 --- a/app/src/main/java/com/fastaccess/App.java +++ b/app/src/main/java/com/fastaccess/App.java @@ -43,7 +43,7 @@ public class App extends Application { } private void init() { - FabricProvider.initFabric(this); + FabricProvider.INSTANCE.initFabric(this); RxBillingService.register(this); deleteDatabase("database.db"); getDataStore(); diff --git a/app/src/main/java/com/fastaccess/helper/Bundler.java b/app/src/main/java/com/fastaccess/helper/Bundler.java index 72ed4021..0ceb5bb4 100644 --- a/app/src/main/java/com/fastaccess/helper/Bundler.java +++ b/app/src/main/java/com/fastaccess/helper/Bundler.java @@ -143,22 +143,42 @@ public class Bundler { } public Bundler put(@NonNull String key, Parcelable value) { - bundle.putParcelable(key, value); + Bundle safeBundle = new Bundle(); + safeBundle.putParcelable(key, value); + if (isValidBundleSize(safeBundle)) { + bundle.putParcelable(key, value); + } + clearBundle(safeBundle); return this; } public Bundler put(@NonNull String key, Parcelable[] value) { - bundle.putParcelableArray(key, value); + Bundle safeBundle = new Bundle(); + safeBundle.putParcelableArray(key, value); + if (isValidBundleSize(safeBundle)) { + bundle.putParcelableArray(key, value); + } + clearBundle(safeBundle); return this; } public Bundler putParcelableArrayList(@NonNull String key, ArrayList value) { - bundle.putParcelableArrayList(key, value); + Bundle safeBundle = new Bundle(); + safeBundle.putParcelableArrayList(key, value); + if (isValidBundleSize(safeBundle)) { + bundle.putParcelableArrayList(key, value); + } + clearBundle(safeBundle); return this; } public Bundler putSparseParcelableArray(@NonNull String key, SparseArray value) { - bundle.putSparseParcelableArray(key, value); + Bundle safeBundle = new Bundle(); + safeBundle.putSparseParcelableArray(key, value); + if (isValidBundleSize(safeBundle)) { + bundle.putSparseParcelableArray(key, value); + } + clearBundle(safeBundle); return this; } @@ -173,7 +193,12 @@ public class Bundler { } public Bundler put(@NonNull String key, Serializable value) { - bundle.putSerializable(key, value); + Bundle safeBundle = new Bundle(); + safeBundle.putSerializable(key, value); + if (isValidBundleSize(safeBundle)) { + bundle.putSerializable(key, value); + } + clearBundle(safeBundle); return this; } @@ -206,4 +231,9 @@ public class Bundler { return parcel.dataSize() < 500000; } + private void clearBundle(Bundle safeBundle) { + safeBundle.clear(); + safeBundle = null; + } + } diff --git a/app/src/main/java/com/fastaccess/helper/PrefHelper.java b/app/src/main/java/com/fastaccess/helper/PrefHelper.java index 02cd67f1..74eadf20 100644 --- a/app/src/main/java/com/fastaccess/helper/PrefHelper.java +++ b/app/src/main/java/com/fastaccess/helper/PrefHelper.java @@ -58,7 +58,8 @@ public class PrefHelper { } public static int getInt(@NonNull String key) { - return PreferenceManager.getDefaultSharedPreferences(App.getInstance()).getInt(key, 0); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(App.getInstance()); + return preferences.getAll().get(key) instanceof Integer ? preferences.getInt(key, 0) : -1; } public static long getLong(@NonNull String key) { diff --git a/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.java b/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.java deleted file mode 100644 index b69af0d7..00000000 --- a/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.fastaccess.provider.fabric; - -import android.content.Context; -import android.support.annotation.NonNull; - -import com.crashlytics.android.Crashlytics; -import com.crashlytics.android.answers.Answers; -import com.crashlytics.android.answers.PurchaseEvent; -import com.crashlytics.android.core.CrashlyticsCore; -import com.fastaccess.BuildConfig; - -import io.fabric.sdk.android.Fabric; - -/** - * Created by kosh on 14/08/2017. - */ - -public class FabricProvider { - - public static void initFabric(@NonNull Context context) { - Fabric fabric = new Fabric.Builder(context) - .kits(new Crashlytics.Builder() - .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) - .build()) - .debuggable(BuildConfig.DEBUG) - .build(); - Fabric.with(fabric); - } - - public static void logPurchase(@NonNull String productKey) { - Answers.getInstance().logPurchase(new PurchaseEvent().putItemName(productKey).putSuccess(true)); - } -} diff --git a/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt b/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt new file mode 100644 index 00000000..e98d4d57 --- /dev/null +++ b/app/src/main/java/com/fastaccess/provider/fabric/FabricProvider.kt @@ -0,0 +1,41 @@ +package com.fastaccess.provider.fabric + +import android.content.Context +import com.crashlytics.android.Crashlytics +import com.crashlytics.android.answers.Answers +import com.crashlytics.android.answers.PurchaseEvent +import com.crashlytics.android.core.CrashlyticsCore +import com.fastaccess.BuildConfig +import io.fabric.sdk.android.Fabric +import java.math.BigDecimal + +/** + * Created by kosh on 14/08/2017. + */ + +object FabricProvider { + + fun initFabric(context: Context) { + val fabric = Fabric.Builder(context) + .kits(Crashlytics.Builder() + .core(CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) + .build()) + .debuggable(BuildConfig.DEBUG) + .build() + Fabric.with(fabric) + } + + fun logPurchase(productKey: String, price: Long? = null, priceText: String? = null) { + val purchaseEvent = PurchaseEvent() + .putItemName(productKey) + .putSuccess(true) + + priceText?.let { + purchaseEvent.putItemType(priceText) + } + price?.let { + purchaseEvent.putItemPrice(BigDecimal(price)) + } + Answers.getInstance().logPurchase(purchaseEvent) + } +} diff --git a/app/src/main/java/com/fastaccess/provider/scheme/SchemeParser.java b/app/src/main/java/com/fastaccess/provider/scheme/SchemeParser.java index cc1e797c..555a4e74 100644 --- a/app/src/main/java/com/fastaccess/provider/scheme/SchemeParser.java +++ b/app/src/main/java/com/fastaccess/provider/scheme/SchemeParser.java @@ -276,7 +276,7 @@ public class SchemeParser { String owner = segments.get(0); String repoName = segments.get(1); if (!InputHelper.isEmpty(repoName)) { - repoName = repoName.replace(".git", ""); + if (repoName.endsWith(".git")) repoName = repoName.replace(".git", ""); } if (segments.size() == 3) { String lastPath = uri.getLastPathSegment(); diff --git a/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonateActivity.kt b/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonateActivity.kt index f46a2fb8..e475fd1a 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonateActivity.kt +++ b/app/src/main/java/com/fastaccess/ui/modules/main/donation/DonateActivity.kt @@ -40,12 +40,14 @@ class DonateActivity : BaseActivity(RxBillingService.getInstance(this, BuildConfig.DEBUG) .purchase(ProductType.IN_APP, productKey, "inapp:com.fastaccess.github:" + productKey)) .subscribe({ p: Purchase?, throwable: Throwable? -> if (throwable == null) { - FabricProvider.logPurchase(productKey) + FabricProvider.logPurchase(productKey, price, priceText) showMessage(R.string.success, R.string.success_purchase_message) enableProduct(productKey, applicationContext) val intent = Intent() @@ -77,18 +79,22 @@ class DonateActivity : BaseActivity(), Premi @BindView(R.id.progressLayout) lateinit var progressLayout: View @BindView(R.id.successActivationView) lateinit var successActivationView: LottieAnimationView @BindView(R.id.successActivationHolder) lateinit var successActivationHolder: View + @BindView(R.id.proPrice) lateinit var proPriceText: TextView + @BindView(R.id.enterprisePrice) lateinit var enterpriseText: TextView + @BindView(R.id.buyAll) lateinit var buyAll: Button + private var disposable: Disposable? = null + private val allFeaturesKey by lazy { getString(R.string.fasthub_all_features_purchase) } + private val enterpriseKey by lazy { getString(R.string.fasthub_enterprise_purchase) } + private val proKey by lazy { getString(R.string.fasthub_pro_purchase) } override fun layout(): Int = R.layout.pro_features_layout @@ -45,17 +56,20 @@ class PremiumActivity : BaseActivity(), Premi @OnClick(R.id.buyAll) fun onBuyAll() { if (!isGoogleSupported()) return - DonateActivity.Companion.start(this, getString(R.string.fasthub_all_features_purchase)) + val price = buyAll.tag as? Long? + DonateActivity.Companion.start(this, allFeaturesKey, price, buyAll.text.toString()) } @OnClick(R.id.buyPro) fun onBuyPro() { if (!isGoogleSupported()) return - DonateActivity.Companion.start(this, getString(R.string.fasthub_pro_purchase)) + val price = proPriceText.tag as? Long? + DonateActivity.Companion.start(this, proKey, price, proPriceText.text.toString()) } @OnClick(R.id.buyEnterprise) fun onBuyEnterprise() { if (!isGoogleSupported()) return - DonateActivity.Companion.start(this, getString(R.string.fasthub_enterprise_purchase)) + val price = enterpriseText.tag as? Long? + DonateActivity.Companion.start(this, enterpriseKey, price, enterpriseText.text.toString()) } @OnClick(R.id.unlock) fun onUnlock() { @@ -80,6 +94,32 @@ class PremiumActivity : BaseActivity(), Premi @OnClick(R.id.close) fun onClose() = finish() + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + buyAll.text = getString(R.string.purchase_all).replace("%price%", "$7.99") + RxHelper.getObservable(RxBillingService.getInstance(this, BuildConfig.DEBUG) + .getSkuDetails(ProductType.IN_APP, arrayListOf(enterpriseKey, proKey, allFeaturesKey)) + .toObservable()) + .flatMap { Observable.fromIterable(it) } + .subscribe({ + Logger.e(it.sku(), it.price(), it.priceCurrencyCode(), it.priceAmountMicros()) + when (it.sku()) { + enterpriseKey -> { + enterpriseText.text = it.price() + enterpriseText.tag = it.priceAmountMicros() + } + proKey -> { + proPriceText.text = it.price() + proPriceText.tag = it.priceAmountMicros() + } + allFeaturesKey -> { + buyAll.text = getString(R.string.purchase_all).replace("%price%", it.price()) + buyAll.tag = it.priceAmountMicros() + } + } + }, { t -> t.printStackTrace() }) + } + override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (resultCode == Activity.RESULT_OK) { @@ -94,6 +134,7 @@ class PremiumActivity : BaseActivity(), Premi } override fun onSuccessfullyActivated() { + ViewHelper.hideKeyboard(editText) hideProgress() successActivationHolder.visibility = View.VISIBLE FabricProvider.logPurchase(InputHelper.toString(editText)) @@ -127,6 +168,12 @@ class PremiumActivity : BaseActivity(), Premi progressLayout.visibility = View.GONE } + override fun onDestroy() { + val disposable = disposable + if (disposable != null && !disposable.isDisposed) disposable.dispose() + super.onDestroy() + } + private fun isGoogleSupported(): Boolean { if (AppHelper.isGoogleAvailable(this)) { return true diff --git a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseBottomSheet.kt b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseBottomSheet.kt index e2544c5c..ddd7ed9d 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseBottomSheet.kt +++ b/app/src/main/java/com/fastaccess/ui/modules/repos/extras/license/RepoLicenseBottomSheet.kt @@ -27,7 +27,7 @@ class RepoLicenseBottomSheet : BaseMvpBottomSheetDialogFragment implements I } private void getIssueFromApi() { + Login loginUser = Login.getUser(); + if (loginUser == null) return; makeRestCall(RxHelper.getObservable(Observable.zip(RestProvider.getIssueService(isEnterprise()).getIssue(login, repoId, issueNumber), - RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, Login.getUser().getLogin()), + RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, loginUser.getLogin()), (issue, booleanResponse) -> { isCollaborator = booleanResponse.code() == 204; return issue; diff --git a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerActivity.java b/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerActivity.java index e9842cf2..d068cf18 100644 --- a/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerActivity.java +++ b/app/src/main/java/com/fastaccess/ui/modules/user/UserPagerActivity.java @@ -33,7 +33,6 @@ import com.fastaccess.ui.base.BaseFragment; import com.fastaccess.ui.modules.main.MainActivity; import com.fastaccess.ui.modules.profile.org.repos.OrgReposFragment; import com.fastaccess.ui.modules.profile.repos.ProfileReposFragment; -import com.fastaccess.ui.modules.search.SearchUserActivity; import com.fastaccess.ui.widgets.SpannableBuilder; import com.fastaccess.ui.widgets.ViewPagerView; @@ -258,6 +257,19 @@ public class UserPagerActivity extends BaseActivity + + diff --git a/app/src/main/res/layouts/main_layouts/layout/edit_repo_file_layout.xml b/app/src/main/res/layouts/main_layouts/layout/edit_repo_file_layout.xml index 7b8e8bcd..64bb5eb2 100644 --- a/app/src/main/res/layouts/main_layouts/layout/edit_repo_file_layout.xml +++ b/app/src/main/res/layouts/main_layouts/layout/edit_repo_file_layout.xml @@ -7,106 +7,136 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/window_background" + android:focusableInTouchMode="true" android:orientation="vertical"> - + android:layout_height="match_parent"> - + android:elevation="0dp" + android:stateListAnimator="@null" + android:theme="?android:toolbarStyle" + app:elevation="0dp"> - + android:orientation="vertical" + app:layout_scrollFlags="scroll|enterAlways"> - - + - + - + - + + - - + - + + + + + + + + + + android:layout_height="match_parent" + android:orientation="vertical" + app:layout_behavior="@string/scroll_behavior"> - + android:layout_height="?actionBarSize" + android:background="?card_background" + android:elevation="2dp" + android:orientation="horizontal" + android:outlineProvider="background"/> + + + + + + + + + - - - - - - + \ No newline at end of file diff --git a/app/src/main/res/layouts/main_layouts/layout/pro_features_layout.xml b/app/src/main/res/layouts/main_layouts/layout/pro_features_layout.xml index 03f16f36..8b12e31f 100644 --- a/app/src/main/res/layouts/main_layouts/layout/pro_features_layout.xml +++ b/app/src/main/res/layouts/main_layouts/layout/pro_features_layout.xml @@ -6,6 +6,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + android:focusableInTouchMode="true" android:orientation="vertical">

FastHub changelog

-

Version 4.5.3 +

Version 4.5.5

Please report the issues in FastHub repo instead, by opening the Drawer Menu and clicking on “Report an Issue” diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 566ead26..615644a8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -120,7 +120,7 @@

]]> - Purchase All for ($ 7.99) + Purchase All for %price% Unlock Unlock Everything Feeds @@ -616,4 +616,5 @@ Disable Loading Image Disable loading image while on data plan This issue will be submitted to FastHub\'s repo in GitHub + Block \ No newline at end of file diff --git a/build.gradle b/build.gradle index a59c5ff9..2ab38304 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ buildscript { ext { butterKnifeVersion = '8.5.1' - state_version = '1.1.0' + state_version = '1.1.6' lombokVersion = '1.16.18' supportVersion = "26.1.0" gms = "11.4.2" @@ -15,6 +15,7 @@ buildscript { requery = '1.3.2' kotlin_version = '1.1.51' commonmark = '0.10.0' + glideVersion = '3.7.0' } repositories { google() @@ -22,7 +23,7 @@ buildscript { maven { url 'https://maven.fabric.io/public' } } dependencies { - classpath 'com.android.tools.build:gradle:3.1.0-alpha02' + classpath 'com.android.tools.build:gradle:3.1.0-alpha03' classpath 'com.google.gms:google-services:3.0.0' classpath 'com.novoda:gradle-build-properties-plugin:0.3' classpath 'com.dicedmelon.gradle:jacoco-android:0.1.2'