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

Commit

Permalink
Make option to show/hide download button at top right corner
Browse files Browse the repository at this point in the history
  • Loading branch information
haoict committed Jun 20, 2020
1 parent e463400 commit 1c4dbdb
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 14 deletions.
29 changes: 19 additions & 10 deletions Tweak.xm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ BOOL autoPlayNextVideo;
BOOL changeRegion;
BOOL showProgressBar;
BOOL canHideUI;
BOOL showAdditionalDownloadButton;
NSDictionary *region;

static void reloadPrefs() {
Expand All @@ -23,6 +24,7 @@ static void reloadPrefs() {
region = [settings objectForKey:@"region"] ?: [@{} mutableCopy];
showProgressBar = [[settings objectForKey:@"showProgressBar"] ?: @(NO) boolValue];
canHideUI = [[settings objectForKey:@"canHideUI"] ?: @(YES) boolValue];
showAdditionalDownloadButton = [[settings objectForKey:@"showAdditionalDownloadButton"] ?: @(NO) boolValue];
}

%group CoreLogic
Expand Down Expand Up @@ -122,7 +124,7 @@ static void reloadPrefs() {
- (void)viewDidLoad {
%orig;

if (downloadWithoutWatermark) {
if (downloadWithoutWatermark && showAdditionalDownloadButton) {
self.hDownloadButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.hDownloadButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
[self.hDownloadButton addTarget:self action:@selector(hDownloadButtonPressed:) forControlEvents:UIControlEventTouchUpInside];
Expand Down Expand Up @@ -169,7 +171,6 @@ static void reloadPrefs() {
}

if (canHideUI) {
// add hide/show ui button
AWEFeedContainerViewController *afcVC = (AWEFeedContainerViewController *)[%c(AWEFeedContainerViewController) sharedInstance];
self.hideUIButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.hideUIButton.titleLabel setFont:[UIFont systemFontOfSize:15]];
Expand Down Expand Up @@ -280,12 +281,16 @@ static void reloadPrefs() {

%hook AWEDownloadShareChannel
- (void)startDownloadingWithCompletion:(id)arg1 {
%orig;
// if (!downloadWithoutWatermark) {
// %orig;
// return;
// }
// [HDownloadMedia checkPermissionToPhotosAndDownload:self.downloadOptions.awemeModel.video.playURL.originURLList.firstObject appendExtension:@"mp4" mediaType:Video toAlbum:@"TikTok"];
if (!downloadWithoutWatermark) {
%orig;
return;
}
NSString *videoURLString = self.downloadOptions.awemeModel.video.playURL.originURLList.firstObject;
if ([videoURLString containsString:@".m3u8"]) {
[HCommon showAlertMessage:@"This video format is not supported (.m3u8 file extension)" withTitle:@"Not supported" viewController:nil];
%orig;
}
[HDownloadMedia checkPermissionToPhotosAndDownload:videoURLString appendExtension:@"mp4" mediaType:Video toAlbum:@"TikTok"];
}
%end

Expand All @@ -295,8 +300,12 @@ static void reloadPrefs() {
%orig;
return;
}
[HDownloadMedia checkPermissionToPhotosAndDownload:self.model.video.playURL.originURLList.firstObject appendExtension:@"mp4" mediaType:Video toAlbum:@"TikTok"];
// [[[HDownloadMediaWithProgress alloc] init] checkPermissionToPhotosAndDownload:self.model.video.playURL.originURLList.firstObject appendExtension:@"mp4" mediaType:Video toAlbum:@"TikTok" viewController:self.viewController];
NSString *videoURLString = self.model.video.playURL.originURLList.firstObject;
if ([videoURLString containsString:@".m3u8"]) {
[HCommon showAlertMessage:@"This video format is not supported (.m3u8 file extension)" withTitle:@"Not supported" viewController:nil];
%orig;
}
[[[HDownloadMediaWithProgress alloc] init] checkPermissionToPhotosAndDownload:videoURLString appendExtension:@"mp4" mediaType:Video toAlbum:@"TikTok" viewController:self.viewController];
}
%end
%end
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: com.haoict.tiktokgod
Name: TikTok God
Depends: mobilesubstrate, preferenceloader, com.haoict.libhdev (>= 4.1.0), firmware (>= 10)
Version: 1.8.0
Version: 1.8.1
Architecture: iphoneos-arm
Description: The best tweak for TikTok app.
The best tweak for TikTok app.
Expand Down
16 changes: 16 additions & 0 deletions pref/Resources/Localization-contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,27 @@ Here are base strings
"DO_YOU_REALLY_WANT_TO_KILL_TIKTOK" = "Do you really want to kill TikTok?";
"CONFIRM" = "Confirm";
"CANCEL" = "Cancel";
"DEFAULT" = "Default";
"MAIN_PREFERENCES" = "Main Preferences";
"NO_ADS" = "No Ads";
"REMOVE_SPONSORED_VIDEO" = "Remove \"Sponsored\" videos";
"UNLIMITED_DOWNLOAD" = "Unlimited Download";
"CAN_DOWNLOAD_UNDOWNLOADABLE_VIDEO" = "Can download undownloadable videos";
"DOWNLOAD_WITHOUT_WATERMARK" = "Download Without Watermark";
"PRESS_AND_HOLD_VIDEO_TO_SHOW_DOWNLOAD_BUTTON" = "Press and hold video to show download butto";
"AUTO_PLAY_NEXT_VIDEO" = "Auto Play Next Video";
"FINGER_FREE" = "Finger free, yeah!";
"CHANGE_REGION" = "Change Region";
"VIEW_TIKTOK_FROM_ANOTHER_COUNTRY" = "View TikTok from another country";
"MAY_NOT_WORK_FOR_IPAD_AND_SOME_DEVICES" = "(may not work for iPad and some devices";
"SELECT_COUNTRY" = "Select Country";
"SHOW_PROGRESS_BAR" = "Show progress bar";
"FOR_FAST_FORWARD_OR_REWIND_VIDEO" = "For fast forward or rewind video";
"CAN_HIDE_UI" = "Can hide UI";
"ENABLE_SHOW_HIDE_UI_BUTTON" = "Enable Show/Hide UI button";
"MORE_FEATURES_COMMING_SOON" = "More Features Comming Soon";
"OTHER_PREFERENCES" = "Other Preferences";
"SHOW_TOP_RIGHT_CORNER_DOWNLOAD_BUTTON" = "Show Top Right Corner Download Button";
"RESET_SETTINGS" = "Reset Settings";
"SUPPORT_ME" = "Support Me";
"DONATION" = "Donation 💰";
Expand Down
20 changes: 20 additions & 0 deletions pref/Resources/Root.plist
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,31 @@
<key>label</key>
<string>OTHER_PREFERENCES</string>
</dict>

<dict>
<key>cell</key>
<string>PSSwitchCell</string>
<key>cellClass</key>
<string>HPSSwitchCell</string>
<key>default</key>
<false/>
<key>defaults</key>
<string>com.haoict.tiktokgodpref</string>
<key>key</key>
<string>showAdditionalDownloadButton</string>
<key>label</key>
<string>SHOW_TOP_RIGHT_CORNER_DOWNLOAD_BUTTON</string>
<key>PostNotification</key>
<string>com.haoict.tiktokgodpref/PrefChanged</string>
</dict>

<dict>
<key>cell</key>
<string>PSLinkCell</string>
<key>cellClass</key>
<string>HPSLinkCell</string>
<key>defaults</key>
<string>com.haoict.tiktokgodpref</string>
<key>label</key>
<string>RESET_SETTINGS</string>
<key>action</key>
Expand Down
3 changes: 2 additions & 1 deletion pref/Resources/base.lproj/Root.strings
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"UNLIMITED_DOWNLOAD" = "Unlimited Download";
"CAN_DOWNLOAD_UNDOWNLOADABLE_VIDEO" = "Can download undownloadable videos";
"DOWNLOAD_WITHOUT_WATERMARK" = "Download Without Watermark";
"PRESS_AND_HOLD_VIDEO_TO_SHOW_DOWNLOAD_BUTTON" = "Press Download at top right corner";
"PRESS_AND_HOLD_VIDEO_TO_SHOW_DOWNLOAD_BUTTON" = "Press and hold video to show download butto";
"AUTO_PLAY_NEXT_VIDEO" = "Auto Play Next Video";
"FINGER_FREE" = "Finger free, yeah!";
"CHANGE_REGION" = "Change Region";
Expand All @@ -23,6 +23,7 @@
"ENABLE_SHOW_HIDE_UI_BUTTON" = "Enable Show/Hide UI button";
"MORE_FEATURES_COMMING_SOON" = "More Features Comming Soon";
"OTHER_PREFERENCES" = "Other Preferences";
"SHOW_TOP_RIGHT_CORNER_DOWNLOAD_BUTTON" = "Show Top Right Corner Download Button";
"RESET_SETTINGS" = "Reset Settings";
"SUPPORT_ME" = "Support Me";
"DONATION" = "Donation 💰";
Expand Down
3 changes: 2 additions & 1 deletion pref/Resources/en.lproj/Root.strings
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"UNLIMITED_DOWNLOAD" = "Unlimited Download";
"CAN_DOWNLOAD_UNDOWNLOADABLE_VIDEO" = "Can download undownloadable videos";
"DOWNLOAD_WITHOUT_WATERMARK" = "Download Without Watermark";
"PRESS_AND_HOLD_VIDEO_TO_SHOW_DOWNLOAD_BUTTON" = "Press Download at top right corner";
"PRESS_AND_HOLD_VIDEO_TO_SHOW_DOWNLOAD_BUTTON" = "Press and hold video to show download butto";
"AUTO_PLAY_NEXT_VIDEO" = "Auto Play Next Video";
"FINGER_FREE" = "Finger free, yeah!";
"CHANGE_REGION" = "Change Region";
Expand All @@ -23,6 +23,7 @@
"ENABLE_SHOW_HIDE_UI_BUTTON" = "Enable Show/Hide UI button";
"MORE_FEATURES_COMMING_SOON" = "More Features Comming Soon";
"OTHER_PREFERENCES" = "Other Preferences";
"SHOW_TOP_RIGHT_CORNER_DOWNLOAD_BUTTON" = "Show Top Right Corner Download Button";
"RESET_SETTINGS" = "Reset Settings";
"SUPPORT_ME" = "Support Me";
"DONATION" = "Donation 💰";
Expand Down
3 changes: 2 additions & 1 deletion pref/Resources/vi.lproj/Root.strings
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"UNLIMITED_DOWNLOAD" = "Download không giới hạn";
"CAN_DOWNLOAD_UNDOWNLOADABLE_VIDEO" = "Có thể download video không cho tải";
"DOWNLOAD_WITHOUT_WATERMARK" = "Download không logo (watermark)";
"PRESS_AND_HOLD_VIDEO_TO_SHOW_DOWNLOAD_BUTTON" = "Ấn nút Download ở góc trên bên phải";
"PRESS_AND_HOLD_VIDEO_TO_SHOW_DOWNLOAD_BUTTON" = "Nhấn và giữ video để hiện nút download";
"AUTO_PLAY_NEXT_VIDEO" = "Tự động chơi video tiếp theo";
"FINGER_FREE" = "Rảnh tay rồi, hehe!";
"CHANGE_REGION" = "Thay đổi khu vực";
Expand All @@ -23,6 +23,7 @@
"ENABLE_SHOW_HIDE_UI_BUTTON" = "Mở chức nút năng ẩn/hiện UI";
"MORE_FEATURES_COMMING_SOON" = "Nhiều tính năng mới sẽ cập nhật sau";
"OTHER_PREFERENCES" = "Tùy chỉnh phụ";
"SHOW_TOP_RIGHT_CORNER_DOWNLOAD_BUTTON" = "Hiện nút download ở góc trên bên phải";
"RESET_SETTINGS" = "Đặt lại tùy chỉnh";
"SUPPORT_ME" = "Hỗ trợ tôi";
"DONATION" = "Ủng hộ 💰";
Expand Down
Binary file not shown.

0 comments on commit 1c4dbdb

Please sign in to comment.