mirror of
https://github.com/SideStore/SideStore.git
synced 2026-02-19 11:43:24 +01:00
[AltServer] Supports sideloading apps to Apple TV
This commit is contained in:
@@ -99,7 +99,7 @@ extension ALTDeviceManager
|
|||||||
let anisetteData = try result.get()
|
let anisetteData = try result.get()
|
||||||
session.anisetteData = anisetteData
|
session.anisetteData = anisetteData
|
||||||
|
|
||||||
self.prepareAllProvisioningProfiles(for: application, team: team, session: session) { (result) in
|
self.prepareAllProvisioningProfiles(for: application, device: device, team: team, session: session) { (result) in
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
let profiles = try result.get()
|
let profiles = try result.get()
|
||||||
@@ -397,10 +397,10 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareAllProvisioningProfiles(for application: ALTApplication, team: ALTTeam, session: ALTAppleAPISession,
|
func prepareAllProvisioningProfiles(for application: ALTApplication, device: ALTDevice, team: ALTTeam, session: ALTAppleAPISession,
|
||||||
completion: @escaping (Result<[String: ALTProvisioningProfile], Error>) -> Void)
|
completion: @escaping (Result<[String: ALTProvisioningProfile], Error>) -> Void)
|
||||||
{
|
{
|
||||||
self.prepareProvisioningProfile(for: application, parentApp: nil, team: team, session: session) { (result) in
|
self.prepareProvisioningProfile(for: application, parentApp: nil, device: device, team: team, session: session) { (result) in
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
let profile = try result.get()
|
let profile = try result.get()
|
||||||
@@ -414,7 +414,7 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
{
|
{
|
||||||
dispatchGroup.enter()
|
dispatchGroup.enter()
|
||||||
|
|
||||||
self.prepareProvisioningProfile(for: appExtension, parentApp: application, team: team, session: session) { (result) in
|
self.prepareProvisioningProfile(for: appExtension, parentApp: application, device: device, team: team, session: session) { (result) in
|
||||||
switch result
|
switch result
|
||||||
{
|
{
|
||||||
case .failure(let e): error = e
|
case .failure(let e): error = e
|
||||||
@@ -443,7 +443,7 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func prepareProvisioningProfile(for application: ALTApplication, parentApp: ALTApplication?, team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTProvisioningProfile, Error>) -> Void)
|
func prepareProvisioningProfile(for application: ALTApplication, parentApp: ALTApplication?, device: ALTDevice, team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTProvisioningProfile, Error>) -> Void)
|
||||||
{
|
{
|
||||||
let parentBundleID = parentApp?.bundleIdentifier ?? application.bundleIdentifier
|
let parentBundleID = parentApp?.bundleIdentifier ?? application.bundleIdentifier
|
||||||
let updatedParentBundleID: String
|
let updatedParentBundleID: String
|
||||||
@@ -486,7 +486,7 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
{
|
{
|
||||||
let appID = try result.get()
|
let appID = try result.get()
|
||||||
|
|
||||||
self.fetchProvisioningProfile(for: appID, team: team, session: session) { (result) in
|
self.fetchProvisioningProfile(for: appID, device: device, team: team, session: session) { (result) in
|
||||||
completionHandler(result)
|
completionHandler(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -666,7 +666,7 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
|
|
||||||
func register(_ device: ALTDevice, team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTDevice, Error>) -> Void)
|
func register(_ device: ALTDevice, team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTDevice, Error>) -> Void)
|
||||||
{
|
{
|
||||||
ALTAppleAPI.shared.fetchDevices(for: team, session: session) { (devices, error) in
|
ALTAppleAPI.shared.fetchDevices(for: team, types: device.type, session: session) { (devices, error) in
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
let devices = try Result(devices, error).get()
|
let devices = try Result(devices, error).get()
|
||||||
@@ -677,7 +677,7 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ALTAppleAPI.shared.registerDevice(name: device.name, identifier: device.identifier, team: team, session: session) { (device, error) in
|
ALTAppleAPI.shared.registerDevice(name: device.name, identifier: device.identifier, type: device.type, team: team, session: session) { (device, error) in
|
||||||
completionHandler(Result(device, error))
|
completionHandler(Result(device, error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -689,9 +689,9 @@ To prevent this from happening, feel free to try again with another Apple ID.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func fetchProvisioningProfile(for appID: ALTAppID, team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTProvisioningProfile, Error>) -> Void)
|
func fetchProvisioningProfile(for appID: ALTAppID, device: ALTDevice, team: ALTTeam, session: ALTAppleAPISession, completionHandler: @escaping (Result<ALTProvisioningProfile, Error>) -> Void)
|
||||||
{
|
{
|
||||||
ALTAppleAPI.shared.fetchProvisioningProfile(for: appID, team: team, session: session) { (profile, error) in
|
ALTAppleAPI.shared.fetchProvisioningProfile(for: appID, deviceType: device.type, team: team, session: session) { (profile, error) in
|
||||||
completionHandler(Result(profile, error))
|
completionHandler(Result(profile, error))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1113,13 +1113,51 @@ NSNotificationName const ALTDeviceManagerDeviceDidDisconnectNotification = @"ALT
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plist_t device_type_plist = NULL;
|
||||||
|
if (lockdownd_get_value(client, NULL, "ProductType", &device_type_plist) != LOCKDOWN_E_SUCCESS)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Could not get device type for %s!\n", device_name);
|
||||||
|
|
||||||
|
lockdownd_client_free(client);
|
||||||
|
idevice_free(device);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ALTDeviceType deviceType = ALTDeviceTypeiPhone;
|
||||||
|
|
||||||
|
char *device_type_string = NULL;
|
||||||
|
plist_get_string_val(device_type_plist, &device_type_string);
|
||||||
|
|
||||||
|
if ([@(device_type_string) hasPrefix:@"iPhone"])
|
||||||
|
{
|
||||||
|
deviceType = ALTDeviceTypeiPhone;
|
||||||
|
}
|
||||||
|
else if ([@(device_type_string) hasPrefix:@"iPad"])
|
||||||
|
{
|
||||||
|
deviceType = ALTDeviceTypeiPad;
|
||||||
|
}
|
||||||
|
else if ([@(device_type_string) hasPrefix:@"AppleTV"])
|
||||||
|
{
|
||||||
|
deviceType = ALTDeviceTypeAppleTV;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, "ERROR: Unknown device type %s for %s!\n", device_type_string, device_name);
|
||||||
|
|
||||||
|
lockdownd_client_free(client);
|
||||||
|
idevice_free(device);
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
lockdownd_client_free(client);
|
lockdownd_client_free(client);
|
||||||
idevice_free(device);
|
idevice_free(device);
|
||||||
|
|
||||||
NSString *name = [NSString stringWithCString:device_name encoding:NSUTF8StringEncoding];
|
NSString *name = [NSString stringWithCString:device_name encoding:NSUTF8StringEncoding];
|
||||||
NSString *identifier = [NSString stringWithCString:udid encoding:NSUTF8StringEncoding];
|
NSString *identifier = [NSString stringWithCString:udid encoding:NSUTF8StringEncoding];
|
||||||
|
|
||||||
ALTDevice *altDevice = [[ALTDevice alloc] initWithName:name identifier:identifier type:ALTDeviceTypeiPhone];
|
ALTDevice *altDevice = [[ALTDevice alloc] initWithName:name identifier:identifier type:deviceType];
|
||||||
[connectedDevices addObject:altDevice];
|
[connectedDevices addObject:altDevice];
|
||||||
|
|
||||||
if (device_name != NULL)
|
if (device_name != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user