Skip to content

Commit abeb3b0

Browse files
authored
Merge pull request #235 from 0xsequence/webgl-demo-workflow
changed vite config and App.tsx, new demo build
2 parents 255bed5 + bb51dcb commit abeb3b0

File tree

9 files changed

+92
-12
lines changed

9 files changed

+92
-12
lines changed

.github/workflows/demo-build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["master"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Single deploy job since we're just deploying
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v5
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: '18'
40+
- name: Install dependencies
41+
run: npm ci --prefix ./Demo/
42+
- name: Build the React app
43+
run: npm run build --prefix ./Demo/
44+
- name: Move Build Files
45+
run: ls ./Demo/ && mkdir ./Demo/dist/Build && cp -r ./Demo/Build/* ./Demo/dist/Build
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
# Upload entire repository
50+
path: './Demo/dist/'
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

Assets/WebGLTemplates/SequenceReact/src/App.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {ReactUnityEventParameter} from "react-unity-webgl/distribution/types/react-unity-event-parameters";
12
import { Unity, useUnityContext } from "react-unity-webgl";
23
import { useCallback, useEffect, useState } from "react";
34
import {
@@ -25,11 +26,14 @@ import "./App.css";
2526

2627
const loadingPercentage = Math.round(loadingProgression * 100);
2728

28-
const handleGoogleSignIn = useCallback((googleClientId: string, nonce: string) => {
29-
setGoogleClientId(googleClientId);
30-
setNonce(nonce);
31-
setShowLogin(true);
32-
}, []);
29+
const handleGoogleSignIn = useCallback((...parameters: ReactUnityEventParameter[]): ReactUnityEventParameter => {
30+
const googleClientId = parameters[0] as string;
31+
const nonce = parameters[1] as string;
32+
setGoogleClientId(googleClientId);
33+
setNonce(nonce);
34+
setShowLogin(true);
35+
return '';
36+
}, []);
3337

3438
const [googleClientIdState, setGoogleClientId] = useState("");
3539
const [nonce, setNonce] = useState("");

Assets/WebGLTemplates/SequenceReact/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ import react from '@vitejs/plugin-react'
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
base: './',
8+
build: {
9+
assetsDir: '.',
10+
outDir: 'dist',
11+
},
712
})

Demo/Build/Demo.data

-15 Bytes
Binary file not shown.

Demo/src/App.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {ReactUnityEventParameter} from "react-unity-webgl/distribution/types/react-unity-event-parameters";
12
import { Unity, useUnityContext } from "react-unity-webgl";
23
import { useCallback, useEffect, useState } from "react";
34
import {
@@ -25,11 +26,14 @@ import "./App.css";
2526

2627
const loadingPercentage = Math.round(loadingProgression * 100);
2728

28-
const handleGoogleSignIn = useCallback((googleClientId: string, nonce: string) => {
29-
setGoogleClientId(googleClientId);
30-
setNonce(nonce);
31-
setShowLogin(true);
32-
}, []);
29+
const handleGoogleSignIn = useCallback((...parameters: ReactUnityEventParameter[]): ReactUnityEventParameter => {
30+
const googleClientId = parameters[0] as string;
31+
const nonce = parameters[1] as string;
32+
setGoogleClientId(googleClientId);
33+
setNonce(nonce);
34+
setShowLogin(true);
35+
return '';
36+
}, []);
3337

3438
const [googleClientIdState, setGoogleClientId] = useState("");
3539
const [nonce, setNonce] = useState("");

Demo/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ import react from '@vitejs/plugin-react'
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
base: './',
8+
build: {
9+
assetsDir: '.',
10+
outDir: 'dist',
11+
},
712
})

Packages/Sequence-Unity/WebGLTemplates/SequenceReact/src/App.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {ReactUnityEventParameter} from "react-unity-webgl/distribution/types/react-unity-event-parameters";
12
import { Unity, useUnityContext } from "react-unity-webgl";
23
import { useCallback, useEffect, useState } from "react";
34
import {
@@ -25,10 +26,13 @@ import "./App.css";
2526

2627
const loadingPercentage = Math.round(loadingProgression * 100);
2728

28-
const handleGoogleSignIn = useCallback((googleClientId: string, nonce: string) => {
29+
const handleGoogleSignIn = useCallback((...parameters: ReactUnityEventParameter[]): ReactUnityEventParameter => {
30+
const googleClientId = parameters[0] as string;
31+
const nonce = parameters[1] as string;
2932
setGoogleClientId(googleClientId);
3033
setNonce(nonce);
3134
setShowLogin(true);
35+
return '';
3236
}, []);
3337

3438
const [googleClientIdState, setGoogleClientId] = useState("");

Packages/Sequence-Unity/WebGLTemplates/SequenceReact/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ import react from '@vitejs/plugin-react'
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
base: './',
8+
build: {
9+
assetsDir: '.',
10+
outDir: 'dist',
11+
},
712
})

Packages/Sequence-Unity/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xyz.0xsequence.waas-unity",
3-
"version": "3.17.2",
3+
"version": "3.17.3",
44
"displayName": "Sequence Embedded Wallet SDK",
55
"description": "A Unity SDK for the Sequence WaaS API",
66
"unity": "2021.3",

0 commit comments

Comments
 (0)