Skip to content

Commit

Permalink
Swap out nonfree library
Browse files Browse the repository at this point in the history
flutter_barcode_scanner depended on
 'com.google.android.gms:play-services-vision:20.1.3'
which is a nonfree library.

Closes #25
  • Loading branch information
brandonp2412 committed Jul 13, 2024
1 parent f89cc82 commit 465f27e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 39 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />

<application
android:label="FitBook"
Expand Down
17 changes: 8 additions & 9 deletions lib/scan_barcode.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:drift/drift.dart';
import 'package:fit_book/main.dart';
import 'package:fit_book/settings/settings_state.dart';
import 'package:fit_book/utils.dart';
import 'package:flutter/material.dart';
import 'package:openfoodfacts/openfoodfacts.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:simple_barcode_scanner/simple_barcode_scanner.dart';

import 'database/database.dart';

Expand All @@ -22,14 +23,12 @@ class _ScanBarcodeState extends State<ScanBarcode> {
bool searching = false;

scan() async {
var barcode = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const SimpleBarcodeScannerPage(),
),
);
if (barcode is! String) return;
if (barcode == '-1') return;
final status = await Permission.camera.request();
if (!status.isGranted) return;

final scan = await BarcodeScanner.scan();
final barcode = scan.rawContent;
if (barcode.isEmpty) return;

var food = await (db.foods.select()
..where((tbl) => tbl.barcode.equals(barcode))
Expand Down
42 changes: 17 additions & 25 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.2"
barcode_scan2:
dependency: "direct main"
description:
name: barcode_scan2
sha256: c1be395802e55f4b54f43a0cf3ece197dc8cc11683a57ea5580a16cc22ba6944
url: "https://pub.dev"
source: hosted
version: "4.3.2"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -350,14 +358,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_barcode_scanner:
dependency: transitive
description:
name: flutter_barcode_scanner
sha256: a4ba37daf9933f451a5e812c753ddd045d6354e4a3280342d895b07fecaab3fa
url: "https://pub.dev"
source: hosted
version: "2.0.0"
flutter_cache_manager:
dependency: transitive
description:
Expand Down Expand Up @@ -696,7 +696,7 @@ packages:
source: hosted
version: "2.2.1"
permission_handler:
dependency: transitive
dependency: "direct main"
description:
name: permission_handler
sha256: "18bf33f7fefbd812f37e72091a15575e72d5318854877e0e4035a24ac1113ecb"
Expand Down Expand Up @@ -783,6 +783,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.0.2"
protobuf:
dependency: transitive
description:
name: protobuf
sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
provider:
dependency: "direct main"
description:
Expand Down Expand Up @@ -911,14 +919,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
simple_barcode_scanner:
dependency: "direct main"
description:
name: simple_barcode_scanner
sha256: e14c0b302ffe76f0b61004aa47c36365b5d884fcd745494309e21042667902d3
url: "https://pub.dev"
source: hosted
version: "0.1.1"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -1188,14 +1188,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.3"
webview_windows:
dependency: transitive
description:
name: webview_windows
sha256: "7572089e5d6fe09e790093c499fcb6d76a552250187dbcb89790987b1fb723db"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
win32:
dependency: transitive
description:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ dependencies:
openfoodfacts: ^3.11.0
archive: ^3.6.1
cached_network_image: ^3.3.1
simple_barcode_scanner: ^0.1.1
barcode_scan2: ^4.3.2
permission_handler: ^11.3.1
dev_dependencies:
integration_test:
sdk: flutter
Expand Down
3 changes: 0 additions & 3 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <share_plus/share_plus_windows_plugin_c_api.h>
#include <sqlite3_flutter_libs/sqlite3_flutter_libs_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <webview_windows/webview_windows_plugin.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
DynamicColorPluginCApiRegisterWithRegistrar(
Expand All @@ -24,6 +23,4 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("Sqlite3FlutterLibsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
WebviewWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("WebviewWindowsPlugin"));
}
1 change: 0 additions & 1 deletion windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
share_plus
sqlite3_flutter_libs
url_launcher_windows
webview_windows
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down

0 comments on commit 465f27e

Please sign in to comment.