Skip to content

feat: implement QR scanning with Safe Browsing threat verification - #1

Merged
RStephanH merged 10 commits into
masterfrom
develop
Jul 15, 2026
Merged

feat: implement QR scanning with Safe Browsing threat verification#1
RStephanH merged 10 commits into
masterfrom
develop

Conversation

@RStephanH

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 15, 2026 20:20
@RStephanH
RStephanH merged commit 643e17b into master Jul 15, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 + ScanResult model to call Safe Browsing v4 and represent scan verdicts.
  • Added ScannerScreen UI wired to mobile_scanner with 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 thread lib/main.dart
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;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants