Skip to content

Commit

Permalink
feat: confirm changing theme
Browse files Browse the repository at this point in the history
  • Loading branch information
SoCuul committed Jun 28, 2024
1 parent 34aaa16 commit 58506a7
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ $(TWEAK_NAME)_FRAMEWORKS = UIKit Foundation CoreGraphics Photos CoreServices Sys
$(TWEAK_NAME)_PRIVATE_FRAMEWORKS = Preferences
$(TWEAK_NAME)_EXTRA_FRAMEWORKS = Cephei CepheiPrefs CepheiUI
$(TWEAK_NAME)_CFLAGS = -fobjc-arc -Wno-unsupported-availability-guard -Wno-unused-value -Wno-deprecated-declarations -Wno-nullability-completeness -Wno-unused-function -Wno-incompatible-pointer-types
$(TWEAK_NAME)_LOGOSFLAGS = --c warnings=none

CCFLAGS += -std=c++11

Expand Down
1 change: 1 addition & 0 deletions src/Controllers/SettingsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ - (NSArray *)specifiers {
[self newSwitchCellWithTitle:@"Confirm voice messages" detailTitle:@"Shows an alert to confirm before sending a voice message" key:@"voice_message_confirm" defaultValue:true changeAction:nil],
[self newSwitchCellWithTitle:@"Confirm sticker interaction" detailTitle:@"Shows an alert when you click a sticker on someone's story to confirm the action" key:@"sticker_interact_confirm" defaultValue:false changeAction:nil],
[self newSwitchCellWithTitle:@"Confirm posting comment" detailTitle:@"Shows an alert when you click the post comment button to confirm" key:@"post_comment_confirm" defaultValue:false changeAction:nil],
[self newSwitchCellWithTitle:@"Confirm changing theme" detailTitle:@"Shows an alert when you change a dm channel theme to confirm" key:@"change_direct_theme_confirm" defaultValue:false changeAction:nil],

// Section 4: Save media
[self newSectionWithTitle:@"Save media" footer:nil],
Expand Down
24 changes: 24 additions & 0 deletions src/Features/Confirm/ChangeThemeConfirm.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#import "../../InstagramHeaders.h"
#import "../../Manager.h"
#import "../../Utils.h"

%hook IGDirectThreadThemePickerViewController
- (void)themeNewPickerSectionController:(id)arg1 didSelectTheme:(id)arg2 atIndex:(NSInteger)arg3 {
if ([SCIManager changeDirectThemeConfirmation]) {
NSLog(@"[SCInsta] Confirm change direct theme triggered");

[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
- (void)themePickerSectionController:(id)arg1 didSelectThemeId:(id)arg2 {
if ([SCIManager changeDirectThemeConfirmation]) {
NSLog(@"[SCInsta] Confirm change direct theme triggered");

[SCIUtils showConfirmation:^(void) { %orig; }];
} else {
return %orig;
}
}
%end
1 change: 1 addition & 0 deletions src/Manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
+ (BOOL)voiceMessageConfirmation;
+ (BOOL)stickerInteractConfirmation;
+ (BOOL)postCommentConfirmation;
+ (BOOL)changeDirectThemeConfirmation;
+ (BOOL)copyDecription;
+ (BOOL)hideReelsTab;
+ (BOOL)noRecentSearches;
Expand Down
3 changes: 3 additions & 0 deletions src/Manager.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ + (BOOL)stickerInteractConfirmation {
+ (BOOL)postCommentConfirmation {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"post_comment_confirm"];
}
+ (BOOL)changeDirectThemeConfirmation {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"change_direct_theme_confirm"];
}
+ (BOOL)copyDecription {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"copy_description"];
}
Expand Down

0 comments on commit 58506a7

Please sign in to comment.