Skip to content

Commit 86b5c3a

Browse files
committed
Build changes
1 parent 6392976 commit 86b5c3a

10 files changed

Lines changed: 133 additions & 52 deletions

File tree

android/app/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ plugins {
1010

1111
android {
1212
namespace = "com.smartquit.breathfree"
13-
compileSdk = 34
14-
ndkVersion = flutter.ndkVersion
13+
compileSdk = 36
14+
ndkVersion = "27.0.12077973"
1515

1616
compileOptions {
1717
isCoreLibraryDesugaringEnabled = true
@@ -29,7 +29,7 @@ android {
2929
// You can update the following values to match your application needs.
3030
// For more information, see: https://flutter.dev/to/review-gradle-config.
3131
minSdk = flutter.minSdkVersion
32-
targetSdk = 34
32+
targetSdk = 36
3333
versionCode = flutter.versionCode
3434
versionName = flutter.versionName
3535
}

android/app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# ProGuard rules for printing package and lStar attribute
2+
-keep class * extends android.content.res.Resources
3+
-keep class android.content.res.Resources$Theme { *; }
4+
-keep class android.util.AttributeSet { *; }
5+
-keep class android.util.TypedValue { *; }
6+
7+
# Keep all printing related classes
8+
-keep class net.nfet.flutter.printing.** { *; }
9+
10+
# Keep all Android material components
11+
-keep class com.google.android.material.** { *; }
12+
13+
# Disable attribute optimizations that may cause issues with lStar
14+
-optimizations !field/removal/writeonly,!field/marking/private,!class/merging/*,!code/allocation/variable
15+
16+
# Keep all attributes
17+
-keepattributes *

lib/screens/settings/ble_logs_screen.dart

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ import 'package:breathe_free/theme/app_theme.dart';
22
import 'package:flutter/material.dart';
33
import 'package:pdf/pdf.dart';
44
import 'package:pdf/widgets.dart' as pw;
5-
import 'package:printing/printing.dart';
5+
import 'package:share_plus/share_plus.dart';
6+
import 'package:path_provider/path_provider.dart';
7+
import 'dart:io';
68
import 'package:intl/intl.dart';
79
import '../../services/ble_logs_service.dart';
810
import '../../models/ble_log_entry.dart';
@@ -132,25 +134,35 @@ class _BleLogsScreenState extends State<BleLogsScreen> {
132134
);
133135
}
134136

135-
// Show print/share dialog
136-
await Printing.layoutPdf(
137-
onLayout: (format) async => pdf.save(),
138-
name:
139-
'SmartQuit_BLE_Logs_${DateFormat('yyyyMMdd_HHmmss').format(DateTime.now())}.pdf',
140-
);
141-
} catch (e) {
142-
if (mounted) {
143-
ScaffoldMessenger.of(context).showSnackBar(
144-
SnackBar(
145-
content: Text('Error generating PDF: $e'),
146-
backgroundColor: AppColors.error,
147-
),
137+
// Save PDF to temporary directory and share
138+
try {
139+
final bytes = await pdf.save();
140+
final dir = await getTemporaryDirectory();
141+
final fileName = 'SmartQuit_BLE_Logs_${DateFormat('yyyyMMdd_HHmmss').format(DateTime.now())}.pdf';
142+
final file = File('${dir.path}/$fileName');
143+
await file.writeAsBytes(bytes);
144+
145+
// Share the PDF file
146+
await Share.shareXFiles(
147+
[XFile(file.path)],
148+
text: 'SmartQuit BLE Logs Export',
149+
subject: fileName,
148150
);
151+
} catch (e) {
152+
if (mounted) {
153+
ScaffoldMessenger.of(context).showSnackBar(
154+
SnackBar(
155+
content: Text('Error sharing PDF: $e'),
156+
backgroundColor: AppColors.error,
157+
),
158+
);
159+
}
149160
}
150-
} finally {
151161
if (mounted) {
152162
setState(() => _isLoading = false);
153163
}
164+
}catch(e){
165+
print('Error generating PDF: $e');
154166
}
155167
}
156168

linux/flutter/generated_plugin_registrant.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@
77
#include "generated_plugin_registrant.h"
88

99
#include <audioplayers_linux/audioplayers_linux_plugin.h>
10-
#include <printing/printing_plugin.h>
10+
#include <url_launcher_linux/url_launcher_plugin.h>
1111

1212
void fl_register_plugins(FlPluginRegistry* registry) {
1313
g_autoptr(FlPluginRegistrar) audioplayers_linux_registrar =
1414
fl_plugin_registry_get_registrar_for_plugin(registry, "AudioplayersLinuxPlugin");
1515
audioplayers_linux_plugin_register_with_registrar(audioplayers_linux_registrar);
16-
g_autoptr(FlPluginRegistrar) printing_registrar =
17-
fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin");
18-
printing_plugin_register_with_registrar(printing_registrar);
16+
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
17+
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
18+
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
1919
}

linux/flutter/generated_plugins.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
list(APPEND FLUTTER_PLUGIN_LIST
66
audioplayers_linux
7-
printing
7+
url_launcher_linux
88
)
99

1010
list(APPEND FLUTTER_FFI_PLUGIN_LIST

macos/Flutter/GeneratedPluginRegistrant.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import firebase_messaging
1414
import flutter_blue_plus_darwin
1515
import google_sign_in_ios
1616
import path_provider_foundation
17-
import printing
17+
import share_plus
1818
import shared_preferences_foundation
1919

2020
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
@@ -27,6 +27,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
2727
FlutterBluePlusPlugin.register(with: registry.registrar(forPlugin: "FlutterBluePlusPlugin"))
2828
FLTGoogleSignInPlugin.register(with: registry.registrar(forPlugin: "FLTGoogleSignInPlugin"))
2929
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
30-
PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin"))
30+
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))
3131
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
3232
}

pubspec.lock

Lines changed: 70 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,14 @@ packages:
297297
url: "https://pub.dev"
298298
source: hosted
299299
version: "3.1.2"
300+
cross_file:
301+
dependency: transitive
302+
description:
303+
name: cross_file
304+
sha256: "28bb3ae56f117b5aec029d702a90f57d285cd975c3c5c281eaca38dbc47c5937"
305+
url: "https://pub.dev"
306+
source: hosted
307+
version: "0.3.5+2"
300308
crypto:
301309
dependency: transitive
302310
description:
@@ -748,10 +756,10 @@ packages:
748756
dependency: transitive
749757
description:
750758
name: js
751-
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
759+
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
752760
url: "https://pub.dev"
753761
source: hosted
754-
version: "0.7.2"
762+
version: "0.6.7"
755763
json_annotation:
756764
dependency: transitive
757765
description:
@@ -844,10 +852,10 @@ packages:
844852
dependency: transitive
845853
description:
846854
name: mime
847-
sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6"
855+
sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a"
848856
url: "https://pub.dev"
849857
source: hosted
850-
version: "2.0.0"
858+
version: "1.0.6"
851859
package_config:
852860
dependency: transitive
853861
description:
@@ -928,14 +936,6 @@ packages:
928936
url: "https://pub.dev"
929937
source: hosted
930938
version: "3.11.3"
931-
pdf_widget_wrapper:
932-
dependency: transitive
933-
description:
934-
name: pdf_widget_wrapper
935-
sha256: c930860d987213a3d58c7ec3b7ecf8085c3897f773e8dc23da9cae60a5d6d0f5
936-
url: "https://pub.dev"
937-
source: hosted
938-
version: "1.0.4"
939939
percent_indicator:
940940
dependency: "direct main"
941941
description:
@@ -996,10 +996,10 @@ packages:
996996
dependency: transitive
997997
description:
998998
name: petitparser
999-
sha256: "1a97266a94f7350d30ae522c0af07890c70b8e62c71e8e3920d1db4d23c057d1"
999+
sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675"
10001000
url: "https://pub.dev"
10011001
source: hosted
1002-
version: "7.0.1"
1002+
version: "7.0.2"
10031003
platform:
10041004
dependency: transitive
10051005
description:
@@ -1032,14 +1032,6 @@ packages:
10321032
url: "https://pub.dev"
10331033
source: hosted
10341034
version: "6.0.3"
1035-
printing:
1036-
dependency: "direct main"
1037-
description:
1038-
name: printing
1039-
sha256: cc4b256a5a89d5345488e3318897b595867f5181b8c5ed6fc63bfa5f2044aec3
1040-
url: "https://pub.dev"
1041-
source: hosted
1042-
version: "5.13.1"
10431035
pub_semver:
10441036
dependency: transitive
10451037
description:
@@ -1112,6 +1104,22 @@ packages:
11121104
url: "https://pub.dev"
11131105
source: hosted
11141106
version: "0.28.0"
1107+
share_plus:
1108+
dependency: "direct main"
1109+
description:
1110+
name: share_plus
1111+
sha256: "3ef39599b00059db0990ca2e30fca0a29d8b37aae924d60063f8e0184cf20900"
1112+
url: "https://pub.dev"
1113+
source: hosted
1114+
version: "7.2.2"
1115+
share_plus_platform_interface:
1116+
dependency: transitive
1117+
description:
1118+
name: share_plus_platform_interface
1119+
sha256: "251eb156a8b5fa9ce033747d73535bf53911071f8d3b6f4f0b578505ce0d4496"
1120+
url: "https://pub.dev"
1121+
source: hosted
1122+
version: "3.4.0"
11151123
shared_preferences:
11161124
dependency: "direct main"
11171125
description:
@@ -1285,6 +1293,38 @@ packages:
12851293
url: "https://pub.dev"
12861294
source: hosted
12871295
version: "1.4.0"
1296+
url_launcher_linux:
1297+
dependency: transitive
1298+
description:
1299+
name: url_launcher_linux
1300+
sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a
1301+
url: "https://pub.dev"
1302+
source: hosted
1303+
version: "3.2.2"
1304+
url_launcher_platform_interface:
1305+
dependency: transitive
1306+
description:
1307+
name: url_launcher_platform_interface
1308+
sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029"
1309+
url: "https://pub.dev"
1310+
source: hosted
1311+
version: "2.3.2"
1312+
url_launcher_web:
1313+
dependency: transitive
1314+
description:
1315+
name: url_launcher_web
1316+
sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"
1317+
url: "https://pub.dev"
1318+
source: hosted
1319+
version: "2.4.1"
1320+
url_launcher_windows:
1321+
dependency: transitive
1322+
description:
1323+
name: url_launcher_windows
1324+
sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f"
1325+
url: "https://pub.dev"
1326+
source: hosted
1327+
version: "3.1.5"
12881328
uuid:
12891329
dependency: "direct main"
12901330
description:
@@ -1365,6 +1405,14 @@ packages:
13651405
url: "https://pub.dev"
13661406
source: hosted
13671407
version: "3.0.3"
1408+
win32:
1409+
dependency: transitive
1410+
description:
1411+
name: win32
1412+
sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e
1413+
url: "https://pub.dev"
1414+
source: hosted
1415+
version: "5.15.0"
13681416
xdg_directories:
13691417
dependency: transitive
13701418
description:

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ dependencies:
4040
flutter_blue_plus: ^1.32.12
4141
permission_handler: ^11.3.0
4242
pdf: ^3.10.7
43-
printing: ^5.12.0
43+
share_plus: ^7.2.1
4444

4545
# Icons
4646
cupertino_icons: ^1.0.6

windows/flutter/generated_plugin_registrant.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#include <firebase_auth/firebase_auth_plugin_c_api.h>
1212
#include <firebase_core/firebase_core_plugin_c_api.h>
1313
#include <permission_handler_windows/permission_handler_windows_plugin.h>
14-
#include <printing/printing_plugin.h>
14+
#include <share_plus/share_plus_windows_plugin_c_api.h>
15+
#include <url_launcher_windows/url_launcher_windows.h>
1516

1617
void RegisterPlugins(flutter::PluginRegistry* registry) {
1718
AudioplayersWindowsPluginRegisterWithRegistrar(
@@ -24,6 +25,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
2425
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
2526
PermissionHandlerWindowsPluginRegisterWithRegistrar(
2627
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
27-
PrintingPluginRegisterWithRegistrar(
28-
registry->GetRegistrarForPlugin("PrintingPlugin"));
28+
SharePlusWindowsPluginCApiRegisterWithRegistrar(
29+
registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi"));
30+
UrlLauncherWindowsRegisterWithRegistrar(
31+
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
2932
}

windows/flutter/generated_plugins.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ list(APPEND FLUTTER_PLUGIN_LIST
88
firebase_auth
99
firebase_core
1010
permission_handler_windows
11-
printing
11+
share_plus
12+
url_launcher_windows
1213
)
1314

1415
list(APPEND FLUTTER_FFI_PLUGIN_LIST

0 commit comments

Comments
 (0)