@Test public void ensureUpdatedPurchaseListIsPersistedAndPlusRemains() { plusPurchaseWallet.addLocalInAppPurchaseToWallet(managedProduct); plusPurchaseWallet.updateLocalInAppPurchasesInWallet(Collections.<ManagedProduct>emptySet()); final PurchaseWallet newWallet = new PlusPurchaseWallet(sharedPreferencesLazy); assertTrue(newWallet.hasActivePurchase(InAppPurchase.SmartReceiptsPlus)); assertNull(newWallet.getLocalInAppManagedProduct(InAppPurchase.SmartReceiptsPlus)); assertTrue(plusPurchaseWallet.hasActivePurchase(InAppPurchase.SmartReceiptsPlus)); assertNull(plusPurchaseWallet.getLocalInAppManagedProduct(InAppPurchase.SmartReceiptsPlus)); assertFalse(newWallet.hasActivePurchase(InAppPurchase.OcrScans50)); assertNull(newWallet.getLocalInAppManagedProduct(InAppPurchase.OcrScans50)); assertFalse(plusPurchaseWallet.hasActivePurchase(InAppPurchase.OcrScans50)); assertNull(plusPurchaseWallet.getLocalInAppManagedProduct(InAppPurchase.OcrScans50)); assertEquals(newWallet.getActiveLocalInAppPurchases(), Collections.emptySet()); assertEquals(plusPurchaseWallet.getActiveLocalInAppPurchases(), Collections.emptySet()); assertEquals(preferences.getStringSet("key_sku_set", Collections.<String>emptySet()), Collections.emptySet()); assertFalse(preferences.contains("ocr_purchase_1_purchaseData")); assertFalse(preferences.contains("ocr_purchase_1_inAppDataSignature")); }
@Override public synchronized boolean hasActivePurchase(@NonNull InAppPurchase inAppPurchase) { if (inAppPurchase == InAppPurchase.SmartReceiptsPlus) { return true; } else { return super.hasActivePurchase(inAppPurchase); } }
PlusPurchaseWallet extends DefaultPurchaseWallet { @Override public synchronized boolean hasActivePurchase(@NonNull InAppPurchase inAppPurchase) { if (inAppPurchase == InAppPurchase.SmartReceiptsPlus) { return true; } else { return super.hasActivePurchase(inAppPurchase); } } }
PlusPurchaseWallet extends DefaultPurchaseWallet { @Override public synchronized boolean hasActivePurchase(@NonNull InAppPurchase inAppPurchase) { if (inAppPurchase == InAppPurchase.SmartReceiptsPlus) { return true; } else { return super.hasActivePurchase(inAppPurchase); } } @Inject  PlusPurchaseWallet(@NonNull Lazy<SharedPreferences> preferences); }
PlusPurchaseWallet extends DefaultPurchaseWallet { @Override public synchronized boolean hasActivePurchase(@NonNull InAppPurchase inAppPurchase) { if (inAppPurchase == InAppPurchase.SmartReceiptsPlus) { return true; } else { return super.hasActivePurchase(inAppPurchase); } } @Inject  PlusPurchaseWallet(@NonNull Lazy<SharedPreferences> preferences); @Override synchronized boolean hasActivePurchase(@NonNull InAppPurchase inAppPurchase); }
PlusPurchaseWallet extends DefaultPurchaseWallet { @Override public synchronized boolean hasActivePurchase(@NonNull InAppPurchase inAppPurchase) { if (inAppPurchase == InAppPurchase.SmartReceiptsPlus) { return true; } else { return super.hasActivePurchase(inAppPurchase); } } @Inject  PlusPurchaseWallet(@NonNull Lazy<SharedPreferences> preferences); @Override synchronized boolean hasActivePurchase(@NonNull InAppPurchase inAppPurchase);  }