Skip to content

Commit

Permalink
feat: What's New Block in Settings - About;
Browse files Browse the repository at this point in the history
feat: Prompts when an operation fails;
codes: Clean up codes;
improve: Update README pictures, deleted outdated information;
version: 1.5.3(1000009) => 1.6.0(1000010).
  • Loading branch information
awaLiny2333 committed Nov 17, 2024
1 parent 86b898f commit ccbc7a9
Show file tree
Hide file tree
Showing 27 changed files with 458 additions and 75 deletions.
4 changes: 2 additions & 2 deletions AppScope/app.json5
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"app": {
"bundleName": "com.next.liny.linysbrowserNEXT",
"vendor": "example",
"versionCode": 1000009,
"versionName": "1.5.3",
"versionCode": 1000010,
"versionName": "1.6.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
Expand Down
Binary file removed Examples/Foldable_dark.png
Binary file not shown.
Binary file removed Examples/Phone_light_tabs.png
Binary file not shown.
Binary file removed Examples/Phone_light_web.png
Binary file not shown.
Binary file removed Examples/Tablet_light.png
Binary file not shown.
Binary file added Examples/gallery_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Examples/gallery_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Examples/gallery_3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Examples/gallery_4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,22 @@ Liny 的浏览器为 HarmonyOS NEXT 而构建,旨在为各种性能水平的

大屏(浅色):

![Tablet_light](Examples/Tablet_light.png)
![Tablet_light](Examples/gallery_4.png)

折叠屏(深色):

![Foldable_Dark](Examples/Foldable_dark.png)
![Foldable_Dark](Examples/gallery_1.png)

手机(浅色):

| 浏览页面 | 标签页面 |
|:------------------------------------------------:|:--------------------------------------------------:|
| ![Phone_light_web](Examples/Phone_light_web.png) | ![Phone_light_tabs](Examples/Phone_light_tabs.png) |
| 浏览页面 | 标签页面 |
|:------------------------------------------:|:-------------------------------------------:|
| ![Phone_light_web](Examples/gallery_2.png) | ![Phone_light_tabs](Examples/gallery_3.png) |

## 快速上手

在界面下方的输入框里输入 URL 或关键词,并且回车或点击小放大镜以提交。

点击四个小圆角矩形(2x2)组成的按钮以查看标签页,再点一次以关闭面板。

点击四个小圆点(2x2)组成的按钮以查看页面详情和更多功能,再点一次以关闭面板。

## 相关权限
Expand Down
13 changes: 5 additions & 8 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,23 @@ Thank you all with your works!! (* ̄3 ̄)╭

On Large screens (Light Mode):

![Tablet_light](Examples/Tablet_light.png)
![Tablet_light](Examples/gallery_4.png)

On Foldables (Dark Mode):

![Foldable_Dark](Examples/Foldable_dark.png)
![Foldable_Dark](Examples/gallery_1.png)

On Phones (Light Mode):

| Browsing Page | TabsView |
|:------------------------------------------------:|:--------------------------------------------------:|
| ![Phone_light_web](Examples/Phone_light_web.png) | ![Phone_light_tabs](Examples/Phone_light_tabs.png) |
| Browsing Page | TabsView |
|:------------------------------------------:|:-------------------------------------------:|
| ![Phone_light_web](Examples/gallery_2.png) | ![Phone_light_tabs](Examples/gallery_3.png) |

## Guides

Type in urls or keywords in the search box at the bottom of the app,
then return or click the little magnifying glass to submit.

Click the icon with four (2x2) little rounded squares to show all tabs,
click again to collapse the panel.

Click the icon with four (2x2) little dots to show page information and more functions,
click again to collapse the panel.

Expand Down
6 changes: 5 additions & 1 deletion home/src/main/ets/blocks/meowAppSettings.ets
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { bunch_of_settings } from '../hosts/bunch_of_settings';
import meowSEManager from './meowSEManager';
import linysLink from '../components/linysLink';
import woofAdsBlocker from '../dialogs/woofAdsBlocker';
import meowWhatsNew from './meowWhatsNew';

@Component
struct meowAppSettings {
Expand Down Expand Up @@ -93,12 +94,14 @@ struct meowAppSettings {
builder: woofHistory({ showing_settings: this.show }),
alignment: DialogAlignment.Center,
cornerRadius: 16,
showInSubWindow: true,
width: "90%",
});
adsBlocker_control: CustomDialogController = new CustomDialogController({
builder: woofAdsBlocker({ adblock_exceptions: this.adblock_exceptions }),
alignment: DialogAlignment.Center,
cornerRadius: 16,
showInSubWindow: true,
width: "90%",
});
waterFlow_control: Scroller = new Scroller();
Expand Down Expand Up @@ -423,7 +426,6 @@ struct meowAppSettings {
FlowItem() {
Column({ space: 15 }) {
linysTitleText({ text: $r('app.string.Settings_about') })
linysText({ text: "(ฅ^・ﻌ・^)ฅ - " + this.versionName + " - " + this.versionNo })
linysLink({
will_be_reversed_boolean: this.showing_app_settings,
text: $r('app.string.About_bilibili'),
Expand All @@ -439,6 +441,8 @@ struct meowAppSettings {
text: $r('app.string.About_Gitee'),
link: "https://gitee.com/awa_Liny/LinysBrowser_NEXT",
})
linysText({ text: "(ฅ^・ﻌ・^)ฅ - " + this.versionName + " - " + this.versionNo }) // Version Info
meowWhatsNew()
}
.padding(15)
.alignItems(HorizontalAlign.Start)
Expand Down
93 changes: 82 additions & 11 deletions home/src/main/ets/blocks/meowBookmarks.ets
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { kv_store_get, kv_store_put } from '../utils/kv_store_tools';
import linysShowButton from '../components/linysShowButton';
import linysCapsuleButton from '../components/linysCapsuleButton';
import woofBookmarksPathSelector from '../dialogs/woofBookmarksMove';
import woofFailPrompt from '../dialogs/woofFailPrompt';

@Component
struct meowBookmarks {
Expand All @@ -33,6 +34,34 @@ struct meowBookmarks {
// Input interactions
@State scroll_area_height: number = 0;
@State bookmark_load_from_disk_ok: boolean = false;
// Dialogs
importFailPrompt_control: CustomDialogController = new CustomDialogController({
builder: woofFailPrompt({
desc: $r('app.string.Fail_desc_import_bookmarks')
}),
alignment: DialogAlignment.Center,
cornerRadius: 16,
showInSubWindow: true,
width: "90%",
});
addFolderFailPrompt_control: CustomDialogController = new CustomDialogController({
builder: woofFailPrompt({
desc: $r('app.string.Fail_desc_new_folder')
}),
alignment: DialogAlignment.Center,
cornerRadius: 16,
showInSubWindow: true,
width: "90%",
});
addBookmarkFailPrompt_control: CustomDialogController = new CustomDialogController({
builder: woofFailPrompt({
desc: $r('app.string.Fail_desc_new_bookmark')
}),
alignment: DialogAlignment.Center,
cornerRadius: 16,
showInSubWindow: true,
width: "90%",
});

// Visual effects related

Expand Down Expand Up @@ -296,9 +325,18 @@ struct meowBookmarks {
new_folder() {
if (this.add_label == "") {
// Cannot add for no label.
this.addFolderFailPrompt_control.open();
return;
}
let result = this.bunch_of_bookmarks.add_folder(new folder(this.add_label), this.looking_at_path);

if (!result) {
// If add failed
// Perhaps due to a name crash
this.addFolderFailPrompt_control.open();
return;
}
this.bunch_of_bookmarks.add_folder(new folder(this.add_label), this.looking_at_path);

this.adding_folder = false;
this.refresh_root_content();
this.save_html_to_kv_store();
Expand All @@ -307,10 +345,19 @@ struct meowBookmarks {
new_bookmark() {
if (this.add_label == "" || this.add_link == "") {
// Cannot add for no label or no link.
this.addBookmarkFailPrompt_control.open();
return;
}
this.bunch_of_bookmarks.add_bookmark(
new bookmark(this.add_label, this.add_link), this.looking_at_path);

let rest = this.bunch_of_bookmarks.add_bookmark(new bookmark(this.add_label, this.add_link), this.looking_at_path);

if (!rest) {
// If add failed
// Perhaps due to a name crash
this.addBookmarkFailPrompt_control.open();
return;
}

this.adding_bookmark = false;
this.refresh_root_content();
this.save_html_to_kv_store();
Expand Down Expand Up @@ -341,10 +388,19 @@ struct meowBookmarks {
import_bookmarks_html() {
this.importing_bookmarks = false;
document_open().then(result => {
// if (result == "") {
// // Selected an empty file or cancelled selection
// return;
// }
let import_result: number = this.bunch_of_bookmarks.import_html(result);
this.refresh_root_content();
console.log("[Meow][LinysBookmarks] Import result: " + import_result.toString())
this.save_html_to_kv_store();

if (import_result != 0) {
// Show Fail Prompt
this.importFailPrompt_control.open();
}
})
}

Expand Down Expand Up @@ -387,12 +443,22 @@ struct bookmarkItem {
// Edit inputs
@State @Watch('on_select_change') select_result: string | undefined = undefined;
@State moving_type: string = "";
// Dialogs
moveFailPrompt_control: CustomDialogController = new CustomDialogController({
builder: woofFailPrompt({
desc: $r('app.string.Fail_desc_move_bookmarks_folders')
}),
alignment: DialogAlignment.Center,
cornerRadius: 16,
showInSubWindow: true,
width: "90%",
});
woofBookmarksPathSelector_control: CustomDialogController = new CustomDialogController({
builder: woofBookmarksPathSelector({
select: this.select_result
}),
alignment: DialogAlignment.Center,
cornerRadius: 12,
cornerRadius: 16,
width: "90%",
})

Expand Down Expand Up @@ -670,28 +736,33 @@ struct bookmarkItem {
}

on_select_change() {
// Move folder or bookmark

if (this.select_result === undefined) {
return;
}

let operation_result = 0;
if (this.moving_type == "folder") {
this.bunch_of_bookmarks.move_folder(this.get_my_path(), this.select_result);

} else if (this.moving_type == "bookmark") {
this.bunch_of_bookmarks.move_bookmark(this.get_my_path(), this.select_result);

operation_result = this.bunch_of_bookmarks.move_folder(this.get_my_path(), this.select_result);
} else {
return;
// if (this.moving_type == "bookmark")
operation_result = this.bunch_of_bookmarks.move_bookmark(this.get_my_path(), this.select_result);
}

if (operation_result != 0) {
// Show Fail Prompt
this.moveFailPrompt_control.open();
}

let temp = this.looking_at_path;
this.looking_at_path = "/refresh";
this.looking_at_path = temp;

// Refresh root content
// Weird as hell but works, fine.

this.save_html_to_kv_store();

this.select_result = undefined;
}

Expand Down
2 changes: 1 addition & 1 deletion home/src/main/ets/blocks/meowDownloads.ets
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct meowDownloads {
@StorageLink('bunch_of_downloads') @Watch('on_download_state_change') bunch_of_downloads: bunch_of_downloads =
new bunch_of_downloads();
@StorageLink('universal_new_download_gateway') @Watch('on_new_download') uni_new_download_gateway: string = "";
@Link showing_downloads: boolean;
@StorageLink('showing_downloads') showing_downloads: boolean = false;
@Link screen_width: number;

build() {
Expand Down
3 changes: 1 addition & 2 deletions home/src/main/ets/blocks/meowDrops.ets
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import {
@Component
struct meowDrops {
// Links
@Link showing_scratching_board: boolean;
@StorageLink('showing_scratching_board') showing_scratching_board: boolean = false;
@Link @Watch('on_data_change') data_list: string[];
// UI
@Prop show_feed_prompt: boolean = true;
@Prop show_scratch_prompt: boolean = false;
@State area_height: number = 200;
@StorageProp('screen_height') screen_height: number = 0;
@State delete_confirm: number = 0;
Expand Down
14 changes: 7 additions & 7 deletions home/src/main/ets/blocks/meowTabs.ets
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct meowTabs {
@StorageLink('bunch_of_tabs') bunch_of_tabs: bunch_of_tabs = new bunch_of_tabs();
@StorageLink('bunch_of_settings') bunch_of_settings: bunch_of_settings = new bunch_of_settings();
@Link webViews_ready: boolean;
@Link showing_tabs: boolean;
@StorageLink('showing_tabs') showing_tabs: boolean = false;
@StorageLink('current_main_tab_index') @Watch('on_did_switch_tab') current_main_tab_index: number = 0;
@StorageLink('current_sub_tab_index') @Watch('on_did_switch_tab') current_sub_tab_index: number = -1;
@StorageProp('tablet_mode') tablet_mode: boolean = false;
Expand Down Expand Up @@ -48,7 +48,7 @@ struct meowTabs {
@State scroll_area_height: number = 0;
@State scroll_animation_enabled: boolean = true;
@State paralleow_description_height: number = 0;
@StorageLink('web_animation') web_animation: AnimateParam = animation_default();
@StorageLink('tab_animation') tab_animation: AnimateParam = animation_default();
// Gateways
@StorageLink('universal_load_url_gateway') @Watch('on_current_load_url') load_url_gateway: string = "";
@StorageLink('universal_new_tab_gateway') @Watch('on_new_targeted_tab') new_tab_gateway: string = "";
Expand Down Expand Up @@ -148,7 +148,7 @@ struct meowTabs {
}
// Try switch tab
this.webViews_ready = true;
this.web_animation = { duration: 0 };
this.tab_animation = { duration: 0 };
this.switch_tab(continue_tabs_main_on);
this.sync_all_list_info();
// Recover Paralleow
Expand Down Expand Up @@ -321,7 +321,7 @@ struct meowTabs {
* @abstract While if new_tab_url is also not set ("" or undefined), then load default home_url().
* */
new_tab(url: string, recover_on_creation?: boolean) {
this.web_animation = { duration: 0 };
this.tab_animation = { duration: 0 };

this.current_main_tab_index = this.bunch_of_tabs.newTab(url, recover_on_creation);
this.extension_area.push(0);
Expand Down Expand Up @@ -368,7 +368,7 @@ struct meowTabs {
}

close_tab(target: number) {
this.web_animation = { duration: 0 };
this.tab_animation = { duration: 0 };

// console.log(target.toString() + " / " + this.offset_area.length.toString())
if (target >= this.offset_area.length) {
Expand Down Expand Up @@ -535,11 +535,11 @@ struct meowTabs {
// if is main this tab
this.switch_paralleow();
} else {
this.web_animation = { duration: 0 };
this.tab_animation = { duration: 0 };
this.switch_tab(index)
}
} else {
this.web_animation = { duration: 0 };
this.tab_animation = { duration: 0 };
this.switch_tab(index)
}
}
Expand Down
Loading

0 comments on commit ccbc7a9

Please sign in to comment.