StikDebug/StikJIT/idevice/ideviceinfo.m
Stephen f3d2dec2e5
Semi-Rewrite – Major Refactor & Codebase Cleanup (#328)
* Change default UPLOAD_IPA value to 'false'

* Part 1 of the great debloat

* Remove Mini Tools, adopt native alerts in StikJITApp, and update HomeView UI

* Refactor views to use native SwiftUI alerts instead of CustomErrorView

* Update ProfileView to use minimal List UI style with native alerts

* Fix up homeview

* Squash: Redesign HomeView, remove Feature Flags, enable all tabs, refactor alerts, and updates

- Redesign HomeView to a simpler style with 'Enable JIT' action.
- Remove 'Help & Info' and 'Quick Launch' from Home.
- Fix DDI false positive by starting heartbeat on HomeView appear.
- Restore robust DDI checks and update app name to 'StikDebug'.
- Remove FeatureFlags and Beta tags; enable 'profiles', 'processes', 'location' tabs by default.
- Remove 'Devices' tab; add 'Target Device IP' field in Settings.
- Hardcode 'Settings' tab to 4th position.
- Refactor 'SettingsView' tab customization to be reorder-only.
- Remove 'Appearance' theme section from Settings.
- Refactor custom error cards to use native SwiftUI/UIKit alerts across the app (HomeView, ConsoleLogsView, ProfileView, etc).
- Restore JS callback support and script execution logic in HomeView.
- Add necessary Color extensions.
- Update project version to 3.0.0.

* Clean up: Remove In-App Purchases, update checker, and unused IPA installer code

* delete more bloat

* fix build issue

* Remove widget to save on App IDs

* Attempt heartbeat restart when Enable JIT button is pressed

* Get rid of PIP

* Update Tab Naming

* remove more bloat

* final changes for today

* Remove unused packages

* UX Improvements

* revert bundle id

* Update README.md

* remove old idevice

* add updated idevice

* Fix ddi false positive errors and add templates for GitHub stuff

* Remove more unused stuff.

* Fix links and update README content

* Update compatibility table in README.md

* Improve performance of console logs

* Remove old code

* Change default UPLOAD_IPA value to 'true'

* remove the welcome sheet

* import support for .mobiledevicepair

* Add back LC JIT stuff

* Fix heartbeat issues with LC JIT

* update the build yml for nightly stuff

* Update README.md

* Update README.md

* Update GitHub Actions workflow for IPA build

* Update GitHub Actions workflow for nightly builds

* Add URL scheme to kill tasks stikjit://kill-process?pid=1234

* fix build issues

* Added App Intents

* Unify the error handling style across the app
2026-02-25 13:44:00 -05:00

77 lines
2.1 KiB
Objective-C

//
// ideviceinfo.c
// StikDebug
//
// Created by Stephen on 8/2/25.
//
#include <stdlib.h>
#include <arpa/inet.h>
#include "ideviceinfo.h"
#include "idevice.h"
#import "JITEnableContext.h"
#import "JITEnableContextInternal.h"
@import Foundation;
NSError* makeError(int code, NSString* msg);
LockdowndClientHandle* ideviceinfo_c_init(IdeviceProviderHandle* g_provider, IdevicePairingFile* g_sess_pf, NSError** error) {
LockdowndClientHandle *g_client = NULL;
IdeviceFfiError *err = lockdownd_connect(g_provider, &g_client);
if (err) {
*error = makeError(err->code, @(err->message));
idevice_pairing_file_free(g_sess_pf);
idevice_error_free(err);
return NULL;
}
err = lockdownd_start_session(g_client, g_sess_pf);
idevice_pairing_file_free(g_sess_pf);
if (err) {
*error = makeError(err->code, @(err->message));
idevice_error_free(err);
lockdownd_client_free(g_client);
return NULL;
}
return g_client;
}
char *ideviceinfo_c_get_xml(LockdowndClientHandle* g_client, NSError** error) {
if (!g_client) {
return NULL;
}
void *plist_obj = NULL;
struct IdeviceFfiError *err = lockdownd_get_value(g_client, NULL, NULL, &plist_obj);
if (err) {
*error = makeError(err->code, @(err->message));
idevice_error_free(err);
return NULL;
}
char *xml = NULL;
uint32_t xml_len = 0;
if (plist_to_xml(plist_obj, &xml, &xml_len) != 0 || !xml) {
plist_free(plist_obj);
return NULL;
}
plist_free(plist_obj);
return xml;
}
@implementation JITEnableContext(DeviceInfo)
- (LockdowndClientHandle*)ideviceInfoInit:(NSError**)error {
[self ensureHeartbeatWithError:error];
if (*error) { return nil; }
IdevicePairingFile *pf = [self getPairingFileWithError:error];
if (*error) { return nil; }
return ideviceinfo_c_init(provider, pf, error);
}
- (char*)ideviceInfoGetXMLWithLockdownClient:(LockdowndClientHandle*)lockdownClient error:(NSError**)error {
[self ensureHeartbeatWithError:error];
if (*error) { return NULL; }
return ideviceinfo_c_get_xml(lockdownClient, error);
}
@end