Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
fix: URL for Expo Go projects (#4)
Browse files Browse the repository at this point in the history
### Linked issue

#3
  • Loading branch information
sguha00 authored Sep 7, 2021
1 parent 913d2b1 commit 7ec200f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -189341,14 +189341,14 @@ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
Object.defineProperty(exports, "__esModule", { value: true });
exports.createQRCodeURL = void 0;
const config_1 = __webpack_require__(5641);
const generateQRCodeBaseURLForGo = 'https://api.qrserver.com/v1/create-qr-code/?size=512x512&data=exp://exp.host';
const generateQRCodeBaseURLForGo = 'https://api.qrserver.com/v1/create-qr-code';
const generateQRCodeBaseURLForBare = 'https://us-central1-exponentjs.cloudfunctions.net';
function createQRCodeURL(projectFlavor, manifestURL, scheme) {
if (projectFlavor === config_1.ProjectFlavor.DevelopmentClient) {
return `${generateQRCodeBaseURLForBare}/generateQRCode/development-client?appScheme=${scheme}&url=${manifestURL}`;
}
else if (projectFlavor === config_1.ProjectFlavor.ExpoGo) {
return `${generateQRCodeBaseURLForGo}/${manifestURL}`;
return `${generateQRCodeBaseURLForGo}?size=512x512&data=${manifestURL.replace('https://', 'exp://')}`;
}
throw new Error('Unknown project flavor.');
}
Expand Down
4 changes: 2 additions & 2 deletions src/url.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ProjectFlavor } from './config';

const generateQRCodeBaseURLForGo = 'https://api.qrserver.com/v1/create-qr-code/?size=512x512&data=exp://exp.host';
const generateQRCodeBaseURLForGo = 'https://api.qrserver.com/v1/create-qr-code';
const generateQRCodeBaseURLForBare = 'https://us-central1-exponentjs.cloudfunctions.net';

export function createQRCodeURL(projectFlavor: ProjectFlavor, manifestURL: string, scheme: string): string {
if (projectFlavor === ProjectFlavor.DevelopmentClient) {
return `${generateQRCodeBaseURLForBare}/generateQRCode/development-client?appScheme=${scheme}&url=${manifestURL}`;
} else if (projectFlavor === ProjectFlavor.ExpoGo) {
return `${generateQRCodeBaseURLForGo}/${manifestURL}`;
return `${generateQRCodeBaseURLForGo}?size=512x512&data=${manifestURL.replace('https://', 'exp://')}`;
}

throw new Error('Unknown project flavor.');
Expand Down

0 comments on commit 7ec200f

Please sign in to comment.