public async Task <string> GetJavaScriptBundleFileAsync(string assetsBundleFileName) { AssetsBundleFileName = assetsBundleFileName; string binaryJsBundleUrl = CodePushUtils.GetAssetsBundlePrefix() + assetsBundleFileName; var binaryResourcesModifiedTime = await FileUtils.GetBinaryResourcesModifiedTimeAsync(AssetsBundleFileName).ConfigureAwait(false); var packageFile = await UpdateManager.GetCurrentPackageBundleAsync(AssetsBundleFileName).ConfigureAwait(false); if (packageFile == null) { // There has not been any downloaded updates. CodePushUtils.LogBundleUrl(binaryJsBundleUrl); IsRunningBinaryVersion = true; return(binaryJsBundleUrl); } var packageMetadata = await UpdateManager.GetCurrentPackageAsync().ConfigureAwait(false); long?binaryModifiedDateDuringPackageInstall = null; var binaryModifiedDateDuringPackageInstallString = (string)packageMetadata[CodePushConstants.BinaryModifiedTimeKey]; if (binaryModifiedDateDuringPackageInstallString != null) { binaryModifiedDateDuringPackageInstall = long.Parse(binaryModifiedDateDuringPackageInstallString); } var packageAppVersion = (string)packageMetadata["appVersion"]; if (binaryModifiedDateDuringPackageInstall != null && binaryModifiedDateDuringPackageInstall == binaryResourcesModifiedTime && AppVersion.Equals(packageAppVersion)) { CodePushUtils.LogBundleUrl(packageFile.Path); IsRunningBinaryVersion = false; return(CodePushUtils.GetFileBundlePrefix() + CodePushUtils.ExtractSubFolder(packageFile.Path)); } else { // The binary version is newer. DidUpdate = false; if (!MainPage.UseDeveloperSupport || !AppVersion.Equals(packageAppVersion)) { await ClearUpdatesAsync().ConfigureAwait(false); } CodePushUtils.LogBundleUrl(binaryJsBundleUrl); IsRunningBinaryVersion = true; return(binaryJsBundleUrl); } }
internal static async Task <IFolder> GetCodePushFolderAsync() { var pathToCodePush = Path.Combine(CodePushUtils.GetFileBundlePrefix(), CodePushConstants.CodePushFolderPrefix); return(await FileSystem.Current.LocalStorage.CreateFolderAsync(pathToCodePush, CreationCollisionOption.OpenIfExists).ConfigureAwait(false)); }