Skip to content

Commit f8e37e4

Browse files
authored
importing github project in offline app (#11208)
1 parent 50486a9 commit f8e37e4

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

webapp/src/app.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6075,11 +6075,7 @@ function isProjectRelatedHash(hash: { cmd: string; arg: string }): boolean {
60756075
}
60766076

60776077
async function importGithubProject(repoid: string, requireSignin?: boolean) {
6078-
if (!pxt.appTarget.appTheme.githubEditor || pxt.BrowserUtils.isPxtElectron()) {
6079-
core.warningNotification(lf("Importing GitHub projects not currently supported"));
6080-
theEditor.openHome();
6081-
return;
6082-
}
6078+
const githubEnabled = !!pxt.appTarget.appTheme.githubEditor && !pxt.BrowserUtils.isPxtElectron();
60836079

60846080
core.showLoading("loadingheader", lf("importing GitHub project..."));
60856081
try {
@@ -6093,7 +6089,7 @@ async function importGithubProject(repoid: string, requireSignin?: boolean) {
60936089
pxt.github.normalizeRepoId(h.githubId) == repoid
60946090
);
60956091
if (!hd) {
6096-
if (requireSignin) {
6092+
if (requireSignin && githubEnabled) {
60976093
const token = await cloudsync.githubProvider(true).routedLoginAsync(repoid);
60986094
if (!token.accessToken) { // did not sign in, give up
60996095
theEditor.openHome();
@@ -6102,8 +6098,14 @@ async function importGithubProject(repoid: string, requireSignin?: boolean) {
61026098
}
61036099
hd = await workspace.importGithubAsync(repoid);
61046100
}
6105-
if (hd)
6101+
if (hd) {
6102+
if (!githubEnabled) {
6103+
hd.githubId = undefined;
6104+
hd.githubTag = undefined;
6105+
hd.githubCurrent = false;
6106+
}
61066107
await theEditor.loadHeaderAsync(hd, null)
6108+
}
61076109
else
61086110
theEditor.openHome();
61096111
} catch (e) {

0 commit comments

Comments
 (0)