Skip to content

Commit

Permalink
Version 1.0.0.8
Browse files Browse the repository at this point in the history
Build 8
  • Loading branch information
DeveshRx authored Sep 7, 2023
2 parents 6ca0898 + 2a39ab9 commit c0c1a7e
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 17 deletions.
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ plugins {
}


def AppVersionCode = 7
def AppVersionName = "1.0.0.7"
def AppVersionCode = 8
def AppVersionName = "1.0.0.8"

android {
compileSdk project.CompileSDK
Expand Down Expand Up @@ -80,6 +80,7 @@ android {
signingConfig signingConfigs.release
minifyEnabled true
shrinkResources true
// debuggable true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'

firebaseAppDistribution {
Expand Down Expand Up @@ -197,7 +198,7 @@ dependencies {

// def billing_version = "5.2.0"
def billing_version = "6.0.1"
implementation "com.android.billingclient:billing:$billing_version"
implementation "com.android.billingclient:billing:$project.billing_version"
implementation "com.google.android.gms:play-services-base:$project.play_services_base"

implementation 'com.google.android.ump:user-messaging-platform:2.1.0'
Expand Down
7 changes: 6 additions & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@
# Modify this rule to fit the structure of your app.
-keepclassmembers class devesh.app.ocr.** {
*;
}
}

-keepclassmembers class com.android.billingclient.api.** {
*;
}

2 changes: 1 addition & 1 deletion billing/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

def billing_version = "6.0.1"
api "com.android.billingclient:billing:$billing_version"
api "com.android.billingclient:billing:$project.billing_version"
api "com.google.android.gms:play-services-base:$project.play_services_base"

}
6 changes: 5 additions & 1 deletion billing/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

-keepclassmembers class com.android.billingclient.api.** {
*;
}
46 changes: 38 additions & 8 deletions billing/src/main/java/devesh/app/billing/BillingActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,32 +82,56 @@ protected void onStart() {
gPlayBilling.init(new BillingClientStateListener() {
@Override
public void onBillingServiceDisconnected() {

Log.d(TAG, "onBillingServiceDisconnected: ");
}

@Override
public void onBillingSetupFinished(@NonNull BillingResult billingResult) {
Log.d(TAG, "onBillingSetupFinished: getResponseCode() "+billingResult.getResponseCode());
if (billingResult.getResponseCode() == BillingClient.BillingResponseCode.OK) {
// The BillingClient is ready. You can query purchases here.
Log.d(TAG, "onBillingSetupFinished: ");
Log.d(TAG, "onBillingSetupFinished: OK");
getProducts();
fetchOwnedPlans();
}else{
Log.d(TAG, "onBillingSetupFinished: NOT OK");
String errorMessage="Error";

if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.BILLING_UNAVAILABLE){
errorMessage="BILLING UNAVAILABLE";
}else if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.USER_CANCELED){
errorMessage="USER CANCELED";
}else if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.ERROR){
errorMessage="ERROR";
}
else if(billingResult.getResponseCode() == BillingClient.BillingResponseCode.DEVELOPER_ERROR){
errorMessage="DEVELOPER_ERROR";
}
Log.d(TAG, "onBillingSetupFinished: ERROR => "+errorMessage);

Toast.makeText(BillingActivity.this, errorMessage, Toast.LENGTH_LONG).show();

}
}



});

