Conversation
…ve and store in the application
…as callback after the a qr have been detected
There was a problem hiding this comment.
Pull request overview
Implements the core LinkGuard flow: scan a QR/barcode, extract a URL, verify it via Google Safe Browsing, and show a verdict in the Flutter UI. It also adds documentation and basic unit tests around the Safe Browsing integration.
Changes:
- Added
SafeBrowsingService+ScanResultmodel to call Safe Browsing v4 and represent scan verdicts. - Added
ScannerScreenUI wired tomobile_scannerwith a simple state machine (idle/loading/result). - Updated README and platform manifests (camera permissions), plus a small CLI script for manual verification.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/services/safe_browsing_service_test.dart | Adds mocked unit tests for Safe Browsing responses (safe/unsafe/http error/network error). |
| README.md | Documents app purpose, architecture, setup, testing, and manual verification flow. |
| lib/services/safe_browsing_service.dart | Introduces Safe Browsing v4 HTTP client/service with injectable http.Client. |
| lib/screens/scanner_screen.dart | Adds camera scanning UI and displays Safe Browsing verdicts. |
| lib/models/scan_result.dart | Adds result model + threat level enum to represent scan outcomes. |
| lib/main.dart | Replaces template counter app with LinkGuard app entrypoint and scanner home screen. |
| ios/Runner/Info.plist | Adds iOS camera usage description for runtime permission prompt. |
| bin/manual_safe_browsing_check.dart | Adds CLI helper to run one real Safe Browsing check. |
| android/app/src/main/AndroidManifest.xml | Adds Android camera permission. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
4
to
10
| void main() { | ||
| runApp(const MyApp()); | ||
| runApp(const LinkGuardApp()); | ||
| } | ||
|
|
||
| class MyApp extends StatelessWidget { | ||
| const MyApp({super.key}); | ||
| class LinkGuardApp extends StatelessWidget { | ||
| const LinkGuardApp({super.key}); | ||
|
|
Comment on lines
+44
to
+56
| final decoded = jsonDecode(response.body) as Map<String, dynamic>; | ||
|
|
||
| if (decoded.isEmpty) { | ||
| return ScanResult(url: url, level: ThreatLevel.safe); | ||
| } | ||
|
|
||
| final matches = decoded['matches'] as List; | ||
| final threatType = matches.first['threatType'] as String; | ||
| return ScanResult( | ||
| url: url, | ||
| level: ThreatLevel.unsafe, | ||
| threatType: threatType, | ||
| ); |
Comment on lines
+98
to
+100
| final label = isError | ||
| ? 'Error: ${result.errorMessage}' | ||
| : (isSafe ? 'URL is safe' : 'Threat detected: ${result.threatType}'); |
| expect(result.level, ThreatLevel.safe); | ||
| }); | ||
|
|
||
| test('retourne unsafe quand l\'API signale une menace', () async { |
Comment on lines
+39
to
+40
|
|
||
| test('returns error on non-200 HTTP status', () async { |
Comment on lines
+35
to
+40
| Future<void> _onDetect(BarcodeCapture capture) async { | ||
| if (_isProcessing) return; | ||
|
|
||
| final value = capture.barcodes.first.rawValue; | ||
| if (value == null) return; | ||
|
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.