Sfoglia il codice sorgente

fix: 历史记录删除不能立即刷新
fix:跳转网页时,部分页面中下载不能跳转到应用市场

hyj 1 mese fa
parent
commit
b289ada7e3

+ 18 - 3
home/src/main/ets/blocks/modules/meowWebView.ets

@@ -10,8 +10,10 @@ import { bookmark, bunch_of_bookmarks, folder, unified_item } from '../../hosts/
 import woofWantJump from '../../dialogs/prompts/woofWantJump';
 import { bunch_of_downloads } from '../../hosts/bunch_of_downloads';
 import woofWantResources from '../../dialogs/prompts/woofWantProtectedResources';
-import { print } from '@kit.BasicServicesKit';
+import { BusinessError, print } from '@kit.BasicServicesKit';
 import { print_web } from '../../utils/print_tools';
+import { Want } from '@kit.AbilityKit';
+import { meowContext } from '../../utils/environment_tools';
 
 @Component
 struct meowWebView {
@@ -433,6 +435,19 @@ struct meowWebView {
               if (event) {
                 let url: string = event.data.getRequestUrl();
                 // Do not intercept data:
+                // 检查是否是华为应用市场网页版链接
+                if (url.includes('appgallery.huawei.com') || url.includes('haokan.baidu.com/download')) {
+                  let want: Want = {
+                    action: 'ohos.want.action.appdetail',
+                    uri: 'store://appgallery.huawei.com/app/',
+                  };
+                  meowContext().startAbility(want).then(() => {
+                    console.info("Succeeded in starting Ability successfully.")
+                  }).catch((error: BusinessError) => {
+                    console.error(`Failed to startAbility.Code: ${error.code}, message is ${error.message}`);
+                  });
+                  return true;
+                }
                 if (url.substring(0, 5) == 'data:') {
                   return false;
                 }
@@ -443,8 +458,8 @@ struct meowWebView {
                   return false;
                 } else {
                   // Not viewable, perhaps is a link that can jump?
-                  this.potential_jump_link = url;
-                  this.woofLinkJumper_control.open();
+                  // this.potential_jump_link = url;
+                  // this.woofLinkJumper_control.open();
                   return true;
                 }
               }

+ 0 - 13
home/src/main/ets/components/HeaderSearch.ets

@@ -79,19 +79,6 @@ export default struct HeaderSearch {
       .width("90%")
       .backgroundColor('#FFE7E7E7')
 
-      linysSymbol({
-        symbol_glyph_target: 'sys.symbol.magnifyingglass'
-      })
-        .aspectRatio(1)
-        .layoutWeight(1)
-        .onClick(() => {
-          this.isShow = !this.isShow
-          // 每次打开筛选面板时更新key,强制重新渲染
-          if (this.isShow) {
-            this.filterKey += 1
-          }
-        })
-
       // Flex()
       //   .width(0)
       //   .height(0)

+ 10 - 7
home/src/main/ets/dialogs/managers/woofHistory.ets

@@ -96,6 +96,12 @@ struct woofHistory {
         .id("title_history")
 
         Column({ space: 10 }) {
+          HeaderSearch({
+            placeHolder: '历史记录',
+            search: (key) => {
+              this.loadData(key)
+            }
+          })
 
           Row() {
             linysText({
@@ -106,12 +112,6 @@ struct woofHistory {
             linysText({ text: " (" + this.filter_list.length.toString() + ")" })
               .opacity(0.7)
 
-            HeaderSearch({
-              placeHolder: '历史记录',
-              search: (key) => {
-                this.loadData(key)
-              }
-            })
           } // Time elapse description
           .width("100%")
 
@@ -325,11 +325,14 @@ struct woofHistory {
         // this.data.notifyDataDelete(indices[index]);
 
         // TODO: use better strategy to notify LazyForEach about a deletion.
-        this.data.setData(this.bunch_of_history.get_history_this_month());
+        // this.data.setData(this.bunch_of_history.get_history_this_month());
       }
     }
     this.bunch_of_history.remove_histories_at_indices(this.viewing_year, this.viewing_month, indices, true);
     this.refresh_current_history_list();
+    // 确保在删除后更新数据源,使UI正确刷新
+    this.data.setData(this.history_list);
+    this.filter_list = this.history_list;
   }
 }
 

+ 1 - 1
home/src/main/resources/base/element/string.json

@@ -502,7 +502,7 @@
     },
     {
       "name": "Have_a_Nice_Surf",
-      "value": "冲浪愉快!(~o ̄3 ̄)~"
+      "value": "冲浪愉快!"
     },
     {
       "name": "History_desc_1",