コード例 #1
0
 public TestFlightUserPreferences()
 {
     userAPIKey = "";
     activeDistributionLists = new string[] {"Devs", "QA"};
     replaceSameBuilds = true;
     notifyUsers = true;
     lastBuildAppTime = 30;
     lastPackageIpaTime = 5;
     lastUploadTime = 60;
     messageHistory = new string[0];
     testFlightSDKEmbedType = TestFlightSDKEmbedType.ForTestflightTesters;
     customProvisionProfile = null;
     //xCodeConfig = "";
     xCodeSchema = "";
     dSYMBuild = true;
     developerIdentity = "iPhone Developer";
     ipaBuildPath = FigureOutProjectName()+".ipa";
 }
コード例 #2
0
    public static void DrawSubUserSettingsForIPA(TestFlightPreferences preferences, bool narrow, TestFlightMobileProvision[] availableProvisions, TestFlightXCodeSchemas availableSchemas, string[] availableIdentities)
    {
        DrawSubUserSettings_TestFlightSDK(preferences, narrow);
        DrawSubUserSettings_dSYM(preferences, narrow);
        DrawSubUserSettings_BundleId(availableProvisions, availableIdentities);
        DrawSubUserSettings_Provisions(preferences, narrow, availableProvisions, availableIdentities);

        if(preferences.userPrefs.customProvisionProfile != null && preferences.userPrefs.customProvisionProfile.Certificates == null)
            DrawSubUserSettings_Identity(preferences, narrow, availableIdentities, availableProvisions);

        DrawSubUserSettings_XCodeSchema(preferences, narrow, availableSchemas);

        if(!narrow)
        {
            GUILayout.Space(20);
            GUILayout.BeginHorizontal();
            GUILayout.Space(FieldWidth+4);
            GUILayout.Box("* Denotes settings that apply to both Autopilot and regular Unity builds");
            GUILayout.EndHorizontal();
        }
    }
コード例 #3
0
 public static void DrawSubUserSettings(TestFlightPreferences preferences, ref bool showUserLists, bool narrow, TestFlightMobileProvision[] availableProvisions, TestFlightXCodeSchemas availableSchemas, string[] availableIdentities)
 {
     DrawSubUserSettings_TestFlightUpload(preferences, ref showUserLists);
     DrawSubUserSettingsForIPA(preferences, narrow, availableProvisions, availableSchemas,availableIdentities);
 }
コード例 #4
0
    private static void DrawSubUserSettings_Provisions(TestFlightPreferences preferences, bool narrow, TestFlightMobileProvision[] availableProvisions, string[] availableIdentities)
    {
        // Only add options we have identities for
        var identityProvisionOptions = new List<KeyValuePair<string, TestFlightMobileProvision>>();
        foreach(var identity in availableIdentities)
        {
            foreach(var provision in availableProvisions)
            {
                if(!provision.MatchesBundleId(PlayerSettings.bundleIdentifier))
                    continue;

                if(provision.Certificates == null)
                {
                    identityProvisionOptions.Add(new KeyValuePair<string,TestFlightMobileProvision>("Unverified Identities", provision));
                    continue;
                }

                if(!System.Array.Exists(provision.Certificates, m => m == identity))
                    continue;

                identityProvisionOptions.Add(new KeyValuePair<string, TestFlightMobileProvision>(identity, provision));
            }
        }

        // craete a list of strings for the options we have
        var options = new List<string>();
        Regex removeParentheses = new Regex(@"\([^\)]*\)");
        for(int i=0; i<identityProvisionOptions.Count; ++i)
        {
            var option = identityProvisionOptions[i];

            string output = option.Key+"/\n"
                            +(option.Value.MatchesBundleId(PlayerSettings.bundleIdentifier)?"":"<Different Bundle Id> ")
                            +option.Value.Name;
            if(narrow)	output = removeParentheses.Replace(output, "");

            options.Add(output);
        }

        int chosen = Mathf.Max(0,identityProvisionOptions.FindIndex(delegate(KeyValuePair<string, TestFlightMobileProvision> obj) {return obj.Value.Equals(preferences.userPrefs.customProvisionProfile);}));

        var labelContent = new GUIContent(narrow?"Profile":"Provisioning Profile", "Select a specific iOS provisioning profile to use.\n\nTestflight can only intall your app on devices that are registered in this profile");
        chosen = PopupButton(labelContent, chosen, options.ToArray(), 0);

        if(identityProvisionOptions.Count != 0 && identityProvisionOptions[chosen].Value != null)
        {
            preferences.userPrefs.customProvisionProfile = identityProvisionOptions[chosen].Value;
            preferences.userPrefs.developerIdentity = identityProvisionOptions[chosen].Key;
        }

        GUI.color = Color.white;
    }
