Skip to content

Commit

Permalink
api: ohos "compileSdkVersion" 12 => 13;
Browse files Browse the repository at this point in the history
other: fixed several bugs;
other: made Liny's auto building script public.
  • Loading branch information
awaLiny2333 committed Dec 13, 2024
1 parent 7c84b18 commit 524714b
Show file tree
Hide file tree
Showing 18 changed files with 233 additions and 134 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@
/.clang-format
/.clang-tidy
**/.test
/.appanalyzer
auto_build.bat
/.appanalyzer
11 changes: 11 additions & 0 deletions auto_build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"D:\Program Files\Huawei\DevEco Studio\tools\node\node.exe" "D:\Program Files\Huawei\DevEco Studio\tools\hvigor\bin\hvigorw.js" --sync -p product=ohos --analyze=normal --parallel --incremental --daemon
"D:\Program Files\Huawei\DevEco Studio\tools\node\node.exe" "D:\Program Files\Huawei\DevEco Studio\tools\hvigor\bin\hvigorw.js" --mode module -p product=ohos assembleHap --analyze=normal --parallel --incremental --daemon

"D:\Program Files\Huawei\DevEco Studio\tools\node\node.exe" "D:\Program Files\Huawei\DevEco Studio\tools\hvigor\bin\hvigorw.js" --sync -p product=default --analyze=normal --parallel --incremental --daemon
"D:\Program Files\Huawei\DevEco Studio\tools\node\node.exe" "D:\Program Files\Huawei\DevEco Studio\tools\hvigor\bin\hvigorw.js" --mode module -p product=default assembleHap --analyze=normal --parallel --incremental --daemon

set PROJECT_PATH="E:\linys\Harmony_Projects\Linys_Browser_NEXT\"

