Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Prepare for Development branch

  • Loading branch information...
commit 803a410b7254a8a30fec6a30b55ca7bb4a8abc45 1 parent 07898f0
@Cocoanetics authored
Showing with 94 additions and 74 deletions.
  1. +1 −1  Classes/AccountManager.m
  2. +1 −1  Classes/App.m
  3. +2 −2 Classes/AppGrouping.m
  4. +1 −1  Classes/AppIconDownloadOperation.m
  5. +1 −1  Classes/AsyncSocket.m
  6. +1 −1  Classes/ChartViewController.m
  7. +21 −17 Classes/CoreDatabase+Import_v1.m
  8. +3 −1 Classes/CoreDatabase.h
  9. +34 −22 Classes/CoreDatabase.m
  10. +1 −1  Classes/CountryFlagDownloadOperation.m
  11. +1 −1  Classes/CountrySummary.m
  12. +1 −1  Classes/Country_v1.m
  13. +2 −2 Classes/Database.m
  14. +2 −2 Classes/GenericAccount.m
  15. +1 −1  Classes/InAppPurchase.m
  16. +1 −1  Classes/ItunesConnectDownloaderOperation.m
  17. +1 −1  Classes/MyAppSalesAppDelegate.m
  18. +1 −1  Classes/NotificationsSubscribeOperation.m
  19. +1 −1  Classes/PinLockController.m
  20. +1 −1  Classes/Product_v1.m
  21. +1 −1  Classes/Query.m
  22. +2 −2 Classes/Report_v1.m
  23. +1 −1  Classes/ReportsOverviewViewController.m
  24. +1 −1  Classes/ReviewDownloaderOperation.m
  25. +2 −2 Classes/Review_v1.m
  26. +1 −1  Classes/SBJSON/SBJSON.m
  27. +1 −1  Classes/Sale_v1.m
  28. +1 −1  Classes/SynchingManager.m
  29. +1 −1  Classes/TranslationScraperOperation.m
  30. +1 −1  Classes/XMLdocument.m
  31. +1 −1  Classes/XMLelement.m
  32. +1 −1  Classes/YahooFinance.m
  33. +2 −0  MyAppSales.xcodeproj/project.pbxproj
