diff --git a/build-system/prepare-build-variables.sh b/build-system/prepare-build-variables.sh index b48f0ce9ad..d88042f518 100755 --- a/build-system/prepare-build-variables.sh +++ b/build-system/prepare-build-variables.sh @@ -17,7 +17,7 @@ prepare_build_variables () { ;; esac - local BAZEL="/Users/ilya/bin/bazel" + local BAZEL="$(which bazel)" if [ "$BAZEL" = "" ]; then echo "bazel not found in PATH" exit 1 diff --git a/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/BarsComponentController.swift b/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/BarsComponentController.swift index 5a5079ffa4..464a1063de 100644 --- a/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/BarsComponentController.swift +++ b/submodules/GraphCore/Sources/Charts/Controllers/Stacked Bars/BarsComponentController.swift @@ -87,7 +87,7 @@ class BarsComponentController: GeneralChartComponentController { super.willAppear(animated: animated) updatePreviewRangeClosure?(currentChartHorizontalRangeFraction, animated) - setConponentsVisible(visible: true, animated: animated) + setComponentsVisible(visible: true, animated: animated) updateHorizontalLimitLabels(animated: animated, forceUpdate: true) } @@ -111,10 +111,10 @@ class BarsComponentController: GeneralChartComponentController { func prepareAppearanceAnimation(horizontalRnage: ClosedRange) { setupMainChart(horizontalRange: horizontalRnage, animated: false) - setConponentsVisible(visible: false, animated: false) + setComponentsVisible(visible: false, animated: false) } - func setConponentsVisible(visible: Bool, animated: Bool) { + func setComponentsVisible(visible: Bool, animated: Bool) { mainBarsRenderer.setVisible(visible, animated: animated) horizontalScalesRenderer.setVisible(visible, animated: animated) verticalScalesRenderer.setVisible(visible, animated: animated) @@ -183,6 +183,9 @@ class BarsComponentController: GeneralChartComponentController { var viewModel = super.chartDetailsViewModel(closestDate: closestDate, pointIndex: pointIndex) let visibleChartValues = self.visibleChartValues let totalSumm: CGFloat = visibleChartValues.map { CGFloat($0.values[pointIndex]) }.reduce(0, +) + viewModel.hideAction = { [weak self] in + self?.hideDetailsView(animated: true) + } if !self.step { viewModel.totalValue = ChartDetailsViewModel.Value(prefix: nil, title: "Total", diff --git a/submodules/GraphCore/Sources/Charts/Renderes/BaseChartRenderer.swift b/submodules/GraphCore/Sources/Charts/Renderes/BaseChartRenderer.swift index d6cd6588a6..590bd6c3e1 100644 --- a/submodules/GraphCore/Sources/Charts/Renderes/BaseChartRenderer.swift +++ b/submodules/GraphCore/Sources/Charts/Renderes/BaseChartRenderer.swift @@ -51,7 +51,7 @@ class BaseChartRenderer: ChartViewRenderer { lazy var horizontalRange = AnimationController>(current: 0...1, refreshClosure: refreshClosure) lazy var verticalRange = AnimationController>(current: 0...1, refreshClosure: refreshClosure) - func setup(verticalRange: ClosedRange, animated: Bool, timeFunction: TimeFunction? = nil) { + func setup(verticalRange: ClosedRange, animated: Bool, timeFunction: TimeFunction? = nil) { guard self.verticalRange.end != verticalRange else { self.verticalRange.timeFunction = timeFunction ?? .linear return diff --git a/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift b/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift index db288c1401..789b3d4c93 100644 --- a/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift +++ b/submodules/GraphCore/Sources/Charts/Renderes/LinesChartRenderer.swift @@ -500,6 +500,11 @@ extension LinesChartRenderer.LineData { } } } + + if vMin == vMax { + return 0...vMax * 2.0 + } + return vMin...vMax } else { guard let firstPoint = lines.first?.points.first else { return nil } @@ -511,6 +516,11 @@ extension LinesChartRenderer.LineData { vMax = max(vMax, point.y) } } + + if vMin == vMax { + return 0...vMax * 2.0 + } + return vMin...vMax } } diff --git a/submodules/StatisticsUI/Sources/StatsController.swift b/submodules/StatisticsUI/Sources/StatsController.swift index 7f8abdec4f..f9b61a11af 100644 --- a/submodules/StatisticsUI/Sources/StatsController.swift +++ b/submodules/StatisticsUI/Sources/StatsController.swift @@ -269,7 +269,7 @@ private enum StatsEntry: ItemListNodeEntry { return false } case let .post(lhsIndex, lhsTheme, lhsStrings, lhsDateTimeFormat, lhsMessage, lhsInteractions): - if case let .post(rhsIndex, rhsTheme, rhsStrings, rhsDateTimeFormat, rhsMessage, rhsInteractions) = rhs, lhsIndex == rhsIndex, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsDateTimeFormat == rhsDateTimeFormat, lhsInteractions == rhsInteractions { + if case let .post(rhsIndex, rhsTheme, rhsStrings, rhsDateTimeFormat, rhsMessage, rhsInteractions) = rhs, lhsIndex == rhsIndex, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsDateTimeFormat == rhsDateTimeFormat, lhsMessage.id == rhsMessage.id, lhsInteractions == rhsInteractions { return true } else { return false @@ -420,8 +420,6 @@ private func statsControllerEntries(data: ChannelStats?, messages: [Message]?, i } public func channelStatsController(context: AccountContext, peerId: PeerId, cachedPeerData: CachedPeerData) -> ViewController { - var pushControllerImpl: ((ViewController) -> Void)? - var presentControllerImpl: ((ViewController, ViewControllerPresentationArguments?) -> Void)? var navigateToMessageImpl: ((MessageId) -> Void)? let actionsDisposable = DisposableSet() @@ -506,16 +504,6 @@ public func channelStatsController(context: AccountContext, peerId: PeerId, cach controller.didDisappear = { [weak controller] _ in controller?.clearItemNodesHighlight(animated: true) } - pushControllerImpl = { [weak controller] c in - if let controller = controller { - (controller.navigationController as? NavigationController)?.pushViewController(c, animated: true) - } - } - presentControllerImpl = { [weak controller] c, a in - if let controller = controller { - controller.present(c, in: .window(.root), with: a) - } - } navigateToMessageImpl = { [weak controller] messageId in if let navigationController = controller?.navigationController as? NavigationController { context.sharedContext.navigateToChatController(NavigateToChatControllerParams(navigationController: navigationController, context: context, chatLocation: .peer(messageId.peerId), subject: .message(messageId), keepStack: .always, useExisting: false, purposefulAction: {})) diff --git a/submodules/StatisticsUI/Sources/StatsGraphItem.swift b/submodules/StatisticsUI/Sources/StatsGraphItem.swift index 7c8356e662..29a8b095c0 100644 --- a/submodules/StatisticsUI/Sources/StatsGraphItem.swift +++ b/submodules/StatisticsUI/Sources/StatsGraphItem.swift @@ -110,7 +110,7 @@ class StatsGraphItemNode: ListViewItemNode { super.didLoad() self.view.interactiveTransitionGestureRecognizerTest = { point -> Bool in - return point.x > 30.0 || (point.y > 250.0 && point.y < 295.0) + return point.x > 30.0 || (point.y > 310.0 && point.y < 355.0) } } @@ -150,12 +150,12 @@ class StatsGraphItemNode: ListViewItemNode { case .plain: itemBackgroundColor = item.presentationData.theme.list.plainBackgroundColor itemSeparatorColor = item.presentationData.theme.list.itemPlainSeparatorColor - contentSize = CGSize(width: params.width, height: 301.0) + contentSize = CGSize(width: params.width, height: 361.0) insets = itemListNeighborsPlainInsets(neighbors) case .blocks: itemBackgroundColor = item.presentationData.theme.list.itemBlocksBackgroundColor itemSeparatorColor = item.presentationData.theme.list.itemBlocksSeparatorColor - contentSize = CGSize(width: params.width, height: 301.0) + contentSize = CGSize(width: params.width, height: 361.0) insets = itemListNeighborsGroupedInsets(neighbors) }