Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: #370 - added "uuid" to configuration #378

Merged
merged 1 commit into from Feb 2, 2022

Conversation

monsieurtanuki
Copy link
Contributor

Impacted files:

  • configuration_test.dart: added tests with "uuid"
  • HttpHelper.dart: included new static uuid to parameters
  • OpenFoodAPIConfiguration.dart: added static String? uuid
  • pubspec.yaml: unrelated upgrade

Impacted files:
* `configuration_test.dart`: added tests with "uuid"
* `HttpHelper.dart`: included new static `uuid` to parameters
* `OpenFoodAPIConfiguration.dart`: added `static String? uuid`
* `pubspec.yaml`: unrelated upgrade
Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

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

Looks good thanks @monsieurtanuki

@monsieurtanuki monsieurtanuki merged commit 2be52e0 into openfoodfacts:master Feb 2, 2022
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your review!
Now the trick is to tell developers to use user agent and uuid, but that's beyond my coding abilities ;)

@MohamedFBoussaid
Copy link
Member

@monsieurtanuki thank you for the changes. Maybe updating the readMe and the example file can help ?
So by default when someone will start coding with OFF package will coy/paste the example with the uuid

@M123-dev
Copy link
Member

M123-dev commented Feb 2, 2022

That's something we can add to https://github.com/openfoodfacts/openfoodfacts-dart/projects/2

@monsieurtanuki
Copy link
Contributor Author

Fair enough @MohamedFBoussaid, but I don't know

  1. which values can be set - strict UUID format or just a String?
    => probably just a String
  2. how the developers get a UUID - they just import whatever uuid package or they call an OFF dedicated API, as @jasmeet0817 feared that UUID may not be unique if generated locally (if I remember well)
    => probably locally with a package - cf. Implement the new App uuid system #370 (comment)
  3. when the UUID must be set
    => probably at the very first init of the app, and saved in preferences

It's looked so far like uuid should be populated by a device id, but that's not supported by (agnostic) dart. Only by flutter.

@MohamedFBoussaid
Copy link
Member

@monsieurtanuki I can give it a try with my Flutter app, and see how it will work. And then I will be back with examples

Future<String?> _getId() async {
var deviceInfo = DeviceInfoPlugin();
if (Platform.isIOS) { // import 'dart:io'
var iosDeviceInfo = await deviceInfo.iosInfo;
return iosDeviceInfo.identifierForVendor; // unique ID on iOS
} else {
var androidDeviceInfo = await deviceInfo.androidInfo;
return androidDeviceInfo.androidId; // unique ID on Android
}
}

@monsieurtanuki
Copy link
Contributor Author

Thank you @MohamedFBoussaid!
I would rather use platform_device_id instead (no ifs), but the result should be similar.

@MohamedFBoussaid
Copy link
Member

Thanks @monsieurtanuki I will use that package.

@MohamedFBoussaid
Copy link
Member

MohamedFBoussaid commented Feb 2, 2022

@monsieurtanuki , I have made a quick test using that package. And normally I made a fake update for a product 7613035989535 with the following UUIDs :

  • iPhone: 1723BE2C-C0EB-4055-8960-5534AFBFB63F.
  • Android : 377654b1f5c4a080

@stephanegigandet @teolemon is there a way to check if the UUID was received on the backend ?

@monsieurtanuki
Copy link
Contributor Author

I've just added uuid to smoothie too (openfoodfacts/smooth-app#1064)

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.

None yet

3 participants