Rely on just window history

This commit is contained in:
Marquis Kurt 2019-12-11 12:55:38 -05:00
parent 93f135e93b
commit e761dc4f97
No known key found for this signature in database
GPG Key ID: 725636D259F5402D
2 changed files with 5 additions and 19 deletions

View File

@ -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"

View File

@ -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;
}