Skip to content

Commit

Permalink
For anyone that has duplicate app entries, remove them
Browse files Browse the repository at this point in the history
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
timshadel committed Apr 5, 2011
1 parent 9e17220 commit dd5fe45
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions Classes/AppManager.h
Expand Up @@ -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
4 changes: 4 additions & 0 deletions Classes/AppManager.m
Expand Up @@ -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) {
Expand Down
11 changes: 10 additions & 1 deletion Classes/ReportManager.m
Expand Up @@ -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];
}
}
Expand All @@ -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];
}
}
Expand Down

0 comments on commit dd5fe45

Please sign in to comment.