Skip to content

202 feature sync user role - #203

Merged
juunpy0 merged 3 commits into
devfrom
202-feature-sync-user-role
Jul 9, 2026
Merged

202 feature sync user role#203
juunpy0 merged 3 commits into
devfrom
202-feature-sync-user-role

Conversation

@minsun-0209

Copy link
Copy Markdown
Collaborator

🍎 개요

  • 디스코드 학생회 역할 동기화 이후 앱 내에서 기존 access token 및 권한 캐시(KeyChain)가 즉시 갱신되지 않아 기존 화면이 유지되는 문제를 해결했습니다

📦 작업 내용

  • GOMSRefreshToken.swift 토큰 재발급(reissue) 요청 시, 응답으로 받은 새로운 AccessToken의 JWT Payload를 디코딩하여 유저의 최신 권한을 authority 키체인에 즉시 동기화하도록 로직을 수정
  • MainViewController.swift& AdminMainViewController.swift 앱 실행 및 포그라운드(Foreground) 재진입 시 viewWillAppear 시점에서 토큰 재발급 및 최신 권한 검사 함수(syncRoleAndFetch() )를 수행하고, 권한 변경이 감지되면 유저/어드민 메인 화면 간 자동 전환 처리가 이루어지도록 대응

🔀 :: #202

@minsun-0209
minsun-0209 requested a review from Copilot July 9, 2026 05:08
@minsun-0209 minsun-0209 self-assigned this Jul 9, 2026
@minsun-0209 minsun-0209 added the 💡 Feature 기능 개발 label Jul 9, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces role synchronization on view appearance in both AdminMainViewController and MainViewController by reissuing tokens, checking the user's profile role, and switching view controllers if the role has changed. It also updates GOMSRefreshToken to parse the role from the JWT payload and update the authority keychain. The review feedback highlights critical improvements: handling Base64URL encoding during JWT payload decoding to prevent decoding failures, removing redundant network calls in MainViewController, and adding a visibility guard check in AdminMainViewController before executing asynchronous UI and navigation updates.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread Projects/Feature/Sources/Extension/GOMSRefreshToken.swift

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses stale in-app permission state after Discord role sync by forcing a token reissue on app entry/foreground and ensuring the app immediately reflects updated user roles (student vs. student council) by switching between Main and Admin main screens.

Changes:

  • Add role-sync flow on viewWillAppear for both user/admin main screens (syncRoleAndFetch()), including automatic screen switching when role changes.
  • Update refresh-token reissue handling to decode the new access token’s JWT payload and immediately persist the latest role to the authority keychain entry.
  • Replace direct fetchData() calls on entry with the new role-sync + fetch flow.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
Projects/Feature/Sources/Scene/Main/User/View/MainViewController.swift Replaces entry-time data fetch with a token reissue + role check that can redirect to admin main.
Projects/Feature/Sources/Scene/Main/Admin/View/AdminMainViewController.swift Adds token reissue + role check on entry that can redirect back to user main.
Projects/Feature/Sources/Extension/GOMSRefreshToken.swift Parses role from newly issued access token and writes it into keychain immediately.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Projects/Feature/Sources/Scene/Main/User/View/MainViewController.swift Outdated
Comment thread Projects/Feature/Sources/Scene/Main/Admin/View/AdminMainViewController.swift Outdated
Comment thread Projects/Feature/Sources/Extension/GOMSRefreshToken.swift
@minsun-0209
minsun-0209 force-pushed the 202-feature-sync-user-role branch from 23fbc9d to 8cb98f5 Compare July 9, 2026 05:11
@juunpy0
juunpy0 merged commit c7f4750 into dev Jul 9, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

💡 Feature 기능 개발

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants