Skip to content

Conversation

@youz2me
Copy link
Member

@youz2me youz2me commented Mar 1, 2025

👻 PULL REQUEST

📄 작업 내용

  • OAuthErrorMonitor 구현 시 선언한 저장 프로퍼티로 인해 발생한 경고를 해결했어요.

💻 주요 코드 설명

EventMonitorcondition 속성 변경

final class OAuthErrorMonitor: EventMonitor {
    let queue = DispatchQueue(label: "OAuthErrorMonitorQueue", attributes: .concurrent)
    private static var condition = false
 
    var isUnauthorized: Bool {
        get {
            queue.sync { OAuthErrorMonitor.condition }
        }
        set {
            queue.async(flags: .barrier) {
                OAuthErrorMonitor.condition = newValue
            }
        }
    }
 
...
  • 원래 저장 프로퍼티 형식으로 선언되어 있던 condition을 정적 프로퍼티로 변경했습니다.
    • 이 방식은 경고를 해결하긴 하지만 여러 OAuthErrorMonitor 인스턴스가 있는 경우 모두 동일한 상태를 공유하고 한 인스턴스에서 인증 실패를 감지하면 모든 인스턴스에 영향을 미칠 수 있다는 단점이 있는데요.
    • OAuthErrorMonitor는 결국 앱에서 하나의 인스턴스만 선언되어야 하기 때문에 변경 가능하다는 결론을 내렸습니다.

👀 기타 더 이야기해볼 점

  • 자고싶어요

🔗 연결된 이슈

@youz2me youz2me added 🛠️ fix 기능적 버그나 오류 해결 시 사용 🦉 유진 🛌🛌🛌🛌🛌🛌🛌🛌🛌🛌 labels Mar 1, 2025
@youz2me youz2me requested a review from JinUng41 March 1, 2025 18:05
@youz2me youz2me self-assigned this Mar 1, 2025
Copy link
Collaborator

@JinUng41 JinUng41 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~

OAuthErrorMonitor가 앱 내에서 하나만 존재해여 한다면, 싱글톤 패턴을 사용해야 할까 하는 고민이 생겼습니다.

var isUnauthorized: Bool {
get {
queue.sync { condition }
queue.sync { OAuthErrorMonitor.condition }
Copy link
Collaborator

@JinUng41 JinUng41 Mar 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self.condition도 가능하답니다~

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

스크린샷 2025-03-03 오후 4 33 58

위와 같은 오류가 발생해 부득이하게 OAuthErrorMonitor를 명시했습니다!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저는 대문자 Self.condition을 말한거긴 한데, 혹시 이것도 적용이 안되나요?

Copy link
Member Author

@youz2me youz2me Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오마이갓 클래스 단위는 Self로 참조가 가능하군요 ... 바로 적용했습니다 감사합니닷

@youz2me youz2me merged commit 0106369 into develop Mar 3, 2025
@youz2me youz2me deleted the fix/#106-interceptor branch March 3, 2025 11:34
@youz2me youz2me added this to Wable-iOS Mar 6, 2025
@youz2me youz2me moved this to Done in Wable-iOS Mar 6, 2025
@youz2me youz2me removed this from Wable-iOS Mar 6, 2025
youz2me added a commit that referenced this pull request Oct 26, 2025
[Fix] EventMonitor의 저장 프로퍼티 관련 경고 해결
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ fix 기능적 버그나 오류 해결 시 사용 🦉 유진 🛌🛌🛌🛌🛌🛌🛌🛌🛌🛌

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Fix] Interceptor 오류 수정

3 participants