-
Notifications
You must be signed in to change notification settings - Fork 121
[MBL-19480][S/T/P] Immersive Video Player for Canvas Media Uploads #3755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
suhaibabsi-inst
wants to merge
32
commits into
master
Choose a base branch
from
feature/MBL-19480-Immersive-VideoPlayer-Canvas-Uploads
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
6d96ddf
Fetching feature flag
suhaibabsi-inst 7210c7b
Add handler to present immersive view in a dedicated modal.
vargaat a49f33c
Fix merge conflicts
suhaibabsi-inst 2aac275
Full functional requirements
suhaibabsi-inst 7a2ea28
Fix issues with flag loading
suhaibabsi-inst 7c07632
Remove context from delegate
suhaibabsi-inst 92c5282
Organising things
suhaibabsi-inst 2b4c697
Fix title extraction for expand button, enhanced separation of concerns
suhaibabsi-inst 7c48f36
Fix feature removal issues
suhaibabsi-inst 1844e19
Update InsertStudioOpenDetailViewButton.swift
suhaibabsi-inst 7b262c8
Button with icon
suhaibabsi-inst a5daf3b
Unit tests
suhaibabsi-inst 6e4cd3b
Address review comments
suhaibabsi-inst 304d865
Naming methods
suhaibabsi-inst d459e0a
Resolve memory leak
suhaibabsi-inst 84abcf4
Revert "Resolve memory leak"
suhaibabsi-inst 6a0059f
Address code review comments
suhaibabsi-inst f7ea7b5
Merge branch 'master' into feature/MBL-19480-Immersive-VideoPlayer-Ca…
suhaibabsi-inst b3bda43
Update CoreWebViewTests.swift
suhaibabsi-inst 243d795
Few fixes
suhaibabsi-inst 5366c88
Update InsertStudioOpenDetailViewButton.swift
suhaibabsi-inst d2c3ae7
Address AI feedback
suhaibabsi-inst 8b887fe
Merge branch 'master' into feature/MBL-19480-Immersive-VideoPlayer-Ca…
suhaibabsi-inst cca614d
Address AI feedback
suhaibabsi-inst 9dfb196
Update unit tests
suhaibabsi-inst ba73d63
Address code review comments
suhaibabsi-inst a84594c
Fix issue with link forming
suhaibabsi-inst c6d99a2
Update CoreWebViewTests.swift
suhaibabsi-inst 15a0c49
Update InsertStudioOpenDetailViewButtonTests.swift
suhaibabsi-inst e18ad06
Update CoreWebViewTests.swift
suhaibabsi-inst cf6fedd
Fix font size.
vargaat b045bb9
Add better name.
vargaat File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
Core/Core/Common/CommonModels/AppEnvironment/FeatureFlags/APIFeatureFlagState.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // | ||
| // This file is part of Canvas. | ||
| // Copyright (C) 2025-present Instructure, Inc. | ||
| // | ||
| // This program is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Affero General Public License as | ||
| // published by the Free Software Foundation, either version 3 of the | ||
| // License, or (at your option) any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Affero General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Affero General Public License | ||
| // along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| public struct APIFeatureFlagState: Codable { | ||
|
|
||
| public enum State: String, Codable { | ||
| /// (valid only for account context) The feature is `off` in the account, but may be enabled in sub-accounts and courses by setting a feature flag `on` the sub-account or course. | ||
| case allowed | ||
| /// (valid only for account context) The feature is `on` in the account, but may be disabled in sub-accounts and courses by setting a feature flag `off` the sub-account or course. | ||
| case allowed_on | ||
| /// The feature is turned `on` unconditionally for the user, course, or account and sub-accounts. | ||
| case on | ||
| /// The feature is not available for the course, user, or account and sub-accounts. | ||
| case off | ||
| } | ||
|
|
||
| public let feature: String | ||
| public let state: State | ||
| public let locked: Bool | ||
|
|
||
| private let context_id: String | ||
| private let context_type: String | ||
|
|
||
| init(feature: String, state: State, locked: Bool, context_id: String, context_type: String) { | ||
| self.feature = feature | ||
| self.state = state | ||
| self.locked = locked | ||
| self.context_id = context_id | ||
| self.context_type = context_type | ||
| } | ||
|
|
||
| public var contextType: ContextType? { | ||
| return ContextType(rawValue: context_type.lowercased()) | ||
| } | ||
|
|
||
| public var canvasContextID: String { | ||
| return "\(context_type.lowercased())_\(context_id)" | ||
| } | ||
|
|
||
| public func overriden(state: State, context: Context) -> Self { | ||
| APIFeatureFlagState( | ||
| feature: feature, | ||
| state: state, | ||
| locked: locked, | ||
| context_id: context.id, | ||
| context_type: context.contextType.rawValue | ||
| ) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
Core/Core/Common/CommonModels/AppEnvironment/FeatureFlags/GetFeatureFlagState.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // | ||
| // This file is part of Canvas. | ||
| // Copyright (C) 2025-present Instructure, Inc. | ||
| // | ||
| // This program is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Affero General Public License as | ||
| // published by the Free Software Foundation, either version 3 of the | ||
| // License, or (at your option) any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Affero General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Affero General Public License | ||
| // along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| // | ||
|
|
||
| import Foundation | ||
| import CoreData | ||
|
|
||
| public class GetFeatureFlagState: CollectionUseCase { | ||
| public typealias Model = FeatureFlag | ||
|
|
||
| public let featureName: FeatureFlagName | ||
| public let context: Context | ||
|
|
||
| public var scope: Scope { | ||
| let contextPredicate = NSPredicate(format: "%K == %@", #keyPath(FeatureFlag.canvasContextID), context.canvasContextID) | ||
| let namePredicate = NSPredicate(format: "%K == %@", #keyPath(FeatureFlag.name), featureName.rawValue) | ||
| let predicate = NSCompoundPredicate( | ||
| andPredicateWithSubpredicates: [ | ||
| contextPredicate, | ||
| namePredicate | ||
| ] | ||
| ) | ||
| return Scope(predicate: predicate, order: [NSSortDescriptor(key: #keyPath(FeatureFlag.name), ascending: true)]) | ||
| } | ||
|
|
||
| public var cacheKey: String? { | ||
| return "get-\(context.canvasContextID)-\(featureName.rawValue)-feature-flag-state" | ||
| } | ||
|
|
||
| public var request: GetFeatureFlagStateRequest { | ||
| return GetFeatureFlagStateRequest(featureName: featureName, context: context) | ||
| } | ||
|
|
||
| public init(featureName: FeatureFlagName, context: Context) { | ||
| self.featureName = featureName | ||
| self.context = context | ||
| } | ||
|
|
||
| public func write(response: APIFeatureFlagState?, urlResponse: URLResponse?, to client: NSManagedObjectContext) { | ||
| guard var item = response else { return } | ||
|
|
||
| /// This as workaround for an API limitation, where | ||
| /// requesting feature state of a course context, | ||
| /// if not set on that course, would return the feature state of | ||
| /// the most higher level (which is the account) | ||
| if item.contextType != context.contextType && item.contextType == .account { | ||
| item = item.overriden( | ||
| state: item.state == .allowed_on ? .on : item.state, | ||
| context: context | ||
| ) | ||
| } | ||
|
|
||
| FeatureFlag.save(item, in: client) | ||
| } | ||
| } |
43 changes: 43 additions & 0 deletions
43
Core/Core/Common/CommonModels/AppEnvironment/FeatureFlags/GetFeatureFlagStateRequest.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // | ||
| // This file is part of Canvas. | ||
| // Copyright (C) 2025-present Instructure, Inc. | ||
| // | ||
| // This program is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Affero General Public License as | ||
| // published by the Free Software Foundation, either version 3 of the | ||
| // License, or (at your option) any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Affero General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Affero General Public License | ||
| // along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| // | ||
|
|
||
| import Foundation | ||
|
|
||
| // https://canvas.instructure.com/doc/api/feature_flags.html#method.feature_flags.show | ||
| public struct GetFeatureFlagStateRequest: APIRequestable { | ||
| public typealias Response = APIFeatureFlagState | ||
|
|
||
| public let context: Context | ||
| public let featureName: FeatureFlagName | ||
|
|
||
| public var path: String { | ||
| return "\(context.pathComponent)/features/flags/\(featureName.rawValue)" | ||
| } | ||
|
|
||
| public init(featureName: FeatureFlagName, context: Context) { | ||
| self.featureName = featureName | ||
| self.context = context | ||
| } | ||
| } | ||
|
|
||
| // MARK: - Parameters | ||
|
|
||
| public enum FeatureFlagName: String { | ||
| case assignmentEnhancements = "assignments_2_student" | ||
| case studioEmbedImprovements = "rce_studio_embed_improvements" | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.