Skip to content

Commit

Permalink
Merge pull request #34 from leon-dunamu/feature/fix-app-version
Browse files Browse the repository at this point in the history
fix: ํŒŒ์‹ฑ ์—๋Ÿฌ ํ•ด๊ฒฐ ์ค‘
  • Loading branch information
leon-dunamu authored Oct 13, 2021
2 parents 6406abf + ec07629 commit f8a4b0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { AndroidToast } from '@utils/android';
import { fetchNotifications } from '@api/api-notifications';

export default function MainPage() {
const [version, setVersion] = useState<string>('');
const [version, setVersion] = useState<{ prev: any; parsed: any }>({
prev: '',
parsed: '',
});
const navList = [
{ title: '๋ฉ”์ธ', path: '/main' },
{ title: 'QR์ฝ”๋“œ', path: '/qrcode' },
Expand Down Expand Up @@ -46,13 +49,17 @@ export default function MainPage() {
const version =
(window as any).Android?.getVersionInfo() ||
`{"current_version": "sample"}`;
console.log(version);

setVersion(JSON.parse(version)?.current_version);
setVersion({
prev: version,
parsed: JSON.parse(version)?.current_version,
});
}}
style={{ marginBottom: 8, display: 'block' }}
/>
<h5>๋ฒ„์ „์ •๋ณด : {version}</h5>
<h5>๋ฒ„์ „์ •๋ณด</h5>
<p>ํŒŒ์‹ฑ ์ „ : {version.prev}</p>
<p>ํŒŒ์‹ฑ ํ›„ : {version.parsed}</p>
</div>
</>
);
Expand Down
2 changes: 1 addition & 1 deletion src/views/MyPage/Guide/Guide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const Guide = () => {

const Android = (window as any)?.Android;
const version = Android?.getVersionInfo() || `{"current_version": "-"}`;
setVersion(JSON.parse(version).current_version);
setVersion(JSON.parse(version)?.current_version);
}, []);

return (
Expand Down

0 comments on commit f8a4b0e

Please sign in to comment.