mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 03:54:16 +00:00
fix props & handlers
This commit is contained in:
parent
d1af2d4777
commit
203553d7d1
@ -160,6 +160,11 @@ class ComtyApp extends React.Component {
|
|||||||
defaultLocked: options.defaultLocked ?? false,
|
defaultLocked: options.defaultLocked ?? false,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
sessionController: this.sessionController,
|
sessionController: this.sessionController,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
bodyStyle: {
|
||||||
|
height: "100%",
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@ -226,15 +231,15 @@ class ComtyApp extends React.Component {
|
|||||||
app.eventBus.emit("app.softReload")
|
app.eventBus.emit("app.softReload")
|
||||||
},
|
},
|
||||||
goAuth: () => {
|
goAuth: () => {
|
||||||
return app.setLocation(config.app.authPath ?? "/auth")
|
return app.location.push(config.app.authPath ?? "/auth")
|
||||||
},
|
},
|
||||||
goMain: () => {
|
goMain: () => {
|
||||||
return app.setLocation(config.app.mainPath ?? "/home")
|
return app.location.push(config.app.mainPath ?? "/home")
|
||||||
},
|
},
|
||||||
goToSettings: (setting_id) => {
|
goToSettings: (setting_id) => {
|
||||||
app.cores.sound.useUIAudio("navigation.settings")
|
app.cores.sound.useUIAudio("navigation.settings")
|
||||||
|
|
||||||
return app.setLocation(`/settings`, {
|
return app.location.push(`/settings`, {
|
||||||
query: {
|
query: {
|
||||||
setting: setting_id
|
setting: setting_id
|
||||||
}
|
}
|
||||||
@ -250,10 +255,10 @@ class ComtyApp extends React.Component {
|
|||||||
username = app.userData.username
|
username = app.userData.username
|
||||||
}
|
}
|
||||||
|
|
||||||
return app.setLocation(`/account/${username}`)
|
return app.location.push(`/account/${username}`)
|
||||||
},
|
},
|
||||||
goToPost: (post_id) => {
|
goToPost: (post_id) => {
|
||||||
return app.setLocation(`/post/${post_id}`)
|
return app.location.push(`/post/${post_id}`)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
electron: {
|
electron: {
|
||||||
@ -300,18 +305,6 @@ class ComtyApp extends React.Component {
|
|||||||
return await StatusBar.show()
|
return await StatusBar.show()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
openDebugger: () => {
|
|
||||||
// create a new dom window
|
|
||||||
const win = new DOMWindow({
|
|
||||||
id: "debug",
|
|
||||||
title: "Debug",
|
|
||||||
})
|
|
||||||
|
|
||||||
win.createDefaultWindow(loadable(() => import("./debug")), {
|
|
||||||
width: 700,
|
|
||||||
height: 500,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
clearInternalStorage: async () => {
|
clearInternalStorage: async () => {
|
||||||
antd.Modal.confirm({
|
antd.Modal.confirm({
|
||||||
title: "Clear internal storage",
|
title: "Clear internal storage",
|
||||||
@ -401,47 +394,6 @@ class ComtyApp extends React.Component {
|
|||||||
icon: <Icons.MdOutlineAccessTimeFilled />,
|
icon: <Icons.MdOutlineAccessTimeFilled />,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
"api.ws.main.connect": () => {
|
|
||||||
if (this.wsReconnecting) {
|
|
||||||
this.wsReconnectingTry = 0
|
|
||||||
this.wsReconnecting = false
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
Toast.show({
|
|
||||||
icon: "success",
|
|
||||||
content: "Connected",
|
|
||||||
})
|
|
||||||
}, 500)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"api.ws.main.connect_error": () => {
|
|
||||||
if (!this.wsReconnecting) {
|
|
||||||
this.wsReconnectingTry = 0
|
|
||||||
this.wsReconnecting = true
|
|
||||||
|
|
||||||
Toast.show({
|
|
||||||
icon: "loading",
|
|
||||||
content: "Connecting...",
|
|
||||||
duration: 0,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
this.wsReconnectingTry = this.wsReconnectingTry + 1
|
|
||||||
|
|
||||||
if (this.wsReconnectingTry > 3 && app.cores.settings.get("app.reloadOnWSConnectionError")) {
|
|
||||||
window.location.reload()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"api.ws.main.disconnect": () => {
|
|
||||||
antd.notification.open({
|
|
||||||
message: <Translation>
|
|
||||||
{(t) => t("Disconnected")}
|
|
||||||
</Translation>,
|
|
||||||
description: <Translation>
|
|
||||||
{(t) => t("You have been disconnected from the server, trying to reconnect.")}
|
|
||||||
</Translation>
|
|
||||||
})
|
|
||||||
},
|
|
||||||
"devtool-opened": () => {
|
"devtool-opened": () => {
|
||||||
// show warning
|
// show warning
|
||||||
antd.notification.open({
|
antd.notification.open({
|
||||||
@ -461,7 +413,7 @@ class ComtyApp extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount = async () => {
|
componentDidMount = async () => {
|
||||||
if (app.capacitor.isAppCapacitor()) {
|
if (app.isCapacitor) {
|
||||||
window.addEventListener("statusTap", () => {
|
window.addEventListener("statusTap", () => {
|
||||||
app.eventBus.emit("statusTap")
|
app.eventBus.emit("statusTap")
|
||||||
})
|
})
|
||||||
@ -472,7 +424,7 @@ class ComtyApp extends React.Component {
|
|||||||
if (!canGoBack) {
|
if (!canGoBack) {
|
||||||
CapacitorApp.exitApp()
|
CapacitorApp.exitApp()
|
||||||
} else {
|
} else {
|
||||||
window.history.back()
|
app.location.back()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -557,11 +509,7 @@ class ComtyApp extends React.Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (!this.state.initialized) {
|
if (!this.state.initialized) {
|
||||||
return <div>
|
return <></>
|
||||||
<h1>
|
|
||||||
App is initializing...
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return <React.Fragment>
|
return <React.Fragment>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user