Skip to content

Commit

Permalink
Fix callback when AppType is OTHER
Browse files Browse the repository at this point in the history
  • Loading branch information
javiersantos committed Feb 25, 2018
1 parent c324a2e commit ebbd5d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ static boolean verifyInstallerId(Context context, List<InstallerID> installerID)
@SuppressLint("SdCardPath")
static PirateApp getPirateApp(Context context, boolean lpf, boolean stores, boolean folders,
ArrayList<PirateApp> extraApps) {
if (!lpf && !stores) return null;
if (!lpf && !stores && extraApps.isEmpty()) return null;
for (PirateApp app : getApps(extraApps)) {
if ((lpf && app.getType() == AppType.PIRATE) || (stores && app.getType() == AppType.STORE) || app.getType() == AppType.OTHER) {
String pack = app.getPackage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public class PiracyChecker {
private String signature;
private List<InstallerID> installerIDs;
private PiracyCheckerCallback callback;
private ArrayList<PirateApp> extraApps = new ArrayList<>();
private ArrayList<PirateApp> extraApps;

// LVL
private LibraryChecker libraryLVLChecker;
Expand All @@ -82,6 +82,7 @@ public PiracyChecker(Context context, String title, String description) {
this.unlicensedDialogDescription = description;
this.display = Display.DIALOG;
this.installerIDs = new ArrayList<>();
this.extraApps = new ArrayList<>();
this.colorPrimary = R.color.colorPrimary;
this.colorPrimaryDark = R.color.colorPrimaryDark;
}
Expand Down Expand Up @@ -390,9 +391,9 @@ private void doExtraVerification(PiracyCheckerCallback verifyCallback,
preferences.edit().putBoolean(preferenceSaveResult, false).apply();
if (preferences != null && blockUnauthorized && app.getType() == AppType.PIRATE)
preferences.edit().putBoolean(preferenceBlockUnauthorized, true).apply();
verifyCallback.dontAllow(app.getType() == AppType.PIRATE
? PiracyCheckerError.PIRATE_APP_INSTALLED
: PiracyCheckerError.THIRD_PARTY_STORE_INSTALLED, app);
verifyCallback.dontAllow(app.getType() == AppType.STORE
? PiracyCheckerError.THIRD_PARTY_STORE_INSTALLED
: PiracyCheckerError.PIRATE_APP_INSTALLED, app);
} else {
if (preferences != null && saveToSharedPreferences)
preferences.edit().putBoolean(preferenceSaveResult, true).apply();
Expand All @@ -404,9 +405,9 @@ private void doExtraVerification(PiracyCheckerCallback verifyCallback,
preferences.edit().putBoolean(preferenceSaveResult, false).apply();
if (preferences != null && blockUnauthorized && app.getType() == AppType.PIRATE)
preferences.edit().putBoolean(preferenceBlockUnauthorized, true).apply();
verifyCallback.dontAllow(app.getType() == AppType.PIRATE
? PiracyCheckerError.PIRATE_APP_INSTALLED
: PiracyCheckerError.THIRD_PARTY_STORE_INSTALLED, app);
verifyCallback.dontAllow(app.getType() == AppType.STORE
? PiracyCheckerError.THIRD_PARTY_STORE_INSTALLED
: PiracyCheckerError.PIRATE_APP_INSTALLED, app);
} else {
if (preferences != null && saveToSharedPreferences)
preferences.edit().putBoolean(preferenceSaveResult, false).apply();
Expand Down

0 comments on commit ebbd5d2

Please sign in to comment.