Skip to content

Commit

Permalink
Removed unneccesary logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesperflodin1 committed Aug 23, 2018
1 parent ff228c4 commit 39dfb33
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
2 changes: 0 additions & 2 deletions JFLog.m

This file was deleted.

28 changes: 14 additions & 14 deletions JFTHRingtoneDataController.m
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ - (void)loadTweakPlist {
_importedRingtonesPlist = [[NSMutableDictionary alloc] init];
NSMutableDictionary *importedRingtones = [[NSMutableDictionary alloc] init];
[_importedRingtonesPlist setObject:importedRingtones forKey:@"Ringtones"];
DLog(@"Creating new tweak plist");
ALog(@"Creating new tweak plist");
}

}
Expand Down Expand Up @@ -157,21 +157,21 @@ - (BOOL)loadRingtonesPlist {
return YES;
}
- (void)saveTweakPlist {
DLog(@"Saving tweak plist");
ALog(@"Saving tweak plist");
NSError *serError;
NSData *newData = [NSPropertyListSerialization dataWithPropertyList: _importedRingtonesPlist
format: NSPropertyListXMLFormat_v1_0
options: 0
error: &serError];
if (!newData)
DLog(@"Error serializing tweak plist: %@",serError);
ALog(@"Error serializing tweak plist: %@",serError);
NSError *writeError;
if (![newData writeToFile:TONEHELPERDATA_PLIST_PATH options:NSDataWritingAtomic error:&writeError])
DLog(@"Error writing tweak plist: %@",writeError);
ALog(@"Error writing tweak plist: %@",writeError);
}
- (void)saveRingtonesPlist {
// Folder may not exist, try to create it
DLog(@"Saving Ringtones.plist");
ALog(@"Saving Ringtones.plist");

//Write plist
NSError *serError;
Expand All @@ -180,11 +180,11 @@ - (void)saveRingtonesPlist {
options: 0
error: &serError];
if (!newData)
DLog(@"Error serializing ringtones plist: %@",serError);
ALog(@"Error serializing ringtones plist: %@",serError);

NSError *writeError;
if (![newData writeToFile:RINGTONE_PLIST_PATH options:NSDataWritingAtomic error:&writeError])
DLog(@"Error writing ringtone plist: %@",writeError);
ALog(@"Error writing ringtone plist: %@",writeError);
}
- (void)save {
ALog(@"Saving plists");
Expand All @@ -206,7 +206,7 @@ - (void)addRingtoneToPlist:(NSString *)name
NSNumber *tonePID = [NSNumber numberWithLongLong:[[self randomizedRingtoneParameter:JFTHRingtonePID] longLongValue]];

if (self.shouldWriteITunesRingtonePlist) {
DLog(@"Adding ringtone i itunes plist: %@", name);
ALog(@"Adding ringtone i itunes plist: %@", name);
// Does this ringtone already exist in itunes ringtone plist?


Expand Down Expand Up @@ -261,7 +261,7 @@ - (NSDictionary *)getRingtoneWithName:(NSString *)name {
NSDictionary *ringtones = [self getImportedRingtones];
for (NSString *item in ringtones) {
if ([[[ringtones objectForKey:item] objectForKey:@"Name"] isEqualToString:name]) {
DLog(@"Ringtone Importer: Found ringtone that already is imported based on filename, skipping. (%@)",item);
ALog(@"Ringtone Importer: Found ringtone that already is imported based on filename, skipping. (%@)",item);
return [ringtones objectForKey:item];
}
}
Expand All @@ -271,7 +271,7 @@ - (NSDictionary *)getRingtoneWithHash:(NSString *)md5 {
NSDictionary *ringtones = [self getImportedRingtones];
for (NSString *item in ringtones) {
if ([[[ringtones objectForKey:item] objectForKey:@"Hash"] isEqualToString:md5]) {
DLog(@"Ringtone Importer: Found ringtone that already is imported based on hash, skipping. (%@)",item);
ALog(@"Ringtone Importer: Found ringtone that already is imported based on hash, skipping. (%@)",item);
return [ringtones objectForKey:item];
}
}
Expand All @@ -282,7 +282,7 @@ - (NSDictionary *)getITunesRingtoneWithGUID:(NSString *)guid {
DLog(@"Read itunes plist: %@",ringtones);
for (NSString *item in ringtones) {
if ([[[ringtones objectForKey:item] objectForKey:@"GUID"] isEqualToString:guid]) {
DLog(@"Ringtone Importer: Found ringtone that already is imported based on GUID, skipping. (%@)",item);
ALog(@"Ringtone Importer: Found ringtone that already is imported based on GUID, skipping. (%@)",item);
return [ringtones objectForKey:item];
}
}
Expand All @@ -293,7 +293,7 @@ - (NSDictionary *)getITunesRingtoneWithName:(NSString *)name {
DLog(@"Read itunes plist: %@",ringtones);
for (NSString *item in ringtones) {
if ([[[ringtones objectForKey:item] objectForKey:@"Name"] isEqualToString:name]) {
DLog(@"Ringtone Importer: Found ringtone in itunes plist that already is imported based on Name, skipping. (%@)",item);
ALog(@"Ringtone Importer: Found ringtone in itunes plist that already is imported based on Name, skipping. (%@)",item);
return [ringtones objectForKey:item];
}
}
Expand Down Expand Up @@ -356,13 +356,13 @@ + (void)syncPlists:(BOOL)currentITunesWriteStatus {
// this ringtone exists in itunes plist
if (!currentITunesWriteStatus) {
// and it should not exist there
DLog(@"Deleting ringtone from itunes plist: %@",[importedTones objectForKey:file]);
ALog(@"Deleting ringtone from itunes plist: %@",[importedTones objectForKey:file]);
[toneData deleteRingtoneFromITunesPlist:file];
}
} else if (currentITunesWriteStatus) {
// does not exist in itunes plist
// and it should exist there. Add it
DLog(@"Adding ringtone to itunes plist: %@",[importedTones objectForKey:file]);
ALog(@"Adding ringtone to itunes plist: %@",[importedTones objectForKey:file]);
NSMutableDictionary *currentTone = [[NSMutableDictionary alloc] init];
[currentTone setObject:[[importedTones objectForKey:file] objectForKey:@"GUID"] forKey:@"GUID"];
[currentTone setObject:[[importedTones objectForKey:file] objectForKey:@"Name"] forKey:@"Name"];
Expand Down
8 changes: 4 additions & 4 deletions JFTHRingtoneImporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ - (void)getRingtoneFilesFromApp:(NSString *)bundleID {
NSMutableArray *m4rFiles = [[NSMutableArray alloc] init];
if (!appDirFiles) // App unavailable or folder unavailable, not adding
return;
DLog (@"Ringtone Importer: App folder available!");
ALog (@"Ringtone Importer: App folder available!");

if (!([appDirFiles count] > 0)) // Nothing to import for this app
return;
DLog (@"Ringtone Importer: Found %lu files", (unsigned long)[appDirFiles count]);
ALog (@"Ringtone Importer: Found %lu files", (unsigned long)[appDirFiles count]);

for (NSString *file in appDirFiles) {
if ([[file pathExtension] isEqualToString: @"m4r"]) {
Expand All @@ -60,15 +60,15 @@ - (void)getRingtoneFilesFromApp:(NSString *)bundleID {
continue;
}
// Does this name already exist in itunes plist?
NSString *baseName = [self createNameFromFile:appDirFile];
NSString *baseName = [self createNameFromFile:file];
if ([_ringtoneData getITunesRingtoneWithName:baseName]) {
ALog(@"Ringtone is already in itunes plist, name: %@", baseName);
continue;
}
if ([_ringtoneData getRingtoneWithHash:[FileHash md5HashOfFileAtPath:[appDirectory stringByAppendingPathComponent:file]]]) {
continue;
}
DLog(@"Adding ringtone to be imported: %@", file);
ALog(@"Adding ringtone to be imported: %@", file);
[m4rFiles addObject:file];
}
}
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ DEBUG = 1
FINALPACKAGE = 0

TWEAK_NAME = ToneHelper
ToneHelper_FILES = Tweak.xm JFLog.m $(wildcard *.m) $(wildcard JGProgressHUD/*.m)
ToneHelper_FILES = Tweak.xm $(wildcard *.m) $(wildcard JGProgressHUD/*.m)

ToneHelper_CFLAGS = -fobjc-arc -Wno-deprecated-declarations

Expand Down
2 changes: 1 addition & 1 deletion thprefsbundle/JFTHRingtoneListController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ - (id)specifiers {

for (NSString *fileName in ringtones) {
NSDictionary *currentTone = [ringtones objectForKey:fileName];
DLog(@"Adding ringtone: %@",[ringtones objectForKey:fileName]);
ALog(@"Adding ringtone: %@",[ringtones objectForKey:fileName]);
PSSpecifier* tone = [PSSpecifier preferenceSpecifierNamed:[currentTone objectForKey:@"Name"]
target:self
set:NULL
Expand Down

0 comments on commit 39dfb33

Please sign in to comment.