mirror of
https://github.com/nab138/isideload.git
synced 2026-03-02 06:26:16 +01:00
Assign app groups and download provisioning profile
This commit is contained in:
@@ -7,6 +7,7 @@ use crate::dev::{
|
||||
use plist_macro::plist;
|
||||
use rootcause::prelude::*;
|
||||
use serde::Deserialize;
|
||||
use tracing::info;
|
||||
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
@@ -91,6 +92,28 @@ pub trait AppGroupsApi {
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn ensure_app_group(
|
||||
&mut self,
|
||||
team: &DeveloperTeam,
|
||||
name: &str,
|
||||
identifier: &str,
|
||||
device_type: impl Into<Option<DeveloperDeviceType>> + Send,
|
||||
) -> Result<AppGroup, Report> {
|
||||
let device_type = device_type.into();
|
||||
let groups = self.list_app_groups(team, device_type.clone()).await?;
|
||||
let matching_group = groups.iter().find(|g| g.identifier == identifier);
|
||||
|
||||
if let Some(group) = matching_group {
|
||||
Ok(group.clone())
|
||||
} else {
|
||||
info!("Adding application group");
|
||||
let group = self
|
||||
.add_app_group(team, name, identifier, device_type)
|
||||
.await?;
|
||||
Ok(group)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl AppGroupsApi for DeveloperSession {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use crate::{
|
||||
dev::{
|
||||
app_groups::AppGroupsApi,
|
||||
app_ids::AppIdsApi,
|
||||
developer_session::DeveloperSession,
|
||||
devices::DevicesApi,
|
||||
teams::{DeveloperTeam, TeamsApi},
|
||||
@@ -98,15 +100,8 @@ impl Sideloader {
|
||||
main_app_id_str
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
for app_id in app_ids.iter_mut() {
|
||||
app_id
|
||||
.ensure_group_feature(&mut self.dev_session, &team)
|
||||
.await?;
|
||||
|
||||
// TODO: Increased memory entitlement
|
||||
}
|
||||
.clone();
|
||||
|
||||
let group_identifier = format!(
|
||||
"group.{}",
|
||||
@@ -117,6 +112,28 @@ impl Sideloader {
|
||||
}
|
||||
);
|
||||
|
||||
let app_group = self
|
||||
.dev_session
|
||||
.ensure_app_group(&team, &main_app_name, &group_identifier, None)
|
||||
.await?;
|
||||
|
||||
for app_id in app_ids.iter_mut() {
|
||||
app_id
|
||||
.ensure_group_feature(&mut self.dev_session, &team)
|
||||
.await?;
|
||||
|
||||
self.dev_session
|
||||
.assign_app_group(&team, &app_group, app_id, None)
|
||||
.await?;
|
||||
|
||||
// TODO: Increased memory entitlement
|
||||
}
|
||||
|
||||
let provisioning_profile = self
|
||||
.dev_session
|
||||
.download_team_provisioning_profile(&team, &main_app_id, None)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user