Skip to content

Commit

Permalink
Revert "Add custom location attachment to the Demo App (#2947)"
Browse files Browse the repository at this point in the history
This reverts commit a26f3c2.
  • Loading branch information
nuno-vieira committed Dec 21, 2023
1 parent 804b42a commit 1814daa
Show file tree
Hide file tree
Showing 24 changed files with 54 additions and 616 deletions.
3 changes: 0 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix editing of async voice messages [#2943](https://github.com/GetStream/stream-chat-swift/pull/2943)

## StreamChatUI
### ✅ Added
- Better support for custom mixed attachments rendering [#2947](https://github.com/GetStream/stream-chat-swift/pull/2947)
### 🐞 Fixed
- Fix duplicated Runpath Search Paths [#2937](https://github.com/GetStream/stream-chat-swift/pull/2937)
- Fix file attachments not rendering file size [#2941](https://github.com/GetStream/stream-chat-swift/pull/2941)
- Fix quoted chat message view with wrong text [#2946](https://github.com/GetStream/ios-issues-tracking/issues/683)
- Fix jumping to bottom when loading new messages [#2945](https://github.com/GetStream/stream-chat-swift/pull/2945)
- Fix deleted messages always showing custom attachments [#2947](https://github.com/GetStream/stream-chat-swift/pull/2947)
- Fix messages failing to be deleted when pending updates to the server [#2949](https://github.com/GetStream/stream-chat-swift/pull/2949)

# [4.45.0](https://github.com/GetStream/stream-chat-swift/releases/tag/4.45.0)
Expand Down
16 changes: 13 additions & 3 deletions DemoApp/DemoAppConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import Atlantis
import Foundation
import GDPerformanceView_Swift
import Sentry
import StreamChat
Expand All @@ -18,15 +19,24 @@ enum DemoAppConfiguration {
#endif
}

// MARK: Internal configuration

static var isStreamInternalConfiguration: Bool {
ProcessInfo.processInfo.environment["STREAM_DEV"] != nil
}

// This function is called from `DemoAppCoordinator` before the Chat UI is created
static func setInternalConfiguration() {
StreamRuntimeCheck.assertionsEnabled = StreamRuntimeCheck.isStreamInternalConfiguration
StreamRuntimeCheck.assertionsEnabled = isStreamInternalConfiguration
StreamRuntimeCheck._isBackgroundMappingEnabled = true
AppConfig.shared.demoAppConfig.isTokenRefreshEnabled = isStreamInternalConfiguration

configureAtlantisIfNeeded()
}

// HTTP and WebSocket Proxy with Proxyman.app
private static func configureAtlantisIfNeeded() {
if AppConfig.shared.demoAppConfig.isAtlantisEnabled {
if isStreamInternalConfiguration || AppConfig.shared.demoAppConfig.isAtlantisEnabled {
Atlantis.start()
} else {
Atlantis.stop()
Expand All @@ -35,7 +45,7 @@ enum DemoAppConfiguration {

// Performance tracker
static func showPerformanceTracker() {
guard StreamRuntimeCheck.isStreamInternalConfiguration else { return }
guard isStreamInternalConfiguration else { return }
// PerformanceMonitor seems to have a bug where it cannot find the hierarchy when trying to place its view
DispatchQueue.main.asyncAfter(deadline: .now() + 3) {
PerformanceMonitor.shared().performanceViewConfigurator.options = [.performance]
Expand Down
27 changes: 27 additions & 0 deletions DemoApp/Screens/AdvancedOptionsViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
//
// Copyright © 2023 Stream.io Inc. All rights reserved.
//

import UIKit

class MainButton: UIButton {
override func updateConstraints() {
super.updateConstraints()
translatesAutoresizingMaskIntoConstraints = false
}

override func layoutSubviews() {
super.layoutSubviews()
clipsToBounds = true
layer.cornerRadius = bounds.height / 2.0
}
}

class AdvancedOptionsViewController: UIViewController {
@IBOutlet var mainStackView: UIStackView! {
didSet {
mainStackView.preservesSuperviewLayoutMargins = true
mainStackView.isLayoutMarginsRelativeArrangement = true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ struct DemoAppConfig {
var isMessageDebuggerEnabled: Bool
/// A Boolean value to define if channel pinning example is enabled.
var isChannelPinningEnabled: Bool
/// A Boolean value to define if custom location attachments are enabled.
var isLocationAttachmentsEnabled: Bool
}

class AppConfig {
Expand All @@ -35,18 +33,8 @@ class AppConfig {
isAtlantisEnabled: false,
isTokenRefreshEnabled: false,
isMessageDebuggerEnabled: false,
isChannelPinningEnabled: false,
isLocationAttachmentsEnabled: false
isChannelPinningEnabled: false
)

StreamRuntimeCheck._isBackgroundMappingEnabled = true

if StreamRuntimeCheck.isStreamInternalConfiguration {
demoAppConfig.isAtlantisEnabled = true
demoAppConfig.isMessageDebuggerEnabled = true
demoAppConfig.isLocationAttachmentsEnabled = true
demoAppConfig.isTokenRefreshEnabled = true
}
}
}

Expand Down Expand Up @@ -149,8 +137,6 @@ class AppConfigViewController: UITableViewController {
case isAtlantisEnabled
case isMessageDebuggerEnabled
case isChannelPinningEnabled
case isLocationAttachmentsEnabled
case isBackgroundMappingEnabled
}

enum ComponentsConfigOption: String, CaseIterable {
Expand Down Expand Up @@ -284,14 +270,6 @@ class AppConfigViewController: UITableViewController {
cell.accessoryView = makeSwitchButton(demoAppConfig.isChannelPinningEnabled) { [weak self] newValue in
self?.demoAppConfig.isChannelPinningEnabled = newValue
}
case .isLocationAttachmentsEnabled:
cell.accessoryView = makeSwitchButton(demoAppConfig.isLocationAttachmentsEnabled) { [weak self] newValue in
self?.demoAppConfig.isLocationAttachmentsEnabled = newValue
}
case .isBackgroundMappingEnabled:
cell.accessoryView = makeSwitchButton(StreamRuntimeCheck._isBackgroundMappingEnabled) { newValue in
StreamRuntimeCheck._isBackgroundMappingEnabled = newValue
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion DemoApp/Screens/UserProfileViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class UserProfileViewController: UIViewController, CurrentChatUserControllerDele
updateButton.backgroundColor = .systemBlue
updateButton.contentEdgeInsets = UIEdgeInsets(top: 0.0, left: 15, bottom: 0.0, right: 15)
updateButton.addTarget(self, action: #selector(didTapUpdateButton), for: .touchUpInside)
updateButton.isHidden = !StreamRuntimeCheck.isStreamInternalConfiguration
updateButton.isHidden = !DemoAppConfiguration.isStreamInternalConfiguration

NSLayoutConstraint.activate([
imageView.widthAnchor.constraint(equalToConstant: 60),
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1814daa

Please sign in to comment.