MCPcopy Index your code
hub / github.com/M66B/NetGuard / updatePurchases

Method updatePurchases

app/src/main/java/eu/faircode/netguard/IAB.java:119–137  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117 }
118
119 public void updatePurchases() throws RemoteException {
120 // Get purchases
121 List<String> skus = new ArrayList<>();
122 skus.addAll(getPurchases("inapp"));
123 skus.addAll(getPurchases("subs"));
124
125 SharedPreferences prefs = context.getSharedPreferences("IAB", Context.MODE_PRIVATE);
126 SharedPreferences.Editor editor = prefs.edit();
127 for (String product : prefs.getAll().keySet())
128 if (!ActivityPro.SKU_DONATION.equals(product)) {
129 Log.i(TAG, "removing SKU=" + product);
130 editor.remove(product);
131 }
132 for (String sku : skus) {
133 Log.i(TAG, "adding SKU=" + sku);
134 editor.putBoolean(sku, true);
135 }
136 editor.apply();
137 }
138
139 public boolean isPurchased(String sku, String type) throws RemoteException {
140 return getPurchases(type).contains(sku);

Callers 2

onReadyMethod · 0.80
onReadyMethod · 0.80

Calls 2

getPurchasesMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected