Skip to content

Make CreatePollView public or fix composerViewModel.pickerState = .polls only working once #684

@f3dm76

Description

@f3dm76

What are you trying to achieve?

I'm using a custom menu for attachments, like this:
simulator_screenshot_A4ED567C-267A-49E4-A367-F25C074E89E5
I'd like to reuse the picker views from inside SC library but use my own menu view.
Here is the code of my menu

@EnvironmentObject private var composerViewModel: MessageComposerViewModel

VStack(alignment: .leading, spacing: 25) {
  MenuItem(icon: "camera.circle.fill", text: "Camera") {
      composerViewModel.pickerState = .camera
  }
  MenuItem(icon: "photo.circle.fill", text: "Photos & Videos") {
      state.wrappedValue = .expanded(.media)
  }
  MenuItem(icon: "bolt.circle.fill", text: "Giphy") {
      composerViewModel.composerCommand = .init(
          id: "/giphy",
          typingSuggestion: .init(text: "", locationRange: NSRange(location: 0, length: 0)),
          displayInfo: CommandDisplayInfo(
              displayName: "Giphy",
              icon: UIImage(systemName: "circle")!,
              format: "/giphy [text]",
              isInstant: true
          )
      )
  }
  MenuItem(icon: "questionmark.circle.fill", text: "Poll") {
          composerViewModel.pickerState = .polls
  }
}

The problem: When I tap "polls" for the first time, it opens ok. When I close polls view, and tap "polls" again - nothing happens. It fixes itself if I open camera, and then the polls works again, but only once.

Could you maybe make CreatePollView public so I can control it myself making sure it works correctly? Or maybe could you change smth inside the lib to make composerViewModel.pickerState = .polls work stably?

If possible, how can you achieve this currently?

What would be the better way?

GetStream Environment

GetStream Chat version: 4.67.0
GetStream Chat frameworks: StreamChat, StreamChatUI
iOS version: 18.0
Swift version: 6.0
Xcode version: 16.0
Device: sim iPhone 16 pro max

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions