|
1 | | -package com.d4rk.androidtutorials.java.ui.screens.support.repository; |
| 1 | +package com.d4rk.androidtutorials.java.data.repository; |
2 | 2 |
|
3 | 3 | import android.content.Context; |
4 | 4 |
|
|
12 | 12 | import com.android.billingclient.api.ProductDetails; |
13 | 13 | import com.android.billingclient.api.QueryProductDetailsParams; |
14 | 14 | import com.d4rk.androidtutorials.java.data.model.AdLoadParams; |
| 15 | +import com.d4rk.androidtutorials.java.data.repository.SupportRepository.BillingFlowLauncher; |
| 16 | +import com.d4rk.androidtutorials.java.data.repository.SupportRepository.OnProductDetailsListener; |
15 | 17 | import com.google.android.gms.ads.AdRequest; |
16 | 18 | import com.google.android.gms.ads.MobileAds; |
17 | 19 |
|
|
21 | 23 | import java.util.List; |
22 | 24 | import java.util.Map; |
23 | 25 |
|
24 | | -public class SupportRepository implements com.d4rk.androidtutorials.java.data.repository.SupportRepository { |
| 26 | +public class DefaultSupportRepository implements SupportRepository { |
25 | 27 |
|
26 | 28 | private final Context context; |
27 | 29 | private final Map<String, ProductDetails> productDetailsMap = new HashMap<>(); |
28 | 30 | private BillingClient billingClient; |
29 | 31 |
|
30 | | - public SupportRepository(Context context) { |
| 32 | + public DefaultSupportRepository(Context context) { |
31 | 33 | this.context = context.getApplicationContext(); |
32 | 34 | } |
33 | 35 |
|
@@ -73,7 +75,7 @@ public void onBillingServiceDisconnected() { |
73 | 75 | * Query your product details for in-app items. |
74 | 76 | * Typically called after billing client is connected. |
75 | 77 | */ |
76 | | - public void queryProductDetails(List<String> productIds, com.d4rk.androidtutorials.java.data.repository.SupportRepository.OnProductDetailsListener listener) { |
| 78 | + public void queryProductDetails(List<String> productIds, OnProductDetailsListener listener) { |
77 | 79 | if (billingClient == null || !billingClient.isReady()) { |
78 | 80 | return; |
79 | 81 | } |
@@ -119,7 +121,7 @@ public void queryProductDetails(List<String> productIds, com.d4rk.androidtutoria |
119 | 121 | /** |
120 | 122 | * Launch the billing flow for a particular product. |
121 | 123 | */ |
122 | | - public void initiatePurchase(String productId, com.d4rk.androidtutorials.java.data.repository.SupportRepository.BillingFlowLauncher launcher) { |
| 124 | + public void initiatePurchase(String productId, BillingFlowLauncher launcher) { |
123 | 125 | ProductDetails details = productDetailsMap.get(productId); |
124 | 126 | if (details != null && billingClient != null && launcher != null) { |
125 | 127 | // Note: In a real app, you would select a specific offer. For simplicity, |
|
0 commit comments