Rely on just window history
This commit is contained in:
parent
93f135e93b
commit
e761dc4f97
|
@ -68,7 +68,6 @@ import {
|
|||
getAccountRegistry,
|
||||
removeAccountFromRegistry
|
||||
} from "../../utilities/accounts";
|
||||
import { isChildView } from "../../utilities/appbar";
|
||||
|
||||
interface IAppLayoutState {
|
||||
acctMenuOpen: boolean;
|
||||
|
@ -223,6 +222,10 @@ export class AppLayout extends Component<any, IAppLayoutState> {
|
|||
});
|
||||
}
|
||||
|
||||
canGoBack(): boolean {
|
||||
return window.history.length > 1;
|
||||
}
|
||||
|
||||
toggleAcctMenu() {
|
||||
this.setState({ acctMenuOpen: !this.state.acctMenuOpen });
|
||||
}
|
||||
|
@ -486,7 +489,7 @@ export class AppLayout extends Component<any, IAppLayoutState> {
|
|||
{this.titlebar()}
|
||||
<AppBar className={classes.appBar} position="static">
|
||||
<Toolbar>
|
||||
{isChildView(window.location.hash) ? (
|
||||
{isDesktopApp() && this.canGoBack() ? (
|
||||
<IconButton
|
||||
className={classes.appBarBackButton}
|
||||
color="inherit"
|
||||
|
|
|
@ -9,20 +9,3 @@ import { isDarwinApp } from "./desktop";
|
|||
export function isAppbarExpanded(): boolean {
|
||||
return isDarwinApp() || process.env.NODE_ENV === "development";
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the current page is a child view and can go back.
|
||||
*/
|
||||
export function isChildView(hash: string): boolean {
|
||||
const childViews = ["#/conversation", "#/profile"];
|
||||
let foundProtocol = false;
|
||||
|
||||
childViews.forEach((childViewProtocol: string) => {
|
||||
if (hash.includes(childViewProtocol)) {
|
||||
console.log(childViewProtocol);
|
||||
foundProtocol = true;
|
||||
}
|
||||
});
|
||||
|
||||
return foundProtocol;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue