diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 98c4f31..0b10f05 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -25,12 +25,24 @@ + + + + + + - + + diff --git a/android/app/src/main/kotlin/com/example/contact_tracing/MainTileService.kt b/android/app/src/main/kotlin/com/example/contact_tracing/MainTileService.kt new file mode 100644 index 0000000..2534528 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/contact_tracing/MainTileService.kt @@ -0,0 +1,35 @@ +package com.example.contact_tracing + +import android.service.quicksettings.TileService + +class MainTileService: TileService(){ + /* + override fun onClick() { + super.onClick() + } + + override fun onTileRemoved() { + super.onTileRemoved() + + // Do something when the user removes the Tile + } + + override fun onTileAdded() { + super.onTileAdded() + + // Do something when the user add the Tile + } + + override fun onStartListening() { + super.onStartListening() + + // Called when the Tile becomes visible + } + + override fun onStopListening() { + super.onStopListening() + + // Called when the tile is no longer visible + } + */ +} diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml index d460d1e..c785b8b 100644 --- a/android/app/src/main/res/values/styles.xml +++ b/android/app/src/main/res/values/styles.xml @@ -15,4 +15,7 @@ + Contact Tracing diff --git a/lib/main.dart b/lib/main.dart index 4e92f3c..fe63edd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:mobile_scanner/mobile_scanner.dart'; import 'package:flutter_sms/flutter_sms.dart'; +import 'package:permission_handler/permission_handler.dart'; void main() { runApp(const AnalyzeView()); @@ -26,6 +27,12 @@ class AnalyzeViewState extends State ); void _sendSMS(String message, List recipents) async { + var status = await Permission.sms.status; + if (status.isDenied) { + Map statuses = await [ + Permission.sms, + ].request(); + } String _result = await sendSMS(message: message, recipients: recipents, sendDirect: true) .catchError((onError) { diff --git a/pubspec.lock b/pubspec.lock index 5a51644..1293296 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -172,6 +172,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + url: "https://pub.dartlang.org" + source: hosted + version: "9.2.0" + permission_handler_android: + dependency: transitive + description: + name: permission_handler_android + url: "https://pub.dartlang.org" + source: hosted + version: "9.0.2+1" + permission_handler_apple: + dependency: transitive + description: + name: permission_handler_apple + url: "https://pub.dartlang.org" + source: hosted + version: "9.0.3" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.7.0" + permission_handler_windows: + dependency: transitive + description: + name: permission_handler_windows + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.0" petitparser: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index edecbc0..52dfcfb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 mobile_scanner: ^0.0.3 + permission_handler: ^9.2.0 # flutter_sms: ^2.3.2 flutter_sms: git: diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 4f78848..a0d0bbe 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,9 +6,12 @@ #include "generated_plugin_registrant.h" +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + PermissionHandlerWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); UrlLauncherWindowsRegisterWithRegistrar( registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 411af46..ca38d21 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + permission_handler_windows url_launcher_windows )