try {
/* try {
getProducts();
}catch (Exception e){

Log.e(TAG, "onStart: ",e );
}
try {
fetchOwnedPlans();
fetchOwnedPlans();
}catch (Exception e){

Log.e(TAG, "onStart: ",e );
}
*/
setUIDetails();

// Check Google Play Services
Expand All @@ -132,15 +156,21 @@ void getProducts(){
gPlayBilling.getProducts(new ProductDetailsResponseListener() {
@Override
public void onProductDetailsResponse(@NonNull BillingResult billingResult, @NonNull List<ProductDetails> list) {

if(list.isEmpty()){
Log.d(TAG, "onProductDetailsResponse: EMPTY PRODUCTS ");
return;
}
Log.d(TAG, "onProductDetailsResponse: "+list.get(0).toString());
productDetails=list.get(0);
gPlayBilling.productDetails=productDetails;

ProductDetails.SubscriptionOfferDetails s= productDetails.getSubscriptionOfferDetails().get(0);
price=s.getPricingPhases().getPricingPhaseList().get(0).getFormattedPrice();
period=s.getPricingPhases().getPricingPhaseList().get(0).getBillingPeriod();
Log.d(TAG, "onProductDetailsResponse: SubscriptionOfferDetails "+s.toString());
Log.d(TAG, "onProductDetailsResponse: getOfferTags "+s.getPricingPhases().getPricingPhaseList().get(0));

Log.d(TAG, "onProductDetailsResponse: SubscriptionOfferDetails "+s.toString());
Log.d(TAG, "onProductDetailsResponse: getOfferTags "+s.getPricingPhases().getPricingPhaseList().get(0));

setUIDetails();

Expand Down
8 changes: 6 additions & 2 deletions billing/src/main/java/devesh/app/billing/GPlayBilling.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import com.android.billingclient.api.QueryPurchasesParams;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.errorprone.annotations.Immutable;
import com.google.firebase.crashlytics.internal.model.ImmutableList;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -103,7 +105,7 @@ public GPlayBilling(Activity activity, PurchasesUpdatedListener purchasesUpdated


public void init(BillingClientStateListener billingClientStateListener){

Log.d(TAG, "init: BillingClientStateListener");
billingClient.startConnection(billingClientStateListener);
/*
Expand Down Expand Up @@ -133,15 +135,17 @@ public void getProducts(ProductDetailsResponseListener productDetailsResponseLis
Log.d(TAG, "getProducts: ");
List<QueryProductDetailsParams.Product> itemsList = new ArrayList<>();


QueryProductDetailsParams.Product qp = QueryProductDetailsParams.Product.newBuilder()
.setProductId("subs")
.setProductType(BillingClient.ProductType.SUBS)
.build();

itemsList.add(qp);

QueryProductDetailsParams queryProductDetailsParams =
QueryProductDetailsParams.newBuilder()
.setProductList(itemsList)
.setProductList(ImmutableList.from(itemsList))
.build();

billingClient.queryProductDetailsAsync(
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ project.ext{
gson_version="2.10.1"
glide_version="4.14.0"
play_services_base="18.2.0"
billing_version = "6.0.1"

AdMobAppID=AdMob_App_ID
AdMobAdBannerID1=AdMob_AdBannerID1
Expand Down
33 changes: 32 additions & 1 deletion common/src/main/java/devesh/app/common/AdMobAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public AdMobAPI(Activity activity) {


if (!BuildConfig.DEBUG) {
List<String> testDeviceIds = Arrays.asList("4DA615D3074C3B7ED74AF7BC445EB58B");
List<String> testDeviceIds = Arrays.asList("4DA615D3074C3B7ED74AF7BC445EB58B","BA7CE8A34143C5A04CCEF9F701FCADB5");
RequestConfiguration configuration =
new RequestConfiguration.Builder()
.setTestDeviceIds(testDeviceIds)
Expand Down Expand Up @@ -161,6 +161,12 @@ public void onInitializationComplete(InitializationStatus initializationStatus)
}

public void setAdBannerTo(AdView adView) {
boolean isSub = cachePref.getBoolean(mActivity.getString(R.string.Pref_isSubscribed));
if (isSub) {
isAdsEnabled = false;
} else {
isAdsEnabled = true;
}
if (isAdsEnabled) {
AdSize adSize = AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(mContext, 320);

Expand Down Expand Up @@ -210,6 +216,12 @@ public void onAdClosed() {
}

public void setAdaptiveBanner(AdView adView, Activity activity) {
boolean isSub = cachePref.getBoolean(activity.getString(R.string.Pref_isSubscribed));
if (isSub) {
isAdsEnabled = false;
} else {
isAdsEnabled = true;
}
if (isAdsEnabled) {
AdSize adSize = AdSize.getCurrentOrientationInlineAdaptiveBannerAdSize(mContext, 320);

Expand Down Expand Up @@ -262,6 +274,12 @@ public void onAdClosed() {
// InterstitialAd

public void setAdaptiveBanner(FrameLayout adContainerView, Activity activity) {
boolean isSub = cachePref.getBoolean(activity.getString(R.string.Pref_isSubscribed));
if (isSub) {
isAdsEnabled = false;
} else {
isAdsEnabled = true;
}
if (isAdsEnabled) {
AdView adView = new AdView(activity);

Expand Down Expand Up @@ -317,6 +335,13 @@ public void onAdClosed() {

public void LoadInterstitialAd(Activity activity) {
mActivity = activity;

boolean isSub = cachePref.getBoolean(mActivity.getString(R.string.Pref_isSubscribed));
if (isSub) {
isAdsEnabled = false;
} else {
isAdsEnabled = true;
}
if (isAdsEnabled) {
AdRequest adRequest = new AdRequest.Builder().build();

Expand Down Expand Up @@ -366,6 +391,12 @@ public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
}

public void ShowInterstitialAd() {
boolean isSub = cachePref.getBoolean(mActivity.getString(R.string.Pref_isSubscribed));
if (isSub) {
isAdsEnabled = false;
} else {
isAdsEnabled = true;
}
if (isAdsEnabled) {
if (mInterstitialAd != null) {
mInterstitialAd.show(mActivity);
Expand Down

0 comments on commit c0c1a7e

Please sign in to comment.