Fix infinite loading, remove pcap capturing, some optimizations (#230)

* Fix infinite loading, remove pcap capturing, some optimizations

* Fix typo
This commit is contained in:
Huge_Black 2025-07-16 04:44:03 +08:00 • committed by GitHub
parent f7cd3444bf
commit 2fd0605868
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 12 deletions

View file

@ -1,5 +1,5 @@
function attach() {
log("Welcome to use StikDebug's srcipting feature! Here you can use JavaScript to customize your debug experience!")
log("Welcome to use StikDebug's scripting feature! Here you can use JavaScript to customize your debug experience!")
log("This script is a demo script that attaches to the connected app and detaches from it.")
// get pid of the connected app

View file

@ -16,6 +16,7 @@ private func registerAdvancedOptionsDefault() {
// Enable advanced options by default on iOS 19/26 and above
let enabled = os.majorVersion >= 19
UserDefaults.standard.register(defaults: ["enableAdvancedOptions": enabled])
UserDefaults.standard.register(defaults: ["enablePiP": enabled])
}
// MARK: - Welcome Sheet

View file

@ -305,7 +305,7 @@ struct HomeView: View {
}
}
.pipify(isPresented: Binding(
get: { enablePiP && isProcessing },
get: { useDefaultScript && enablePiP && isProcessing },
set: { newValue in isProcessing = newValue }
)) {
RunJSViewPiP(model: $jsModel)

View file

@ -13,7 +13,7 @@ struct SettingsView: View {
@AppStorage("selectedAppIcon") private var selectedAppIcon: String = "AppIcon"
@AppStorage("useDefaultScript") private var useDefaultScript = false
@AppStorage("enableAdvancedOptions") private var enableAdvancedOptions = false
@AppStorage("enablePiP") private var enablePiP = true
@AppStorage("enablePiP") private var enablePiP = false
@State private var isShowingPairingFilePicker = false
@Environment(\.colorScheme) private var colorScheme

View file

@ -17,7 +17,6 @@ NSDate* lastHeartbeatDate = nil;
void startHeartbeat(IdevicePairingFile* pairing_file, IdeviceProviderHandle** provider, bool* isHeartbeat, HeartbeatCompletionHandlerC completion, LogFuncC logger) {
*isHeartbeat = true;
// Initialize logger
idevice_init_logger(Debug, Disabled, NULL);
@ -28,8 +27,9 @@ void startHeartbeat(IdevicePairingFile* pairing_file, IdeviceProviderHandle** pr
addr.sin_port = htons(LOCKDOWN_PORT);
inet_pton(AF_INET, "10.7.0.2", &addr.sin_addr);
IdeviceProviderHandle* newProvider = 0;
IdeviceFfiError* err = idevice_tcp_provider_new((struct sockaddr *)&addr, pairing_file,
"ExampleProvider", provider);
"ExampleProvider", &newProvider);
if (err != NULL) {
fprintf(stderr, "Failed to create TCP provider: [%d] %s", err->code,
err->message);
@ -41,16 +41,23 @@ void startHeartbeat(IdevicePairingFile* pairing_file, IdeviceProviderHandle** pr
// Connect to installation proxy
HeartbeatClientHandle *client = NULL;
err = heartbeat_connect(*provider, &client);
err = heartbeat_connect(newProvider, &client);
if (err != NULL) {
fprintf(stderr, "Failed to connect to installation proxy: [%d] %s",
err->code, err->message);
idevice_provider_free(*provider);
idevice_provider_free(newProvider);
idevice_error_free(err);
*isHeartbeat = false;
return;
}
if(*isHeartbeat) {
idevice_provider_free(newProvider);
return;
}
// we mark heartbeat as success and set the default provider
*isHeartbeat = true;
*provider = newProvider;
completion(0, "Heartbeat Completed");

View file

@ -176,11 +176,6 @@ int debug_app(IdeviceProviderHandle* tcp_provider, const char *bundle_id, LogFun
return 1;
}
printf("Successfully launched app with PID: %llu\n", pid);
char* path = malloc(2048);
snprintf(path, 2048, "%s/Documents/debugProxy.pcap", getenv("HOME"));
adapter_pcap(adapter, path);
free(path);
printf("\n=== Setting up Debug Proxy ===\n");