Skip to content

Commit

Permalink
Merge pull request #2 from imprakharshukla/dev
Browse files Browse the repository at this point in the history
version 3.0 (16)
  • Loading branch information
imprakharshukla authored Aug 10, 2022
2 parents 878a6b1 + 58e24fa commit 9acb4ce
Show file tree
Hide file tree
Showing 11 changed files with 2,143 additions and 44 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ android {
applicationId "com.techriz.andronix.donation"
minSdk 24
targetSdk 31
versionCode 14
versionCode 16
versionName "3.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -66,7 +66,7 @@ dependencies {
implementation 'com.google.firebase:firebase-analytics-ktx'

implementation 'com.firebaseui:firebase-ui-auth:7.2.0'
implementation 'com.google.android.gms:play-services-auth:19.2.0'
implementation 'com.google.android.gms:play-services-auth:20.2.0'
implementation "com.google.android.play:core-ktx:1.8.1"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-play-services:1.3.5'

Expand Down
1 change: 1 addition & 0 deletions app/src/main/assets/done-payment-lottie.json

Large diffs are not rendered by default.

2,074 changes: 2,074 additions & 0 deletions app/src/main/assets/error-payment-lottie.json

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion app/src/main/assets/pay_failed.json

This file was deleted.

1 change: 0 additions & 1 deletion app/src/main/assets/thank_you.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,31 @@ class BillingRepository @Inject constructor(
}


private fun consumePurchase(purchase: Purchase) {
suspend fun consumePurchase(purchase: Purchase) {
val consumeParams = ConsumeParams.newBuilder()
.setPurchaseToken(purchase.purchaseToken)
.build()
//
// billingClient.consumeAsync(consumeParams) { billingResult, _ ->
// if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
// "Purchase consumed".log()
// _purchaseState.value = PurchaseStateClass.Consumed
// }
// }

val consumeResult = withContext(Dispatchers.IO) {
billingClient.consumePurchase(consumeParams)
}

billingClient.consumeAsync(consumeParams) { billingResult, _ ->
if (billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
"Purchase consumed".log()
_purchaseState.value = PurchaseStateClass.Consumed
if (consumeResult.billingResult.responseCode == BillingClient.BillingResponseCode.OK) {
"Purchase ${purchase.orderId} has been consumed!".log()
_purchaseState.value = PurchaseStateClass.Consumed
} else {
consumeResult.billingResult.apply {
"There was an error consuming the purchase ${purchase.orderId} with error code ${responseCode} and ${debugMessage}".log()
_purchaseState.value = PurchaseStateClass.Error(
"The app was not able to acknowledge the purchase. Please try again."
)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.techriz.andronix.donation.ui.fragments.commerce

import android.app.Dialog
import android.os.Bundle
import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
Expand Down Expand Up @@ -43,6 +44,7 @@ class PayFragment : Fragment(R.layout.pay_fragment) {
private lateinit var binding: PayFragmentBinding

private val viewModel: PayViewModel by viewModels()
private var dialog: RoundedBottomSheetDialog? = null
private lateinit var billingJob: Job


Expand Down Expand Up @@ -204,40 +206,44 @@ class PayFragment : Fragment(R.layout.pay_fragment) {
private fun showPostPurchaseDialog(isSuccessful: Boolean, error: String = "") {
if (isSuccessful) {
val binding = PurchaseSuccessDialogBinding.inflate(layoutInflater)
val dialog = RoundedBottomSheetDialog(requireContext())
dialog.setContentView(binding.root)
binding.close.setOnClickListener {
dialog.dismiss()
}
binding.successSupportText.text =
viewModel.getSupportSpannableTextSuccess(requireContext().getString(R.string.purchase_successful)) {
ActionUtils.launchSendEmailIntent(
"Purchase Support",
"",
requireContext(),
arrayOf(ANDRONIX_SUPPORT_EMAIL)
)
dialog = RoundedBottomSheetDialog(requireContext())
if (dialog != null) {
dialog!!.setContentView(binding.root)
binding.close.setOnClickListener {
dialog!!.dismiss()
}
binding.close.setOnClickListener { dialog.dismiss() }
dialog.show()
} else {
val binding = PurchaseFailedDialogBinding.inflate(layoutInflater)
val dialog = RoundedBottomSheetDialog(requireContext())
dialog.setContentView(binding.root)
binding.close.setOnClickListener {
dialog.dismiss()
binding.successSupportText.text =
viewModel.getSupportSpannableTextSuccess(requireContext().getString(R.string.purchase_successful)) {
ActionUtils.launchSendEmailIntent(
"Purchase Support",
"",
requireContext(),
arrayOf(ANDRONIX_SUPPORT_EMAIL)
)
}
binding.close.setOnClickListener { dialog!!.dismiss() }
dialog!!.show()
}
binding.failedSupportText.text =
viewModel.getSupportSpannableTextFailed(requireContext().getString(R.string.payment_failed)) {
ActionUtils.launchSendEmailIntent(
"Purchase Support",
"Error - $error \n\n Please add your message below this. \n\n",
requireContext(),
arrayOf(ANDRONIX_SUPPORT_EMAIL)
)
} else {
if (dialog != null) {
val binding = PurchaseFailedDialogBinding.inflate(layoutInflater)
dialog = RoundedBottomSheetDialog(requireContext())
dialog!!.setContentView(binding.root)
binding.close.setOnClickListener {
dialog!!.dismiss()
}
binding.close.setOnClickListener { dialog.dismiss() }
dialog.show()
binding.failedSupportText.text =
viewModel.getSupportSpannableTextFailed(requireContext().getString(R.string.payment_failed)) {
ActionUtils.launchSendEmailIntent(
"Purchase Support",
"Error - $error \n\n Please add your message below this. \n\n",
requireContext(),
arrayOf(ANDRONIX_SUPPORT_EMAIL)
)
}
binding.close.setOnClickListener { dialog!!.dismiss() }
dialog!!.show()
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/purchase_failed_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
android:layout_marginBottom="25dp"
android:visibility="visible"
app:lottie_autoPlay="true"
app:lottie_fileName="pay_failed.json" />
app:lottie_fileName="error-payment-lottie.json"
app:lottie_loop="false"
app:lottie_speed="0.5" />

<TextView
android:layout_width="match_parent"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/purchase_success_dialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
android:layout_marginBottom="25dp"
android:visibility="visible"
app:lottie_autoPlay="true"
app:lottie_fileName="thank_you.json" />
app:lottie_fileName="done-payment-lottie.json"
app:lottie_loop="false"
app:lottie_speed="0.5" />

<TextView
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<string name="andronix_is_now_a_complete_linux_on_android_utility_we_have_all_the_main_stream_distros_and_well_as_many_great_features_such_as_abliliy_to_save_your_commands_so_that_you_don_t_forget_them_again_sync_them_to_the_cloud_and_access_them_on_any_device_with_an_intenet_connection_we_now_also_have_a_webapp_for_the_same_purpose_from_downloading_offline_to_priority_support_our_premium_features_are_unmatched_in_the_whole_android_market">Andronix is now a complete Linux on Android utility. We have all the mainstream distributions and many great features, such as the ability to save your commands so that you don\'t forget them again. Sync them to the cloud and access them on any device with an internet connection. We now also have a web app for the same purpose. From downloading offline to priority support, our premium features are unmatched in the whole android market.</string>

<string name="all_the_logos_and_trademarks_used_in_the_app_are_the_are_the_properties_of_their_respective_owners">All the logos and trademarks used in the app are the properties of their respective owners</string>
<string name="warning_text_dashboard">This is the donations app for Andronix and not the acutal Andronix App to install Linux distributions. Please install the actual app here.</string>
<string name="warning_text_dashboard">This is the donations app for Andronix and not the actual Andronix App to install Linux distributions. Please install the actual app here.</string>
<string name="title_activity_splash">SplashActivity</string>
<!-- Strings used for fragments for navigation -->
<string name="first_fragment_label">First Fragment</string>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
classpath "com.android.tools.build:gradle:7.0.2"
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.google.gms:google-services:4.3.13'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand Down

0 comments on commit 9acb4ce

Please sign in to comment.