Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Add option to skip analytic url when open a link
Browse files Browse the repository at this point in the history
  • Loading branch information
haoict committed May 28, 2020
1 parent 56ccdd5 commit e45c6de
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Free & Open Source Tweak for Twitter app on iOS!
- Hide News and Trending posts in search tab
- Hide who to follow section
- Can Save Video (long press on video to save)
- Skip analytic URL when open a link
- Lightweight
- Support iOS 10 (not tested) - 11 (tested) - 12 (tested) - 13 (tested)
- Support latest Twitter version (If it doesn't work, you should update the app to latest version)
Expand Down
4 changes: 4 additions & 0 deletions Tweak.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@
@interface T1URTTimelineUserItemViewModel : NSObject
@property(readonly, nonatomic) NSString *scribeComponent;
@end

@interface TFSTwitterEntityURL : NSObject
@property(readonly, copy, nonatomic) NSString *expandedURL;
@end
14 changes: 14 additions & 0 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ BOOL noads;
BOOL hideNewsAndTrending;
BOOL hideWhoToFollow;
BOOL canSaveVideo;
BOOL skipAnalyticUrl;

static void reloadPrefs() {
NSDictionary *settings = [[NSMutableDictionary alloc] initWithContentsOfFile:@PLIST_PATH] ?: [@{} mutableCopy];
Expand All @@ -15,6 +16,7 @@ static void reloadPrefs() {
hideNewsAndTrending = [[settings objectForKey:@"hideNewsAndTrending"] ?: @(YES) boolValue];
hideWhoToFollow = [[settings objectForKey:@"hideWhoToFollow"] ?: @(YES) boolValue];
canSaveVideo = [[settings objectForKey:@"canSaveVideo"] ?: @(YES) boolValue];
skipAnalyticUrl = [[settings objectForKey:@"skipAnalyticUrl"] ?: @(YES) boolValue];
}

static void showDownloadPopup(id twStatus, UIViewController *viewController, void (^origHandler)(UIAlertAction *)) {
Expand Down Expand Up @@ -179,6 +181,14 @@ static void showDownloadPopup(id twStatus, UIViewController *viewController, voi
// %end
%end

%group SkipAnalyticUrl
%hook TFSTwitterEntityURL
- (NSString*)url{
return self.expandedURL;
}
%end
%end

%ctor {
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback) reloadPrefs, CFSTR(PREF_CHANGED_NOTIF), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
reloadPrefs();
Expand All @@ -188,4 +198,8 @@ static void showDownloadPopup(id twStatus, UIViewController *viewController, voi
if (canSaveVideo) {
%init(SaveVideo);
}

if (skipAnalyticUrl) {
%init(SkipAnalyticUrl);
}
}
3 changes: 2 additions & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: com.haoict.twitternoads
Name: Twitter No Ads
Depends: mobilesubstrate, preferenceloader, com.haoict.libhdev (>= 2.0.0), firmware (>= 10)
Version: 1.1.0
Version: 1.2.0
Architecture: iphoneos-arm
Description: Free & Open Source Tweak for Twitter
Free & Open Source Tweak for Twitter
Expand All @@ -12,6 +12,7 @@ Description: Free & Open Source Tweak for Twitter
- Hide News and Trending posts in search tab
- Hide who to follow section
- Can Save Video (long press on video to save)
- Skip analytic URL when open a link
- Lightweight
- Support iOS 10 (not tested) - 11 (tested) - 12 (tested) - 13 (tested)
- Support latest Twitter version (If it doesn't work, you should update the app to latest version)
Expand Down
19 changes: 19 additions & 0 deletions pref/Resources/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,25 @@
<string>com.haoict.twitternoadspref/PrefChanged</string>
</dict>

<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>cellClass</key>
<string>HPSSwitchCell</string>
<key>default</key>
<true/>
<key>defaults</key>
<string>com.haoict.twitternoadspref</string>
<key>key</key>
<string>skipAnalyticUrl</string>
<key>label</key>
<string>SKIP_ANALYTIC_URL</string>
<key>subtitle</key>
<string>SKIP_ANALYTIC_URL_WHEN_OPEN_A_LINK</string>
<key>PostNotification</key>
<string>com.haoict.twitternoadspref/PrefChanged</string>
</dict>

<!-- Support Me -->
<dict>
<key>cell</key>
Expand Down
2 changes: 2 additions & 0 deletions pref/Resources/base.lproj/Root.strings
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"HIDE_WHO_TO_FOLLOW_SECTION" = "Hide who to follow section";
"CAN_SAVE_VIDEO" = "Can Save Video";
"LONG_PRESS_ON_VIDEO_TO_SAVE" = "Long press on video to save";
"SKIP_ANALYTIC_URL" = "Skip Analytic URL";
"SKIP_ANALYTIC_URL_WHEN_OPEN_A_LINK" = "Skip analytic URL (t.co) when open a link";
"OTHER_PREFERENCES" = "Other Preferences";
"RESET_SETTINGS" = "Reset Settings";
"SUPPORT_ME" = "Support Me";
Expand Down
2 changes: 2 additions & 0 deletions pref/Resources/en.lproj/Root.strings
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"HIDE_WHO_TO_FOLLOW_SECTION" = "Hide who to follow section";
"CAN_SAVE_VIDEO" = "Can Save Video";
"LONG_PRESS_ON_VIDEO_TO_SAVE" = "Long press on video to save";
"SKIP_ANALYTIC_URL" = "Skip Analytic URL";
"SKIP_ANALYTIC_URL_WHEN_OPEN_A_LINK" = "Skip analytic URL (t.co) when open a link";
"OTHER_PREFERENCES" = "Other Preferences";
"RESET_SETTINGS" = "Reset Settings";
"SUPPORT_ME" = "Support Me";
Expand Down
2 changes: 2 additions & 0 deletions pref/Resources/vi.lproj/Root.strings
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"HIDE_WHO_TO_FOLLOW_SECTION" = "Ẩn mục gợi ý theo dõi";
"CAN_SAVE_VIDEO" = "Có thể tải video";
"LONG_PRESS_ON_VIDEO_TO_SAVE" = "Ấn và giữ video để lưu";
"SKIP_ANALYTIC_URL" = "Bỏ qua Analytic URL";
"SKIP_ANALYTIC_URL_WHEN_OPEN_A_LINK" = "Bỏ qua analytic URL (t.co) khi mở link";
"OTHER_PREFERENCES" = "Tùy chỉnh phụ";
"RESET_SETTINGS" = "Đặt lại tùy chỉnh";
"SUPPORT_ME" = "Hỗ trợ tôi";
Expand Down
Binary file not shown.

0 comments on commit e45c6de

Please sign in to comment.