def RunDownloadSigniOS(self): # self.Init() # self.LoginAppleDeveloper("*****@*****.**","Moonqianlizhiwai1") # self.PreDownloadSigniOS(False) # self.PreDownloadSigniOS(True) appid = mainAppInfo.GetAppId(False, Source.APPSTORE) mainAppConnectApi.GetAppProfile( mainAppInfo.GetAppPackage(Source.IOS, False), appid) appid = mainAppInfo.GetAppId(True, Source.APPSTORE) mainAppConnectApi.GetAppProfile( mainAppInfo.GetAppPackage(Source.IOS, True), appid)
def SubmitApp(self, isHD): self.SubmitAppByWeb(isHD) return appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) mainAppConnectApi.SubmitApp(appid, package)
def MakeGooglePlayObbFile(self, isHD): print("MakeGooglePlayObbFile start") dir = mainResource.GameResApp() print("MakeGooglePlayObbFile GameRes=", dir) self.DeleAllObbFile(FileUtil.GetLastDirofDir(dir)) package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) versioncode = mainAppInfo.GetAppVersionCode(Source.ANDROID, isHD) dir = FileUtil.GetLastDirofDir(dir) print("MakeGooglePlayObbFile file_zip dir =", dir) file_zip = dir + "/main." + str(versioncode) + "." + package + ".obb" file_zip = dir + "/GameRes.zip" # main.13.com.itant.wuji.obb print("MakeGooglePlayObbFile obb file=", file_zip) # if os.path.exists(file_zip): # os.remove(file_zip) # os.system("git config --global credential.helper store") # jobb -d D:\contents\ main\assets\ -o D:\obb\output.obb -pn com.example.app -pv 25 # 压缩目录 ZipUtil.zipDir(dir, file_zip) # delete dir = mainResource.GetRootDirAndroidAsset() + "/GameRes" if os.path.exists(dir): shutil.rmtree(dir) print("MakeGooglePlayObbFile end")
def UploadScreenShot(self, isHD): self.UpdateAppInfo(isHD) appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) # isHD = True version = mainAppInfo.GetAppVersion(Source.IOS, isHD) total_screenshot = 5 idx_country = 0 idx_display = 0 for country in self.listCountryScreentShot: idx_display = 0 for type in self.listDisplay: # try: # mainAppConnectApi.DeleteAllScreenShot(appid, version, country, type) # except Exception as e: # print("DeleteAllScreenShot eror=",e) for i in range(total_screenshot): filepath = mainResource.GetOutPutScreenshot( isHD) + "/" + self.listCountryLanguage[ idx_country] + "/" + self.listDisplayName[ idx_display] + "/" + str(i + 1) + ".jpg" print("UploadScreenShot filepath=", filepath) if os.path.exists(filepath): mainAppConnectApi.UploadScreenShot( appid, version, country, type, filepath) idx_display += 1 idx_country += 1
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 CreateBundleID(self, isHD): print("CreateBundleID enter=") # isHD = True appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) # package = "com.moonma.fillfood.pad2" print("CreateBundleID package=", package, " appid=", appid) mainAppConnectApi.CreateBundleID(package)
def UploadIAPInfo(self, isHd, stros): package = mainAppInfo.GetAppPackage(stros, isHd) rootJson = self.LoadJsonIAP(isHd, stros) rootConfig = mainResource.GetProjectConfigDefault() striap = FileUtil.GetFileString(rootConfig + "/appstore/KEY_IAP.xml") listIAP = [] for item in rootJson["items"]: if item["isSkip"]: continue name = item["key"] striap = striap.replace("_NAME_", name) product_id = package + "." + item["id"] striap = striap.replace("_ID_", product_id) # consumable non-consumable isConsume = item["isConsume"] product_type = "non-consumable" if isConsume: product_type = "consumable" striap = striap.replace("_TYPE_", product_type) title_cn = item["title"]["cn"] striap = striap.replace("_TITLE_CN_", title_cn) title_en = item["title"]["en"] striap = striap.replace("_TITLE_EN_", title_en) title_cn = item["detail"]["cn"] striap = striap.replace("_DETAIL_CN_", title_cn) title_en = item["detail"]["en"] striap = striap.replace("_DETAIL_EN_", title_en) price = item["price_tier"] striap = striap.replace("_PRICE_", price) listIAP.append(striap) str_metadata_xml = FileUtil.GetFileString(rootConfig + "/appstore/IAP_metadata.xml") str_metadata_xml = str_metadata_xml.replace( "_VENDOR_ID_", mainAppInfo.GetAppSKU(isHd)) strkeyiap = "" for strtmp in listIAP: strkeyiap += strtmp str_metadata_xml = str_metadata_xml.replace("_KEY_IAP_", strkeyiap) rootConfig = mainResource.GetProjectConfigApp() file_metadata_ios = rootConfig + "/appstore/ios/app.itmsp/metadata.xml" if isHd: file_metadata_ios = rootConfig + "/appstore/ios/app_pad.itmsp/metadata.xml" FileUtil.SaveString2File(str_metadata_xml, file_metadata_ios) mainAppstoreUploadiOS.Run(isHd)
def CreateApp(self, isHD): # ad.GoHome(isHD) time.sleep(1) print(" gp CreateApp") package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) name = mainAppInfo.GetAppName(Source.IOS, isHD, Source.LANGUAGE_EN) gameName = mainResource.getGameName() gameType = mainResource.getGameType() #self.driver.get(self.HTTP_HEAD+"GooglePlayDeveloperAPI/CreateApp?package="+package+"&name="+name+"&apptype="+gameType+"&appkey="+gameName+"&path="+mainResource.cmdPath) mainAppStoreGoogleInternal.Run("createapp", isHD)
def DownloadAppleDeveloper(self, isHd): url = "https://developer.apple.com/account/resources/profiles/add" self.driver.get(url) time.sleep(3) webcmd = WebDriverCmd(self.driver) key = "//button[@id='action-ok']" item = webcmd.Find(key) if item is not None: item = webcmd.AddCmd(CmdType.CLICK_Action, key) webcmd.Run(True) self.driver.get(url) # <label for="IOS_APP_STORE"> key = "//label[@for='IOS_APP_STORE']" item = webcmd.AddCmdWait(CmdType.CLICK_Action, key) webcmd.Run(True) # <button type="summit" id="action-continue" class="tb-btn--primary">Continue</button> key = "//button[@id='action-continue']" item = webcmd.AddCmd(CmdType.CLICK_Action, key) webcmd.Run(True) package = mainAppInfo.GetAppPackage(Source.IOS, isHd) print(package) # select app # <div class=" css-1hwfws3"> key = "//div[@class=' css-1hwfws3']" item = webcmd.AddCmdWait(CmdType.CLICK_Action, key) webcmd.Run(True) key = "//input[@id='react-select-2-input']" item = webcmd.AddCmdWait(CmdType.INPUT, key, package) webcmd.Run(True) # 手工输入包名 # <div><label for="name">Provisioning Profile Name</label><input type="text" maxlength="50" id="name" class="form-text text-input" required=""></div> key = "//input[@id='name']" item = webcmd.Find(key, True) webcmd.AddCmd(CmdType.INPUT, key, package) webcmd.Run(True) # <button type="submit" id="action-continue" class="tb-btn--primary">Generate</button> key = "//button[@id='action-continue']" item = webcmd.AddCmd(CmdType.CLICK_Action, key) webcmd.Run(True) # <a class="tb-btn--primary" download="" href="/services-account/QH65B2/account/ios/profile/downloadProfileContent?teamId=Y9ZUK2WTEE&provisioningProfileId=TUNL6PRSZA">Download</a> key = "//a[@class='tb-btn--primary']" item = webcmd.AddCmdWait(CmdType.CLICK_Action, key) webcmd.Run(True)
def UpdateAppInfo(self, isHD): package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) version = mainAppInfo.GetAppVersion(Source.ANDROID, isHD) idx = 0 print("google UpdateAppInfo=", package) for country in self.listCountry: lan = self.listCountryLanguage[idx] name = mainAppInfo.GetAppName(Source.IOS, isHD, lan) description = mainAppInfo.GetAppDetail(isHD, lan) promotionalText = mainAppInfo.GetAppPromotion(isHD, lan) mainGooglePlayApi.UpdateAppInfo(package, country, name, description, promotionalText, str(isHD), lan) idx += 1
def UploadScreenShot(self, isHD): # isHD = True package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) version = mainAppInfo.GetAppVersion(Source.ANDROID, isHD) total_screenshot = 5 idx_country = 0 idx_display = 0 for country in self.listCountry: idx_display = 0 for type in self.listDisplay: for i in range(total_screenshot): applan = self.listCountryLanguage[idx_country] filepath = mainResource.GetOutPutScreenshot( isHD) + "/" + applan + "/" + self.listDisplayName[ idx_display] + "/" + str(i + 1) + ".jpg" if self.listDisplayName[idx_display] == "icon": filepath = mainResource.GetOutPutIconPathWin32( mainResource.GetProjectOutPut(), Source.TAPTAP, isHD) + "\\icon_android_512.png" if i > 0: continue if self.listDisplayName[idx_display] == "adhome": filepath = mainResource.GetOutPutAdPathWin32( mainResource.GetProjectOutPut(), Source.TAPTAP, isHD ) + "\\" + applan + "\\" + "ad_home_1024x500.png" if i > 0: continue print("UploadScreenShot filepath=", filepath) if os.path.exists(filepath): mainGooglePlayApi.DeleteAllScreenShot( package, version, country, type) mainGooglePlayApi.UploadOneScreenShot( package, filepath, country, type) idx_display += 1 idx_country += 1
def UpdateApk(self, isHD): package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) gameName = mainResource.getGameName() gameType = mainResource.getGameType() mainAppStoreGoogleInternal.Run("UpdateApk", isHD)
def UpdateApk(self, isHD): package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) apk = mainResource.GetOutPutApkPath(Source.GP, isHD) mainGooglePlayApi.UploadApk(package, apk)
def CreateApp(self, isHD): self.driver.get( "http://union.baidu.com/bqt/appco.html#/promotion/application/create" ) time.sleep(1) webcmd = WebDriverCmd(self.driver) appChannel = Source.TAPTAP appid = mainAppInfo.GetAppId(isHD, Source.TAPTAP) appurl = "https://www.taptap.com/app/" + appid if appid == "0": appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) appChannel = Source.HUAWEI # appurl = mainAppVersionHuawei.GetApkUrl(mainAppInfo.GetAppId(isHD, Source.HUAWEI)) appurl = "https://appgallery1.huawei.com/#/app/C" + appid key = "//input[@type='text' and @name='name']" title = self.GetAppName(isHD) if self.osApp == Source.IOS: appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) title = mainAppVersionApple.GetAppName(appid) self.SetText(key, title) # 行业 key = "//div[@class='veui-select veui-select-empty']" div = webcmd.Find(key) key = ".//button[@aria-haspopup='listbox']" item = webcmd.FindChild(div, key) item.click() time.sleep(1) key = "//span[@class='veui-option-label' and text()='教育']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(1) key = "//span[@class='veui-option-label' and text()='儿童']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) key = "//input[@type='text' and @name='keyword']" title = self.GetAppName(isHD) self.SetText(key, title) key = "//textarea[@class='veui-textarea-input']" title = mainAppInfo.GetAppDetail(isHD, Source.LANGUAGE_CN) max = 150 if len(title) >= max: title = title[0:max - 1] self.SetText(key, title) # <button type="button" class="veui-button"> Android </button> if self.osApp == Source.ANDROID: key = "//button[@class='veui-button' and contains(text(),'Android')]" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) key = "//input[@type='text' and @name='packageName']" title = mainAppInfo.GetAppPackage(self.osApp, isHD) self.SetText(key, title) #应用市场 http://app.mi.com/details?id=com.kibey.prophecy if self.osApp == Source.ANDROID: key = "//button[@class='veui-button veui-dropdown-button']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) time.sleep(1) keyword = "" if appChannel == Source.TAPTAP: keyword = "TapTap" if appChannel == Source.HUAWEI: # 华为应用市场 keyword = "华为" key = "//span[@class='veui-option-label' and text()='" + keyword + "']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) if self.osApp == Source.IOS: appurl = mainAppInfo.GetAppUrl(Source.IOS, isHD, Source.APPSTORE) key = "//input[@type='text' and @name='appUrl']" # http(s)://appdl-drcn.dbankcdn.com/xxx或者http(s)://appdlc-drcn.hispace.hicloud.com/xxx # http://appdlc-drcn.hispace.hicloud.com/dl/appdl/application/apk/7c/7c1e552794ec43d488e9149e6c4644a7/com.ss.android.ugc.aweme.lite.2007201350.apk print("appurl=", appurl) self.SetText(key, appurl) old_window = self.driver.current_window_handle # 下一步 # <button ui="primary" type="submit" class="veui-button">下一步</button> key = "//button[@ui='primary' and @type='submit']" webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) # 跳转到新的页面 print("self.driver.current_url=", self.driver.current_url) # self.driver.switch_to.window(self.driver.window_handles[0]) for win in self.driver.window_handles: if win != old_window: self.driver.switch_to.window(win) time.sleep(3) print("self.driver.current_url 2=", self.driver.current_url) if self.osApp == Source.ANDROID: self.UpLoadSignAndroid() if self.osApp == Source.IOS: self.UpLoadSigniOS(isHD) # 完成 key = "//button[@ui='primary' and @type='submit']" webcmd.AddCmd(CmdType.CLICK_Action, key) webcmd.Run(True)
def UpdateApkApi(self, isHD): package = mainAppInfo.GetAppPackage(Source.ANDROID, isHD) apk = mainResource.GetOutPutApkPath(Source.HUAWEI, isHD) appid = mainAppInfo.GetAppId(isHD, Source.HUAWEI) mainHuaweiAppGalleryApi.UploadApk(appid, apk)
def DownloadProfile(self, isHD): # isHD = True appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) print("DownloadProfile package=", package, " appid=", appid) mainAppConnectApi.GetAppProfile(package, appid)
def CreateApp(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) package = mainAppInfo.GetAppPackage(Source.IOS, isHD) if appid != "0": self.FillAppInfo(isHD) # self.UpdateAppInfo(isHD) # self.UploadScreenShot(isHD) # self.Init() # self.GoHome(isHD) return # mainAppConnectApi.GetAppProfile(package,appid) # package = mainAppInfo.GetAppPackage(Source.IOS,isHD) bundleid = mainAppConnectApi.GetBundleIdByPackage(package) webcmd = WebDriverCmd(self.driver) url = "https://appstoreconnect.apple.com/apps" self.driver.get(url) time.sleep(2) self.urlold = self.driver.current_url webcmd.AddCmdWait(CmdType.CLICK, "//button[@id='new-app-btn-icon']") webcmd.AddCmd(CmdType.CLICK, "//button[@id='new-app-btn']") webcmd.AddCmdWait(CmdType.CLICK, "//input[@name='appStoreVersionsIOS']") webcmd.AddCmd( CmdType.INPUT, "//input[@id='name']", mainAppInfo.GetAppName(Source.IOS, isHD, Source.LANGUAGE_EN)) webcmd.AddCmd(CmdType.INPUT, "//input[@id='sku']", mainAppInfo.GetAppSKU(isHD)) key = "//select[@name='primaryLocale']" item = webcmd.AddCmd(CmdType.CLICK, key) webcmd.Run(True) if item == None: item = webcmd.Find(key) key = ".//option[@value='en-US']" subitem = webcmd.FindChild(item, key) webcmd.DoCmd(subitem, CmdType.CLICK) item = webcmd.AddCmd(CmdType.CLICK, "//select[@name='bundleId']") webcmd.Run(True) # time.sleep(2) key = ".//option[@value='" + package + "']" subitem = webcmd.FindChild(item, key, True) webcmd.DoCmd(subitem, CmdType.CLICK) time.sleep(1) webcmd.AddCmd(CmdType.INPUT, "//input[@id='sku']", mainAppInfo.GetAppSKU(isHD)) # item=webcmd.AddCmd(CmdType.CLICK_SCRIPT, "//button[@type='primary'] and text()='创建'") # webcmd.Run(True) # webcmd.WaitKeyBoard("q") # 等待创建成功 while True: time.sleep(1) self.urlnew = self.driver.current_url print("CreateApp urlnew=", self.urlnew) if self.urlnew != self.urlold: print("CreateApp Finish =", self.urlnew) break time.sleep(2) # https://appstoreconnect.apple.com/apps/1525843317/appstore/ios/version/inflight url = self.driver.current_url print(url) head = "/apps/" idx = url.find(head) + len(head) url = url[idx:] idx = url.find("/") appid = url[0:idx] print("appid create =", appid) if len(appid) > 2: mainAppInfo.SetAppId(isHD, Source.IOS, Source.APPSTORE, appid) self.FillAppInfo(isHD)
def CreateNewVersion(self, isHD): appid = mainAppInfo.GetAppId(isHD, Source.APPSTORE) mainAppConnectApi.CreateNewVersion( appid, mainAppInfo.GetAppVersion(Source.IOS, isHD), mainAppInfo.GetAppPackage(Source.IOS, isHD))