Skip to content

Commit

Permalink
improve: System back now closes tabs if cannot go any further back.
Browse files Browse the repository at this point in the history
This requires optimization when in Paralleow mode to fit general using habits!
  • Loading branch information
awaLiny2333 committed Dec 5, 2024
1 parent 84a5313 commit 413567d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions home/src/main/ets/blocks/meowTabs.ets
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ struct meowTabs {

// Switch
this.current_main_tab_index = this.bunch_of_tabs.switchToTab(target);
console.log('[Meow][meowTabs] Switch to tab ' + this.current_main_tab_index.toString())
if (this.recover_tabs_finished) {
// Update history
this.update_backward_forward_access()
Expand Down Expand Up @@ -582,6 +583,7 @@ struct meowTabs {
}

on_targeted_close_tab() {
console.log('close' + this.close_tab_gateway.toString())
if (this.close_tab_gateway >= 0) {
this.close_tab(this.close_tab_gateway);
this.close_tab_gateway = -1;
Expand Down
9 changes: 8 additions & 1 deletion home/src/main/ets/pages/Index.ets
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ struct Index {
@StorageLink('current_loading_progress') current_loading_progress: number = 0
@StorageLink('tab_is_loading') tab_is_loading: boolean[] = [true]
@StorageLink('current_is_loading') current_is_loading: boolean = true
// Web control statuses
// Web control
@StorageLink('current_main_tab_index') current_main_tab_index: number = 0;
@StorageLink('current_sub_tab_index') current_sub_tab_index: number = -1;
@StorageLink('current_accessForward') current_accessForward: boolean = false;
@StorageLink('current_accessBackward') current_accessBackward: boolean = false;
@StorageLink('universal_close_tab_gateway') uni_close_tab_gateway: number = -1;
// Settings
@State @Watch('on_title_bar_position_change') settings_title_bar_position: string = "";
@State sys_back_to_access_backward: boolean = false;
Expand Down Expand Up @@ -141,6 +142,12 @@ struct Index {
if (this.sys_back_to_access_backward) {
if (this.go_back_if_possible()) {
stop_system_back = true;
} else {
if (this.bunch_of_tabs.Tabs.length > 1) {
// Can close something
this.uni_close_tab_gateway = this.current_main_tab_index;
stop_system_back = true;
}
}
}

Expand Down

0 comments on commit 413567d

Please sign in to comment.