Skip to content

Commit

Permalink
Release Teacher 1.34.0 71
Browse files Browse the repository at this point in the history
  • Loading branch information
domonkosadam authored Oct 10, 2024
2 parents 50df3c8 + c19e0b5 commit 6409056
Show file tree
Hide file tree
Showing 572 changed files with 31,227 additions and 2,099 deletions.
2 changes: 1 addition & 1 deletion android-vault
4 changes: 2 additions & 2 deletions apps/flutter_parent/assets/html/html_wrapper.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@
margin-bottom: 12px;
height: 38px;
width: 100%;
border: 0.5px solid #C7CDD1;
border: 0.5px solid #9EA6AD;
border-radius: 4px;
background-color: #F5F5F5;
background-color: #FFFFFF;
text-align: center;
vertical-align: middle;
line-height: 38px;
Expand Down
5 changes: 5 additions & 0 deletions apps/flutter_parent/lib/network/api/course_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,9 @@ class CourseApi {
var dio = canvasDio(forceRefresh: forceRefresh);
return fetch(dio.get('courses/$courseId/permissions'));
}

Future<List<String>?> getEnabledCourseFeatures(String courseId, {bool forceRefresh = false}) async {
var dio = canvasDio(forceRefresh: forceRefresh);
return fetchList(dio.get('courses/$courseId/features/enabled'));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,22 @@ import 'package:flutter_parent/utils/notification_util.dart';
import 'package:flutter_parent/utils/service_locator.dart';

class AssignmentDetailsInteractor {
final String _ASSIGNMENT_ENHANCEMENT_KEY = "assignments_2_student";

Future<AssignmentDetails?> loadAssignmentDetails(
bool forceRefresh,
String courseId,
String assignmentId,
String? studentId,
) async {
final course = locator<CourseApi>().getCourse(courseId, forceRefresh: forceRefresh);
final enabledCourseFeatures = locator<CourseApi>().getEnabledCourseFeatures(courseId, forceRefresh: forceRefresh);
final assignment = locator<AssignmentApi>().getAssignment(courseId, assignmentId, forceRefresh: forceRefresh);

return AssignmentDetails(
assignment: (await assignment),
course: (await course),
);
assignment: (await assignment),
course: (await course),
assignmentEnhancementEnabled: (await enabledCourseFeatures)?.contains(_ASSIGNMENT_ENHANCEMENT_KEY));
}

Future<AssignmentDetails> loadQuizDetails(
Expand All @@ -45,12 +48,13 @@ class AssignmentDetailsInteractor {
String studentId,
) async {
final course = locator<CourseApi>().getCourse(courseId, forceRefresh: forceRefresh);
final enabledCourseFeatures = locator<CourseApi>().getEnabledCourseFeatures(courseId, forceRefresh: forceRefresh);
final quiz = locator<AssignmentApi>().getAssignment(courseId, assignmentId, forceRefresh: forceRefresh);

return AssignmentDetails(
assignment: (await quiz),
course: (await course),
);
assignment: (await quiz),
course: (await course),
assignmentEnhancementEnabled: (await enabledCourseFeatures)?.contains(_ASSIGNMENT_ENHANCEMENT_KEY));
}

Future<Reminder?> loadReminder(String assignmentId) async {
Expand Down Expand Up @@ -100,7 +104,6 @@ class AssignmentDetailsInteractor {
reminder = insertedReminder;
await locator<NotificationUtil>().scheduleReminder(l10n, title, body, reminder);
}

}

Future<void> deleteReminder(Reminder? reminder) async {
Expand All @@ -113,6 +116,7 @@ class AssignmentDetailsInteractor {
class AssignmentDetails {
final Course? course;
final Assignment? assignment;
final bool? assignmentEnhancementEnabled;

AssignmentDetails({this.course, this.assignment});
AssignmentDetails({this.course, this.assignment, this.assignmentEnhancementEnabled});
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'package:flutter_parent/screens/inbox/create_conversation/create_conversa
import 'package:flutter_parent/utils/common_widgets/error_panda_widget.dart';
import 'package:flutter_parent/utils/common_widgets/loading_indicator.dart';
import 'package:flutter_parent/utils/common_widgets/web_view/html_description_tile.dart';
import 'package:flutter_parent/utils/common_widgets/web_view/web_content_interactor.dart';
import 'package:flutter_parent/utils/core_extensions/date_time_extensions.dart';
import 'package:flutter_parent/utils/design/canvas_icons_solid.dart';
import 'package:flutter_parent/utils/design/parent_theme.dart';
Expand Down Expand Up @@ -142,6 +143,7 @@ class _AssignmentDetailsScreenState extends State<AssignmentDetailsScreen> {
final course = snapshot.data?.course;
final restrictQuantitativeData = course?.settings?.restrictQuantitativeData ?? false;
final assignment = snapshot.data!.assignment!;
final assignmentEnhancementEnabled = snapshot.data?.assignmentEnhancementEnabled ?? false;
final submission = assignment.submission(_currentStudent?.id);
final fullyLocked = assignment.isFullyLocked;
final missing = submission?.missing == true;
Expand Down Expand Up @@ -190,7 +192,11 @@ class _AssignmentDetailsScreenState extends State<AssignmentDetailsScreen> {
padding: const EdgeInsets.only(top: 16.0, bottom: 16.0),
child: OutlinedButton(
onPressed: () {
_onSubmissionAndRubricClicked(assignment.htmlUrl, l10n.submission);
_onSubmissionAndRubricClicked(
assignment.htmlUrl,
assignmentEnhancementEnabled,
l10n.submission,
);
},
child: Align(
alignment: Alignment.center,
Expand Down Expand Up @@ -399,12 +405,13 @@ class _AssignmentDetailsScreenState extends State<AssignmentDetailsScreen> {
}
}

_onSubmissionAndRubricClicked(String? assignmentUrl, String title) {
_onSubmissionAndRubricClicked(String? assignmentUrl, bool assignmentEnhancementEnabled, String title) async {
if (assignmentUrl == null) return;
final parentId = ApiPrefs.getUser()?.id ?? 0;
final currentStudentId = _currentStudent?.id ?? 0;
final url = assignmentEnhancementEnabled ? assignmentUrl : assignmentUrl + "/submissions/$currentStudentId";
locator<QuickNav>().pushRoute(context, PandaRouter.submissionWebViewRoute(
assignmentUrl,
await locator<WebContentInteractor>().getAuthUrl(url),
title,
{"k5_observed_user_for_$parentId": "$currentStudentId"},
false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ class WebContentInteractor {
}

Future<String> getAuthUrl(String targetUrl) async {
if (targetUrl.contains(ApiPrefs.getDomain()!)) {
final domain = ApiPrefs.getDomain();
if (domain != null && targetUrl.contains(domain)) {
return _authUrl(targetUrl);
} else {
return targetUrl;
Expand Down
2 changes: 1 addition & 1 deletion apps/flutter_parent/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ description: Canvas Parent
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.10.0+50
version: 3.11.0+51

module:
androidX: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,21 @@ void main() {

expect(details?.assignment, assignment);
});

test('returns assignmentEnhancementEnabled as false if response does not contain key', () async {
final features = ["feature1", "feature2"];
when(courseApi.getEnabledCourseFeatures(courseId)).thenAnswer((_) async => features);
final details = await AssignmentDetailsInteractor().loadAssignmentDetails(false, courseId, assignmentId, studentId);

expect(details?.assignmentEnhancementEnabled, false);
});

test('returns assignmentEnhancementEnabled as true if response contains key', () async {
final features = ["feature1", "assignments_2_student", "feature3"];
when(courseApi.getEnabledCourseFeatures(courseId)).thenAnswer((_) async => features);
final details = await AssignmentDetailsInteractor().loadAssignmentDetails(false, courseId, assignmentId, studentId);

expect(details?.assignmentEnhancementEnabled, true);
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -662,4 +662,66 @@ void main() {
// Check that we have the correct title
expect(find.text(AppLocalizations().submission), findsOneWidget);
});

testWidgetsWithAccessibilityChecks(
'Submission & Rubric button opens SimpleWebViewScreen with the '
'correct url when assignment enhancements are enabled', (tester) async {
when(interactor.loadAssignmentDetails(any, courseId, assignmentId, studentId))
.thenAnswer((_) async => AssignmentDetails(assignment: assignment, assignmentEnhancementEnabled: true));

await tester.pumpWidget(TestApp(
AssignmentDetailsScreen(
courseId: courseId,
assignmentId: assignmentId,
),
platformConfig: PlatformConfig(mockApiPrefs: {ApiPrefs.KEY_CURRENT_STUDENT: json.encode(serialize(student))}, initWebview: true),
));

// Pump for a duration since we're delaying webview load for the animation
await tester.pumpAndSettle(Duration(seconds: 1));

await tester.tap(find.text(AppLocalizations().submissionAndRubric));
await tester.pumpAndSettle();

// Check to make sure we're on the SimpleWebViewScreen screen
final webViewScreenFinder = find.byType(SimpleWebViewScreen);
expect(find.byType(SimpleWebViewScreen), findsOneWidget);

final SimpleWebViewScreen webViewScreen = tester.widget(webViewScreenFinder) as SimpleWebViewScreen;
expect(webViewScreen.url, assignmentUrl);

// Check that we have the correct title
expect(find.text(AppLocalizations().submission), findsOneWidget);
});

testWidgetsWithAccessibilityChecks(
'Submission & Rubric button opens SimpleWebViewScreen with the '
'correct url when assignment enhancements are disabled', (tester) async {
when(interactor.loadAssignmentDetails(any, courseId, assignmentId, studentId))
.thenAnswer((_) async => AssignmentDetails(assignment: assignment, assignmentEnhancementEnabled: false));

await tester.pumpWidget(TestApp(
AssignmentDetailsScreen(
courseId: courseId,
assignmentId: assignmentId,
),
platformConfig: PlatformConfig(mockApiPrefs: {ApiPrefs.KEY_CURRENT_STUDENT: json.encode(serialize(student))}, initWebview: true),
));

// Pump for a duration since we're delaying webview load for the animation
await tester.pumpAndSettle(Duration(seconds: 1));

await tester.tap(find.text(AppLocalizations().submissionAndRubric));
await tester.pumpAndSettle();

// Check to make sure we're on the SimpleWebViewScreen screen
final webViewScreenFinder = find.byType(SimpleWebViewScreen);
expect(find.byType(SimpleWebViewScreen), findsOneWidget);

final SimpleWebViewScreen webViewScreen = tester.widget(webViewScreenFinder) as SimpleWebViewScreen;
expect(webViewScreen.url, assignmentUrl + '/submissions/' + studentId);

// Check that we have the correct title
expect(find.text(AppLocalizations().submission), findsOneWidget);
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -1670,6 +1670,20 @@ class MockCourseApi extends _i1.Mock implements _i52.CourseApi {
returnValue: _i8.Future<_i56.CoursePermissions?>.value(),
returnValueForMissingStub: _i8.Future<_i56.CoursePermissions?>.value(),
) as _i8.Future<_i56.CoursePermissions?>);
@override
_i8.Future<List<String>?> getEnabledCourseFeatures(
String? courseId, {
bool? forceRefresh = false,
}) =>
(super.noSuchMethod(
Invocation.method(
#getEnabledCourseFeatures,
[courseId],
{#forceRefresh: forceRefresh},
),
returnValue: _i8.Future<List<String>?>.value(),
returnValueForMissingStub: _i8.Future<List<String>?>.value(),
) as _i8.Future<List<String>?>);
}

/// A class which mocks [CourseDetailsInteractor].
Expand Down
5 changes: 4 additions & 1 deletion apps/parent/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ android {
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_11.toString()
}
buildFeatures {
viewBinding true
Expand Down Expand Up @@ -218,4 +218,7 @@ dependencies {
implementation Libs.PLAY_IN_APP_UPDATES

androidTestImplementation Libs.COMPOSE_UI_TEST

implementation (Libs.JOURNEY_ZXING) { transitive = false }
implementation Libs.JOURNEY_ZXING_CORE
}
24 changes: 24 additions & 0 deletions apps/parent/flank.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
gcloud:
project: delta-essence-114723
# Use the next two lines to run locally
# app: ./build/intermediates/apk/qa/debug/parent-qa-debug.apk
# test: ./build/intermediates/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
app: ./apps/parent/build/outputs/apk/qa/debug/parent-qa-debug.apk
test: ./apps/parent/build/outputs/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
results-bucket: android-parent
auto-google-login: true
use-orchestrator: true
performance-metrics: false
record-video: true
timeout: 60m
test-targets:
- notAnnotation com.instructure.canvas.espresso.E2E, com.instructure.canvas.espresso.Stub, com.instructure.canvas.espresso.FlakyE2E, com.instructure.canvas.espresso.KnownBug, com.instructure.canvas.espresso.OfflineE2E
device:
- model: Pixel2.arm
version: 29
locale: en_US
orientation: portrait

flank:
testShards: 10
testRuns: 1
33 changes: 33 additions & 0 deletions apps/parent/flank_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
gcloud:
project: delta-essence-114723
# Use the next two lines to run locally
# app: ./build/outputs/apk/qa/debug/parent-qa-debug.apk
# test: ./build/outputs/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
app: ./apps/parent/build/outputs/apk/qa/debug/parent-qa-debug.apk
test: ./apps/parent/build/outputs/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
results-bucket: android-parent
auto-google-login: true
use-orchestrator: true
performance-metrics: false
record-video: true
num-flaky-test-attempts: 2
timeout: 60m
environment-variables:
coverage: true
coverageFilePath: /sdcard/
clearPackageData: true
directories-to-pull:
- /sdcard/
test-targets:
- notAnnotation com.instructure.canvas.espresso.E2E, com.instructure.canvas.espresso.OfflineE2E, com.instructure.canvas.espresso.Stub, com.instructure.canvas.espresso.StubCoverage
device:
- model: Pixel2.arm
version: 29
locale: en_US
orientation: portrait

flank:
testShards: 10
testRuns: 1
files-to-download:
- .*\.ec$
24 changes: 24 additions & 0 deletions apps/parent/flank_landscape.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
gcloud:
project: delta-essence-114723
# Use the next two lines to run locally
# app: ./build/outputs/apk/qa/debug/parent-qa-debug.apk
# test: ./build/outputs/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
app: ./apps/parent/build/outputs/apk/qa/debug/parent-qa-debug.apk
test: ./apps/parent/build/outputs/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
results-bucket: android-parent
auto-google-login: true
use-orchestrator: true
performance-metrics: false
record-video: true
timeout: 60m
test-targets:
- notAnnotation com.instructure.canvas.espresso.E2E, com.instructure.canvas.espresso.Stub, com.instructure.canvas.espresso.StubLandscape, com.instructure.canvas.espresso.OfflineE2E
device:
- model: Pixel2.arm
version: 29
locale: en_US
orientation: landscape

flank:
testShards: 10
testRuns: 1
32 changes: 32 additions & 0 deletions apps/parent/flank_multi_api_level.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
gcloud:
project: delta-essence-114723
# Use the next two lines to run locally
# app: ./build/outputs/apk/qa/debug/parent-qa-debug.apk
# test: ./build/outputs/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
app: ./apps/parent/build/outputs/apk/qa/debug/parent-qa-debug.apk
test: ./apps/parent/build/outputs/apk/androidTest/qa/debug/parent-qa-debug-androidTest.apk
results-bucket: android-parent
auto-google-login: true
use-orchestrator: true
performance-metrics: false
record-video: true
timeout: 60m
test-targets:
- notAnnotation com.instructure.canvas.espresso.E2E, com.instructure.canvas.espresso.Stub, com.instructure.canvas.espresso.StubMultiAPILevel, com.instructure.canvas.espresso.FlakyE2E, com.instructure.canvas.espresso.KnownBug, com.instructure.canvas.espresso.OfflineE2E
device:
- model: NexusLowRes
version: 27
locale: en_US
orientation: portrait
- model: NexusLowRes
version: 28
locale: en_US
orientation: portrait
- model: NexusLowRes
version: 30
locale: en_US
orientation: portrait

flank:
testShards: 10
testRuns: 1
Loading

0 comments on commit 6409056

Please sign in to comment.