IAB fixes

This commit is contained in:
M66B 2017-01-06 19:20:00 +01:00
parent 6d2ed9f4a0
commit 36f5cfc46c
3 changed files with 12 additions and 3 deletions

View File

@ -376,6 +376,8 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
if (!"teal".equals(prefs.getString("theme", "teal")))
prefs.edit().putString("theme", "teal").apply();
}
if (!IAB.isPurchased(ActivityPro.SKU_NOTIFY, ActivityMain.this))
prefs.edit().putBoolean("install", false).apply();
if (!IAB.isPurchased(ActivityPro.SKU_SPEED, ActivityMain.this))
prefs.edit().putBoolean("show_stats", false).apply();
} catch (Throwable ex) {

View File

@ -122,10 +122,12 @@ public class IAB implements ServiceConnection {
SharedPreferences prefs = context.getSharedPreferences("IAB", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
for (String product : prefs.getAll().keySet())
if (!ActivityPro.SKU_DONATION.equals(product))
if (!ActivityPro.SKU_DONATION.equals(product)) {
Log.i(TAG, "removing SKU=" + product);
editor.remove(product);
}
for (String sku : skus) {
Log.i(TAG, "SKU=" + sku);
Log.i(TAG, "adding SKU=" + sku);
editor.putBoolean(sku, true);
}
editor.apply();

View File

@ -1296,8 +1296,13 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
private void prepareUidIPFilters(String dname) {
lock.writeLock().lock();
if (dname == null)
if (dname == null) {
mapUidIPFilters.clear();
if (!IAB.isPurchased(ActivityPro.SKU_FILTER, ServiceSinkhole.this)) {
lock.writeLock().unlock();
return;
}
}
Cursor cursor = DatabaseHelper.getInstance(ServiceSinkhole.this).getAccessDns(dname);
int colUid = cursor.getColumnIndex("uid");