/// <summary>
        /// Called right after a build process ends
        /// </summary>
        /// <param name="report">A summary of the build process</param>
        public void OnPostprocessBuild(BuildReport report)
        {
            BuildSummary summary = report.summary;

            if (summary.platform != BuildTarget.WebGL)
            {
                return;
            }

            string buildOutputDir = summary.outputPath;
            string buildGUID      = summary.guid.ToString();

            ShareUtils.AddBuildDirectory(buildOutputDir);

            ShareWindow windowInstance = ShareWindow.FindInstance();

            windowInstance?.Store.Dispatch(new BuildFinishAction
            {
                outputDir = buildOutputDir,
                buildGUID = buildGUID
            });

            WriteMetadataFile(summary.outputPath, buildGUID);
            windowInstance?.OnBuildCompleted();
        }
        public static AppState reducer(AppState old, object action)
        {
            switch (action)
            {
            case BuildFinishAction build:
                return(old.CopyWith(
                           buildOutputDir: build.outputDir,
                           buildGUID: build.buildGUID
                           ));

            case ZipPathChangeAction zip:
                return(old.CopyWith(
                           zipPath: zip.zipPath,
                           step: ShareStep.Zip
                           ));

            case UploadStartAction upload:
                AnalyticsHelper.UploadStarted();
                return(old.CopyWith(step: ShareStep.Upload));

            case QueryProgressAction query:

                return(old.CopyWith(
                           step: ShareStep.Process,
                           key: query.key
                           ));

            case UploadProgressAction upload:
                ShareWindow.FindInstance()?.OnUploadProgress(upload.progress);
                return(old);

            case QueryProgressResponseAction queryResponse:
                ShareStep?step = null;
                if (queryResponse.response.progress == 100)
                {
                    step = ShareStep.Idle;
                }

                ShareWindow.FindInstance()?.OnProcessingProgress(queryResponse.response.progress);
                return(old.CopyWith(url: queryResponse.response.url, step: step));

            case TitleChangeAction titleChangeAction: return(old.CopyWith(title: titleChangeAction.title));

            case DestroyAction destroyAction: return(new AppState(buildOutputDir: old.buildOutputDir, buildGUID: old.buildGUID));

            case OnErrorAction errorAction: return(old.CopyWith(errorMsg: errorAction.errorMsg));

            case StopUploadAction stopUploadAction: return(new AppState(buildOutputDir: old.buildOutputDir, buildGUID: old.buildGUID));

            case NotLoginAction login: return(old.CopyWith(step: ShareStep.Login));

            case LoginAction login: return(old.CopyWith(step: ShareStep.Idle));
            }
            return(old);
        }