echo F| xcopy %PROJECT_PATH%"home\build\default\outputs\default\home-default-unsigned.hap" %PROJECT_PATH%"build_auto\HMOS-home-default-unsigned.hap" /Y
echo F| xcopy %PROJECT_PATH%"home\build\ohos\outputs\default\home-default-unsigned.hap" %PROJECT_PATH%"build_auto\OHOS-home-default-unsigned.hap" /Y
echo F| xcopy %PROJECT_PATH%"home\build\ohos\outputs\default\home-default-signed.hap" %PROJECT_PATH%"build_auto\entry.hap" /Y
2 changes: 1 addition & 1 deletion build-profile.json5
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{
"name": "ohos",
"signingConfig": "ohos",
"compileSdkVersion": 12,
"compileSdkVersion": 13,
"compatibleSdkVersion": 12,
"runtimeOS": "OpenHarmony",
"buildOption": {
Expand Down
Binary file modified build_auto/HMOS-home-default-unsigned.hap
Binary file not shown.
Binary file modified build_auto/OHOS-home-default-unsigned.hap
Binary file not shown.
Binary file modified build_auto/entry.hap
Binary file not shown.
4 changes: 2 additions & 2 deletions home/src/main/ets/blocks/meowAppSettings.ets
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct meowAppSettings {
woofHistory_control: CustomDialogController = new CustomDialogController({
builder: woofHistory({ showing_settings: this.show }),
alignment: DialogAlignment.Center,
cornerRadius: 16,
cornerRadius: 22,
showInSubWindow: true,
width: "90%",
});
Expand Down Expand Up @@ -465,7 +465,7 @@ struct meowAppSettings {
linysText({ text: $r('app.string.Settings_storage_clear_webview') })
linysText({ text: $r('app.string.Settings_storage_clear_webview_desc'), max_lines: 6 })

Row({ space: 10 }) {
Row({ space: 12 }) {
linysTitleText({ text: "󰂼 " + add_units_to_size(this.web_cache_size) })
.layoutWeight(1)

Expand Down
206 changes: 136 additions & 70 deletions home/src/main/ets/blocks/meowTabs.ets
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import linysSymbol from '../components/linysSymbol';
import { bunch_of_tabs, tab_label } from '../hosts/bunch_of_tabs';
import { url_resource_to_meow } from '../utils/url_tools';
import { animation_default, fontSize_Large, fontSize_Normal, url_default_blank } from '../hosts/bunch_of_defaults';
import {
animation_default,
click_effect_default,
fontSize_Large,
fontSize_Normal,
url_default_blank
} from '../hosts/bunch_of_defaults';
import { kv_store_get, kv_store_put } from '../utils/kv_store_tools';
import { bunch_of_settings } from '../hosts/bunch_of_settings';
import linysShowButton from '../components/linysShowButton';
import linysText from '../components/linysText';
import { sandbox_open_array_sync } from '../utils/storage_tools';
import { fileIo as fs } from '@kit.CoreFileKit';

@Component
struct meowTabs {
Expand Down Expand Up @@ -126,10 +133,15 @@ struct meowTabs {
let web_state_arrays_to_restore: Uint8Array[] = [];
for (let index = 0; index < continue_tabs_count; index++) {
// Read continue tabs data
let key = "continue_tabs_web_state_array_" + index.toString();
let key = "continue/continue_tabs_web_state_array_" + index.toString();
let array_buffer = sandbox_open_array_sync(key);
if (array_buffer) {
web_state_arrays_to_restore.push(new Uint8Array(array_buffer));
} else {
// An unexpected error may occur.
web_state_arrays_to_restore.push(new Uint8Array())
this.current_sub_tab_index = -1;
this.current_main_tab_index = 0;
}
}

Expand Down Expand Up @@ -157,6 +169,17 @@ struct meowTabs {
}
}

// clear continue storage
for (let index = 0; index < continue_tabs_count; index++) {
let key = "continue/continue_tabs_web_state_array_" + index.toString();
let filesDir = getContext().filesDir;
try {
fs.unlink(filesDir + '/' + key);
} catch (e) {
console.error(e);
}
}

this.recover_tabs_finished = true;
}

Expand All @@ -165,72 +188,11 @@ struct meowTabs {
Scroll(this.scroll_controller) {
Column({ space: 5 }) {
ForEach(this.bunch_of_tabs.Labels, (Label: tab_label) => {
RelativeContainer() {
Row() {
Text("󰇀")
.padding({ right: 5 })
.fontSize(fontSize_Large())
.fontColor(this.color_current_font)
.fontWeight((this.current_main_tab_index == Label.index_key ||
this.current_sub_tab_index == Label.index_key)
? FontWeight.Medium : undefined)
.visibility(this.current_sub_tab_index == Label.index_key ? Visibility.Visible : Visibility.None)
.animation(animation_default())
.offset({ y: -2 })

Text(this.tab_titles[Label.index_key] == "" ? "Meow" : this.tab_titles[Label.index_key])
.padding({ left: 2 })
.fontSize(fontSize_Normal())
.fontColor(this.color_current_font)
.fontWeight((this.current_main_tab_index == Label.index_key ||
this.current_sub_tab_index == Label.index_key)
? FontWeight.Medium : undefined)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)

SymbolGlyph($r('sys.symbol.xmark'))
.fontSize(fontSize_Normal())
.fontColor([this.color_current_font])
.fontWeight(FontWeight.Medium)

} // Title and xmark
.border({
radius: 10,
width: 2,
color: (this.current_main_tab_index == Label.index_key ||
this.current_sub_tab_index == Label.index_key)
? this.color_current_font : "transparent"
})
.animation({ duration: 100 })
.width("100%")
.height(this.tab_height_default)
.padding(10)
.backgroundColor(this.color_current_secondary)
.offset({ y: this.offset_area[Label.index_key] })
.alignRules({
middle: { anchor: "__container__", align: HorizontalAlign.Center },
top: { anchor: "__container__", align: VerticalAlign.Top }
})
.onClick(() => {
this.click_tab_button(Label.index_key);
})

Column() {
} // The True Tab Closer
.width(70)
.height("100%")
.alignRules({
middle: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.onClick(() => {
this.close_tab(Label.index_key)
})

}
.width("100%")
.height(this.tab_height_default + this.extension_area[Label.index_key])
TabButton({
Label: Label,
extension_area: this.extension_area,
offset_area: this.offset_area,
})
}, (Label: tab_label) => Label.timestamp.toString())

}
Expand Down Expand Up @@ -432,6 +394,10 @@ struct meowTabs {
this.current_sub_tab_index = -1;
this.choosing_paralleow = false;
}
if (target < this.current_sub_tab_index) {
this.current_sub_tab_index -= 1;
}
this.bunch_of_tabs.re_save_web_state(target);
}

choose_paralleow() {
Expand Down Expand Up @@ -527,7 +493,7 @@ struct meowTabs {
// if choosing and is not main web then set as sub view (Paralleow)
this.choosing_paralleow = false;
this.current_sub_tab_index = index;
this.showing_tabs = false;
// this.showing_tabs = false;
} else {
if (this.current_sub_tab_index >= 0) {
// Paralleow enabled
Expand Down Expand Up @@ -603,4 +569,104 @@ struct meowTabs {
}
}

export default meowTabs;
export default meowTabs;


@Component
struct TabButton {
// Sync
@Link offset_area: number[];
@Link extension_area: number[];
@Prop Label: tab_label;
tab_height_default: number = 42;
// Public
@StorageLink('current_main_tab_index') current_main_tab_index: number = 0;
@StorageLink('current_sub_tab_index') current_sub_tab_index: number = -1;
@StorageLink('tab_titles') tab_titles: string[] = []
// Gateways
@StorageLink('universal_tab_button_clicked_gateway') uni_tab_button_clicked: number = -1;
@StorageLink('universal_close_tab_gateway') close_tab_gateway: number = -1;
// Colors
@StorageProp('color_current_secondary') color_current_secondary: ResourceColor = $r('app.color.block_color');
@StorageProp('color_current_font') color_current_font: ResourceColor = $r('app.color.font_color_title');
// Animation
@State pressing: boolean = false;

build() {
RelativeContainer() {
Row() {
Text("󰇀")
.padding({ right: 5 })
.fontSize(fontSize_Large())
.fontColor(this.color_current_font)
.fontWeight((this.current_main_tab_index == this.Label.index_key ||
this.current_sub_tab_index == this.Label.index_key)
? FontWeight.Medium : undefined)
.visibility(this.current_sub_tab_index == this.Label.index_key ? Visibility.Visible : Visibility.None)
.animation(animation_default())
.offset({ y: -2 })

Text(this.tab_titles[this.Label.index_key] == "" ? "Meow" : this.tab_titles[this.Label.index_key])
.padding({ left: 2 })
.fontSize(fontSize_Normal())
.fontColor(this.color_current_font)
.fontWeight((this.current_main_tab_index == this.Label.index_key ||
this.current_sub_tab_index == this.Label.index_key)
? FontWeight.Medium : undefined)
.maxLines(1)
.textOverflow({ overflow: TextOverflow.Ellipsis })
.layoutWeight(1)

SymbolGlyph($r('sys.symbol.xmark'))
.fontSize(fontSize_Normal())
.fontColor([this.color_current_font])
.fontWeight(FontWeight.Medium)

} // Title and xmark
.border({
radius: 10,
width: 2,
color: (this.current_main_tab_index == this.Label.index_key ||
this.current_sub_tab_index == this.Label.index_key)
? this.color_current_font : "transparent"
})
.backgroundColor(this.color_current_secondary)
.animation(animation_default())
.width("100%")
.height(this.tab_height_default)
.padding(10)
.offset({ y: this.offset_area[this.Label.index_key] })
.alignRules({
middle: { anchor: "__container__", align: HorizontalAlign.Center },
top: { anchor: "__container__", align: VerticalAlign.Top }
})
.onClick(() => {
this.uni_tab_button_clicked = this.Label.index_key;
})

Column() {
} // The True Tab Closer
.width(70)
.height("100%")
.alignRules({
middle: { anchor: "__container__", align: HorizontalAlign.End },
center: { anchor: "__container__", align: VerticalAlign.Center }
})
.onClick(() => {
this.close_tab_gateway = this.Label.index_key;
})
}
.onTouch((event) => {
if (event.type == TouchType.Up) {
this.pressing = false;
// If touch ends
} else {
this.pressing = true;
// If touching
}
})
.width("100%")
.height(this.tab_height_default + this.extension_area[this.Label.index_key])
.clickEffect(click_effect_default())
}
}
13 changes: 6 additions & 7 deletions home/src/main/ets/blocks/meowTabsHorizontal.ets
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import linysShowButton from '../components/linysShowButton';
import linysSymbol from '../components/linysSymbol';
import { animation_default, fontSize_Large, fontSize_Normal } from '../hosts/bunch_of_defaults';
import { animation_default, click_effect_default, fontSize_Large, fontSize_Normal } from '../hosts/bunch_of_defaults';
import { bunch_of_tabs } from '../hosts/bunch_of_tabs';
import { LengthMetrics } from '@kit.ArkUI';

Expand Down Expand Up @@ -53,7 +53,7 @@ struct meowTabsHorizontal {
.animation(animation_default())
} // Scroll of tab buttons
.scrollBarWidth(5)
.scrollBar(this.tab_width() == 60 ? BarState.On : BarState.Off)
.scrollBar(this.tab_width() == 80 ? BarState.On : BarState.Off)
.scrollable(ScrollDirection.Horizontal)
.edgeEffect(EdgeEffect.Spring)
.align(Alignment.Start)
Expand Down Expand Up @@ -112,8 +112,8 @@ struct meowTabsHorizontal {
if (result > 200) {
return 200;
}
if (result < 60) {
return 60;
if (result < 80) {
return 80;
}
return result;
}
Expand All @@ -127,7 +127,6 @@ struct HorizontalTabButton {
@Link current_sub_tab_index: number;
@Prop index: number;
@Prop title: string;

@Link full_area_width: number;
@Link tab_titles: string[];
// Gateways
Expand Down Expand Up @@ -164,11 +163,10 @@ struct HorizontalTabButton {
.fontColor([this.color_current_font])
.fontWeight(FontWeight.Medium)
.onClick(() => {

this.close_tab_gateway = this.index;
// Close tab
})
.visibility(this.tab_width() < 80 ? this.visibility_visible_on_chosen(this.index) : Visibility.Visible)
.visibility(this.tab_width() <= 80 ? this.visibility_visible_on_chosen(this.index) : Visibility.Visible)
.animation(animation_default())
}
.offset({ y: this.offset_y })
Expand All @@ -191,6 +189,7 @@ struct HorizontalTabButton {
this.offset_y = 0;
}, 50)
})
.clickEffect(click_effect_default())
}

tab_width() {
Expand Down
5 changes: 3 additions & 2 deletions home/src/main/ets/blocks/meowWebView.ets
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { sandbox_save } from '../utils/storage_tools';
import { url_meow_to_resource, url_resource_to_meow } from '../utils/url_tools';
import { webview } from '@kit.ArkWeb';
import { bunch_of_settings } from '../hosts/bunch_of_settings';
import { fileIo as fs } from '@kit.CoreFileKit';

@Component
struct meowWebView {
Expand Down Expand Up @@ -185,12 +186,12 @@ struct meowWebView {
}

// Get web_state
const web_state = this.bunch_of_tabs.Tabs[Label.index_key].controller.serializeWebState();
let web_state = this.bunch_of_tabs.Tabs[Label.index_key].controller.serializeWebState();
// Sync to bunch_of_tabs
this.bunch_of_tabs.Tabs[Label.index_key].web_state_array = web_state;
// save web state to sandbox storage
if (web_state) {
let identifier = "continue_tabs_web_state_array_" + Label.index_key.toString();
let identifier = "continue/continue_tabs_web_state_array_" + Label.index_key.toString();
sandbox_save(identifier, web_state.buffer);
}
})
Expand Down
Loading

0 comments on commit 524714b

Please sign in to comment.