View
2  Classes/AccountManager.m
@@ -43,7 +43,7 @@ + (AccountManager *) sharedAccountManager
- (id) init
{
- if (self = [super init])
+ if ((self = [super init]))
{
[self loadAllGenericAccounts];
View
2  Classes/App.m
@@ -51,7 +51,7 @@ @implementation App
- (id)init
{
// default images
- if (self = [super init])
+ if ((self = [super init]))
{
self.iconImage = [UIImage imageNamed:@"Empty.png"];
UIImage *tmpImageNanoResized = [self.iconImage imageByScalingToSize:CGSizeMake(32.0,32.0)];
View
4 Classes/AppGrouping.m
@@ -24,7 +24,7 @@ @implementation AppGrouping
- (id) initWithAppSet:(NSSet *)appSet
{
- if (self = [super init])
+ if ((self = [super init]))
{
apps = [[NSMutableSet alloc] initWithSet:appSet];
}
@@ -58,7 +58,7 @@ - (void)appendAppsOfSet:(NSSet *)appSet
#pragma mark Database
- (id)initWithPrimaryKey:(NSInteger)pk database:(sqlite3 *)db {
- if (self = [super init])
+ if ((self = [super init]))
{
primaryKey = pk;
database = db;
View
2  Classes/AppIconDownloadOperation.m
@@ -13,7 +13,7 @@ @implementation AppIconDownloadOperation
- (id)initWithApplicationIdentifier:(NSInteger)appID
{
- if (self = [super init])
+ if ((self = [super init]))
{
_appID = appID;
}
View
2  Classes/AsyncSocket.m
@@ -161,7 +161,7 @@ - (id)initWithData:(NSMutableData *)d
terminator:(NSData *)e
maxLength:(CFIndex)m
{
- if(self = [super init])
+ if ((self = [super init]))
{
buffer = [d retain];
timeout = t;
View
2  Classes/ChartViewController.m
@@ -30,7 +30,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- (id)initWithChartData:(NSDictionary *)dataDict
{
- if (self = [super init])
+ if ((self = [super init]))
{
UIView *rootView = [[UIView alloc] init];
self.view = rootView;
View
38 Classes/CoreDatabase+Import_v1.m
@@ -205,8 +205,6 @@ - (void)importDatabase:(Database *)database
// migrate reports separately
NSArray *allReports = [database allReports];
- NSLog(@"%d reports", [allReports count]);
-
for (Report_v1 *oneReport in allReports)
{
// create a report for each
@@ -231,6 +229,9 @@ - (void)importDatabase:(Database *)database
[reportLookup setObject:report forKey:[NSNumber numberWithInt:oneReport.primaryKey]];
}
+ NSLog(@"%d reports imported", [allReports count]);
+ [self save];
+
// migrate sales separately
sqlite3_stmt *statement = nil;
@@ -287,23 +288,26 @@ - (void)importDatabase:(Database *)database
// don't need it any more
sqlite3_finalize(statement);
+ [self save];
- // make summary right away as well
- for (Report *oneReport in [reportLookup allValues])
- {
- [self buildSummaryForReport:oneReport];
- }
-
- // make product summaries
- for (Product *oneProduct in [productLookup allValues])
- {
- if (![oneProduct.isInAppPurchase boolValue])
- {
- [self buildSummaryForProduct:oneProduct];
- }
- }
+
+ // TAKES TOO LONG!
+// // make summary right away as well
+// for (Report *oneReport in [reportLookup allValues])
+// {
+// [self buildSummaryForReport:oneReport];
+// }
- [self save];
+// // make product summaries
+// for (Product *oneProduct in [productLookup allValues])
+// {
+// if (![oneProduct.isInAppPurchase boolValue])
+// {
+// [self buildSummaryForProduct:oneProduct];
+// }
+// }
+//
+// [self save];
// export country plist
NSString *path = [NSString pathForFileInDocuments:@"countries.plist"];
View
4 Classes/CoreDatabase.h
@@ -28,6 +28,9 @@
NSMutableDictionary *flagDictionary;
NSMutableDictionary *iconDictionary;
+ // Country cache
+ NSMutableDictionary *countryDictionary;
+
// Core Data Stack
NSPersistentStoreCoordinator *persistentStoreCoordinator;
@@ -36,7 +39,6 @@
// caches
- NSArray *countries;
NSMutableDictionary *newReportsByType;
NSMutableDictionary *newAppsByProductGroup;
}
View
56 Classes/CoreDatabase.m
@@ -38,7 +38,7 @@ + (CoreDatabase *)sharedInstance
- (id) init
{
- if (self = [super init])
+ if ((self = [super init]))
{
NSLog(@"Connected to: %@", [[CoreDatabase databaseStoreUrl] path]);
@@ -62,6 +62,16 @@ - (id) init
newReportsByType = [[NSMutableDictionary alloc] init];
newAppsByProductGroup = [[NSMutableDictionary alloc] init];
+
+ NSArray *allCountries = [self allCountriesWithAppStore];
+ countryDictionary = [[NSMutableDictionary alloc] init];
+
+ for (Country *oneCountry in allCountries)
+ {
+ [countryDictionary setObject:oneCountry forKey:oneCountry.iso2];
+ [countryDictionary setObject:oneCountry forKey:oneCountry.iso3];
+ }
+
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(willResignActive:)
name:UIApplicationWillResignActiveNotification
@@ -78,7 +88,7 @@ - (void)dealloc
[flagDictionary release];
[newReportsByType release];
[newAppsByProductGroup release];
- [countries release];
+ [countryDictionary release];
[super dealloc];
}
@@ -452,28 +462,30 @@ - (Country *) countryForName:(NSString *)countryName
- (Country *) countryForCode:(NSString *)code
{
- if ([code length]==2)
+ if ([code length]<=3)
{
- // iso2 code
- NSFetchRequest *request = [[NSFetchRequest alloc] init];
- NSEntityDescription *entity = [NSEntityDescription entityForName:@"Country" inManagedObjectContext:self.managedObjectContext];
- [request setEntity:entity];
- [request setFetchLimit:1];
-
- NSPredicate *predicate = [NSPredicate predicateWithFormat:@"iso2 = %@", code];
- [request setPredicate:predicate];
-
- NSError *error;
- NSArray *fetchResults = [managedObjectContext executeFetchRequest:request error:&error];
- if (fetchResults == nil)
- {
- // Handle the error.
- NSLog(@"Cannot resolve country code '%@', please report this to oliver@drobnik.com", code);
- }
-
- [request release];
+ return [countryDictionary objectForKey:code];
- return [fetchResults lastObject];
+// // iso2 code
+// NSFetchRequest *request = [[NSFetchRequest alloc] init];
+// NSEntityDescription *entity = [NSEntityDescription entityForName:@"Country" inManagedObjectContext:self.managedObjectContext];
+// [request setEntity:entity];
+// [request setFetchLimit:1];
+//
+// NSPredicate *predicate = [NSPredicate predicateWithFormat:@"iso2 = %@", code];
+// [request setPredicate:predicate];
+//
+// NSError *error;
+// NSArray *fetchResults = [managedObjectContext executeFetchRequest:request error:&error];
+// if (fetchResults == nil)
+// {
+// // Handle the error.
+// NSLog(@"Cannot resolve country code '%@', please report this to oliver@drobnik.com", code);
+// }
+//
+// [request release];
+//
+// return [fetchResults lastObject];
}
else
{
View
2  Classes/CountryFlagDownloadOperation.m
@@ -13,7 +13,7 @@ @implementation CountryFlagDownloadOperation
- (id)initWithISO3:(NSString *)iso3
{
- if (self = [super init])
+ if ((self = [super init]))
{
self.iso3 = [iso3 lowercaseString];
}
View
2  Classes/CountrySummary.m
@@ -15,7 +15,7 @@ @implementation CountrySummary
- (id)initWithCountry:(Country_v1 *)cntry sumSales:(NSInteger)sales sumUpdates:(NSInteger)updates sumRefunds:(NSInteger)refunds
{
- if (self = [super init])
+ if ((self = [super init]))
{
self.country = cntry;
self.sumSales = sales;
View
2  Classes/Country_v1.m
@@ -32,7 +32,7 @@ @implementation Country_v1
// Creates the object with primary key and title is brought into memory.
- (id)initWithISO3:(NSString *)pk database:(sqlite3 *)db
{
- if (self = [super init])
+ if ((self = [super init]))
{
self.iso3 = pk;
database = db;
View
4 Classes/Database.m
@@ -71,7 +71,7 @@ + (Database *) sharedInstance
- (id) init
{
- if (self = [super init])
+ if ((self = [super init]))
{
newReportsByType = [[NSMutableDictionary alloc] init];
appGroupings = [[NSMutableSet alloc] init];
@@ -304,7 +304,7 @@ - (void) bulkLoadReportsOfType:(ReportType)reportType
// try cache first
- NSString *path = [NSString pathForFileInDocuments:[NSString stringWithFormat:@"index_cache_%d.dat", reportType]];
+ //NSString *path = [NSString pathForFileInDocuments:[NSString stringWithFormat:@"index_cache_%d.dat", reportType]];
//NSData *compressed = [NSData dataWithContentsOfFile:path];
// NSData *compressed;
View
4 Classes/GenericAccount.m
@@ -32,7 +32,7 @@ @implementation GenericAccount
- (id) initFromKeychainDictionary:(NSDictionary *)dict
{
- if (self = [super init])
+ if ((self = [super init]))
{
account = [[dict objectForKey:(id)kSecAttrAccount] retain];
description = [[dict objectForKey:(id)kSecAttrDescription] retain];
@@ -66,7 +66,7 @@ - (id) initFromKeychainDictionary:(NSDictionary *)dict
- (id) initService:(NSString *)aService forUser:(NSString *)aUser
{
- if (self = [super init])
+ if ((self = [super init]))
{
account = [aUser retain];
service = [aService retain];
View
2  Classes/InAppPurchase.m
@@ -39,7 +39,7 @@ - (void)dealloc
// Creates the object with primary key and title is brought into memory.
- (id)initWithPrimaryKey:(NSInteger)pk database:(sqlite3 *)db {
- if (self = [super init])
+ if ((self = [super init]))
{
apple_identifier = pk;
database = db;
View
2  Classes/ItunesConnectDownloaderOperation.m
@@ -30,7 +30,7 @@ @implementation ItunesConnectDownloaderOperation
- (id) initForAccount:(GenericAccount *)itcAccount
{
- if (self = [super init])
+ if ((self = [super init]))
{
account = [itcAccount retain];
View
2  Classes/MyAppSalesAppDelegate.m
@@ -517,7 +517,7 @@ - (void) emptyCache
NSError *error=nil;
- while (aString = [enu nextObject])
+ while ((aString = [enu nextObject]))
{
NSString *pathOfFile = [documentsDirectory stringByAppendingPathComponent:aString];
View
2  Classes/NotificationsSubscribeOperation.m
@@ -18,7 +18,7 @@ @implementation NotificationsSubscribeOperation
- (id) initForAccount:(GenericAccount *)notificationsAccount subscribe:(BOOL)doSubscribe;
{
- if (self = [super init])
+ if ((self = [super init]))
{
account = [notificationsAccount retain];
workInProgress = YES;
View
2  Classes/PinLockController.m
@@ -22,7 +22,7 @@ @implementation PinLockController
- (id)initWithMode:(PinLockControllerMode)initMode
{
- if (self = [super init])
+ if ((self = [super init]))
{
mode = initMode;
View
2  Classes/Product_v1.m
@@ -52,7 +52,7 @@ @implementation Product_v1
- (id)init
{
// default images
- if (self = [super init])
+ if ((self = [super init]))
{
// subscribe to total update notifications
//[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appTotalsUpdated:) name:@"AppTotalsUpdated" object:nil];
View
2  Classes/Query.m
@@ -16,7 +16,7 @@ @implementation Query
- (id)initWithDatabase:(sqlite3 *)db
{
- if (self = [super init])
+ if ((self = [super init]))
{
database = db;
return self;
View
4 Classes/Report_v1.m
@@ -49,7 +49,7 @@ @implementation Report_v1
-(id)init
{
- if (self = [super init])
+ if ((self = [super init]))
{
dirty = NO;
hydrated = NO;
@@ -340,7 +340,7 @@ - (id)initAsFreeReportWithDict:(NSDictionary *)dict
- (id)initWithReportText:(NSString *)string
{
- if (self = [super init])
+ if ((self = [super init]))
{
// Make a list of apps in this report
NSMutableSet *tmpAppsInReport = [NSMutableSet set];
View
2  Classes/ReportsOverviewViewController.m
@@ -30,7 +30,7 @@ @implementation ReportsOverviewViewController
- (id)initWithProductGroup:(ProductGroup *)productGroup reportType:(ReportType)reportType
{
- if (self = [super initWithStyle:UITableViewStylePlain])
+ if ((self = [super initWithStyle:UITableViewStylePlain]))
{
_productGroup = [productGroup retain];
_reportType = reportType;
View
2  Classes/ReviewDownloaderOperation.m
@@ -24,7 +24,7 @@ @implementation ReviewDownloaderOperation
- (id) initForAppID:(NSInteger)appID storeID:(NSInteger)storeID delegate:(NSObject <ReviewScraperDelegate> *) scrDelegate;
{
- if (self = [super init])
+ if ((self = [super init]))
{
_appID = appID;
_storeID = storeID;
View
4 Classes/Review_v1.m
@@ -26,7 +26,7 @@ @implementation Review_v1
- (id) initWithApp:(App *)reviewApp country:(Country_v1 *)reviewCountry title:(NSString *)aTitle name:(NSString *)aName version:(NSString *)aVersion date:(NSDate *)aDate review:(NSString *)aReview stars:(double)aStars
{
- if (self = [super init])
+ if ((self = [super init]))
{
self.app = reviewApp;
self.country = reviewCountry;
@@ -52,7 +52,7 @@ - (id) initWithApp:(App *)reviewApp country:(Country_v1 *)reviewCountry title:(N
- (id) initWithString:(NSString *)stub
{
- if (self = [super init])
+ if ((self = [super init]))
{
NSScanner *scanner = [NSScanner scannerWithString:stub];
View
2  Classes/SBJSON/SBJSON.m
@@ -99,7 +99,7 @@ + (void)initialize
}
- (id)init {
- if (self = [super init]) {
+ if ((self = [super init])) {
[self setMaxDepth:512];
}
return self;
View
2  Classes/Sale_v1.m
@@ -26,7 +26,7 @@ @implementation Sale_v1
- (id) initWithCountry:(Country_v1 *)acountry report:(Report_v1 *)areport product:(Product_v1 *)saleProduct units:(NSInteger)aunits royaltyPrice:(double)aprice royaltyCurrency:(NSString *)acurrency customerPrice:(double)c_price customerCurrency:(NSString *)c_currency transactionType:(TransactionType)ttype
{
- if (self = [super init])
+ if ((self = [super init]))
{
self.country = acountry;
NSAssert(country, @"Country must not be null");
View
2  Classes/SynchingManager.m
@@ -41,7 +41,7 @@ + (SynchingManager *) sharedInstance
- (id) init
{
- if (self = [super init])
+ if ((self = [super init]))
{
queue = [[NSOperationQueue alloc] init];
queue.maxConcurrentOperationCount = 10; // more does not seem to improve time
View
2  Classes/TranslationScraperOperation.m
@@ -22,7 +22,7 @@ @implementation TranslationScraperOperation
- (id) initForText:(NSString *)textToTrans fromLanguage:(NSString *)fromLang toLanguage:(NSString *)toLang delegate:(NSObject <TranslationScraperDelegate> *) transDelegate
{
- if (self = [super init])
+ if ((self = [super init]))
{
scraperDelegate = transDelegate;
View
2  Classes/XMLdocument.m
@@ -56,7 +56,7 @@ + (XMLdocument *) documentWithContentsOfURL:(NSURL *)url delegate:(id<XMLdocumen
// designated initializer
- (id) init
{
- if (self = [super init])
+ if ((self = [super init]))
{
}
View
2  Classes/XMLelement.m
@@ -16,7 +16,7 @@ @implementation XMLelement
- (id) initWithName:(NSString *)elementName
{
- if (self = [super init])
+ if ((self = [super init]))
{
self.name = elementName;
self.text = [NSMutableString string];
View
2  Classes/YahooFinance.m
@@ -39,7 +39,7 @@ + (YahooFinance *)sharedInstance
- (id) initWithAllCurrencies
{
- if (self = [super init])
+ if ((self = [super init]))
{
// the latested finance data is cached in the documents directory
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
View
2  MyAppSales.xcodeproj/project.pbxproj
@@ -2261,6 +2261,7 @@
buildSettings = {
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = NO;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES;
};
name = Debug;
@@ -2268,6 +2269,7 @@
1D6058950D05DD3E006BFB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
};
name = Release;
};
Please sign in to comment.
Something went wrong with that request. Please try again.