Integrazione YouTube Live: OAuth squadra, canale piattaforma Light e UI.
Collegamento da Dettagli squadra e admin per il refresh token Match Live TV; API e app mobile allineate ai piani Light/Full. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
44
backend/app/services/youtube/team_status.rb
Normal file
44
backend/app/services/youtube/team_status.rb
Normal file
@@ -0,0 +1,44 @@
|
||||
module Youtube
|
||||
class TeamStatus
|
||||
PLATFORM_LABEL = "Match Live TV".freeze
|
||||
|
||||
def initialize(team)
|
||||
@team = team
|
||||
@ent = team.entitlements
|
||||
@mode = @ent.plan.youtube_mode
|
||||
end
|
||||
|
||||
def selectable?
|
||||
return false unless @ent.youtube_enabled?
|
||||
|
||||
case @mode
|
||||
when "matchlivetv_light"
|
||||
PlatformCredential.configured?
|
||||
when "team"
|
||||
@team.youtube_credential.present?
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def connected?
|
||||
selectable?
|
||||
end
|
||||
|
||||
def uses_platform_channel?
|
||||
@mode == "matchlivetv_light" && PlatformCredential.configured?
|
||||
end
|
||||
|
||||
def channel_title
|
||||
if uses_platform_channel?
|
||||
PLATFORM_LABEL
|
||||
else
|
||||
@team.youtube_credential&.channel_title
|
||||
end
|
||||
end
|
||||
|
||||
def needs_team_oauth?
|
||||
@mode == "team" && @ent.premium_full?
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user