Skip to content

Commit e812590

Browse files
committed
Release 1.0.1
1 parent c484393 commit e812590

File tree

3 files changed

+122
-26
lines changed

3 files changed

+122
-26
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
## Requirements
2929

3030
- iOS 5.0+
31-
- Pinterest app version 2.6+ installed (older versions may work too)
31+
- Pinterest app version 2.6+ (tested with versions 2.6+, 3.4.1, and 3.8.1)
3232
- MobileSubstrate
3333

3434
## Installation
@@ -49,6 +49,15 @@
4949

5050
4. Respring your device
5151

52+
## Version History
53+
54+
### v1.0.1
55+
- Fixed a bug that caused the SpringBoard to crash
56+
- Fixed an issue where Pinterest sometimes wasn't patched
57+
58+
### v1.0.0
59+
- Initial release
60+
5261
## To Do
5362

5463
- [ ] Add support for older Pinterest versions (if possible)

Tweak.x

Lines changed: 107 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,140 @@
11
#import <Foundation/Foundation.h>
22
#import <UIKit/UIKit.h>
33

4+
// Helper function to verify if previously fixed Pinterest still exists
5+
BOOL verifyPinterestFix() {
6+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
7+
NSString *savedPath = [defaults objectForKey:@"PinterestFixPath"];
8+
NSString *savedVersion = [defaults objectForKey:@"PinterestFixVersion"];
9+
10+
if (!savedPath || !savedVersion) {
11+
NSLog(@"[PinterestFix] No saved Pinterest fix data found");
12+
return NO;
13+
}
14+
15+
NSFileManager *fileManager = [NSFileManager defaultManager];
16+
if (![fileManager fileExistsAtPath:savedPath]) {
17+
NSLog(@"[PinterestFix] Previously fixed Pinterest no longer exists at: %@", savedPath);
18+
// Clear the saved data since Pinterest was uninstalled/reinstalled
19+
[defaults removeObjectForKey:@"PinterestFixPath"];
20+
[defaults removeObjectForKey:@"PinterestFixVersion"];
21+
[defaults setBool:NO forKey:@"PinterestFixApplied"];
22+
[defaults synchronize];
23+
return NO;
24+
}
25+
26+
// Verify the fix is still applied
27+
NSDictionary *infoDict = [NSDictionary dictionaryWithContentsOfFile:savedPath];
28+
if (infoDict) {
29+
NSString *currentVersion = [infoDict objectForKey:@"CFBundleVersion"];
30+
NSString *currentShortVersion = [infoDict objectForKey:@"CFBundleShortVersionString"];
31+
32+
if ([currentVersion isEqualToString:@"13.28"] && [currentShortVersion isEqualToString:@"13.28"]) {
33+
NSLog(@"[PinterestFix] Previously fixed Pinterest still has correct versions");
34+
return YES;
35+
} else {
36+
NSLog(@"[PinterestFix] Previously fixed Pinterest versions changed - Version: %@, Short: %@", currentVersion, currentShortVersion);
37+
// Clear the saved data since Pinterest was updated/downgraded
38+
[defaults removeObjectForKey:@"PinterestFixPath"];
39+
[defaults removeObjectForKey:@"PinterestFixVersion"];
40+
[defaults setBool:NO forKey:@"PinterestFixApplied"];
41+
[defaults synchronize];
42+
return NO;
43+
}
44+
}
45+
46+
return NO;
47+
}
48+
449
// Helper function to find and fix Pinterest Info.plist
550
void findAndFixPinterest() {
51+
NSLog(@"[PinterestFix] Starting Pinterest fix scan...");
52+
653
NSFileManager *fileManager = [NSFileManager defaultManager];
754
NSString *applicationsPath = @"/var/mobile/Applications";
855

956
if (![fileManager fileExistsAtPath:applicationsPath]) {
57+
NSLog(@"[PinterestFix] Applications path not found: %@", applicationsPath);
1058
return;
1159
}
1260

61+
NSLog(@"[PinterestFix] Scanning applications directory: %@", applicationsPath);
62+
1363
NSError *error;
1464
NSArray *appDirs = [fileManager contentsOfDirectoryAtPath:applicationsPath error:&error];
1565

1666
if (error) {
67+
NSLog(@"[PinterestFix] Error reading applications directory: %@", error);
1768
return;
1869
}
1970

20-
// Quick check: if Pinterest is already fixed, skip scanning
21-
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
22-
if ([defaults boolForKey:@"PinterestFixApplied"]) {
71+
NSLog(@"[PinterestFix] Found %lu application directories", (unsigned long)[appDirs count]);
72+
73+
// First, verify if previously fixed Pinterest still exists and is still fixed
74+
if (verifyPinterestFix()) {
75+
NSLog(@"[PinterestFix] Previously fixed Pinterest verified, skipping scan");
2376
return;
2477
}
2578

79+
NSLog(@"[PinterestFix] Pinterest needs fixing, scanning for installations...");
80+
2681
// Look for Pinterest app
2782
for (NSString *appDir in appDirs) {
2883
NSString *fullAppPath = [applicationsPath stringByAppendingPathComponent:appDir];
2984
NSString *infoPlistPath = [fullAppPath stringByAppendingPathComponent:@"Info.plist"];
3085

86+
NSLog(@"[PinterestFix] Checking app directory: %@", appDir);
87+
3188
if ([fileManager fileExistsAtPath:infoPlistPath]) {
3289
NSDictionary *infoDict = [NSDictionary dictionaryWithContentsOfFile:infoPlistPath];
3390
if (infoDict) {
3491
NSString *bundleID = [infoDict objectForKey:@"CFBundleIdentifier"];
3592
NSString *appName = [infoDict objectForKey:@"CFBundleDisplayName"];
3693

94+
NSLog(@"[PinterestFix] Found app: %@ (%@)", appName ?: @"Unknown", bundleID ?: @"Unknown");
95+
3796
// Check if this is Pinterest
3897
if ([bundleID isEqualToString:@"com.coldbrewlabs.pinterest"] ||
3998
[bundleID isEqualToString:@"com.pinterest"] ||
4099
[bundleID isEqualToString:@"com.pinterest.app"] ||
41100
(appName && [appName hasPrefix:@"Pinterest"]) ||
42101
(bundleID && [bundleID hasPrefix:@"com.pinterest"])) {
43102

103+
NSLog(@"[PinterestFix] Found Pinterest! Bundle ID: %@, Name: %@", bundleID, appName);
104+
44105
// Check if already fixed
45106
NSString *currentVersion = [infoDict objectForKey:@"CFBundleVersion"];
46107
NSString *currentShortVersion = [infoDict objectForKey:@"CFBundleShortVersionString"];
108+
NSLog(@"[PinterestFix] Current versions - Version: %@, Short: %@", currentVersion, currentShortVersion);
109+
47110
if ([currentVersion isEqualToString:@"13.28"] && [currentShortVersion isEqualToString:@"13.28"]) {
111+
NSLog(@"[PinterestFix] Pinterest already fixed at: %@", infoPlistPath);
112+
// Mark this specific Pinterest installation as fixed
113+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
114+
[defaults setObject:infoPlistPath forKey:@"PinterestFixPath"];
115+
[defaults setObject:currentVersion forKey:@"PinterestFixVersion"];
116+
[defaults setBool:YES forKey:@"PinterestFixApplied"];
117+
[defaults synchronize];
48118
return;
49119
}
50120

51121
// Apply the fix
122+
NSLog(@"[PinterestFix] Applying fix to Pinterest Info.plist");
52123
NSMutableDictionary *mutableInfoDict = [infoDict mutableCopy];
53124
[mutableInfoDict setObject:@"13.28" forKey:@"CFBundleVersion"];
54125
[mutableInfoDict setObject:@"13.28" forKey:@"CFBundleShortVersionString"];
55-
[mutableInfoDict writeToFile:infoPlistPath atomically:YES];
56126

57-
// Mark as fixed to avoid future scans
127+
BOOL success = [mutableInfoDict writeToFile:infoPlistPath atomically:YES];
128+
if (success) {
129+
NSLog(@"[PinterestFix] Successfully applied fix to Pinterest!");
130+
} else {
131+
NSLog(@"[PinterestFix] Failed to write Info.plist file");
132+
}
133+
134+
// Mark this specific Pinterest installation as fixed
58135
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
136+
[defaults setObject:infoPlistPath forKey:@"PinterestFixPath"];
137+
[defaults setObject:@"13.28" forKey:@"PinterestFixVersion"];
59138
[defaults setBool:YES forKey:@"PinterestFixApplied"];
60139
[defaults synchronize];
61140
return;
@@ -85,16 +164,33 @@ void findAndFixPinterest() {
85164

86165
NSString *currentVersion = [appInfoDict objectForKey:@"CFBundleVersion"];
87166
NSString *currentShortVersion = [appInfoDict objectForKey:@"CFBundleShortVersionString"];
167+
NSLog(@"[PinterestFix] App bundle versions - Version: %@, Short: %@", currentVersion, currentShortVersion);
168+
88169
if ([currentVersion isEqualToString:@"13.28"] && [currentShortVersion isEqualToString:@"13.28"]) {
170+
NSLog(@"[PinterestFix] Pinterest app bundle already fixed at: %@", appInfoPlistPath);
171+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
172+
[defaults setObject:appInfoPlistPath forKey:@"PinterestFixPath"];
173+
[defaults setObject:currentVersion forKey:@"PinterestFixVersion"];
174+
[defaults setBool:YES forKey:@"PinterestFixApplied"];
175+
[defaults synchronize];
89176
return;
90177
}
91178

179+
NSLog(@"[PinterestFix] Applying fix to Pinterest app bundle Info.plist");
92180
NSMutableDictionary *mutableInfoDict = [appInfoDict mutableCopy];
93181
[mutableInfoDict setObject:@"13.28" forKey:@"CFBundleVersion"];
94182
[mutableInfoDict setObject:@"13.28" forKey:@"CFBundleShortVersionString"];
95-
[mutableInfoDict writeToFile:appInfoPlistPath atomically:YES];
183+
184+
BOOL success = [mutableInfoDict writeToFile:appInfoPlistPath atomically:YES];
185+
if (success) {
186+
NSLog(@"[PinterestFix] Successfully applied fix to Pinterest app bundle!");
187+
} else {
188+
NSLog(@"[PinterestFix] Failed to write app bundle Info.plist file");
189+
}
96190

97191
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
192+
[defaults setObject:appInfoPlistPath forKey:@"PinterestFixPath"];
193+
[defaults setObject:@"13.28" forKey:@"PinterestFixVersion"];
98194
[defaults setBool:YES forKey:@"PinterestFixApplied"];
99195
[defaults synchronize];
100196
return;
@@ -106,30 +202,21 @@ void findAndFixPinterest() {
106202
}
107203
}
108204
}
205+
206+
NSLog(@"[PinterestFix] Pinterest not found in applications directory");
109207
}
110208

111209
%hook SpringBoard
112210

113211
- (void)applicationDidFinishLaunching:(UIApplication *)application {
114212
%orig;
115213

214+
NSLog(@"[PinterestFix] SpringBoard launched, applying Pinterest fix...");
215+
116216
// Apply fix immediately on SpringBoard launch
117217
findAndFixPinterest();
118218

119-
// Monitor for Pinterest launches
120-
[[NSNotificationCenter defaultCenter] addObserver:self
121-
selector:@selector(pinterestLaunched:)
122-
name:@"UIApplicationDidFinishLaunchingNotification"
123-
object:nil];
124-
}
125-
126-
- (void)pinterestLaunched:(NSNotification *)notification {
127-
NSDictionary *userInfo = notification.userInfo;
128-
NSString *bundleID = [userInfo objectForKey:@"UIApplicationLaunchOptionsBundleIdentifierKey"];
129-
130-
if ([bundleID isEqualToString:@"com.coldbrewlabs.pinterest"]) {
131-
findAndFixPinterest();
132-
}
219+
NSLog(@"[PinterestFix] Pinterest fix scan completed");
133220
}
134221

135222
%end

control

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Package: com.victorlobe.pinterestfix
22
Name: PinterestFix
3-
Version: 1.0.0
3+
Version: 1.0.1
44
Architecture: iphoneos-arm
5-
Description: Fixes Pinterest on iOS 5+
6-
Maintainer: Victor
7-
Author: Victor
5+
Description: Fixes Pinterest on iOS 5+ Needs Pinterest version 2.6+
6+
Maintainer: Victor <[email protected]>
7+
Author: Victor <[email protected]>
88
Section: Tweaks
9-
Depends: mobilesubstrate (>= 0.9.5000)
9+
Depends: mobilesubstrate (>= 0.9.5000)

0 commit comments

Comments
 (0)