diff --git a/.gitignore b/.gitignore index cd0b69e..4c1158c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .theos packages -HAOUtils* \ No newline at end of file +HAOUtils* +**/.DS_Store diff --git a/Makefile b/Makefile index a9b5734..edd3662 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,15 @@ ARCHS = arm64 arm64e -TARGET = iphone:clang:12.4:10.0 +TARGET = iphone:clang:13.6:12.0 INSTALL_TARGET_PROCESSES = Twitter Preferences +PREFIX = "$(THEOS)/toolchain/XcodeDefault-11.5.xctoolchain/usr/bin/" + include $(THEOS)/makefiles/common.mk TWEAK_NAME = twitternoads twitternoads_FILES = $(wildcard *.xm *.m) twitternoads_EXTRA_FRAMEWORKS = libhdev -twitternoads_CFLAGS = -fobjc-arc +twitternoads_CFLAGS = -fobjc-arc -std=c++11 include $(THEOS_MAKE_PATH)/tweak.mk diff --git a/README.md b/README.md index 3740787..005f9ba 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ Free & Open Source Tweak for Twitter app on iOS! - 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) +- Support iOS 12 - 14 & latest Twitter version ## Cydia Repo diff --git a/Tweak.xm b/Tweak.xm index e15ced7..25eccf5 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -17,28 +17,25 @@ static void reloadPrefs() { nofleets = [[settings objectForKey:@"nofleets"] ?: @(NO) boolValue]; hideNewsAndTrending = [[settings objectForKey:@"hideNewsAndTrending"] ?: @(NO) boolValue]; hideWhoToFollow = [[settings objectForKey:@"hideWhoToFollow"] ?: @(NO) boolValue]; - canSaveVideo = [[settings objectForKey:@"canSaveVideo"] ?: @(NO) boolValue]; + canSaveVideo = [[settings objectForKey:@"canSaveVideo"] ?: @(YES) boolValue]; skipAnalyticUrl = [[settings objectForKey:@"skipAnalyticUrl"] ?: @(NO) boolValue]; } static void showDownloadPopup(id twStatus, UIViewController *viewController, void (^origHandler)(UIAlertAction *)) { UIAlertController* alert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:IS_iPAD ? UIAlertControllerStyleAlert : UIAlertControllerStyleActionSheet]; [alert addAction:[UIAlertAction actionWithTitle:@"Save Video" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - NSString* videoUrl = nil; - if ([twStatus isKindOfClass:%c(TFNTwitterStatus)]) { - videoUrl = ((TFNTwitterStatus *)twStatus).primaryMediaVideoURL; - } - // if primary video is m3u8 format, we can't save it, thus we have to look for another place to find .mp4 and save highest bitrate - if (!videoUrl || [videoUrl containsString:@".m3u8"]) { - long long bitrate = 0; - for (TFSTwitterEntityMediaVideoVariant *video in ((id)twStatus).primaryMediaInfo.mediaEntity.videoInfo.variants) { - if ([video.contentType isEqualToString:@"video/mp4"] && video.bitrate > bitrate) { - bitrate = video.bitrate; - videoUrl = video.url; - } + UIAlertController* qualitySelectionAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:IS_iPAD ? UIAlertControllerStyleAlert : UIAlertControllerStyleActionSheet]; + + int linkCount = 1; + for (TFSTwitterEntityMediaVideoVariant *video in ((id)twStatus).primaryMediaInfo.mediaEntity.videoInfo.variants) { + if ([video.contentType isEqualToString:@"video/mp4"]) { + [qualitySelectionAlert addAction:[UIAlertAction actionWithTitle:[NSString stringWithFormat:@"Link %d (bitrate: %lld)", linkCount++, video.bitrate] style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { + [[[HDownloadMediaWithProgress alloc] init] checkPermissionToPhotosAndDownload:video.url appendExtension:nil mediaType:Video toAlbum:@"Twitter" viewController:viewController]; + }]]; } } - [[[HDownloadMediaWithProgress alloc] init] checkPermissionToPhotosAndDownload:videoUrl appendExtension:nil mediaType:Video toAlbum:@"Twitter" viewController:viewController]; + [qualitySelectionAlert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; + [viewController presentViewController:qualitySelectionAlert animated:YES completion:nil]; }]]; [alert addAction:[UIAlertAction actionWithTitle:@"Twitter Options" style:UIAlertActionStyleDefault handler:origHandler]]; [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]]; @@ -86,6 +83,11 @@ static void showDownloadPopup(id twStatus, UIViewController *viewController, voi return tbvCell; } + if ([itemClassName isEqualToString:@"T1Twitter.URTTimelineCarouselViewModel"]) { + [tbvCell setHidden: YES]; + return tbvCell; + } + if ([itemClassName isEqualToString:@"T1URTFooterViewModel"] && [((T1URTFooterViewModel *)item).url.absoluteString containsString:@"connect_people"] ) { [tbvCell setHidden: YES]; return tbvCell; @@ -130,6 +132,10 @@ static void showDownloadPopup(id twStatus, UIViewController *viewController, voi return 0; } + if ([itemClassName isEqualToString:@"T1Twitter.URTTimelineCarouselViewModel"]) { + return 0; + } + if ([itemClassName isEqualToString:@"T1URTFooterViewModel"] && [((T1URTFooterViewModel *)item).url.absoluteString containsString:@"connect_people"] ) { return 0; } diff --git a/control b/control index 9a946b3..6824d91 100644 --- a/control +++ b/control @@ -1,7 +1,7 @@ Package: com.haoict.twitternoads Name: Twitter No Ads -Depends: mobilesubstrate, preferenceloader, com.haoict.libhdev (>= 4.5.0), firmware (>= 10) -Version: 1.3.0 +Depends: mobilesubstrate, preferenceloader, com.haoict.libhdev (>= 4.8.0), firmware (>= 12) +Version: 1.4.0 Architecture: iphoneos-arm Description: Free & Open Source Tweak for Twitter Free & Open Source Tweak for Twitter @@ -15,8 +15,7 @@ Description: Free & Open Source Tweak for Twitter - 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) + - Support iOS 12 - 14 & latest Twitter app . I work very hard to make good, free and open source tweaks for everyone If you want to support, you can buy me a coffee at https://www.paypal.me/haoict diff --git a/pref/Resources/Root.plist b/pref/Resources/Root.plist index 006db0d..59538cc 100755 --- a/pref/Resources/Root.plist +++ b/pref/Resources/Root.plist @@ -102,7 +102,7 @@ cellClass HPSSwitchCell default - + defaults com.haoict.twitternoadspref key diff --git a/pref/Resources/zh.lproj/Root.strings b/pref/Resources/zh.lproj/Root.strings new file mode 100644 index 0000000..c71f385 --- /dev/null +++ b/pref/Resources/zh.lproj/Root.strings @@ -0,0 +1,30 @@ +{ + "HIDE_NEWS_AND_TRENDING_POST_ON_SEARCH_TAB": "在“搜索”选项卡上删除“新闻和趋势”帖子", + "CAN_SAVE_VIDEO": "启动保存视频", + "DONATION": "捐赠", + "FOUND_A_BUG": "报告错误", + "CONFIRM": "确认", + "LEAVE_A_BUG_REPORT_ON_GITHUB": "在 Github 上留下错误报告", + "OTHER_PREFERENCES": "其他偏好", + "REMOVE_ADS_IN_NEWS_FEED": "删除信息流中的广告", + "REMOVE_FLEETS_IN_NEWS_FEED": "删除信息流中的Fleets ", + "SEND_ME_AN_EMAIL_WITH_YOUR_REQUEST": "给我发送您的电子邮件请求", + "SKIP_ANALYTIC_URL": "跳过分析网址", + "SKIP_ANALYTIC_URL_WHEN_OPEN_A_LINK": "打开链接时跳过分析网址(t.co)", + "HIDE_WHO_TO_FOLLOW_SECTION": "去除首页顶部出现的推荐用户头像", + "HIDE_NEWS_AND_TRENDING": "屏蔽新闻和趋势", + "HIDE_WHO_TO_FOLLOW": "屏蔽要关注的人", + "CANCEL": "取消", + "LONG_PRESS_ON_VIDEO_TO_SAVE": "长按视频保存", + "APPLY": "重启应用", + "FEATURE_REQUEST": "功能要求", + "NO_FLEETS": "去除 Fleets", + "BUY_ME_A_COFFEE": "请我喝杯咖啡", + "SOURCE_CODE": "源码", + "NO_ADS": "去除广告", + "RESET_SETTINGS": "重置", + "SUPPORT_ME": "支持", + "DEFAULT": "默认", + "DO_YOU_REALLY_WANT_TO_KILL_TWITTER": "您真的要结束 Twitter 吗?", + "MAIN_PREFERENCES": "主要偏好" +} \ No newline at end of file diff --git a/release/com.haoict.twitternoads_1.4.0_iphoneos-arm.deb b/release/com.haoict.twitternoads_1.4.0_iphoneos-arm.deb new file mode 100644 index 0000000..21ff6ff Binary files /dev/null and b/release/com.haoict.twitternoads_1.4.0_iphoneos-arm.deb differ