Beispiel #1
0
 def GetPathXcodePrifile(self, isHd):
     package = mainAppInfo.GetAppPackage(Source.IOS, isHd)
     path = mainResource.GetResourceDataApp(
     ) + "/" + package + ".mobileprovision"
     if os.path.exists(path) == False:
         package = package.replace(".", "")
         path = mainResource.GetResourceDataApp(
         ) + "/" + package + ".mobileprovision"
     return os.path.normpath(path)
    def GetAppProfile(self, package, appid):

        filename = package + ".mobileprovision"
        savepath = mainResource.GetResourceDataApp() + "/" + filename
        savepath = os.path.normpath(savepath)
        if os.path.exists(savepath):
            return

        # self.DeleteAllProfile(package)

        self.ListAllCertificates()
        self.GetAppInfo(appid)
        bundle_id = self.GetBundleIdByPackage(package)
        print("bundle_id =", bundle_id)

        count = 0
        if len(bundle_id) == 0:
            count = 0
        else:
            # self.DeleteBundleID(bundle_id)
            # bundle_id = self.GetBundleIdByPackage(package)

            header = self.GetApiUrlHead()
            url = "https://api.appstoreconnect.apple.com/v1/bundleIds/" + bundle_id + "/profiles"
            mdl_rqt = requests.get(url, headers=header
                                   # timeout=30
                                   )
            result = mdl_rqt.content.decode("utf-8")
            json = mdl_rqt.json()
            # print("ListAllBundleIds =",result)
            self.SaveData2Json(json, "GetAppProfile.json")
            jsonRoot = json
            jsondata = jsonRoot["data"]
            count = len(jsondata)

        print("GetAppProfile count=", count, " package=" + package)
        if count:
            dataprofile = jsonRoot["data"][0]["attributes"]["profileContent"]

        else:
            # if isCreate:
            dataprofile = self.CreateProfile(package, appid)

        decode_content = self.base64decode(dataprofile)
        FileUtil.SaveByte2File(decode_content, savepath)
    def MakeConfigAudio(self):

        # dir1 = mainResource.GetRootUnityAssetsResource()+"/App/Audio"
        # filepathJson = mainResource.GetRootUnityAssetsResource() + "/ConfigData/Audio/" + "ConfigAudioApp.json"
        # self.ScanAudioFile(dir1, filepathJson)

        # dir2 = mainResource.GetRootUnityAssetsResource()+"/AppCommon/Audio"
        # filepathJson = mainResource.GetRootUnityAssetsResource() + "/ConfigData/Audio/" + "ConfigAudioAppCommon.json"
        # self.ScanAudioFile(dir2, filepathJson)

        # # CloudRes
        dircommon = mainResource.GetRootUnityAssetsResource(
        ) + "/GameRes/CloudRes"
        filepathJson = dircommon + "/AudioCloudRes.json"
        self.ScanAudioFile(dircommon, filepathJson)
        filedst = mainResource.GetResourceDataApp(
        ) + "/GameRes/CloudRes/AudioCloudRes.json"
        FileUtil.CopyFile(filepathJson, filedst)
    def MakeConfigImage(self):
        dir1 = mainResource.GetRootUnityAssetsResource() + "/App/UI"
        filepathJson = mainResource.GetRootUnityAssetsResource(
        ) + "/ConfigData/Image/" + "ImageResApp.json"
        self.ScanImageFile(dir1, filepathJson)

        dir2 = mainResource.GetRootUnityAssetsResource() + "/AppCommon/UI"
        filepathJson = mainResource.GetRootUnityAssetsResource(
        ) + "/ConfigData/Image/" + "ImageResAppCommon.json"
        self.ScanImageFile(dir2, filepathJson)

        dircommon = mainResource.GetRootUnityAssetsResource() + "/Common/UI"
        filepathJson = dircommon + "/ImageRes.json"
        self.ScanImageFile(dircommon, filepathJson)

        # # CloudRes
        dircommon = mainResource.GetRootUnityAssetsResource(
        ) + "/GameRes/CloudRes"
        filepathJson = dircommon + "/ImageResCloudRes.json"
        self.ScanImageFile(dircommon, filepathJson)
        filedst = mainResource.GetResourceDataApp(
        ) + "/GameRes/CloudRes/ImageResCloudRes.json"
        FileUtil.CopyFile(filepathJson, filedst)
    def CreateProfile2(self, package, appid):
        # package = mainap
        # devices = api.list_devices(limit=1)
        # print(devices)

        # result = api.register_device('name','udid')
        # print(result)

        # result = api.register_certificate(csr_path='/Users/last/Desktop/CertificateSigningRequest.certSigningRequest')
        # print(result)

        # result = api.delete_certificate('N9P79WJTHK')
        # print(result)

        # result = self.api.list_certificates()
        # # print(result)
        # self.SaveData2Json(result,"Certificate.json")

        # result = api.register_bundle_id(bundle_id='com.hepburn.app',team_id='6DD349HLLU',name='hepburn')
        # print(result)

        # result = api.list_bundle_ids()
        # # print(result)
        # self.SaveData2Json(result,"Bundle_id.json")

        # result = api.list_bundle_ids(sort='-identifier com.moonma.poem')
        # "name": "com-moonma-poem",

        # result = api.get_bundle_id('com.moonma.poem')
        # print(result)

        # result = api.get_bundle_id_profiles('N49MX9AWAX')
        # print(result)

        # result = api.delete_bundle_id('N49MX9AWAX')
        # print(result)

        # result = api.create_app_version(app_id='123456', version_string='1.2.3', platform='IOS',
        #                                 release_type='AFTER_APPROVAL', copyright='2020 My Company', build_id='123',
        #                                 earliest_release_date=None, uses_idfa=False)
        # print(result)

        # result = api.get_app_version_localizations('a1a2a3a4-a1a2-a1a2-a1a2-a1a2a3a4a5a6')
        # print(result)

        bundleid = self.GetBundleIdByPackage(package)
        print("bundleid=", bundleid)
        #   # type IOS_APP_DEVELOPMENT, IOS_APP_STORE, IOS_APP_ADHOC
        result = self.api.create_profile(name=package,
                                         bundle_id=bundleid,
                                         certificate_id=self.CertificateID,
                                         type='IOS_APP_STORE')

        result = self.api.get_bundle_id_profiles(bundleid)
        print(result)
        # self.SaveData2Json(result,"create_profile.json")
        filename = package + ".mobileprovision"
        src = self.DIR_HOME + "/" + filename
        src = os.path.normpath(src)
        dst = mainResource.GetResourceDataApp() + "/" + filename
        dst = os.path.normpath(dst)
        FileUtil.CopyFile(src, dst)