Skip to content
Browse files

For anyone that has duplicate app entries, remove them

A number of people may have downloaded daily files prior to the proper
treatment of IAPs; remove those so that they don't continue to download
duplicate reviews. Treat Subscriptions as IAP & don't generate reviews.

Signed-off-by: Tim Shadel <github@timshadel.com>
  • Loading branch information...
1 parent 9e17220 commit dd5fe458b5df4027687f5f0bc40ffde8ca7ddbdc @timshadel committed
Showing with 15 additions and 1 deletion.
  1. +1 −0 Classes/AppManager.h
  2. +4 −0 Classes/AppManager.m
  3. +10 −1 Classes/ReportManager.m
View
1 Classes/AppManager.h
@@ -19,6 +19,7 @@
- (App*) appWithID:(NSString*)appID;
- (void) addApp:(App*)app;
- (BOOL) createOrUpdateAppIfNeededWithID:(NSString*)appID name:(NSString*)appName;
+- (void) removeAppWithID:(NSString*)appID;
- (void) saveToDisk;
@end
View
4 Classes/AppManager.m
@@ -53,6 +53,10 @@ - (void) addApp:(App*)app {
[appsByID setObject:app forKey:app.appID];
}
+- (void) removeAppWithID:(NSString*)appID {
+ [appsByID removeObjectForKey:appID];
+}
+
- (BOOL) createOrUpdateAppIfNeededWithID:(NSString*)appID name:(NSString*)appName {
App *app = [self appWithID:appID];
if (app == nil) {
View
11 Classes/ReportManager.m
@@ -521,7 +521,11 @@ - (void) successfullyDownloadedReport:(Day*)report {
AppManager *manager = [AppManager sharedManager];
for (Country *c in [report.countries allValues]) {
for (Entry *e in c.entries) {
- if (e.transactionType==2) { continue; } //skips IAPs in app manager, so IAPs don't duplicate reviews
+ if (e.transactionType == 2 || e.transactionType == 9) {
+ //skips IAPs in app manager, so IAPs don't duplicate reviews
+ [manager removeAppWithID:e.productIdentifier];
+ continue;
+ }
[manager createOrUpdateAppIfNeededWithID:e.productIdentifier name:e.productName];
}
}
@@ -535,6 +539,11 @@ - (void)importReport:(Day *)report
AppManager *manager = [AppManager sharedManager];
for (Country *c in [report.countries allValues]) {
for (Entry *e in c.entries) {
+ if (e.transactionType == 2 || e.transactionType == 9) {
+ //skips IAPs in app manager, so IAPs don't duplicate reviews
+ [manager removeAppWithID:e.productIdentifier];
+ continue;
+ }
[manager createOrUpdateAppIfNeededWithID:e.productIdentifier name:e.productName];
}
}

0 comments on commit dd5fe45

Please sign in to comment.
Something went wrong with that request. Please try again.