Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hugeBlack committed Jan 2, 2025
1 parent d23ae3a commit ad60e48
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 4 deletions.
14 changes: 14 additions & 0 deletions LiveContainerSwiftUI/LCSettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct LCSettingsView: View {
@State var isSignOnlyOnExpiration = true
@State var frameShortIcon = false
@State var silentSwitchApp = false
@State var silentOpenWebPage = false
@State var injectToLCItelf = false
@State var strictHiding = false
@AppStorage("dynamicColors") var dynamicColors = true
Expand All @@ -58,6 +59,7 @@ struct LCSettingsView: View {
_isSignOnlyOnExpiration = State(initialValue: LCUtils.appGroupUserDefault.bool(forKey: "LCSignOnlyOnExpiration"))
_frameShortIcon = State(initialValue: UserDefaults.standard.bool(forKey: "LCFrameShortcutIcons"))
_silentSwitchApp = State(initialValue: UserDefaults.standard.bool(forKey: "LCSwitchAppWithoutAsking"))
_silentOpenWebPage = State(initialValue: UserDefaults.standard.bool(forKey: "LCOpenWebPageWithoutAsking"))
_injectToLCItelf = State(initialValue: UserDefaults.standard.bool(forKey: "LCLoadTweaksToSelf"))

_isSideStore = State(initialValue: LCUtils.store() == .SideStore)
Expand Down Expand Up @@ -202,6 +204,15 @@ struct LCSettingsView: View {
} footer: {
Text("lc.settings.silentSwitchAppDesc".loc)
}

Section {
Toggle(isOn: $silentOpenWebPage) {
Text("lc.settings.silentOpenWebPage".loc)
}
} footer: {
Text("lc.settings.silentOpenWebPageDesc".loc)
}

if sharedModel.developerMode {
Section {
Toggle(isOn: $injectToLCItelf) {
Expand Down Expand Up @@ -365,6 +376,9 @@ struct LCSettingsView: View {
.onChange(of: silentSwitchApp) { newValue in
saveItem(key: "LCSwitchAppWithoutAsking", val: newValue)
}
.onChange(of: silentOpenWebPage) { newValue in
saveItem(key: "LCOpenWebPageWithoutAsking", val: newValue)
}
.onChange(of: frameShortIcon) { newValue in
saveItem(key: "LCFrameShortcutIcons", val: newValue)
}
Expand Down
34 changes: 34 additions & 0 deletions LiveContainerSwiftUI/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3091,6 +3091,40 @@
}
}
},
"lc.settings.silentOpenWebPage" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Always Open URL in Current App"
}
},
"zh_CN" : {
"stringUnit" : {
"state" : "translated",
"value" : "总是在当前App打开链接"
}
}
}
},
"lc.settings.silentOpenWebPageDesc" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "By default, LiveContainer asks you how to open an URL. Enable this automatically open URL in current app."
}
},
"zh_CN" : {
"stringUnit" : {
"state" : "translated",
"value" : "LiveContainer在打开链接时会询问你如何打开。启用此选项来自动在当前App中打开。"
}
}
}
},
"lc.settings.silentSwitchApp" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
2 changes: 1 addition & 1 deletion NSUserDefaults.m
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ - (void) hook_removePersistentDomainForName:(NSString*)domainName {
[self hook_removePersistentDomainForName:domainName];
} else {
// empty dictionary means deletion
[LCPreferences setObject:[[NSMutableArray alloc] init] forKey:domainName];
[LCPreferences setObject:[[NSMutableDictionary alloc] init] forKey:domainName];
LCSavePreference();
}
NSURL* preferenceFilePath = LCGetPreferencePath(domainName);
Expand Down
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.1.56</string>
<string>3.1.57</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
Expand All @@ -61,7 +61,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>3.1.56</string>
<string>3.1.57</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.games</string>
<key>LSApplicationQueriesSchemes</key>
Expand Down
5 changes: 5 additions & 0 deletions TweakLoader/UIKit+GuestHooks.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ void openUniversalLink(NSString* decodedUrl) {
}

void LCOpenWebPage(NSString* webPageUrlString, NSString* originalUrl) {
if ([NSUserDefaults.lcUserDefaults boolForKey:@"LCOpenWebPageWithoutAsking"]) {
openUniversalLink(webPageUrlString);
return;
}

NSString *message = @"lc.guestTweak.openWebPageTip".loc;
UIWindow *window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"LiveContainer" message:message preferredStyle:UIAlertControllerStyleAlert];
Expand Down
2 changes: 1 addition & 1 deletion control
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: com.kdt.livecontainer
Name: livecontainer
Version: 3.1.56
Version: 3.1.57
Architecture: iphoneos-arm
Description: Run iOS app without actually installing it!
Maintainer: khanhduytran0
Expand Down

0 comments on commit ad60e48

Please sign in to comment.