コード例 #5
0
    private static void DrawSubUserSettings_Identity(TestFlightPreferences preferences, bool narrow, string[] availableIdentities, TestFlightMobileProvision[] availableProvisions)
    {
        List<string> identities = new List<string>();
        identities.AddRange(availableIdentities);

        GUILayout.BeginHorizontal();

        int current = Mathf.Max(0,identities.IndexOf(preferences.userPrefs.developerIdentity));
        current = Mathf.Max(0, Popup(new GUIContent(narrow ? "Identity":"iOS Codesign Identity",
                                                    "The developer identity certificate to use when building the app.\n\nThis must be set to a 'Distribution' identity for Ad-hoc and App store builds."),
                                     				current, identities.ToArray(), narrow ? 5:0));

        if(!narrow)
        {
            GUI.backgroundColor = Color.yellow;
            GUILayout.Label("NOTE: must be set to a 'Distribution' identity for Ad-hoc and App store builds.","textfield");
            GUI.backgroundColor = Color.white;
        }

        GUILayout.EndHorizontal();

        if(availableIdentities.Contains(identities[current]))
            preferences.userPrefs.developerIdentity = identities[current];
    }
コード例 #6
0
    static void DrawSubUserSettings_BundleId(TestFlightMobileProvision[] availableProvisions, string[] availableIdentities)
    {
        var bundleIdOptions = new List<string>();

        bundleIdOptions.Add("com.*");

        foreach(var p in availableProvisions)
        {
            int start = p.AppIdentifier.IndexOf(".");

            if(start == -1)
                continue;

            var id = p.AppIdentifier.Substring(start+1);
            if(id == "*")
                id = "com.*";
            else if(p.Certificates != null && !System.Array.Exists(availableIdentities, m => p.Certificates.Contains(m)))
                continue;

            if(bundleIdOptions.Contains(id))
                continue;

            bundleIdOptions.Add(id);
        }

        bundleIdOptions.Sort((m,n) => m.Length.CompareTo(n.Length) );

        int prevBundle = 0;
        prevBundle = Mathf.Max(0,bundleIdOptions.FindLastIndex(m => PlayerSettings.bundleIdentifier.StartsWith(m.Replace("*",""))));

        var newChosenBundle = Popup(new GUIContent("Bundle Id*", "Select/edit your bundle Id from the list of bundle ids that match your provisioning profiles.\n\nYou are only able to select from provisioning profiles that match this bundle id."), prevBundle, bundleIdOptions.ToArray(), 0);

        if(bundleIdOptions.Count == 0)
            return;

        var newBundleId = bundleIdOptions[newChosenBundle];

        if(bundleIdOptions[newChosenBundle].EndsWith("*"))
        {
            EditorGUILayout.BeginHorizontal();
            GUILayout.Space(FieldWidth+4);
            EditorGUILayout.BeginHorizontal("box");

            var appsuffix = PlayerSettings.productName;
            if(PlayerSettings.bundleIdentifier.StartsWith(bundleIdOptions[prevBundle].Replace("*","")))
                appsuffix = PlayerSettings.bundleIdentifier.Remove(0, bundleIdOptions[prevBundle].Replace("*","").Length);

            newBundleId = bundleIdOptions[newChosenBundle].Replace("*","");
            GUILayout.Label(newBundleId, GUILayout.ExpandWidth(false));

            newBundleId += GUILayout.TextField(appsuffix, GUILayout.ExpandWidth(false), GUILayout.MinWidth(100));

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndHorizontal();
        }

        PlayerSettings.bundleIdentifier = newBundleId;
    }
コード例 #7
0
    public static bool CanBuild(TestFlightPreferences preferences, TestFlightMobileProvision[] availableProvisions, string[] availableIdentities)
    {
        if(preferences.userPrefs.userAPIKey.Length==0)
            return false;

        if(preferences.teamPrefs.teamAPIKey.Length==0)
            return false;

        if(System.Array.IndexOf(availableProvisions, preferences.userPrefs.customProvisionProfile) == -1)
            return false;

        if(System.Array.IndexOf(availableIdentities, preferences.userPrefs.developerIdentity) == -1)
            return false;

        if(!TestFlightBuildPipeline.MenuItemAllowed)
            return false;

        return true;
    }