diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 9a0f74f..eb35b2a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -62,6 +62,8 @@ PODS: - SwiftyGif (5.4.5) - uri_content (0.0.1): - Flutter + - url_launcher_ios (0.0.1): + - Flutter DEPENDENCIES: - accessing_security_scoped_resource (from `.symlinks/plugins/accessing_security_scoped_resource/darwin`) @@ -77,6 +79,7 @@ DEPENDENCIES: - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - super_native_extensions (from `.symlinks/plugins/super_native_extensions/ios`) - uri_content (from `.symlinks/plugins/uri_content/ios`) + - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) SPEC REPOS: trunk: @@ -112,6 +115,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/super_native_extensions/ios" uri_content: :path: ".symlinks/plugins/uri_content/ios" + url_launcher_ios: + :path: ".symlinks/plugins/url_launcher_ios/ios" SPEC CHECKSUMS: accessing_security_scoped_resource: 4a87897646efbc3a4578e28ea4c08083d7bf3e67 @@ -131,6 +136,7 @@ SPEC CHECKSUMS: super_native_extensions: b763c02dc3a8fd078389f410bf15149179020cb4 SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 uri_content: 70a99850f89322ef5eca2e69451ee38221b917ec + url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b PODFILE CHECKSUM: 3c63482e143d1b91d2d2560aee9fb04ecc74ac7e diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index bd4074e..dc23077 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -66,5 +66,7 @@ ITSAppUsesNonExemptEncryption + NSLocalNetworkUsageDescription + To send files app needs to find devices in your network. diff --git a/ios/Runner/Runner.entitlements b/ios/Runner/Runner.entitlements index 08405e2..1ff8512 100644 --- a/ios/Runner/Runner.entitlements +++ b/ios/Runner/Runner.entitlements @@ -2,6 +2,8 @@ + com.apple.developer.networking.multicast + com.apple.security.application-groups group.jett diff --git a/lib/main.dart b/lib/main.dart index b33f7d6..9774b36 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,23 +1,28 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:forui/forui.dart'; import 'package:go_router/go_router.dart'; import 'package:jett/discovery/konst.dart'; import 'package:jett/platform/platform_api.dart'; +import 'package:jett/screen/about_screen.dart'; import 'package:jett/screen/apk_picker_screen.dart'; import 'package:jett/screen/home_screen.dart'; import 'package:jett/screen/transfer_screen.dart'; import 'package:jett/utils/device_info.dart'; import 'package:jett/utils/package_info.dart'; -import 'package:flutter/material.dart'; -import 'package:forui/forui.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); - PlatformApi.instance.init(); await Future.wait([PackageInfoHelper.init(), DeviceInfoHelper.init()]); - PlatformApi.instance.getPlatformVersion().then((value) { - debugPrint('Running on: ${value.string}'); - }); + if (Platform.isAndroid || Platform.isIOS) { + PlatformApi.instance.init(); + PlatformApi.instance.getPlatformVersion().then((value) { + debugPrint('Running on: ${value.string}'); + }); + } runApp(const MyApp()); } @@ -47,14 +52,13 @@ final _router = GoRouter( GoRoute(path: '/', builder: (context, state) => HomeScreen()), GoRoute( path: '/send', - builder: (context, state) => - TransferScreen(transferType: TransferType.send), + builder: (_, _) => TransferScreen(transferType: TransferType.send), ), GoRoute( path: '/receive', - builder: (context, state) => - TransferScreen(transferType: TransferType.receive), + builder: (_, _) => TransferScreen(transferType: TransferType.receive), ), - GoRoute(path: '/pick_apk', builder: (context, state) => ApkPickerScreen()), + GoRoute(path: '/pick_apk', builder: (_, _) => ApkPickerScreen()), + GoRoute(path: '/about', builder: (_, _) => AboutScreen()), ], ); diff --git a/lib/platform/platform_api.dart b/lib/platform/platform_api.dart index 5879884..5086ee0 100644 --- a/lib/platform/platform_api.dart +++ b/lib/platform/platform_api.dart @@ -19,6 +19,7 @@ class PlatformApi { _getAPKs(); } + /// Mobile only API Future getPlatformVersion() { return _hostApi.getPlatformVersion(); } diff --git a/lib/screen/about_screen.dart b/lib/screen/about_screen.dart new file mode 100644 index 0000000..c1d8e7c --- /dev/null +++ b/lib/screen/about_screen.dart @@ -0,0 +1,45 @@ +import 'package:flutter/material.dart'; +import 'package:forui/forui.dart'; +import 'package:jett/utils/package_info.dart'; +import 'package:url_launcher/url_launcher_string.dart'; + +class AboutScreen extends StatelessWidget { + const AboutScreen({super.key}); + + @override + Widget build(BuildContext context) { + return FScaffold( + header: FHeader.nested( + prefixes: [ + FHeaderAction.x( + onPress: () { + Navigator.of(context).pop(); + }, + ), + ], + title: Text('About'), + ), + child: Column( + children: [ + FTileGroup( + children: [ + FTile( + prefix: Icon(FIcons.code), + title: Text('Source code'), + subtitle: Text('GitHub '), + onPress: () { + launchUrlString("https://github.com/2shrestha22/jett"); + }, + ), + FTile( + prefix: Icon(FIcons.tag), + title: Text('Version'), + subtitle: Text(PackageInfoHelper.version), + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/screen/home_screen.dart b/lib/screen/home_screen.dart index a17b24f..03c7db6 100644 --- a/lib/screen/home_screen.dart +++ b/lib/screen/home_screen.dart @@ -1,6 +1,9 @@ import 'dart:async'; import 'dart:developer'; +import 'package:flutter/material.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; +import 'package:forui/forui.dart'; import 'package:go_router/go_router.dart'; import 'package:jett/discovery/konst.dart'; import 'package:jett/discovery/presence.dart'; @@ -9,7 +12,6 @@ import 'package:jett/model/message.dart'; import 'package:jett/model/resource.dart'; import 'package:jett/model/transfer_status.dart'; import 'package:jett/screen/send/online_devices.dart'; -import 'package:jett/widgets/picker_buttons.dart'; import 'package:jett/screen/send/presence_notifier.dart'; import 'package:jett/transfer/client.dart'; import 'package:jett/transfer/server.dart'; @@ -17,11 +19,10 @@ import 'package:jett/utils/io.dart'; import 'package:jett/utils/network.dart'; import 'package:jett/widgets/drop_region.dart'; import 'package:jett/widgets/file_view.dart'; +import 'package:jett/widgets/picker_buttons.dart'; import 'package:jett/widgets/presence_view.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; -import 'package:forui/forui.dart'; import 'package:jett/widgets/safe_area.dart'; +import 'package:lucide_icons_flutter/lucide_icons.dart'; import '../platform/platform_api.dart'; @@ -175,7 +176,17 @@ class _HomeScreenState extends State with WidgetsBindingObserver { @override Widget build(BuildContext context) { return FScaffold( - header: FHeader(title: Text(appName)), + header: FHeader( + title: Text(appName), + suffixes: [ + IconButton( + onPressed: () { + context.push('/about'); + }, + icon: Icon(LucideIcons.info), + ), + ], + ), child: FSafeArea( child: (resources.isEmpty) ? _fileEmptyView() : _fileSelectedView(), ), diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index 6044e65..720a90e 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -10,6 +10,7 @@ #include #include #include +#include void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) file_selector_linux_registrar = @@ -24,4 +25,7 @@ void fl_register_plugins(FlPluginRegistry* registry) { g_autoptr(FlPluginRegistrar) uri_content_registrar = fl_plugin_registry_get_registrar_for_plugin(registry, "UriContentPlugin"); uri_content_plugin_register_with_registrar(uri_content_registrar); + g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin"); + url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 87e0646..de8bd5e 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST irondash_engine_context super_native_extensions uri_content + url_launcher_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 572dda1..c9c4a21 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -16,6 +16,7 @@ import package_info_plus import path_provider_foundation import super_native_extensions import uri_content +import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { AccessingSecurityScopedResourcePlugin.register(with: registry.registrar(forPlugin: "AccessingSecurityScopedResourcePlugin")) @@ -29,4 +30,5 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) SuperNativeExtensionsPlugin.register(with: registry.registrar(forPlugin: "SuperNativeExtensionsPlugin")) UriContentPlugin.register(with: registry.registrar(forPlugin: "UriContentPlugin")) + UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 9bbbecf..022ec0e 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -24,6 +24,8 @@ PODS: - FlutterMacOS - uri_content (0.0.1): - FlutterMacOS + - url_launcher_macos (0.0.1): + - FlutterMacOS DEPENDENCIES: - accessing_security_scoped_resource (from `Flutter/ephemeral/.symlinks/plugins/accessing_security_scoped_resource/darwin`) @@ -38,6 +40,7 @@ DEPENDENCIES: - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - super_native_extensions (from `Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos`) - uri_content (from `Flutter/ephemeral/.symlinks/plugins/uri_content/macos`) + - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) EXTERNAL SOURCES: accessing_security_scoped_resource: @@ -64,6 +67,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/super_native_extensions/macos uri_content: :path: Flutter/ephemeral/.symlinks/plugins/uri_content/macos + url_launcher_macos: + :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos SPEC CHECKSUMS: accessing_security_scoped_resource: 4a87897646efbc3a4578e28ea4c08083d7bf3e67 @@ -78,6 +83,7 @@ SPEC CHECKSUMS: path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564 super_native_extensions: c2795d6d9aedf4a79fae25cb6160b71b50549189 uri_content: 6c7c098bcc83078659b4d274f42db92691eb9123 + url_launcher_macos: f87a979182d112f911de6820aefddaf56ee9fbfd PODFILE CHECKSUM: 54d867c82ac51cbd61b565781b9fada492027009 diff --git a/pubspec.lock b/pubspec.lock index 161141a..38d5359 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1058,6 +1058,70 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.1" + url_launcher: + dependency: "direct main" + description: + name: url_launcher + sha256: f6a7e5c4835bb4e3026a04793a4199ca2d14c739ec378fdfe23fc8075d0439f8 + url: "https://pub.dev" + source: hosted + version: "6.3.2" + url_launcher_android: + dependency: transitive + description: + name: url_launcher_android + sha256: "5c8b6c2d89a78f5a1cca70a73d9d5f86c701b36b42f9c9dac7bad592113c28e9" + url: "https://pub.dev" + source: hosted + version: "6.3.24" + url_launcher_ios: + dependency: transitive + description: + name: url_launcher_ios + sha256: "6b63f1441e4f653ae799166a72b50b1767321ecc263a57aadf825a7a2a5477d9" + url: "https://pub.dev" + source: hosted + version: "6.3.5" + url_launcher_linux: + dependency: transitive + description: + name: url_launcher_linux + sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + url_launcher_macos: + dependency: transitive + description: + name: url_launcher_macos + sha256: "8262208506252a3ed4ff5c0dc1e973d2c0e0ef337d0a074d35634da5d44397c9" + url: "https://pub.dev" + source: hosted + version: "3.2.4" + url_launcher_platform_interface: + dependency: transitive + description: + name: url_launcher_platform_interface + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + url_launcher_web: + dependency: transitive + description: + name: url_launcher_web + sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2" + url: "https://pub.dev" + source: hosted + version: "2.4.1" + url_launcher_windows: + dependency: transitive + description: + name: url_launcher_windows + sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77" + url: "https://pub.dev" + source: hosted + version: "3.1.4" uuid: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index efd27e9..3f8ed5d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 1.0.0+2 +version: 1.0.1+3 environment: sdk: ^3.8.1 flutter: 3.35.6 @@ -54,6 +54,7 @@ dependencies: flutter_hooks: ^0.21.3+1 super_drag_and_drop: ^0.9.1 go_router: ^16.2.4 + url_launcher: ^6.3.2 dev_dependencies: flutter_test: sdk: flutter diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 0e45367..d396b4c 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -10,6 +10,7 @@ #include #include #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { FileSelectorWindowsRegisterWithRegistrar( @@ -20,4 +21,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi")); UriContentPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("UriContentPluginCApi")); + UrlLauncherWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("UrlLauncherWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 63f418a..b79f835 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST irondash_engine_context super_native_extensions uri_content + url_launcher_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST