• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { Log } from '../../utils/Log'
17import { getStore } from '../../redux/store'
18import { Action } from '../../redux/actions/Action'
19import EventLog from '../../utils/EventLog'
20
21let tabBarState = (state) => {
22  return {
23    isThirdPartyCall: state.ContextReducer.isThirdPartyCall
24  }
25}
26
27let tabBarDispatcher = (dispatch) => {
28  return {
29    showSettingView: () => {
30      EventLog.write(EventLog.CLICK_SETTINGS)
31      dispatch(Action.showSettingView(true))
32    },
33  }
34}
35
36class StateStruct {
37  isThirdPartyCall
38  showSettingView: Function
39}
40
41@Component
42export struct TabBar {
43  private TAG: string = '[TabBar]'
44  @State state: StateStruct = new StateStruct()
45  private onBackClicked:Function
46
47  aboutToAppear(): void {
48    Log.info(`${this.TAG} aboutToAppear invoke E`)
49    getStore().connect(tabBarState, tabBarDispatcher)(this.state)
50    Log.info(`${this.TAG} aboutToAppear invoke X`)
51  }
52
53  build() {
54    Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
55      Column() {
56//        TabBarOther()
57      }.width('40%').height('100%')
58      Column() {
59            if (this.state.isThirdPartyCall) {
60              Row() {
61                Image($r("app.media.ic_public_back")).width(24).height(24)
62                  .onClick(() => {
63                    this.state.showSettingView()
64                    this.onBackClicked()
65                  })
66              }.width(48).height(48)
67              .padding({left: 12})
68              .margin({ bottom: 12 })
69            }
70      }.width('40%').height('100%')
71      Column() {
72        Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
73          Image($r('app.media.setting')).width(24).height(24)
74        }.width('100%').height('100%')
75      }.width('20%').height('100%').onClick(() => {
76        this.state.showSettingView()
77      })
78    }.width('100%').height('100%')
79  }
80}