diff --git a/README.md b/README.md index 0e8ec83..474db4d 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/Tweak.h b/Tweak.h index 8369ef1..c8794aa 100644 --- a/Tweak.h +++ b/Tweak.h @@ -64,3 +64,7 @@ @interface T1URTTimelineUserItemViewModel : NSObject @property(readonly, nonatomic) NSString *scribeComponent; @end + +@interface TFSTwitterEntityURL : NSObject +@property(readonly, copy, nonatomic) NSString *expandedURL; +@end \ No newline at end of file diff --git a/Tweak.xm b/Tweak.xm index 71044cc..fab0db5 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -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]; @@ -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 *)) { @@ -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(); @@ -188,4 +198,8 @@ static void showDownloadPopup(id twStatus, UIViewController *viewController, voi if (canSaveVideo) { %init(SaveVideo); } + + if (skipAnalyticUrl) { + %init(SkipAnalyticUrl); + } } diff --git a/control b/control index 0b2815a..cbdade1 100644 --- a/control +++ b/control @@ -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 @@ -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) diff --git a/pref/Resources/Root.plist b/pref/Resources/Root.plist index 903a8fb..0ffe389 100755 --- a/pref/Resources/Root.plist +++ b/pref/Resources/Root.plist @@ -111,6 +111,25 @@ com.haoict.twitternoadspref/PrefChanged + + cell + PSSwitchCell + cellClass + HPSSwitchCell + default + + defaults + com.haoict.twitternoadspref + key + skipAnalyticUrl + label + SKIP_ANALYTIC_URL + subtitle + SKIP_ANALYTIC_URL_WHEN_OPEN_A_LINK + PostNotification + com.haoict.twitternoadspref/PrefChanged + + cell diff --git a/pref/Resources/base.lproj/Root.strings b/pref/Resources/base.lproj/Root.strings index a09620d..9ff6e20 100644 --- a/pref/Resources/base.lproj/Root.strings +++ b/pref/Resources/base.lproj/Root.strings @@ -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"; diff --git a/pref/Resources/en.lproj/Root.strings b/pref/Resources/en.lproj/Root.strings index a09620d..9ff6e20 100644 --- a/pref/Resources/en.lproj/Root.strings +++ b/pref/Resources/en.lproj/Root.strings @@ -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"; diff --git a/pref/Resources/vi.lproj/Root.strings b/pref/Resources/vi.lproj/Root.strings index a6d3866..e94dd28 100644 --- a/pref/Resources/vi.lproj/Root.strings +++ b/pref/Resources/vi.lproj/Root.strings @@ -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"; diff --git a/release/com.haoict.twitternoads_1.2.0_iphoneos-arm.deb b/release/com.haoict.twitternoads_1.2.0_iphoneos-arm.deb new file mode 100644 index 0000000..2cbfb66 Binary files /dev/null and b/release/com.haoict.twitternoads_1.2.0_iphoneos-arm.deb differ