diff --git a/AppIcons (2)/Assets.xcassets/AppIcon.appiconset/Contents.json b/AppIcons (2)/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..bc89d32 --- /dev/null +++ b/AppIcons (2)/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1 @@ +{"images":[]} \ No newline at end of file diff --git a/AppIcons (2)/android/mipmap-hdpi/ic_launcher.png b/AppIcons (2)/android/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..3afff20 Binary files /dev/null and b/AppIcons (2)/android/mipmap-hdpi/ic_launcher.png differ diff --git a/AppIcons (2)/android/mipmap-mdpi/ic_launcher.png b/AppIcons (2)/android/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..eb7a9d5 Binary files /dev/null and b/AppIcons (2)/android/mipmap-mdpi/ic_launcher.png differ diff --git a/AppIcons (2)/android/mipmap-xhdpi/ic_launcher.png b/AppIcons (2)/android/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..6c3c0ec Binary files /dev/null and b/AppIcons (2)/android/mipmap-xhdpi/ic_launcher.png differ diff --git a/AppIcons (2)/android/mipmap-xxhdpi/ic_launcher.png b/AppIcons (2)/android/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..6589b1e Binary files /dev/null and b/AppIcons (2)/android/mipmap-xxhdpi/ic_launcher.png differ diff --git a/AppIcons (2)/android/mipmap-xxxhdpi/ic_launcher.png b/AppIcons (2)/android/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..33ea49d Binary files /dev/null and b/AppIcons (2)/android/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/AppIcons (2)/appstore.png b/AppIcons (2)/appstore.png new file mode 100644 index 0000000..90d039f Binary files /dev/null and b/AppIcons (2)/appstore.png differ diff --git a/AppIcons (2)/playstore.png b/AppIcons (2)/playstore.png new file mode 100644 index 0000000..7146562 Binary files /dev/null and b/AppIcons (2)/playstore.png differ diff --git a/android/app/build.gradle b/android/app/build.gradle index 67ad8c9..9f1ede5 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 29 + compileSdkVersion 30 sourceSets { main.java.srcDirs += 'src/main/kotlin' @@ -40,9 +40,10 @@ android { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "be.musee.de.la.fraise.tablet_app" minSdkVersion 20 - targetSdkVersion 29 + targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName + multiDexEnabled true } buildTypes { diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 296b146..bc24dcf 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/assets/icons/icon.png b/assets/icons/icon.png new file mode 100644 index 0000000..eb7a9d5 Binary files /dev/null and b/assets/icons/icon.png differ diff --git a/lib/Helpers/DeviceInfoHelper.dart b/lib/Helpers/DeviceInfoHelper.dart new file mode 100644 index 0000000..458e4a4 --- /dev/null +++ b/lib/Helpers/DeviceInfoHelper.dart @@ -0,0 +1,33 @@ +import 'dart:io'; + +import 'package:device_info/device_info.dart'; +import 'package:flutter/services.dart'; + +class DeviceInfoHelper { + static Future getDeviceDetails() async { + /* String deviceName; + String deviceVersion;*/ + String identifier; + final DeviceInfoPlugin deviceInfoPlugin = new DeviceInfoPlugin(); + try { + if (Platform.isAndroid) { + var build = await deviceInfoPlugin.androidInfo; + /*deviceName = build.model; + deviceVersion = build.version.toString();*/ + identifier = build.androidId; //UUID for Android + print(identifier); + + } else if (Platform.isIOS) { + var data = await deviceInfoPlugin.iosInfo; + /*deviceName = data.name; + deviceVersion = data.systemVersion;*/ + identifier = data.identifierForVendor; //UUID for iOS + } + } on PlatformException { + print('Failed to get platform version'); + } + +//if (!mounted) return; + return identifier; + } +} \ No newline at end of file diff --git a/lib/Helpers/MQTTHelper.dart b/lib/Helpers/MQTTHelper.dart index b07d68a..859f27d 100644 --- a/lib/Helpers/MQTTHelper.dart +++ b/lib/Helpers/MQTTHelper.dart @@ -5,8 +5,8 @@ import 'package:fluttertoast/fluttertoast.dart'; import 'package:managerapi/api.dart'; import 'package:mqtt_client/mqtt_client.dart'; import 'package:mqtt_client/mqtt_server_client.dart'; +import 'package:tablet_app/Helpers/DeviceInfoHelper.dart'; import 'package:tablet_app/Models/tabletContext.dart'; -import 'package:unique_identifier/unique_identifier.dart'; import 'DatabaseHelper.dart'; @@ -106,7 +106,7 @@ class MQTTHelper { Future connect(dynamic appContext) async { TabletAppContext tabletAppContext = appContext.getContext(); - var identifier = await UniqueIdentifier.serial; + var identifier = await DeviceInfoHelper.getDeviceDetails(); tabletAppContext.clientMQTT = MqttServerClient.withPort(tabletAppContext.host.replaceAll('http://', ''), 'tablet_app_'+identifier, 1883); isInstantiated = true; diff --git a/lib/Screens/Configuration/config_view.dart b/lib/Screens/Configuration/config_view.dart index 098c418..eac4085 100644 --- a/lib/Screens/Configuration/config_view.dart +++ b/lib/Screens/Configuration/config_view.dart @@ -1,3 +1,4 @@ +import 'package:device_info/device_info.dart'; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; import 'package:flutter/services.dart'; @@ -9,6 +10,7 @@ import 'package:tablet_app/Components/Buttons/rounded_button.dart'; import 'package:tablet_app/Components/loading.dart'; import 'package:tablet_app/Components/rounded_input_field.dart'; import 'package:tablet_app/Helpers/DatabaseHelper.dart'; +import 'package:tablet_app/Helpers/DeviceInfoHelper.dart'; import 'package:tablet_app/Helpers/MQTTHelper.dart'; import 'package:tablet_app/Models/tabletContext.dart'; import 'package:tablet_app/Screens/MainView/dropDown_configuration.dart'; @@ -18,8 +20,6 @@ import 'package:tablet_app/client.dart'; import 'package:tablet_app/constants.dart'; import 'dart:io'; -import 'package:unique_identifier/unique_identifier.dart'; - class ConfigViewWidget extends StatefulWidget { ConfigViewWidget(); @@ -162,7 +162,8 @@ class _ConfigViewWidget extends State { TabletAppContext tabletAppContext = new TabletAppContext(); tabletAppContext.host = url; tabletAppContext.clientAPI = client; - var identifier = await UniqueIdentifier.serial; + + var identifier = await DeviceInfoHelper.getDeviceDetails(); tabletAppContext.clientMQTT = new MqttServerClient(url.replaceAll('http://', ''),'tablet_app_'+identifier); setState(() { appContext.setContext(tabletAppContext); @@ -197,7 +198,7 @@ class _ConfigViewWidget extends State { newDevice.configurationId = configurationDTO.id; newDevice.configuration = configurationDTO.label; newDevice.connected = true; - newDevice.identifier = await UniqueIdentifier.serial; + newDevice.identifier = await DeviceInfoHelper.getDeviceDetails(); newDevice.ipAddressWLAN = await getIP(true); newDevice.ipAddressETH = await getIP(false); newDevice.name = newDevice.ipAddressWLAN; diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 66dd8a8..8370e57 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -2,8 +2,6 @@ // Generated file. Do not edit. // -// clang-format off - import FlutterMacOS import Foundation diff --git a/pubspec.lock b/pubspec.lock index 59956e5..4a92390 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,7 +7,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0" + version: "2.8.1" auto_size_text: dependency: "direct main" description: @@ -42,7 +42,7 @@ packages: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.3.1" clock: dependency: transitive description: @@ -78,6 +78,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.3" + device_info: + dependency: "direct main" + description: + name: device_info + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + device_info_platform_interface: + dependency: transitive + description: + name: device_info_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" enum_to_string: dependency: "direct main" description: @@ -105,7 +119,7 @@ packages: name: flare_flutter url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "3.0.2" flutter: dependency: "direct main" description: flutter @@ -141,7 +155,7 @@ packages: name: fluttertoast url: "https://pub.dartlang.org" source: hosted - version: "8.0.7" + version: "8.0.8" google_maps_flutter: dependency: "direct main" description: @@ -155,7 +169,7 @@ packages: name: google_maps_flutter_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" http: dependency: "direct main" description: @@ -204,7 +218,7 @@ packages: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.7.0" mime: dependency: transitive description: @@ -272,14 +286,14 @@ packages: name: sqflite url: "https://pub.dartlang.org" source: hosted - version: "2.0.0+3" + version: "2.0.0+4" sqflite_common: dependency: transitive description: name: sqflite_common url: "https://pub.dartlang.org" source: hosted - version: "2.0.0+2" + version: "2.0.1" stack_trace: dependency: transitive description: @@ -328,7 +342,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19" + version: "0.4.2" typed_data: dependency: transitive description: @@ -336,13 +350,6 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" - unique_identifier: - dependency: "direct main" - description: - name: unique_identifier - url: "https://pub.dartlang.org" - source: hosted - version: "0.0.3" uuid: dependency: transitive description: @@ -363,7 +370,7 @@ packages: name: webview_flutter url: "https://pub.dartlang.org" source: hosted - version: "2.0.10" + version: "2.0.12" youtube_player_flutter: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index a178077..cb8f98c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -31,7 +31,7 @@ dependencies: http: ^0.12.2 auto_size_text: ^2.1.0 fluttertoast: - unique_identifier: ^0.0.3 + device_info: ^2.0.2 enum_to_string: ^2.0.1 carousel_slider: ^4.0.0 youtube_player_flutter: ^7.0.0+7 @@ -50,9 +50,13 @@ dev_dependencies: # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec +flutter_icons: + android: "launcher_icon" + ios: false + image_path: "assets/icons/icon.png" + # The following section is specific to Flutter. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class.