diff --git a/mobile-app/integration_test/learn/learn_landing.dart b/mobile-app/integration_test/learn/learn_landing.dart index 76e59a54c..5cc802017 100644 --- a/mobile-app/integration_test/learn/learn_landing.dart +++ b/mobile-app/integration_test/learn/learn_landing.dart @@ -20,24 +20,16 @@ void main() { await tester.pumpAndSettle(); await binding.takeScreenshot('learn/learn-landing'); - String baseUrlV2 = LearnService.baseUrlV2; - final Response res = await dio.get('$baseUrlV2/available-superblocks.json'); - Map superBlockStages = res.data['superblocks']; + String baseUrl = LearnService.baseUrl; + final Response res = await dio.get('$baseUrl/available-superblocks.json'); + List superBlocks = res.data['superblocks']; int publicSuperBlocks = 0; - int totalSuperBlocks = 0; - - // Iterate through each stage and count the superblocks - superBlockStages.forEach((stage, superBlocksList) { - for (final superBlock in superBlocksList) { - totalSuperBlocks++; - if (superBlock['public']) { - publicSuperBlocks++; - } - } - }); - print('Total SuperBlocks: $totalSuperBlocks'); - print('Total Public SuperBlocks: $publicSuperBlocks'); + for (int i = 0; i < superBlocks.length; i++) { + if (superBlocks[i]['public']) { + publicSuperBlocks++; + } + } await tester.pumpAndSettle(); // Check if all superblocks are displayed @@ -45,7 +37,10 @@ void main() { final publicSuperBlockButtons = find.byWidgetPredicate( (widget) => widget is SuperBlockButton && widget.button.public == true, ); - expect(superBlockButtons, findsNWidgets(totalSuperBlocks)); + expect( + superBlockButtons, + findsNWidgets(superBlocks.length - 1), // Exclude 'full-stack' superblock + ); expect(publicSuperBlockButtons, findsNWidgets(publicSuperBlocks)); // Check for login button diff --git a/mobile-app/lib/service/learn/learn_service.dart b/mobile-app/lib/service/learn/learn_service.dart index a369685b8..6e4e23917 100644 --- a/mobile-app/lib/service/learn/learn_service.dart +++ b/mobile-app/lib/service/learn/learn_service.dart @@ -23,6 +23,8 @@ class LearnService { final Dio _dio = DioService.dio; + // TODO: change this to v2 and remove baseUrlV2 once the migration is complete + static final baseUrl = '${AuthenticationService.baseURL}/curriculum-data/v1'; static final baseUrlV2 = '${AuthenticationService.baseURL}/curriculum-data/v2'; diff --git a/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart b/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart index f21774892..80463e70e 100644 --- a/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart +++ b/mobile-app/lib/ui/views/learn/landing/landing_viewmodel.dart @@ -74,7 +74,7 @@ class LearnLandingViewModel extends BaseViewModel { lastVisitedChallenge[0], ); - String baseUrl = LearnService.baseUrlV2; + String baseUrl = LearnService.baseUrl; final Response res = await _dio.get('$baseUrl/${lastVisitedChallenge[1]}.json'); @@ -158,37 +158,53 @@ class LearnLandingViewModel extends BaseViewModel { } Future> requestSuperBlocks() async { - String baseUrl = LearnService.baseUrlV2; + String baseUrl = LearnService.baseUrl; final Response res = await _dio.get('$baseUrl/available-superblocks.json'); List layout = []; if (res.statusCode == 200) { - Map superBlockStages = res.data['superblocks']; - await dotenv.load(fileName: '.env'); bool showAllSB = dotenv.get('SHOWALLSB', fallback: 'false').toLowerCase() == 'true'; - for (var superBlockStage in superBlockStages.keys) { - layout.add(Padding( - padding: const EdgeInsets.all(8.0), - child: handleStageTitle(superBlockStage), - )); - - for (var superBlock in superBlockStages[superBlockStage]) { - layout.add( - SuperBlockButton( - button: SuperBlockButtonData( - path: superBlock['dashedName'], - name: superBlock['title'], - public: !showAllSB ? superBlock['public'] : true, - ), - model: this, - ), - ); + // Map superBlockStages = res.data['superblocks']; + // for (var superBlockStage in superBlockStages.keys) { + // layout.add(Padding( + // padding: const EdgeInsets.all(8.0), + // child: handleStageTitle(superBlockStage), + // )); + + // for (var superBlock in superBlockStages[superBlockStage]) { + // layout.add( + // SuperBlockButton( + // button: SuperBlockButtonData( + // path: superBlock['dashedName'], + // name: superBlock['title'], + // public: !showAllSB ? superBlock['public'] : true, + // ), + // model: this, + // ), + // ); + // } + // } + + List superBlocks = res.data['superblocks']; + for (int i = 0; i < superBlocks.length; i++) { + if (superBlocks[i]['dashedName'].toString().contains('full-stack')) { + continue; } + layout.add( + SuperBlockButton( + button: SuperBlockButtonData( + path: superBlocks[i]['dashedName'], + name: superBlocks[i]['title'], + public: !showAllSB ? superBlocks[i]['public'] : true, + ), + model: this, + ), + ); } return layout;