diff --git a/.gitignore b/.gitignore index be82281..5faa5b3 100644 --- a/.gitignore +++ b/.gitignore @@ -46,4 +46,12 @@ app.*.map.json /android/app/release # Environment Variables -*.env \ No newline at end of file +*.env + +# Coverage Report +coverage/lcov.info + +# Secret Files +odin-release-key.keystore +android/app/google-services.json +android/app/build/* \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index 56cb953..dd44d58 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -23,10 +23,11 @@ if (flutterVersionName == null) { apply plugin: 'com.android.application' apply plugin: 'kotlin-android' +apply plugin: 'com.google.gms.google-services' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 30 + compileSdkVersion 31 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -43,8 +44,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.odin" - minSdkVersion 16 + applicationId "com.odin.odin" + minSdkVersion 19 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() versionName flutterVersionName @@ -65,4 +66,6 @@ flutter { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + implementation platform('com.google.firebase:firebase-bom:29.0.0') + implementation 'com.google.firebase:firebase-analytics-ktx' } diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index a242ca4..c91a0b3 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,7 +1,9 @@ + package="com.odin.odin"> - - + + + + \ No newline at end of file diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index e44b319..6d044f4 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,43 +1,64 @@ - - - - - - - - - - - - - - - - - + + + + + + + \ No newline at end of file diff --git a/android/app/src/main/kotlin/com/example/odin/MainActivity.kt b/android/app/src/main/kotlin/com/odin/odin/MainActivity.kt similarity index 79% rename from android/app/src/main/kotlin/com/example/odin/MainActivity.kt rename to android/app/src/main/kotlin/com/odin/odin/MainActivity.kt index e113e89..29e5583 100644 --- a/android/app/src/main/kotlin/com/example/odin/MainActivity.kt +++ b/android/app/src/main/kotlin/com/odin/odin/MainActivity.kt @@ -1,4 +1,4 @@ -package com.example.odin +package com.odin.odin import io.flutter.embedding.android.FlutterActivity diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index a242ca4..ec57716 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.odin.odin"> diff --git a/android/build.gradle b/android/build.gradle index ed45c65..2ec5821 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.3.50' + ext.kotlin_version = '1.4.32' repositories { google() mavenCentral() @@ -8,6 +8,7 @@ buildscript { dependencies { classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath 'com.google.gms:google-services:4.3.10' } } diff --git a/ios/Podfile.lock b/ios/Podfile.lock new file mode 100644 index 0000000..766c39d --- /dev/null +++ b/ios/Podfile.lock @@ -0,0 +1,97 @@ +PODS: + - DKImagePickerController/Core (4.3.2): + - DKImagePickerController/ImageDataManager + - DKImagePickerController/Resource + - DKImagePickerController/ImageDataManager (4.3.2) + - DKImagePickerController/PhotoGallery (4.3.2): + - DKImagePickerController/Core + - DKPhotoGallery + - DKImagePickerController/Resource (4.3.2) + - DKPhotoGallery (0.0.17): + - DKPhotoGallery/Core (= 0.0.17) + - DKPhotoGallery/Model (= 0.0.17) + - DKPhotoGallery/Preview (= 0.0.17) + - DKPhotoGallery/Resource (= 0.0.17) + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Core (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Preview + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Model (0.0.17): + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Preview (0.0.17): + - DKPhotoGallery/Model + - DKPhotoGallery/Resource + - SDWebImage + - SwiftyGif + - DKPhotoGallery/Resource (0.0.17): + - SDWebImage + - SwiftyGif + - file_picker (0.0.1): + - DKImagePickerController/PhotoGallery + - Flutter + - Flutter (1.0.0) + - fluttertoast (0.0.2): + - Flutter + - Toast + - path_provider_ios (0.0.1): + - Flutter + - SDWebImage (5.12.1): + - SDWebImage/Core (= 5.12.1) + - SDWebImage/Core (5.12.1) + - shared_preferences (0.0.1): + - Flutter + - SwiftyGif (5.4.0) + - Toast (4.0.0) + - url_launcher (0.0.1): + - Flutter + +DEPENDENCIES: + - file_picker (from `.symlinks/plugins/file_picker/ios`) + - Flutter (from `Flutter`) + - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) + - path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`) + - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) + - url_launcher (from `.symlinks/plugins/url_launcher/ios`) + +SPEC REPOS: + trunk: + - DKImagePickerController + - DKPhotoGallery + - SDWebImage + - SwiftyGif + - Toast + +EXTERNAL SOURCES: + file_picker: + :path: ".symlinks/plugins/file_picker/ios" + Flutter: + :path: Flutter + fluttertoast: + :path: ".symlinks/plugins/fluttertoast/ios" + path_provider_ios: + :path: ".symlinks/plugins/path_provider_ios/ios" + shared_preferences: + :path: ".symlinks/plugins/shared_preferences/ios" + url_launcher: + :path: ".symlinks/plugins/url_launcher/ios" + +SPEC CHECKSUMS: + DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d + DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 + file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 + Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58 + path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5 + SDWebImage: 4dc3e42d9ec0c1028b960a33ac6b637bb432207b + shared_preferences: 5033afbb22d372e15aff8ff766df9021b845f273 + SwiftyGif: 5d4af95df24caf1c570dbbcb32a3b8a0763bc6d7 + Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 + url_launcher: b6e016d912f04be9f5bf6e8e82dc599b7ba59649 + +PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c + +COCOAPODS: 1.10.2 diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index d839b23..55b5035 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -10,6 +10,7 @@ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; + 79DF600E59FE316592D4D2EA /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B1C0BA13701FEF4705D0592 /* Pods_Runner.framework */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; @@ -29,12 +30,16 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 0421B36D6A4BB73AE139E805 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 05FAA6C9911FF316DC32C1AF /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 4B1C0BA13701FEF4705D0592 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 86D76059EEF7402A65462524 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -49,12 +54,32 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 79DF600E59FE316592D4D2EA /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 4A06798E3698482BCB9FA510 /* Pods */ = { + isa = PBXGroup; + children = ( + 05FAA6C9911FF316DC32C1AF /* Pods-Runner.debug.xcconfig */, + 0421B36D6A4BB73AE139E805 /* Pods-Runner.release.xcconfig */, + 86D76059EEF7402A65462524 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; + 6CEF878642B00B899E8F72A7 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 4B1C0BA13701FEF4705D0592 /* Pods_Runner.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( @@ -72,6 +97,8 @@ 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, + 4A06798E3698482BCB9FA510 /* Pods */, + 6CEF878642B00B899E8F72A7 /* Frameworks */, ); sourceTree = ""; }; @@ -105,12 +132,14 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + 54CBB8B844CDA4D94EC33CED /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + DA012354BFB7D40C2D413CB2 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -183,6 +212,28 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; + 54CBB8B844CDA4D94EC33CED /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -197,6 +248,23 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; + DA012354BFB7D40C2D413CB2 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -291,7 +359,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.odin; + PRODUCT_BUNDLE_IDENTIFIER = com.odin.odin; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -415,7 +483,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.odin; + PRODUCT_BUNDLE_IDENTIFIER = com.odin.odin; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -434,7 +502,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.odin; + PRODUCT_BUNDLE_IDENTIFIER = com.odin.odin; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -468,4 +536,4 @@ /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; -} \ No newline at end of file +} diff --git a/ios/Runner.xcworkspace/contents.xcworkspacedata b/ios/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/ios/Runner.xcworkspace/contents.xcworkspacedata +++ b/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/lib/main.dart b/lib/main.dart index 4247899..d02bc03 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'dart:async'; import 'dart:io'; import 'package:bitsdojo_window/bitsdojo_window.dart'; +import 'package:firebase_dynamic_links/firebase_dynamic_links.dart'; import 'package:flutter/material.dart'; import 'package:flutter_dotenv/flutter_dotenv.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -10,7 +11,10 @@ import 'package:odin/pages/home_page.dart'; import 'package:odin/providers/file_notifier.dart'; import 'package:odin/services/locator.dart'; import 'package:odin/services/logger.dart'; +import 'package:odin/services/toast_service.dart'; +import 'package:open_file/open_file.dart'; import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; void main() async { if (Platform.environment.containsKey('FLUTTER_TEST')) { @@ -45,9 +49,68 @@ void main() async { } } -class MyApp extends StatelessWidget { +class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); + @override + State createState() => _MyAppState(); +} + +class _MyAppState extends State { + void initDynamicLinks() async { + final _toast = locator(); + final _fileNotifier = context.read(); + FirebaseDynamicLinks.instance.onLink( + onSuccess: (PendingDynamicLinkData? dynamicLink) async { + final Uri? deepLink = dynamicLink?.link; + if (deepLink != null) { + if (deepLink.pathSegments.isNotEmpty) { + if (deepLink.pathSegments[0] == "files") { + logger.i(deepLink.pathSegments.last); + final String token = deepLink.pathSegments.last; + final _filePath = + await _fileNotifier.getFileFromToken(token.trim()); + if (Platform.isWindows || Platform.isMacOS) { + launch(_filePath); + } else { + _toast.showMobileToast("Files saved in Downloads."); + await OpenFile.open(_filePath); + } + } + } + } + }, onError: (OnLinkErrorException e) async { + logger.e(e.message, e); + }); + final PendingDynamicLinkData? data = + await FirebaseDynamicLinks.instance.getInitialLink(); + final Uri? deepLink = data?.link; + + if (deepLink != null) { + if (deepLink.pathSegments.isNotEmpty) { + if (deepLink.pathSegments[0] == "files") { + logger.i(deepLink.pathSegments.last); + final String token = deepLink.pathSegments.last; + final _filePath = await _fileNotifier.getFileFromToken(token.trim()); + if (Platform.isWindows || Platform.isMacOS) { + launch(_filePath); + } else { + _toast.showMobileToast("Files saved in Downloads."); + await OpenFile.open(_filePath); + } + } + } + } + } + + @override + void initState() { + super.initState(); + if (Platform.isAndroid || Platform.isIOS) { + initDynamicLinks(); + } + } + @override Widget build(BuildContext context) { return MaterialApp( diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index be59a65..a5d3958 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -13,10 +13,14 @@ import 'package:odin/painters/tooltip_painter.dart'; import 'package:odin/providers/file_notifier.dart'; import 'package:odin/services/locator.dart'; import 'package:odin/services/preferences_service.dart'; +import 'package:odin/services/shortener_service.dart'; import 'package:odin/services/toast_service.dart'; +import 'package:odin/widgets/mac_top_bar.dart'; import 'package:odin/widgets/window_top_bar.dart'; +import 'package:open_file/open_file.dart'; import 'package:provider/provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; +import 'package:url_launcher/url_launcher.dart'; const backgroundStartColor = Color(0xFF7D5DEC); const backgroundEndColor = Color(0xFF6148B9); @@ -41,7 +45,7 @@ class _HomePageState extends State bool _qrVisible = false; final _toast = locator(); final PreferencesService _preferencesService = locator(); - + final TextEditingController _tokenController = TextEditingController(); @override void initState() { _preferencesService.init(); @@ -72,6 +76,7 @@ class _HomePageState extends State @override Widget build(BuildContext context) { final _fileNotifier = context.watch(); + final _shortenerService = locator(); return Scaffold( backgroundColor: const Color(0xFF7D5DEC), body: Container( @@ -161,7 +166,7 @@ class _HomePageState extends State : MediaQuery.of(context).size.width / 1.7), width: _fileNotifier.processing ? 160 - : _fileNotifier.loading + : _fileNotifier.uploading || _fileNotifier.downloading ? 160 : 220, height: 55, @@ -174,11 +179,13 @@ class _HomePageState extends State child: Text( _fileNotifier.processing ? "Processing." - : _fileNotifier.loading + : _fileNotifier.uploading ? "Uploading." - : (Platform.isWindows || Platform.isMacOS) - ? 'Drop files to start.' - : 'Tap to share files.', + : _fileNotifier.downloading + ? "Downloading." + : (Platform.isWindows || Platform.isMacOS) + ? 'Drop files to start.' + : 'Tap to share files.', textAlign: TextAlign.center, style: GoogleFonts.poppins( fontSize: 16, @@ -219,7 +226,8 @@ class _HomePageState extends State mainAxisAlignment: MainAxisAlignment.start, children: [ const Spacer(flex: 9), - if (_fileNotifier.loading) + if (_fileNotifier.uploading || + _fileNotifier.downloading) if (_fileNotifier.zipfileName == '') Padding( padding: const EdgeInsets.only(bottom: 24.0), @@ -344,13 +352,20 @@ class _HomePageState extends State mainAxisSize: MainAxisSize.min, children: [ InkWell( - onTap: () => FlutterClipboard.copy( - _fileNotifier.fileLink ?? '') + onTap: () => FlutterClipboard.copy(_fileNotifier + .fileLink != + null + ? Platform.isAndroid || Platform.isIOS + ? "Some files were shared with you.\nTo access them, visit ${_fileNotifier.fileLink} from your mobile device. To access them on your PC, download Odin from https://shrtco.de/odin and enter this unique token - ${_shortenerService.token}" + : "Some files were shared with you.\nTo access them, download Odin from https://shrtco.de/odin and enter this unique token - ${_fileNotifier.fileLink}" + : '') .then((value) => _toast.showToast( Platform.isIOS || Platform.isMacOS ? CupertinoIcons.check_mark : Icons.check, - "Link copied to clipboard.")), + Platform.isIOS || Platform.isAndroid + ? "Link copied to clipboard." + : "Token copied to clipboard.")), child: Container( decoration: BoxDecoration( color: Colors.white12, @@ -433,10 +448,124 @@ class _HomePageState extends State ), ], ), + if (!_fileNotifier.processing && + !_fileNotifier.uploading && + !_fileNotifier.downloading && + _fileNotifier.fileLink == null) + Text( + "or", + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w200, + letterSpacing: 0.5, + color: Colors.white.withOpacity(0.5), + ), + ), + if (!_fileNotifier.processing && + !_fileNotifier.uploading && + !_fileNotifier.downloading && + _fileNotifier.fileLink == null) + Row( + mainAxisSize: MainAxisSize.min, + children: [ + Container( + decoration: BoxDecoration( + color: Colors.white12, + borderRadius: BorderRadius.circular(6), + border: Border.all( + color: Colors.white.withOpacity(0.05), + width: 0.5, + ), + ), + padding: + const EdgeInsets.fromLTRB(16, 0, 16, 0), + margin: + const EdgeInsets.fromLTRB(16, 16, 8, 16), + child: SizedBox( + width: (Platform.isWindows || + Platform.isMacOS) + ? MediaQuery.of(context).size.width * 0.2 + : MediaQuery.of(context).size.width * 0.4, + height: 44, + child: TextField( + controller: _tokenController, + style: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w300, + letterSpacing: 0.5, + color: Colors.white.withOpacity(0.8), + ), + decoration: InputDecoration( + hintText: "Enter unique file token", + hintStyle: GoogleFonts.poppins( + fontSize: 12, + fontWeight: FontWeight.w200, + letterSpacing: 0.5, + color: Colors.white.withOpacity(0.7), + ), + border: InputBorder.none, + ), + ), + ), + ), + InkWell( + onTap: _tokenController.text.isNotEmpty && + _tokenController.text.length > 16 + ? () async { + final _filePath = await _fileNotifier + .getFileFromToken( + _tokenController.text.trim()); + _tokenController.clear(); + if (Platform.isWindows || + Platform.isMacOS) { + launch(_filePath); + } else { + _toast.showMobileToast( + "Files saved in Downloads."); + await OpenFile.open(_filePath); + } + } + : null, + child: Container( + decoration: BoxDecoration( + color: Colors.white12, + borderRadius: BorderRadius.circular(6), + border: Border.all( + color: Colors.white.withOpacity(0.05), + width: 0.5, + ), + ), + padding: + const EdgeInsets.fromLTRB(10, 10, 10, 10), + margin: + const EdgeInsets.fromLTRB(8, 16, 16, 16), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + SizedBox( + height: 24.0, + width: 24.0, + child: Icon( + Platform.isIOS || Platform.isMacOS + ? CupertinoIcons.qrcode + : Icons.adaptive + .arrow_forward_rounded, + size: 16, + color: Colors.white.withOpacity(0.8), + ), + ) + ], + ), + ), + ), + ], + ), Padding( padding: const EdgeInsets.symmetric(horizontal: 32.0), child: Text( - "Files are encrypted with AES-256 encryption and will be deleted after 15 hours.", + _fileNotifier.fileLink != null + ? "Share this token with your friends to access the files." + : "Files are encrypted with AES-256 encryption and will be deleted after 15 hours.", textAlign: TextAlign.center, style: GoogleFonts.poppins( fontSize: (Platform.isWindows || Platform.isMacOS) @@ -551,7 +680,7 @@ class _HomePageState extends State ), ), Text( - _fileNotifier.fileLink.toString(), + "Scan using the Odin app to access the files.", style: GoogleFonts.poppins( fontSize: 12, fontWeight: FontWeight.normal, @@ -567,8 +696,61 @@ class _HomePageState extends State ), ), ), - - const WindowTopBar(), + if (Platform.isWindows) const WindowTopBar(), + if (Platform.isMacOS) const MacTopBar(), + if (Platform.isAndroid || Platform.isIOS) + Align( + alignment: Alignment.topCenter, + child: SizedBox( + height: kToolbarHeight + MediaQuery.of(context).padding.top, + child: AppBar( + elevation: 0, + backgroundColor: Colors.transparent, + actions: [ + // IconButton( + // onPressed: () {}, + // icon: Icon( + // Platform.isIOS || Platform.isMacOS + // ? CupertinoIcons.qrcode_viewfinder + // : Icons.qr_code_scanner_rounded, + // color: Colors.white, + // ), + // ), + Theme( + data: ThemeData.dark(), + child: PopupMenuButton( + onSelected: (value) { + if (value == 1) { + launch('https://github.com/odinapp/odin#readme'); + } else if (value == 2) { + launch( + 'https://www.buymeacoffee.com/HashStudios'); + } + }, + itemBuilder: (context) => [ + PopupMenuItem( + child: Text( + "About", + style: GoogleFonts.poppins(fontSize: 14), + ), + height: 40, + value: 1, + ), + PopupMenuItem( + child: Text( + "Support us", + style: GoogleFonts.poppins(fontSize: 14), + ), + value: 2, + height: 40, + ), + ], + ), + ), + ], + ), + ), + ), ], ), ), diff --git a/lib/providers/file_notifier.dart b/lib/providers/file_notifier.dart index 8b14f35..7918775 100644 --- a/lib/providers/file_notifier.dart +++ b/lib/providers/file_notifier.dart @@ -4,7 +4,8 @@ import 'package:odin/services/locator.dart'; class FileNotifier with ChangeNotifier { final _fileService = locator(); - bool get loading => _fileService.loading; + bool get uploading => _fileService.uploading; + bool get downloading => _fileService.downloading; bool get processing => _fileService.processing; String? get fileLink => _fileService.fileLink; String get zipfileName => _fileService.zipfileName; @@ -18,4 +19,10 @@ class FileNotifier with ChangeNotifier { await _fileService.getLinkFromDroppedFiles(urls); notifyListeners(); } + + Future getFileFromToken(String token) async { + final _filePath = await _fileService.getFileFromToken(token); + notifyListeners(); + return _filePath; + } } diff --git a/lib/services/download_service.dart b/lib/services/download_service.dart new file mode 100644 index 0000000..37b0e91 --- /dev/null +++ b/lib/services/download_service.dart @@ -0,0 +1,57 @@ +import 'dart:io'; + +import 'package:android_path_provider/android_path_provider.dart'; +import 'package:dio/dio.dart'; +import 'package:odin/services/logger.dart'; +import 'package:path/path.dart'; +import 'package:path_provider/path_provider.dart'; +import 'package:permission_handler/permission_handler.dart'; + +class DownloadService { + String progress = '0%'; + bool downloading = false; + + Dio dio = Dio(); + Future _getFilePath(String fileName) async { + Directory? dir; + if (Platform.isAndroid) { + var status = await Permission.storage.status; + if (!status.isGranted) { + await Permission.storage.request(); + } + dir = Directory(await AndroidPathProvider.downloadsPath); + } else if (Platform.isIOS) { + dir = await getTemporaryDirectory(); + } else { + dir = await getDownloadsDirectory(); + } + String path = join(dir?.path ?? '', fileName); + logger.d("File path : $path"); + return path; + } + + Future downloadFile(String url) async { + progress = '0%'; + downloading = true; + Response response = await Dio().get( + url, + options: Options( + followRedirects: false, + validateStatus: (status) { + return (status ?? 0) < 500; + }), + ); + final filePath = await _getFilePath( + basename(response.headers.map["location"]?[0] ?? '')); + await dio.download( + url, + filePath, + onReceiveProgress: (rcv, total) { + progress = ((rcv / total) * 100).toStringAsFixed(0) + "%"; + }, + deleteOnError: true, + ); + downloading = false; + return File(filePath); + } +} diff --git a/lib/services/encryption_service.dart b/lib/services/encryption_service.dart new file mode 100644 index 0000000..906c205 --- /dev/null +++ b/lib/services/encryption_service.dart @@ -0,0 +1,40 @@ +import 'dart:io'; + +import 'package:aes_crypt_null_safe/aes_crypt_null_safe.dart'; +import 'package:odin/services/locator.dart'; +import 'package:odin/services/logger.dart'; +import 'package:odin/services/random_service.dart'; +import 'package:path/path.dart'; + +class EncryptionService { + final RandomService _randomService = locator(); + + Future> encryptFile(File file) async { + logger.d('Started Encryption'); + final crypt = AesCrypt(); + final password = _randomService.getRandomString(16); + crypt.setPassword(password); + crypt.setOverwriteMode(AesCryptOwMode.rename); + final encryptedFilePath = + join(file.parent.path, basename(file.path) + '.odin'); + crypt.encryptFileSync(file.path, encryptedFilePath); + file.deleteSync(); // Delete the original zip file + logger.d('Finished Encryption'); + return {'file': File(encryptedFilePath), 'password': password}; + } + + Future decryptFile(File file, String password) async { + logger.d('Started Deryption'); + final crypt = AesCrypt(); + crypt.setPassword(password); + crypt.setOverwriteMode(AesCryptOwMode.rename); + file = await file + .rename(file.path.substring(0, file.path.length - 5) + ".aes"); + final decryptedFilePath = crypt.decryptFileSync( + file.path, join(file.parent.path, basenameWithoutExtension(file.path))); + File decryptedFile = File(decryptedFilePath); + file.deleteSync(); // Delete the original AES file + logger.d('Finished Decryption'); + return decryptedFile; + } +} diff --git a/lib/services/file_service.dart b/lib/services/file_service.dart index 4ea5c1a..0b9573f 100644 --- a/lib/services/file_service.dart +++ b/lib/services/file_service.dart @@ -1,15 +1,24 @@ import 'dart:io'; import 'package:file_picker/file_picker.dart'; +import 'package:odin/services/download_service.dart'; +import 'package:odin/services/encryption_service.dart'; import 'package:odin/services/github_service.dart'; import 'package:odin/services/locator.dart'; +import 'package:odin/services/logger.dart'; +import 'package:odin/services/shortener_service.dart'; import 'package:odin/services/zip_service.dart'; import 'package:path/path.dart'; +import 'package:path_provider/path_provider.dart'; class FileService { + final _shortenerService = locator(); final _githubService = locator(); final _zipService = locator(); - bool loading = false; + final _encrytionService = locator(); + final _downloadService = locator(); + bool uploading = false; + bool downloading = false; bool processing = false; String? fileLink; String zipfileName = ''; @@ -21,14 +30,25 @@ class FileService { final String? _path; if (result != null) { zipfileName = ''; - loading = true; + uploading = true; processing = true; List files = result.paths.map((path) => File(path!)).toList(); - final zippedFile = await _zipService.zipFile(fileToZips: files); + File zippedFile; + if (files.length > 1) { + zippedFile = await _zipService.zipFile(fileToZips: files); + } else { + final Directory cacheDir = await getTemporaryDirectory(); + zippedFile = files[0]; + zippedFile = + zippedFile.copySync(join(cacheDir.path, basename(files[0].path))); + } + final encryptedFileDetails = + await _encrytionService.encryptFile(zippedFile); zipfileName = basename(zippedFile.path); processing = false; - _path = await _githubService.uploadFileAnonymous(zippedFile); - loading = false; + _path = await _githubService.uploadFileAnonymous( + encryptedFileDetails['file'], encryptedFileDetails['password']); + uploading = false; } else { // User canceled the picker _path = null; @@ -41,18 +61,52 @@ class FileService { final String? _path; if (urls.isNotEmpty) { zipfileName = ''; - loading = true; + uploading = true; processing = true; - final List fileToZips = - urls.map((e) => File(e.toFilePath())).toList(); - final zippedFile = await _zipService.zipFile(fileToZips: fileToZips); + final List files = urls.map((e) => File(e.toFilePath())).toList(); + File zippedFile; + if (files.length > 1) { + zippedFile = await _zipService.zipFile(fileToZips: files); + } else { + final Directory cacheDir = await getTemporaryDirectory(); + zippedFile = files[0]; + zippedFile = + zippedFile.copySync(join(cacheDir.path, basename(files[0].path))); + } + final encryptedFileDetails = + await _encrytionService.encryptFile(zippedFile); zipfileName = basename(zippedFile.path); processing = false; - _path = await _githubService.uploadFileAnonymous(zippedFile); - loading = false; + _path = await _githubService.uploadFileAnonymous( + encryptedFileDetails['file'], encryptedFileDetails['password']); + uploading = false; } else { _path = null; } fileLink = _path; } + + Future getFileFromToken(String token) async { + downloading = true; + processing = true; + final password = token.substring(token.length - 16); + final fileCode = token.replaceAll(password, ""); + final fileLink = _shortenerService.getShortUrlFromFileCode(fileCode); + processing = false; + final file = await _downloadService.downloadFile(fileLink); + processing = true; + final decryptedFile = await _encrytionService.decryptFile(file, password); + logger.d("decryptedFile path : ${decryptedFile.path}"); + if (decryptedFile.path.endsWith('.zip')) { + final unzippedFilePath = await _zipService.unzipFile(decryptedFile); + logger.d("unzippedFile path : $unzippedFilePath"); + processing = false; + downloading = false; + return unzippedFilePath; + } else { + processing = false; + downloading = false; + return decryptedFile.parent.path; + } + } } diff --git a/lib/services/github_service.dart b/lib/services/github_service.dart index 996ded6..34b1dae 100644 --- a/lib/services/github_service.dart +++ b/lib/services/github_service.dart @@ -17,7 +17,7 @@ class GithubService { final RandomService _randomService = locator(); final _env = dotenv.env; - Future uploadFileAnonymous(File file) async { + Future uploadFileAnonymous(File file, String password) async { final uploadTime = DateFormat('dd-MM-yyyy hh:mm:ss').format(DateTime.now()); final createFile = CreateFile( content: base64Encode(file.readAsBytesSync()), @@ -30,9 +30,13 @@ class GithubService { body: GitHubJson.encode(createFile), ); - final _downloadLink = await _shortenerService.getShortUrl( - url: jsonDecode(response.body)["content"]["download_url"] ?? ''); - return _downloadLink ?? ''; + final _fileCode = await _shortenerService.getFileCode( + jsonDecode(response.body)["content"]["download_url"] ?? '', password); + if (Platform.isMacOS || Platform.isWindows) { + return _fileCode ?? ''; + } + final dynamicLink = await _shortenerService.getDynamicLink(_fileCode ?? ''); + return dynamicLink; } Future request( diff --git a/lib/services/locator.dart b/lib/services/locator.dart index a2f262d..3dce020 100644 --- a/lib/services/locator.dart +++ b/lib/services/locator.dart @@ -1,4 +1,6 @@ import 'package:get_it/get_it.dart'; +import 'package:odin/services/download_service.dart'; +import 'package:odin/services/encryption_service.dart'; import 'package:odin/services/file_service.dart'; import 'package:odin/services/github_service.dart'; import 'package:odin/services/preferences_service.dart'; @@ -21,6 +23,8 @@ void setupLocator() { locator.registerLazySingleton(() => FileService()); locator.registerLazySingleton(() => ToastService()); locator.registerLazySingleton(() => PreferencesService()); + locator.registerLazySingleton(() => EncryptionService()); + locator.registerLazySingleton(() => DownloadService()); logger.d('Locator setup in ${stopwatch.elapsed}'); stopwatch.stop(); } diff --git a/lib/services/shortener_service.dart b/lib/services/shortener_service.dart index 30c0de6..2e40c07 100644 --- a/lib/services/shortener_service.dart +++ b/lib/services/shortener_service.dart @@ -1,9 +1,14 @@ import 'dart:io'; import 'package:dio/dio.dart'; +import 'package:firebase_dynamic_links/firebase_dynamic_links.dart'; +import 'package:odin/services/locator.dart'; import 'package:odin/services/logger.dart'; +import 'package:odin/services/zip_service.dart'; class ShortenerService { + String token = ""; + final _zipService = locator(); final _dio = Dio(BaseOptions( baseUrl: 'https://api.shrtco.de/v2/', )); @@ -13,8 +18,6 @@ class ShortenerService { Map? headers, Map? body, }) async { - final String time = DateTime.now().toString(); - logger.d("GET:: $time : ${uri.toString()}"); try { final Stopwatch stopwatch = Stopwatch()..start(); final Map query = {}; @@ -23,7 +26,6 @@ class ShortenerService { queryParameters: query, options: Options(headers: headers)); stopwatch.stop(); logger.d("Last request took : ${stopwatch.elapsedMilliseconds} ms."); - logger.d("Request : ${response.realUri}"); if (response.statusCode != 201) { throw HttpException(response.statusCode.toString()); } @@ -39,8 +41,6 @@ class ShortenerService { Map? headers, Map? body, }) async { - final String time = DateTime.now().toString(); - logger.d("POST:: $time : ${uri.toString()}"); try { final Stopwatch stopwatch = Stopwatch()..start(); final Map query = {}; @@ -49,7 +49,6 @@ class ShortenerService { queryParameters: query, options: Options(headers: headers)); stopwatch.stop(); logger.d("Last request took : ${stopwatch.elapsedMilliseconds} ms."); - logger.d("Request : ${response.realUri}"); if (response.statusCode != 201) { throw HttpException(response.statusCode.toString()); } @@ -60,12 +59,51 @@ class ShortenerService { } } - Future getShortUrl({required String url}) async { + Future getFileCode(String url, String password) async { + logger.d('Fetching short link'); final Response? response = await post(uri: 'shorten?url=$url'); if (response != null) { - return response.data["result"]["full_short_link"]; + final shortLink = response.data["result"]["full_short_link"]; + token = shortLink.replaceAll("https://shrtco.de/", "") + password; + return token; } else { return null; } } + + String getShortUrlFromFileCode(String fileCode) { + return "https://shrtco.de/$fileCode"; + } + + Future getDynamicLink(String fileCode) async { + logger.d('Started building dynamic link'); + final initialLink = Uri.parse('https://getodin.com/files/$fileCode'); + final DynamicLinkParameters parameters = DynamicLinkParameters( + uriPrefix: 'https://getodin.page.link', + link: initialLink, + androidParameters: AndroidParameters( + packageName: 'com.odin.odin', + minimumVersion: 1, + ), + iosParameters: IosParameters( + bundleId: 'com.odin.odin', + minimumVersion: '0.2.0', + appStoreId: + '123456789', // Update this value with your app's App Store ID + ), + socialMetaTagParameters: SocialMetaTagParameters( + title: _zipService.linkTitle, + description: _zipService.linkDesc, + ), + ); + final Uri dynamicLink = await parameters.buildUrl(); + final ShortDynamicLink shortenedLink = + await DynamicLinkParameters.shortenUrl( + dynamicLink, + DynamicLinkParametersOptions( + shortDynamicLinkPathLength: ShortDynamicLinkPathLength.short), + ); + logger.d('Finished building dynamic link'); + return shortenedLink.shortUrl.toString(); + } } diff --git a/lib/services/toast_service.dart b/lib/services/toast_service.dart index a644f44..2f36e05 100644 --- a/lib/services/toast_service.dart +++ b/lib/services/toast_service.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:google_fonts/google_fonts.dart'; @@ -43,17 +45,36 @@ class ToastService { ), )); fToast.removeCustomToast(); + if (Platform.isIOS || Platform.isAndroid) { + Fluttertoast.showToast( + msg: text, + toastLength: Toast.LENGTH_LONG, + gravity: ToastGravity.CENTER, + timeInSecForIosWeb: 1, + textColor: Colors.white, + fontSize: 16.0); + } else { + fToast.showToast( + child: toast, + positionedToastBuilder: (context, child) { + return Positioned( + child: child, + top: 32.0 + MediaQuery.of(context).padding.top, + left: MediaQuery.of(context).size.width / 2 - 125, + ); + }, + toastDuration: const Duration(seconds: 2), + ); + } + } - fToast.showToast( - child: toast, - positionedToastBuilder: (context, child) { - return Positioned( - child: child, - top: 32.0, - left: MediaQuery.of(context).size.width / 2 - 125, - ); - }, - toastDuration: const Duration(seconds: 2), - ); + void showMobileToast(String text) { + Fluttertoast.showToast( + msg: text, + toastLength: Toast.LENGTH_LONG, + gravity: ToastGravity.CENTER, + timeInSecForIosWeb: 1, + textColor: Colors.white, + fontSize: 16.0); } } diff --git a/lib/services/zip_service.dart b/lib/services/zip_service.dart index 73f4894..1a70bc7 100644 --- a/lib/services/zip_service.dart +++ b/lib/services/zip_service.dart @@ -4,11 +4,14 @@ import 'package:archive/archive_io.dart'; import 'package:odin/services/locator.dart'; import 'package:odin/services/logger.dart'; import 'package:odin/services/random_service.dart'; +import 'package:odin/utilities/byte_formatter.dart'; import 'package:path/path.dart'; import 'package:path_provider/path_provider.dart'; class ZipService { final RandomService _randomService = locator(); + String linkTitle = ""; + String linkDesc = ""; Future zipFile({ required List fileToZips, @@ -27,6 +30,34 @@ class ZipService { } encoder.close(); logger.d('Finished Zipping Files'); + if (fileToZips.length == 1) { + linkTitle = basename(fileToZips.first.path); + } else if (fileToZips.length == 2) { + linkTitle = + "${basename(fileToZips.first.path)} & ${fileToZips.length - 1} more file."; + } else { + linkTitle = + "${basename(fileToZips.first.path)} & ${fileToZips.length - 1} more files."; + } + linkDesc = formatBytes(File(zipFilePath).lengthSync(), 2); return File(zipFilePath); } + + Future unzipFile(File file) async { + final archive = ZipDecoder().decodeBytes(file.readAsBytesSync()); + final outDirectory = file.path.replaceAll('.zip', ''); + for (final zfile in archive) { + final filename = zfile.name; + if (zfile.isFile) { + final data = zfile.content as List; + File(join(outDirectory, filename)) + ..createSync(recursive: true) + ..writeAsBytesSync(data); + } else { + Directory(join(outDirectory, filename)).create(recursive: true); + } + } + file.deleteSync(); // Delete the original ZIP file + return Directory(outDirectory).path; + } } diff --git a/lib/utilities/byte_formatter.dart b/lib/utilities/byte_formatter.dart new file mode 100644 index 0000000..d81c1b3 --- /dev/null +++ b/lib/utilities/byte_formatter.dart @@ -0,0 +1,8 @@ +import 'dart:math'; + +String formatBytes(int bytes, int decimals) { + if (bytes <= 0) return "0 B"; + const suffixes = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]; + var i = (log(bytes) / log(1024)).floor(); + return ((bytes / pow(1024, i)).toStringAsFixed(decimals)) + ' ' + suffixes[i]; +} diff --git a/lib/widgets/mac_top_bar.dart b/lib/widgets/mac_top_bar.dart new file mode 100644 index 0000000..f68d83d --- /dev/null +++ b/lib/widgets/mac_top_bar.dart @@ -0,0 +1,75 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class MacTopBar extends StatelessWidget { + const MacTopBar({ + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return SizedBox( + height: 26, + child: Row( + children: [ + const Expanded( + child: TitleBar(), + ), + Theme( + data: ThemeData.dark(), + child: PopupMenuButton( + onSelected: (value) { + if (value == 1) { + launch('https://github.com/odinapp/odin#readme'); + } else if (value == 2) { + launch('https://www.buymeacoffee.com/HashStudios'); + } + }, + itemBuilder: (context) => [ + PopupMenuItem( + child: Text( + "About", + style: GoogleFonts.poppins(fontSize: 12), + ), + height: 32, + value: 1, + ), + PopupMenuItem( + child: Text( + "Support us", + style: GoogleFonts.poppins(fontSize: 12), + ), + value: 2, + height: 32, + ), + ], + child: Padding( + padding: const EdgeInsets.only(right: 8.0), + child: Icon(Icons.adaptive.more_rounded), + ), + ), + ), + ], + ), + ); + } +} + +class TitleBar extends StatelessWidget { + const TitleBar({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Center( + child: Text( + "Odin", + style: GoogleFonts.poppins( + fontSize: 10, + color: Colors.white60, + ), + ), + ); + } +} diff --git a/lib/widgets/window_buttons.dart b/lib/widgets/window_buttons.dart index d7f32a5..ac584b2 100644 --- a/lib/widgets/window_buttons.dart +++ b/lib/widgets/window_buttons.dart @@ -1,6 +1,8 @@ import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; import 'package:odin/widgets/menu_window_button.dart'; +import 'package:url_launcher/url_launcher.dart'; final buttonColors = WindowButtonColors( iconNormal: const Color(0x77FFFFFF), @@ -16,9 +18,15 @@ final closeButtonColors = WindowButtonColors( iconNormal: const Color(0x77FFFFFF), iconMouseOver: const Color(0xFFD32F2F)); -class WindowButtons extends StatelessWidget { +class WindowButtons extends StatefulWidget { const WindowButtons({Key? key}) : super(key: key); + @override + State createState() => _WindowButtonsState(); +} + +class _WindowButtonsState extends State { + final GlobalKey _menuKey = GlobalKey(); @override Widget build(BuildContext context) { return Row( @@ -27,9 +35,44 @@ class WindowButtons extends StatelessWidget { colors: buttonColors, animate: true, ), - MenuWindowButton( - colors: buttonColors, - animate: true, + Theme( + data: ThemeData.dark(), + child: PopupMenuButton( + key: _menuKey, + onSelected: (value) { + if (value == 1) { + launch('https://github.com/odinapp/odin#readme'); + } else if (value == 2) { + launch('https://www.buymeacoffee.com/HashStudios'); + } + }, + child: MenuWindowButton( + colors: buttonColors, + animate: true, + onPressed: () { + dynamic state = _menuKey.currentState; + state.showButtonMenu(); + }, + ), + itemBuilder: (context) => [ + PopupMenuItem( + child: Text( + "About", + style: GoogleFonts.poppins(fontSize: 12), + ), + height: 32, + value: 1, + ), + PopupMenuItem( + child: Text( + "Support us", + style: GoogleFonts.poppins(fontSize: 12), + ), + value: 2, + height: 32, + ), + ], + ), ), CloseWindowButton( colors: closeButtonColors, diff --git a/lib/widgets/window_top_bar.dart b/lib/widgets/window_top_bar.dart index def546a..60f5bea 100644 --- a/lib/widgets/window_top_bar.dart +++ b/lib/widgets/window_top_bar.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:bitsdojo_window/bitsdojo_window.dart'; import 'package:flutter/material.dart'; import 'package:odin/widgets/window_buttons.dart'; @@ -11,17 +9,15 @@ class WindowTopBar extends StatelessWidget { @override Widget build(BuildContext context) { - return (Platform.isWindows || Platform.isMacOS) - ? WindowTitleBarBox( - child: Row( - children: [ - Expanded( - child: MoveWindow(), - ), - const WindowButtons() - ], - ), - ) - : Container(); + return WindowTitleBarBox( + child: Row( + children: [ + Expanded( + child: MoveWindow(), + ), + const WindowButtons() + ], + ), + ); } } diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index ca5fa74..dd86a35 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,11 +8,13 @@ import Foundation import bitsdojo_window_macos import desktop_drop import path_provider_macos +import shared_preferences_macos import url_launcher_macos func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin")) DesktopDropPlugin.register(with: registry.registrar(forPlugin: "DesktopDropPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) } diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 4f7ab68..3b04ed5 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -6,6 +6,8 @@ PODS: - FlutterMacOS (1.0.0) - path_provider_macos (0.0.1): - FlutterMacOS + - shared_preferences_macos (0.0.1): + - FlutterMacOS - url_launcher_macos (0.0.1): - FlutterMacOS @@ -14,6 +16,7 @@ DEPENDENCIES: - desktop_drop (from `Flutter/ephemeral/.symlinks/plugins/desktop_drop/macos`) - FlutterMacOS (from `Flutter/ephemeral`) - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) + - shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) EXTERNAL SOURCES: @@ -25,6 +28,8 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral path_provider_macos: :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos + shared_preferences_macos: + :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos url_launcher_macos: :path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos @@ -33,6 +38,7 @@ SPEC CHECKSUMS: desktop_drop: 69eeff437544aa619c8db7f4481b3a65f7696898 FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424 path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f + shared_preferences_macos: 480ce071d0666e37cef23fe6c702293a3d21799e url_launcher_macos: 45af3d61de06997666568a7149c1be98b41c95d4 PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index 2003d5b..554f33b 100644 --- a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1 +1,68 @@ -{"images":[{"size":"128x128","expected-size":"128","filename":"128.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"256x256","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"128x128","expected-size":"256","filename":"256.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"256x256","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"512x512","expected-size":"512","filename":"512.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"16","filename":"16.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"1x"},{"size":"16x16","expected-size":"32","filename":"32.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"32x32","expected-size":"64","filename":"64.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"},{"size":"512x512","expected-size":"1024","filename":"1024.png","folder":"Assets.xcassets/AppIcon.appiconset/","idiom":"mac","scale":"2x"}]} \ No newline at end of file +{ + "images": [ + { + "size": "16x16", + "idiom": "mac", + "filename": "icon_16x16@1x.png", + "scale": "1x" + }, + { + "size": "16x16", + "idiom": "mac", + "filename": "icon_16x16@2x.png", + "scale": "2x" + }, + { + "size": "32x32", + "idiom": "mac", + "filename": "icon_32x32@1x.png", + "scale": "1x" + }, + { + "size": "32x32", + "idiom": "mac", + "filename": "icon_32x32@2x.png", + "scale": "2x" + }, + { + "size": "128x128", + "idiom": "mac", + "filename": "icon_128x128@1x.png", + "scale": "1x" + }, + { + "size": "128x128", + "idiom": "mac", + "filename": "icon_128x128@2x.png", + "scale": "2x" + }, + { + "size": "256x256", + "idiom": "mac", + "filename": "icon_256x256@1x.png", + "scale": "1x" + }, + { + "size": "256x256", + "idiom": "mac", + "filename": "icon_256x256@2x.png", + "scale": "2x" + }, + { + "size": "512x512", + "idiom": "mac", + "filename": "icon_512x512@1x.png", + "scale": "1x" + }, + { + "size": "512x512", + "idiom": "mac", + "filename": "icon_512x512@2x.png", + "scale": "2x" + } + ], + "info": { + "version": 1, + "author": "com.midwinter-dg.appiconset-generator" + } +} diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png deleted file mode 100644 index 9017a6a..0000000 Binary files a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png and /dev/null differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png deleted file mode 100644 index 58db03d..0000000 Binary files a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png and /dev/null differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png deleted file mode 100644 index 72cc3ec..0000000 Binary files a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png and /dev/null differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png deleted file mode 100644 index a0ad330..0000000 Binary files a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png and /dev/null differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png deleted file mode 100644 index a5f40dd..0000000 Binary files a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png and /dev/null differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png deleted file mode 100644 index 3775c27..0000000 Binary files a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png and /dev/null differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png deleted file mode 100644 index d164cd3..0000000 Binary files a/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png and /dev/null differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128x128@1x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128x128@1x.png new file mode 100644 index 0000000..a8478a2 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128x128@1x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png new file mode 100644 index 0000000..4517149 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16x16@1x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16x16@1x.png new file mode 100644 index 0000000..fdd011b Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16x16@1x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png new file mode 100644 index 0000000..aef39ce Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256x256@1x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256x256@1x.png new file mode 100644 index 0000000..4517149 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256x256@1x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png new file mode 100644 index 0000000..ba234c1 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32x32@1x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32x32@1x.png new file mode 100644 index 0000000..aef39ce Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32x32@1x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png new file mode 100644 index 0000000..8a8329c Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512x512@1x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512x512@1x.png new file mode 100644 index 0000000..ba234c1 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512x512@1x.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png new file mode 100644 index 0000000..4fc63e0 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig index 6d14659..ad3fbc6 100644 --- a/macos/Runner/Configs/AppInfo.xcconfig +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -8,7 +8,7 @@ PRODUCT_NAME = odin // The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.example.odin +PRODUCT_BUNDLE_IDENTIFIER = com.odin.odin // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2021 com.example. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2021 com.odin. All rights reserved. diff --git a/pubspec.lock b/pubspec.lock index ee4ce89..a4d3da4 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -8,6 +8,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "30.0.0" + aes_crypt_null_safe: + dependency: "direct main" + description: + name: aes_crypt_null_safe + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" analyzer: dependency: transitive description: @@ -15,6 +22,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.7.0" + android_path_provider: + dependency: "direct main" + description: + name: android_path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0" archive: dependency: "direct main" description: @@ -260,6 +274,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.2.3" + firebase_core: + dependency: transitive + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + firebase_dynamic_links: + dependency: "direct main" + description: + name: firebase_dynamic_links + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" fixnum: dependency: transitive description: @@ -471,6 +513,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + open_file: + dependency: "direct main" + description: + name: open_file + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.1" package_config: dependency: transitive description: @@ -534,6 +583,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.4" + permission_handler: + dependency: "direct main" + description: + name: permission_handler + url: "https://pub.dartlang.org" + source: hosted + version: "8.3.0" + permission_handler_platform_interface: + dependency: transitive + description: + name: permission_handler_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.7.0" petitparser: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 2545a73..76d3f6a 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 # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 0.1.0+1 +version: 0.2.0+2 environment: sdk: ">=2.12.0 <3.0.0" @@ -27,6 +27,8 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: + aes_crypt_null_safe: ^2.0.1 + android_path_provider: ^0.3.0 archive: ^3.1.6 bitsdojo_window: ^0.1.1+1 clipboard: ^0.1.3 @@ -34,6 +36,7 @@ dependencies: desktop_drop: ^0.1.2 dio: ^4.0.3 file_picker: ^4.2.3 + firebase_dynamic_links: ^3.0.1 flutter: sdk: flutter flutter_dotenv: ^5.0.2 @@ -44,8 +47,10 @@ dependencies: intl: ^0.17.0 json_annotation: ^4.3.0 logger: ^1.1.0 + open_file: ^3.2.1 path: ^1.8.0 path_provider: ^2.0.6 + permission_handler: ^8.3.0 provider: ^6.0.1 qr_flutter: ^4.0.0 shared_preferences: ^2.0.8 diff --git a/test/shortner_service_test.dart b/test/shortner_service_test.dart index 6423571..a0a7b02 100644 --- a/test/shortner_service_test.dart +++ b/test/shortner_service_test.dart @@ -6,7 +6,7 @@ void main() { test("Url should contain shrtco.de", () async { final ShortenerService _shortnerService = ShortenerService(); const String url = "https://www.google.com"; - final String? shortUrl = await _shortnerService.getShortUrl(url: url); + final String? shortUrl = await _shortnerService.getFileCode(url, "test"); expect(shortUrl, stringContainsInOrder(["https://", "shrtco.de"])); }); }); diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 1d8d315..82e0781 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -89,11 +89,11 @@ BEGIN BEGIN BLOCK "040904e4" BEGIN - VALUE "CompanyName", "com.example" "\0" + VALUE "CompanyName", "com.odin" "\0" VALUE "FileDescription", "Open source easy file sharing for everyone." "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "InternalName", "odin" "\0" - VALUE "LegalCopyright", "Copyright (C) 2021 com.example. All rights reserved." "\0" + VALUE "LegalCopyright", "Copyright (C) 2021 com.odin. All rights reserved." "\0" VALUE "OriginalFilename", "odin.exe" "\0" VALUE "ProductName", "odin" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0"