Skip to content

Commit

Permalink
feat: History are now categorized according to years and months.
Browse files Browse the repository at this point in the history
WARNING: OLD HISTORY WILL NOT BE READ IN THIS NEW SYSTEM
  • Loading branch information
awaLiny2333 committed Dec 13, 2024
1 parent 9b97642 commit 921fc2b
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 251 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": 1000014,
"versionName": "1.6.4",
"versionCode": 1000015,
"versionName": "1.7.0",
"icon": "$media:app_icon",
"label": "$string:app_name"
}
Expand Down
17 changes: 5 additions & 12 deletions home/src/main/ets/blocks/meowAppSettings.ets
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { bunch_of_user_agents } from '../hosts/bunch_of_user_agents';
import { bunch_of_tabs } from '../hosts/bunch_of_tabs';
import linysCapsuleButton from '../components/linysCapsuleButton';
import { bunch_of_history } from '../hosts/bunch_of_history';
import { add_units_to_size, get_folder_size_Sync, sandbox_open_sync } from '../utils/storage_tools';
import { add_units_to_size, get_folder_size_Sync } from '../utils/storage_tools';
import woofHistory from '../dialogs/woofHistory';
import { bunch_of_settings } from '../hosts/bunch_of_settings';
import meowSEManager from './meowSEManager';
Expand Down Expand Up @@ -58,7 +58,7 @@ struct meowAppSettings {
// Information
@State versionName: string = "Version Name";
@State versionNo: number = 0;
@State history_length: number = this.bunch_of_history.history_list.length;
@State history_length: number = this.bunch_of_history.history_this_month.length;
// Segment Button Options
@State title_bar_position_tabOptions: SegmentButtonOptions = SegmentButtonOptions.tab({
buttons: [{ text: ' 󰀐 ' }, { text: ' 󰃐 ' }] as ItemRestriction<SegmentButtonTextItem>,
Expand Down Expand Up @@ -359,7 +359,7 @@ struct meowAppSettings {
.width("100%")

Row({ space: 10 }) {
linysTitleText({ text: "󰏕 " + this.history_length.toString() })
// linysTitleText({ text: "󰏕 " + this.history_length.toString() })
Blank()
linysText({ text: $r('app.string.Settings_experience_history_view') })
linysCapsuleButton({ text: " 󰀩 " })
Expand Down Expand Up @@ -625,14 +625,7 @@ struct meowAppSettings {
await this.bunch_of_settings.get('web_force_dark_mode') as boolean;

// Read history
let result = sandbox_open_sync("history.txt");
if (result as string == "undefined") {
// no history before
console.log("[Meow][meowAppSettings] NO HISTORY BEFORE")
} else {
this.bunch_of_history.import_string(result as string);
console.log("[Meow][meowAppSettings] Recovered History, length: " + result.length.toString())
}
this.bunch_of_history.check_disk_month(new Date().getFullYear(), new Date().getMonth() + 1);

// Read webview cache
this.web_cache_size = await this.bunch_of_settings.get('webview_cache_size') as number;
Expand All @@ -651,7 +644,7 @@ struct meowAppSettings {
this.on_panel_close();
}
// Get length properties
this.history_length = this.bunch_of_history.history_list.length;
this.history_length = this.bunch_of_history.history_this_month.length;
}

on_panel_open() {
Expand Down
11 changes: 6 additions & 5 deletions home/src/main/ets/blocks/meowTitleBar.ets
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ struct meowTitleBar {
.animation(animation_default())
.id('left_controls')

Row({ space: 10 }) {
Row() {
RelativeContainer() {
TextInput({ text: this.search_input })
.allowDrop(null)
Expand Down Expand Up @@ -296,14 +296,15 @@ struct meowTitleBar {
} // Two inputs
.layoutWeight(1)

Row({ space: 10 }) {
Row() {
linysShowButton({
symbol_glyph_target: this.showing_search_extracted_field ? 'sys.symbol.text_and_t' : 'sys.symbol.link',
text: $r(this.showing_search_extracted_field ?
'app.string.Address_analyzer_keyword' :
'app.string.Address_analyzer_address'),
show: this.address_analyzers_desc_close_cd > 0,
})
.margin({ left: 10 })
.visibility(this.search_extracted_field_available ? Visibility.Visible : Visibility.None)
.onClick(() => {
this.showing_search_extracted_field = !this.showing_search_extracted_field;
Expand All @@ -323,12 +324,12 @@ struct meowTitleBar {
.onClick(() => {
this.submit_searching()
})
.margin({ left: 10 })
.animation(animation_default())
}
} // Buttons
} // Searching bar
.height(36)
.padding(this.tablet_mode ?
{ left: 15, right: this.search_extracted_field_available || this.is_search_input_typing ? 10 : 0 } : {})
.padding(this.tablet_mode ? { left: 10, right: 10 } : {})
.alignRules(this.tablet_mode ?
{
left: { anchor: 'left_controls', align: HorizontalAlign.End },
Expand Down
3 changes: 1 addition & 2 deletions home/src/main/ets/blocks/meowWebView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ struct meowWebView {
&& !this.tab_urls[Label.index_key].includes("resource://")
) {
let new_record = new history_record(this.tab_titles[Label.index_key], this.tab_urls[Label.index_key])
this.bunch_of_history.add_history(new_record);
sandbox_save("history.txt", this.bunch_of_history.export_string());
this.bunch_of_history.add_history(new_record, true);
} else {
this.bunch_of_tabs.Tabs[Label.index_key].restore_on_creation = false;
// log
Expand Down
Loading

0 comments on commit 921fc2b

Please sign in to comment.