diff --git a/.gitignore b/.gitignore index 1ba9c33..509f6c7 100644 --- a/.gitignore +++ b/.gitignore @@ -41,3 +41,4 @@ app.*.map.json # Exceptions to above rules. !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages +peervault diff --git a/Makefile b/Makefile index c2ad20e..106befa 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,11 @@ run: flutter run + +release: + rm -rf /Applicationsbuild/macos/Build/Products/Release/ + flutter build macos --release + cp peervault build/macos/Build/Products/Release/Peervault.app/Contents/MacOS/io.plab.peervault + codesign --deep --force --verbose --sign "6474BEC494BACEB22D23B3656F45F5BD7337552F" build/macos/Build/Products/Release/Peervault.app + +install: + cp -r build/macos/Build/Products/Release/Peervault.app /Applications/ \ No newline at end of file diff --git a/README.md b/README.md index 3df7751..7f6c1a2 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,37 @@ -# peervault +# Peervault - Client A new Flutter project. -## Getting Started +## Release instruction -This project is a starting point for a Flutter application. +### Build for MacOs -A few resources to get you started if this is your first Flutter project: +1. build macos -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) +``` +flutter build macos --releas +``` -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +2. Sign with certificate from XCode + 2.1 Get a certificate from Xcode. The simplest step is to use Xcode, add a new certificate. + Read more about it here https://help.apple.com/xcode/mac/current/#/dev154b28f09 + + 2.2 Once you have the certificate you need to find the identity for it to sign your app. + ``` + security find-identity -p codesigning + ``` + run this in terminal and copy hash it gives you against the certificate name you just created. + + 2.3 + ``` + codesign --deep --force --verbose --sign "" build/macos + ``` + + 2.4 + Verify the signature codesign --verify -vvvv Application.app and spctl -a -vvvv Application.app + + ## Dev followup + + - Structure directory for core service class + - Splash loader for daemon loading and API check if owner exists + - State with default settings (api url, ws url, p2p relay) \ No newline at end of file diff --git a/assets/logo-icon.png b/assets/logo-icon.png index c65a886..ebe1313 100644 Binary files a/assets/logo-icon.png and b/assets/logo-icon.png differ diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee..e8efba1 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee..399e934 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..6697f0a --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,87 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '9.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + generated_key_values = {} + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) do |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + generated_key_values[podname] = podpath + else + puts "Invalid plugin specification: #{line}" + end + end + generated_key_values +end + +target 'Runner' do + use_frameworks! + use_modular_headers! + + # Flutter Pod + + copied_flutter_dir = File.join(__dir__, 'Flutter') + copied_framework_path = File.join(copied_flutter_dir, 'Flutter.framework') + copied_podspec_path = File.join(copied_flutter_dir, 'Flutter.podspec') + unless File.exist?(copied_framework_path) && File.exist?(copied_podspec_path) + # Copy Flutter.framework and Flutter.podspec to Flutter/ to have something to link against if the xcode backend script has not run yet. + # That script will copy the correct debug/profile/release version of the framework based on the currently selected Xcode configuration. + # CocoaPods will not embed the framework on pod install (before any build phases can generate) if the dylib does not exist. + + generated_xcode_build_settings_path = File.join(copied_flutter_dir, 'Generated.xcconfig') + unless File.exist?(generated_xcode_build_settings_path) + raise "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + generated_xcode_build_settings = parse_KV_file(generated_xcode_build_settings_path) + cached_framework_dir = generated_xcode_build_settings['FLUTTER_FRAMEWORK_DIR']; + + unless File.exist?(copied_framework_path) + FileUtils.cp_r(File.join(cached_framework_dir, 'Flutter.framework'), copied_flutter_dir) + end + unless File.exist?(copied_podspec_path) + FileUtils.cp(File.join(cached_framework_dir, 'Flutter.podspec'), copied_flutter_dir) + end + end + + # Keep pod path relative so it can be checked into Podfile.lock. + pod 'Flutter', :path => 'Flutter' + + # Plugin Pods + + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + system('rm -rf .symlinks') + system('mkdir -p .symlinks/plugins') + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.each do |name, path| + symlink = File.join('.symlinks', 'plugins', name) + File.symlink(path, symlink) + pod name, :path => File.join(symlink, 'ios') + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + target.build_configurations.each do |config| + config.build_settings['ENABLE_BITCODE'] = 'NO' + end + end +end diff --git a/lib/main.dart b/lib/main.dart index 4a70589..65b02a0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,15 +1,38 @@ import 'package:flutter/material.dart'; +import 'package:peervault/ui/owner/display_seed.dart'; +import 'package:window_utils/window_utils.dart'; +import 'package:window_utils/window_frame.dart'; + +import 'package:peervault/ui/splash.dart'; import 'package:peervault/ui/home.dart'; import 'package:peervault/ui/owner/create_owner.dart'; import 'package:peervault/ui/unlock.dart'; void main() => runApp(MyApp()); -class MyApp extends StatelessWidget { +class MyApp extends StatefulWidget { + const MyApp({Key key}) : super(key: key); + + @override + PeerVaultApp createState() => new PeerVaultApp(); +} + +class PeerVaultApp extends State { + @override + void initState() { + WidgetsBinding.instance.addPostFrameCallback( + (_) { + WindowUtils.setSize(new Size(900, 640)); + WindowUtils.centerWindow(); + }, + ); + super.initState(); + } + @override Widget build(BuildContext context) { return MaterialApp( - debugShowCheckedModeBanner: false, + debugShowCheckedModeBanner: true, theme: ThemeData( scaffoldBackgroundColor: Color(0xFF191919), primarySwatch: MaterialColor( @@ -28,12 +51,18 @@ class MyApp extends StatelessWidget { } ), accentColor: Color(0xFF82E1B3), + unselectedWidgetColor: Colors.white, ), - initialRoute: '/createOwner', + initialRoute: '/splash', routes: { - '/': (context) => Home(), + '/splash': (context) => WindowsFrame( + active: true, + child: Splash() + ), + '/home': (context) => Home(), '/unlock': (context) => Unlock(), '/createOwner': (context) => CreateOwner(), + '/owner/display_seed': (context) => DisplaySeed(), }, ); } diff --git a/lib/model/owner.dart b/lib/model/owner.dart new file mode 100644 index 0000000..6d4b3ec --- /dev/null +++ b/lib/model/owner.dart @@ -0,0 +1,44 @@ +class Owner { + // ignore: non_constant_identifier_names + final String QmPeerId; + // ignore: non_constant_identifier_names + final String Nickname; + // ignore: non_constant_identifier_names + final String DeviceName; + // ignore: non_constant_identifier_names + final String UnlockCode; + // ignore: non_constant_identifier_names + final int AskPassword; + + Owner({ + // ignore: non_constant_identifier_names + this.QmPeerId, + // ignore: non_constant_identifier_names + this.Nickname, + // ignore: non_constant_identifier_names + this.DeviceName, + // ignore: non_constant_identifier_names + this.UnlockCode, + // ignore: non_constant_identifier_names + this.AskPassword + }); + + factory Owner.fromJson(Map json) { + return Owner( + QmPeerId: json['QmPeerId'], + Nickname: json['Nickname'], + DeviceName: json['DeviceName'], + UnlockCode: json['UnlockCode'], + AskPassword: json['AskPassword'], + ); + } + + Map toJson() { + return { + 'Nickname': Nickname, + 'DeviceName': DeviceName, + 'UnlockCode': UnlockCode, + 'AskPassword': AskPassword, + }; + } +} diff --git a/lib/service/api/owner.dart b/lib/service/api/owner.dart new file mode 100644 index 0000000..f2ef603 --- /dev/null +++ b/lib/service/api/owner.dart @@ -0,0 +1,35 @@ +import 'dart:convert'; + +import 'package:http/http.dart' as http; +import 'package:peervault/model/owner.dart'; + +Future fetchOwner() async { + final response = await http.get('http://localhost:4444/owner'); + + if (response.statusCode == 200) { + return Owner.fromJson(json.decode(response.body)); + } + + // NO OWNER SETUP + if (response.statusCode == 424) { + return null; + } + + throw Exception('Error with PeerVault Daemon'); +} + +Future createOwner(Owner owner) async { + var response = await http.post( + 'http://localhost:4444/owner', + headers: { + 'Content-Type': 'application/json' + }, + body: jsonEncode(owner), + ); + + if (response.statusCode == 200) { + return json.decode(response.body)['seed']; + } + + throw Exception('Error with PeerVault Daemon'); +} diff --git a/lib/service/daemon.dart b/lib/service/daemon.dart new file mode 100644 index 0000000..ed4cbe8 --- /dev/null +++ b/lib/service/daemon.dart @@ -0,0 +1,135 @@ +import 'dart:io'; +import 'package:path_provider/path_provider.dart'; + +class Daemon { + static const BIN_PATH_DEBUG = '/Users/pierozi/Project/github/peervault/PeerVault-Client/build/macos/Build/Products/Debug/Peervault.app/Contents/MacOS/io.plab.peervault'; + static const BIN_PATH_MACOS = '/Applications/Peervault.app/Contents/MacOS/io.plab.peervault'; + static const BIN_PATH_LINUX = ''; + + static const DEFAULT_RELAY = '/ip4/37.187.1.229/tcp/23003/ipfs/QmeFecyqtgzYx1TFN9vYTroMGNo3DELtDZ63FpjqUd6xfW'; + + int _pid = 0; + int exitCode = 0; // For debug purpose when process are stopped + bool running = false; + + Future get _appPath async { + final directory = await getLibraryDirectory(); + + return '${directory.path}/PeerVault'; + } + + Future get _pidFile async { + final path = await _appPath; + return File('$path/peervault-daemon.pid'); + } + + Future start({int level: 3}) async { + if (this.running) { + return false; + } + + String bin; + List options; + final appPath = await _appPath; + + if (Platform.isMacOS) { + bin = BIN_PATH_MACOS; + } + + if (Platform.isLinux) { + bin = BIN_PATH_LINUX; + } + + options = [ + '--log', '$level', + '--relay', DEFAULT_RELAY, + '--bbolt', '$appPath/bbolt.db', + ]; + + // ONLY DURING DEV + assert(() { + bin = BIN_PATH_DEBUG; + options = [ + '-dev', + '--log', '9', + '--relay', DEFAULT_RELAY, + '--bbolt', '$appPath/bbolt.db', + ]; + return true; + }()); + + var result = await Process.start( + bin, + options, + ); + + this.running = true; + this._pid = result.pid; + + stdout.addStream(result.stdout); + stderr.addStream(result.stderr); + + var pidFile = await _pidFile; + await pidFile.writeAsString('${this._pid}'); + + return true; + } + + // TODO try to watch when flutter app close in order to SIGTERM the PeerVault Daemon + watch() { + //sleep(new Duration(seconds:5)); + print(pid); + ProcessSignal.sighup.watch().listen((event) { + print(event); + }); + ProcessSignal.sigusr1.watch().listen((event) { + print(event); + }); + ProcessSignal.sigusr2.watch().listen((event) { + print(event); + }); + ProcessSignal.sigwinch.watch().listen((event) { + print(event); + }); + } + + Future status() async { + var pidFile = await _pidFile; + if (!pidFile.existsSync()) { + return 'stopped'; + } + this._pid = int.parse(pidFile.readAsStringSync()); + return 'stopped'; + + // TODO OPERATION NOT PERMITTED DUE TO SANDBOX MODE + //var psResult = Process.runSync('/bin/ps', ['-p', '${this._pid}'], runInShell: true); + //var psResult = Process.runSync('kill', ['-0', ' ${this._pid}'], runInShell: true); + //var psResult = Process.runSync('kill', ['-0', '16029'], runInShell: true, includeParentEnvironment: false); + + /*if (0 == psResult.exitCode) { + this.running = true; + return 'running'; + } else { + this.running = false; + return 'stopped'; + }*/ + } + + stop() { + // TODO OPERATION NOT PERMITTED DUE TO SANDBOX MODE + if (this._pid > 0) { + Process.killPid(this._pid, ProcessSignal.sigterm); + this._pid = 0; + this.running = false; + + _pidFile.then((pidFile) { + pidFile.delete(); + }); + } + } + + Future restart() async { + this.stop(); + return await this.start(); + } +} \ No newline at end of file diff --git a/lib/ui/home.dart b/lib/ui/home.dart index 0fcbdc2..3a46fb7 100644 --- a/lib/ui/home.dart +++ b/lib/ui/home.dart @@ -1,11 +1,32 @@ import 'package:flutter/material.dart'; +import 'package:peervault/model/owner.dart'; class Home extends StatelessWidget { @override Widget build(BuildContext context) { + final Owner owner = ModalRoute.of(context).settings.arguments; + + if (owner != null) { + print(owner.toJson()); + } + return new Scaffold( - body: Text('Hello Home') + body: Center( + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.15), + child: Image( + image: AssetImage('assets/peervault-logo.png'), + fit: BoxFit.scaleDown, + height: 120, + ) + ), + SizedBox(height: 30), + ] + ) + ) ); } } \ No newline at end of file diff --git a/lib/ui/owner/create_owner.dart b/lib/ui/owner/create_owner.dart index 4cc8ad4..8ed08c7 100644 --- a/lib/ui/owner/create_owner.dart +++ b/lib/ui/owner/create_owner.dart @@ -1,25 +1,209 @@ import 'package:flutter/material.dart'; +import 'package:peervault/model/owner.dart'; +import 'package:peervault/service/api/owner.dart'; -class CreateOwner extends StatelessWidget { +enum UnlockCodeOptions { + PasswordPolicyNone, + PasswordPolicyAlwaysRequired, + PasswordPolicyOnlyWhenExposure +} + +class CreateOwner extends StatefulWidget { + CreateOwner() : super(); + + _CreateOwner createState() => _CreateOwner(); +} + +class _CreateOwner extends State { + UnlockCodeOptions _unlockCodeOption = UnlockCodeOptions.PasswordPolicyOnlyWhenExposure; + final nicknameController = TextEditingController(); + final deviceController = TextEditingController(); + final unlockController = TextEditingController(); @override Widget build(BuildContext context) { return new Scaffold( - body: Center( - child: Column( - children: [ - Padding( - padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.15), + body: Row(children: [ + Align( + alignment: Alignment.topLeft, + child: Container( + // decoration: new BoxDecoration(color: Colors.red), + height: 170, + width: 170, + padding: const EdgeInsets.fromLTRB(40, 30, 15, 40), child: Image( - image: AssetImage('assets/peervault-logo.png'), - fit: BoxFit.scaleDown, - height: 120, - ) + image: AssetImage('assets/peervault-logo.png') + ), ), - SizedBox(height: 30), - ] - ) - ) + ), + Container( + padding: const EdgeInsets.fromLTRB(0, 30, 50, 0), + width: MediaQuery.of(context).size.width - 170, + child: Column(children: [ + Row( + children: [Text( + 'Owner\nCreation', + style: TextStyle( + color: Colors.white, + height: 1.2, + fontSize: 36, + fontFamily: "Roboto", + ) + )], + ), + SizedBox(height: 30), + Row( + children: [Expanded( + child: Text( + 'Welcome in the PeerVault community!\n\nYou will now create a new Owner for a Vault, The Owner creation process creates a Master Key. It will be stored on a dedicated OSX Keychain on your computer, which is the most secure place to ensure other software are not able to access that precise key used to encrypt all of your secrets.\n\nThe master key also has a Paper format, it is a phrase composed of 24 words. As long as you keep those words, you will be able to decrypt any Vault backup in case of data disaster.', + style: TextStyle( + color: Colors.white, + height: 1.3, + fontSize: 14, + fontFamily: "Roboto", + ), + textAlign: TextAlign.justify, + overflow: TextOverflow.ellipsis, + maxLines: 10, + ), + )], + ), + SizedBox(height: 20), + Row( + children: [ + Expanded( + flex: 1, + child: Column(children: [ + inputLine(context, "Owner name", false, nicknameController), + inputLine(context, "Device name", false, deviceController), + inputLine(context, "Unlock Code", true, unlockController), + ]), + ), + Expanded( + flex: 1, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Unlock Condition', + textAlign: TextAlign.left, + style: TextStyle( + color: Colors.white, + fontSize: 14, + fontFamily: "Roboto" + ) + ), + RadioListTile( + dense: false, + title: const Text( + 'Always required', + style: TextStyle( + color: Colors.white, + fontSize: 12, + fontFamily: "Roboto" + ) + ), + activeColor: Theme.of(context).primaryColor, + value: UnlockCodeOptions.PasswordPolicyAlwaysRequired, + groupValue: _unlockCodeOption, + onChanged: (UnlockCodeOptions value) { + setState(() { _unlockCodeOption = value; }); + }, + ), + RadioListTile( + dense: false, + title: const Text( + 'When secret are reveal', + style: TextStyle( + color: Colors.white, + fontSize: 12, + fontFamily: "Roboto", + ) + ), + activeColor: Theme.of(context).primaryColor, + value: UnlockCodeOptions.PasswordPolicyOnlyWhenExposure, + groupValue: _unlockCodeOption, + onChanged: (UnlockCodeOptions value) { + setState(() { _unlockCodeOption = value; }); + }, + ), + RadioListTile( + dense: false, + title: const Text( + 'Never', + style: TextStyle( + color: Colors.white, + fontSize: 12, + fontFamily: "Roboto", + ) + ), + activeColor: Theme.of(context).primaryColor, + value: UnlockCodeOptions.PasswordPolicyNone, + groupValue: _unlockCodeOption, + onChanged: (UnlockCodeOptions value) { + setState(() { _unlockCodeOption = value; }); + }, + ), + ]) + ) + ], + ), + SizedBox(height: 30), + FlatButton( + color: Theme.of(context).primaryColor, + child: Text('Next'), + onPressed: () { + var askPassword = 0; + if (_unlockCodeOption == UnlockCodeOptions.PasswordPolicyNone) { + askPassword = 0; + } + if (_unlockCodeOption == UnlockCodeOptions.PasswordPolicyAlwaysRequired) { + askPassword = 1; + } + if (_unlockCodeOption == UnlockCodeOptions.PasswordPolicyOnlyWhenExposure) { + askPassword = 2; + } + createOwner(Owner( + Nickname: nicknameController.text, + DeviceName: deviceController.text, + UnlockCode: unlockController.text, + AskPassword: askPassword, + )).then((seed) { + Navigator.pushNamed(context, '/owner/display_seed', arguments: seed); + }); + } + ) + ])), + ])); + } + + Widget inputLine(context, label, obscureText, controller) { + return Container( + width: 200, + child: TextField( + controller: controller, + obscureText: obscureText, + cursorColor: Theme.of(context).accentColor, + decoration: InputDecoration( + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Theme.of(context).accentColor), + ), + labelStyle: TextStyle( + color: Theme.of(context).accentColor, + ), + labelText: label, + floatingLabelBehavior: FloatingLabelBehavior.auto, + ), + autofocus: true, + showCursor: true, + autocorrect: false, + enableInteractiveSelection: false, + textAlign: TextAlign.left, + style: TextStyle( + fontSize: 14, + color: Theme.of(context).primaryColor, + ), + ), ); } -} \ No newline at end of file +} diff --git a/lib/ui/owner/display_seed.dart b/lib/ui/owner/display_seed.dart new file mode 100644 index 0000000..92ba625 --- /dev/null +++ b/lib/ui/owner/display_seed.dart @@ -0,0 +1,90 @@ +import 'package:flutter/material.dart'; + +class DisplaySeed extends StatelessWidget { + + @override + Widget build(BuildContext context) { + final String seed = ModalRoute.of(context).settings.arguments; + + return new Scaffold( + body: Column(children: [ + Row(children: [ + Align( + alignment: Alignment.topLeft, + child: Container( + // decoration: new BoxDecoration(color: Colors.red), + height: 170, + width: 170, + padding: const EdgeInsets.fromLTRB(40, 30, 15, 40), + child: Image( + image: AssetImage('assets/peervault-logo.png') + ), + ), + ), + Container( + padding: const EdgeInsets.fromLTRB(0, 30, 50, 0), + width: MediaQuery.of(context).size.width - 170, + child: Column(children: [ + Row( + children: [Text( + 'Recovery Seed', + style: TextStyle( + color: Colors.white, + height: 1.2, + fontSize: 36, + fontFamily: "Roboto", + ) + )], + ), + SizedBox(height: 30), + Row( + children: [Expanded( + child: Text( + 'Your Vault has been created with sucesss!\n' + 'Please ensure to keep this phrase in security in order ' + 'to restore your Ownership in case of disaster.\n' + 'Keep your paper key somewhere safe, on a cold storage.', + style: TextStyle( + color: Colors.white, + height: 1.3, + fontSize: 14, + fontFamily: "Roboto", + ), + textAlign: TextAlign.justify, + overflow: TextOverflow.ellipsis, + maxLines: 10, + ), + )], + ), + ]) + ), + ]), + SizedBox(height: 50), + Container( + child: Column(children: [ + Text( + seed, + style: TextStyle( + color: Colors.green, + height: 1.3, + fontSize: 16, + fontFamily: "Roboto", + ), + textAlign: TextAlign.left, + overflow: TextOverflow.ellipsis, + maxLines: 10, + ), + SizedBox(height: 30), + FlatButton( + color: Theme.of(context).primaryColor, + child: Text('OK, it\'s somewhere safe!'), + onPressed: () { + Navigator.pushNamed(context, '/home'); + } + ) + ]), + ) + ]) + ); + } +} \ No newline at end of file diff --git a/lib/ui/splash.dart b/lib/ui/splash.dart new file mode 100644 index 0000000..d45ddbe --- /dev/null +++ b/lib/ui/splash.dart @@ -0,0 +1,55 @@ +import 'dart:io'; +import 'package:flutter/material.dart'; +import 'package:peervault/service/api/owner.dart'; +import 'package:peervault/ui/utils/color_loader_2.dart'; +import 'package:peervault/service/daemon.dart'; + +class Splash extends StatefulWidget { + Splash() : super(); + + _Splash createState() => _Splash(); +} + +class _Splash extends State { + Daemon daemon = Daemon(); + + @override + void initState() { + // TODO Need to improve the daemon state monitoring + super.initState(); + this.daemon.status().then((status) { + this.daemon.restart().then((state) { + sleep(new Duration(seconds:2)); + fetchOwner().then((owner) { + if (owner == null) { + Navigator.pushNamed(context, '/createOwner'); + } else { + Navigator.pushNamed(context, '/home', arguments: owner); + } + }); + }); + }); + } + + @override + Widget build(BuildContext context) { + return new Scaffold( + body: Center( + child: Column( + children: [ + Padding( + padding: EdgeInsets.only(top: MediaQuery.of(context).size.height * 0.15), + child: Image( + image: AssetImage('assets/peervault-logo.png'), + fit: BoxFit.scaleDown, + height: 120, + ) + ), + SizedBox(height: 30), + ColorLoader2(), + ] + ) + ) + ); + } +} \ No newline at end of file diff --git a/lib/ui/utils/color_loader_2.dart b/lib/ui/utils/color_loader_2.dart new file mode 100644 index 0000000..2b4a756 --- /dev/null +++ b/lib/ui/utils/color_loader_2.dart @@ -0,0 +1,200 @@ +// Copyright (c) 2018 Samarth Agarwal +// https://github.com/samarthagarwal/FlutterScreens + +import 'package:flutter/material.dart'; +import 'dart:math'; + +class ColorLoader2 extends StatefulWidget { + + final Color color1; + final Color color2; + final Color color3; + + ColorLoader2({this.color1 = Colors.deepOrangeAccent, this.color2 = Colors.yellow, this.color3 = Colors.lightGreen}); + + @override + _ColorLoader2State createState() => _ColorLoader2State(); +} + +class _ColorLoader2State extends State with TickerProviderStateMixin { + + Animation animation1; + Animation animation2; + Animation animation3; + AnimationController controller1; + AnimationController controller2; + AnimationController controller3; + + @override + void initState() { + super.initState(); + + controller1 = AnimationController( + duration: const Duration(milliseconds: 1200), vsync: this); + + controller2 = AnimationController( + duration: const Duration(milliseconds: 900), vsync: this); + + controller3 = AnimationController( + duration: const Duration(milliseconds: 2000), vsync: this); + + animation1 = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( + parent: controller1, + curve: Interval( + 0.0, 1.0, curve: Curves.linear + ) + )); + + animation2 = Tween(begin: -1.0, end: 0.0).animate(CurvedAnimation( + parent: controller2, + curve: Interval( + 0.0, 1.0, curve: Curves.easeIn + ) + )); + + animation3 = Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation( + parent: controller3, + curve: Interval( + 0.0, 1.0, curve: Curves.decelerate + ) + )); + + controller1.repeat(); + controller2.repeat(); + controller3.repeat(); + } + + + @override + Widget build(BuildContext context) { + return Container( + child: Stack( + children: [ + new RotationTransition( + turns: animation1, + child: CustomPaint( + painter: Arc1Painter(widget.color1), + child: Container( + width: 50.0, + height: 50.0, + ), + ), + ), new RotationTransition( + turns: animation2, + child: CustomPaint( + painter: Arc2Painter(widget.color2), + child: Container( + width: 50.0, + height: 50.0, + ), + ), + ), new RotationTransition( + turns: animation3, + child: CustomPaint( + painter: Arc3Painter(widget.color3), + child: Container( + width: 50.0, + height: 50.0, + ), + ), + ) + ], + ), + ); + } + + @override + void dispose() { + controller1.dispose(); + controller2.dispose(); + controller3.dispose(); + super.dispose(); + } + +} + +class Arc1Painter extends CustomPainter { + + final Color color; + + Arc1Painter(this.color); + + @override + void paint(Canvas canvas, Size size) { + + Paint p1 = new Paint() + ..color = color + ..strokeWidth = 2.0 + ..strokeCap = StrokeCap.round + ..style = PaintingStyle.stroke; + + Rect rect1 = new Rect.fromLTWH(0.0, 0.0, size.width, size.height); + + canvas.drawArc(rect1, 0.0 , 0.5 * pi, false, p1); + canvas.drawArc(rect1, 0.6 * pi , 0.8 * pi, false, p1); + canvas.drawArc(rect1, 1.5 * pi , 0.4 * pi, false, p1); + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return true; + } + +} + +class Arc2Painter extends CustomPainter { + + final Color color; + + Arc2Painter(this.color); + + @override + void paint(Canvas canvas, Size size) { + + Paint p2 = new Paint() + ..color = color + ..strokeWidth = 2.0 + ..strokeCap = StrokeCap.round + ..style = PaintingStyle.stroke; + + Rect rect2 = new Rect.fromLTWH(0.0 + (0.2 * size.width)/2, 0.0 + (0.2 * size.height)/2, size.width - 0.2 * size.width, size.height - 0.2 * size.height); + + canvas.drawArc(rect2, 0.0 , 0.5 * pi, false, p2); + canvas.drawArc(rect2, 0.8 * pi , 0.6 * pi, false, p2); + canvas.drawArc(rect2, 1.6 * pi , 0.2 * pi, false, p2); + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return true; + } + +} + +class Arc3Painter extends CustomPainter { + + final Color color; + + Arc3Painter(this.color); + + @override + void paint(Canvas canvas, Size size) { + + Paint p3 = new Paint() + ..color = color + ..strokeWidth = 1.5 + ..strokeCap = StrokeCap.round + ..style = PaintingStyle.stroke; + + Rect rect3 = new Rect.fromLTWH(0.0 + (0.4 * size.width)/2, 0.0 + (0.4 * size.height)/2, size.width - 0.4 * size.width, size.height - 0.4 * size.height); + + canvas.drawArc(rect3, 0.0 , 0.9 * pi, false, p3); + canvas.drawArc(rect3, 1.1 * pi , 0.8 * pi, false, p3); + } + + @override + bool shouldRepaint(CustomPainter oldDelegate) { + return true; + } + +} \ No newline at end of file diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b..785633d 100644 --- a/macos/Flutter/Flutter-Debug.xcconfig +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig index c2efd0b..5fba960 100644 --- a/macos/Flutter/Flutter-Release.xcconfig +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..5193c1a 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,10 @@ import FlutterMacOS import Foundation +import path_provider_macos +import window_utils func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + WindowUtils.register(with: registry.registrar(forPlugin: "WindowUtils")) } diff --git a/macos/Podfile b/macos/Podfile new file mode 100644 index 0000000..d60ec71 --- /dev/null +++ b/macos/Podfile @@ -0,0 +1,82 @@ +platform :osx, '10.11' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def parse_KV_file(file, separator='=') + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return []; + end + pods_ary = [] + skip_line_start_symbols = ["#", "/"] + File.foreach(file_abs_path) { |line| + next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } + plugin = line.split(pattern=separator) + if plugin.length == 2 + podname = plugin[0].strip() + path = plugin[1].strip() + podpath = File.expand_path("#{path}", file_abs_path) + pods_ary.push({:name => podname, :path => podpath}); + else + puts "Invalid plugin specification: #{line}" + end + } + return pods_ary +end + +def pubspec_supports_macos(file) + file_abs_path = File.expand_path(file) + if !File.exists? file_abs_path + return false; + end + File.foreach(file_abs_path) { |line| + return true if line =~ /^\s*macos:/ + } + return false +end + +target 'Runner' do + use_frameworks! + use_modular_headers! + + # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock + # referring to absolute paths on developers' machines. + ephemeral_dir = File.join('Flutter', 'ephemeral') + symlink_dir = File.join(ephemeral_dir, '.symlinks') + symlink_plugins_dir = File.join(symlink_dir, 'plugins') + system("rm -rf #{symlink_dir}") + system("mkdir -p #{symlink_plugins_dir}") + + # Flutter Pods + generated_xcconfig = parse_KV_file(File.join(ephemeral_dir, 'Flutter-Generated.xcconfig')) + if generated_xcconfig.empty? + puts "Flutter-Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." + end + generated_xcconfig.map { |p| + if p[:name] == 'FLUTTER_FRAMEWORK_DIR' + symlink = File.join(symlink_dir, 'flutter') + File.symlink(File.dirname(p[:path]), symlink) + pod 'FlutterMacOS', :path => File.join(symlink, File.basename(p[:path])) + end + } + + # Plugin Pods + plugin_pods = parse_KV_file('../.flutter-plugins') + plugin_pods.map { |p| + symlink = File.join(symlink_plugins_dir, p[:name]) + File.symlink(p[:path], symlink) + if pubspec_supports_macos(File.join(symlink, 'pubspec.yaml')) + pod p[:name], :path => File.join(symlink, 'macos') + end + } +end + +# Prevent Cocoapods from embedding a second Flutter framework and causing an error with the new Xcode build system. +install! 'cocoapods', :disable_input_output_paths => true diff --git a/macos/Podfile.lock b/macos/Podfile.lock new file mode 100644 index 0000000..dc55ed6 --- /dev/null +++ b/macos/Podfile.lock @@ -0,0 +1,33 @@ +PODS: + - FlutterMacOS (1.0.0) + - path_provider (0.0.1) + - path_provider_macos (0.0.1): + - FlutterMacOS + - window_utils (0.0.3): + - FlutterMacOS + +DEPENDENCIES: + - FlutterMacOS (from `Flutter/ephemeral/.symlinks/flutter/darwin-x64-release`) + - path_provider (from `Flutter/ephemeral/.symlinks/plugins/path_provider/macos`) + - path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`) + - window_utils (from `Flutter/ephemeral/.symlinks/plugins/window_utils/macos`) + +EXTERNAL SOURCES: + FlutterMacOS: + :path: Flutter/ephemeral/.symlinks/flutter/darwin-x64-release + path_provider: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider/macos + path_provider_macos: + :path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos + window_utils: + :path: Flutter/ephemeral/.symlinks/plugins/window_utils/macos + +SPEC CHECKSUMS: + FlutterMacOS: 15bea8a44d2fa024068daa0140371c020b4b6ff9 + path_provider: e0848572d1d38b9a7dd099e79cf83f5b7e2cde9f + path_provider_macos: adb94ae6c253c45ef2aac146fbf1f4504d74b0f8 + window_utils: 30d6f8e67c0732ebd021c020cb2634e1da2d8bc6 + +PODFILE CHECKSUM: d8ba9b3e9e93c62c74a660b46c6fcb09f03991a7 + +COCOAPODS: 1.9.0 diff --git a/macos/Runner.xcodeproj/project.pbxproj b/macos/Runner.xcodeproj/project.pbxproj index 1d45b1e..6308921 100644 --- a/macos/Runner.xcodeproj/project.pbxproj +++ b/macos/Runner.xcodeproj/project.pbxproj @@ -28,6 +28,7 @@ 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; }; 33D1A10522148B93006C7A3E /* FlutterMacOS.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = 33D1A10322148B71006C7A3E /* FlutterMacOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 81E741E0F715CF2C1210409D /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D576F2EF9765EBDE233C19D /* Pods_Runner.framework */; }; D73912F022F37F9E000D13A0 /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; }; D73912F222F3801D000D13A0 /* App.framework in Bundle Framework */ = {isa = PBXBuildFile; fileRef = D73912EF22F37F9E000D13A0 /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; /* End PBXBuildFile section */ @@ -58,9 +59,10 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 303C2F6766F54E4B6BEB6AA1 /* 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 = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* peervault.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "peervault.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* peervault.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = peervault.app; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -73,9 +75,12 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; + 3D576F2EF9765EBDE233C19D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; + C257B28E9E67ACA5DE56656B /* 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 = ""; }; D73912EF22F37F9E000D13A0 /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/ephemeral/App.framework; sourceTree = SOURCE_ROOT; }; + E7DDB3F20B829108592DDA70 /* 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -85,6 +90,7 @@ files = ( D73912F022F37F9E000D13A0 /* App.framework in Frameworks */, 33D1A10422148B71006C7A3E /* FlutterMacOS.framework in Frameworks */, + 81E741E0F715CF2C1210409D /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -109,6 +115,7 @@ 33CEB47122A05771004F2AC0 /* Flutter */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, + B4B14676CF9B414AD061763F /* Pods */, ); sourceTree = ""; }; @@ -157,9 +164,21 @@ path = Runner; sourceTree = ""; }; + B4B14676CF9B414AD061763F /* Pods */ = { + isa = PBXGroup; + children = ( + C257B28E9E67ACA5DE56656B /* Pods-Runner.debug.xcconfig */, + 303C2F6766F54E4B6BEB6AA1 /* Pods-Runner.release.xcconfig */, + E7DDB3F20B829108592DDA70 /* Pods-Runner.profile.xcconfig */, + ); + name = Pods; + path = Pods; + sourceTree = ""; + }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( + 3D576F2EF9765EBDE233C19D /* Pods_Runner.framework */, ); name = Frameworks; sourceTree = ""; @@ -171,11 +190,13 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( + A63471A1E7A8CE2BD36DAE4A /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, + C415D006A1DD537BD25110CC /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -282,6 +303,43 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh\ntouch Flutter/ephemeral/tripwire\n"; }; + A63471A1E7A8CE2BD36DAE4A /* [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; + }; + C415D006A1DD537BD25110CC /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + name = "[CP] Embed Pods Frameworks"; + outputFileListPaths = ( + ); + 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 */ diff --git a/macos/Runner.xcworkspace/contents.xcworkspacedata b/macos/Runner.xcworkspace/contents.xcworkspacedata index 1d526a1..21a3cc1 100644 --- a/macos/Runner.xcworkspace/contents.xcworkspacedata +++ b/macos/Runner.xcworkspace/contents.xcworkspacedata @@ -4,4 +4,7 @@ + + diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index a2ec33f..04d0542 100644 --- a/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -3,61 +3,61 @@ { "size" : "16x16", "idiom" : "mac", - "filename" : "app_icon_16.png", + "filename" : "logo-icon-16.png", "scale" : "1x" }, { "size" : "16x16", "idiom" : "mac", - "filename" : "app_icon_32.png", + "filename" : "logo-icon-32.png", "scale" : "2x" }, { "size" : "32x32", "idiom" : "mac", - "filename" : "app_icon_32.png", + "filename" : "logo-icon-32.png", "scale" : "1x" }, { "size" : "32x32", "idiom" : "mac", - "filename" : "app_icon_64.png", + "filename" : "logo-icon-64.png", "scale" : "2x" }, { "size" : "128x128", "idiom" : "mac", - "filename" : "app_icon_128.png", + "filename" : "logo-icon-128.png", "scale" : "1x" }, { "size" : "128x128", "idiom" : "mac", - "filename" : "app_icon_256.png", + "filename" : "logo-icon-256.png", "scale" : "2x" }, { "size" : "256x256", "idiom" : "mac", - "filename" : "app_icon_256.png", + "filename" : "logo-icon-256.png", "scale" : "1x" }, { "size" : "256x256", "idiom" : "mac", - "filename" : "app_icon_512.png", + "filename" : "logo-icon-512.png", "scale" : "2x" }, { "size" : "512x512", "idiom" : "mac", - "filename" : "app_icon_512.png", + "filename" : "logo-icon-512.png", "scale" : "1x" }, { "size" : "512x512", "idiom" : "mac", - "filename" : "app_icon_1024.png", + "filename" : "logo-icon-1024.png", "scale" : "2x" } ], @@ -65,4 +65,4 @@ "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file 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 3c4935a..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 ed4cc16..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 483be61..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 bcbf36d..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 9c0a652..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 e71a726..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 8a31fe2..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/logo-icon-1024.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-1024.png new file mode 100644 index 0000000..16351ff Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-1024.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-128.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-128.png new file mode 100644 index 0000000..b37865f Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-128.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-16.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-16.png new file mode 100644 index 0000000..2ec68f3 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-16.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-256.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-256.png new file mode 100644 index 0000000..bb9f313 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-256.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-32.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-32.png new file mode 100644 index 0000000..f03d424 Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-32.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-512.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-512.png new file mode 100644 index 0000000..b1b2f4f Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-512.png differ diff --git a/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-64.png b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-64.png new file mode 100644 index 0000000..a00426b Binary files /dev/null and b/macos/Runner/Assets.xcassets/AppIcon.appiconset/logo-icon-64.png differ diff --git a/macos/Runner/Configs/AppInfo.xcconfig b/macos/Runner/Configs/AppInfo.xcconfig index f959f6a..c4c0bdc 100644 --- a/macos/Runner/Configs/AppInfo.xcconfig +++ b/macos/Runner/Configs/AppInfo.xcconfig @@ -5,10 +5,10 @@ // 'flutter create' template. // The application's name. By default this is also the title of the Flutter window. -PRODUCT_NAME = peervault +PRODUCT_NAME = Peervault // The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.example.peervault +// PRODUCT_BUNDLE_IDENTIFIER = io.plab.peervault // The copyright displayed in application information PRODUCT_COPYRIGHT = Copyright © 2020 com.example. All rights reserved. diff --git a/macos/Runner/Configs/Debug.xcconfig b/macos/Runner/Configs/Debug.xcconfig index 36b0fd9..b581fc4 100644 --- a/macos/Runner/Configs/Debug.xcconfig +++ b/macos/Runner/Configs/Debug.xcconfig @@ -1,2 +1,4 @@ #include "../../Flutter/Flutter-Debug.xcconfig" #include "Warnings.xcconfig" + +PRODUCT_BUNDLE_IDENTIFIER = io.plab.debug.peervault \ No newline at end of file diff --git a/macos/Runner/Configs/Release.xcconfig b/macos/Runner/Configs/Release.xcconfig index dff4f49..430a57c 100644 --- a/macos/Runner/Configs/Release.xcconfig +++ b/macos/Runner/Configs/Release.xcconfig @@ -1,2 +1,4 @@ #include "../../Flutter/Flutter-Release.xcconfig" #include "Warnings.xcconfig" + +PRODUCT_BUNDLE_IDENTIFIER = io.plab.peervault \ No newline at end of file diff --git a/macos/Runner/DebugProfile.entitlements b/macos/Runner/DebugProfile.entitlements index dddb8a3..08c3ab1 100644 --- a/macos/Runner/DebugProfile.entitlements +++ b/macos/Runner/DebugProfile.entitlements @@ -8,5 +8,7 @@ com.apple.security.network.server + com.apple.security.network.client + diff --git a/macos/Runner/Release.entitlements b/macos/Runner/Release.entitlements index 852fa1a..64cabb4 100644 --- a/macos/Runner/Release.entitlements +++ b/macos/Runner/Release.entitlements @@ -4,5 +4,9 @@ com.apple.security.app-sandbox + com.apple.security.network.server + + com.apple.security.network.client + diff --git a/pubspec.lock b/pubspec.lock index b34c5b7..d3ca631 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,42 +7,42 @@ packages: name: archive url: "https://pub.dartlang.org" source: hosted - version: "2.0.11" + version: "2.0.13" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "1.5.2" + version: "1.6.0" async: dependency: transitive description: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.4.0" + version: "2.4.1" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.5" + version: "2.0.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.1.3" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.14.12" convert: dependency: transitive description: @@ -56,7 +56,7 @@ packages: name: crypto url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "2.1.4" cupertino_icons: dependency: "direct main" description: @@ -74,13 +74,34 @@ packages: description: flutter source: sdk version: "0.0.0" + http: + dependency: "direct main" + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.1" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.12" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.4" matcher: dependency: transitive description: @@ -102,6 +123,34 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.6.4" + path_provider: + dependency: "direct main" + description: + name: path_provider + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.5" + path_provider_macos: + dependency: transitive + description: + name: path_provider_macos + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.0" petitparser: dependency: transitive description: @@ -109,13 +158,41 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.4.0" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.1" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + process_run: + dependency: "direct main" + description: + name: process_run + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.8" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" quiver: dependency: transitive description: name: quiver url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.1.3" sky_engine: dependency: transitive description: flutter @@ -127,7 +204,7 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.5.5" + version: "1.7.0" stack_trace: dependency: transitive description: @@ -162,7 +239,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.14" + version: "0.2.15" typed_data: dependency: transitive description: @@ -177,12 +254,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.8" + window_utils: + dependency: "direct main" + description: + name: window_utils + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" xml: dependency: transitive description: name: xml url: "https://pub.dartlang.org" source: hosted - version: "3.5.0" + version: "3.6.1" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" sdks: - dart: ">=2.4.0 <3.0.0" + dart: ">=2.6.0 <3.0.0" + flutter: ">=1.12.8 <2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 887b6c4..5b0e743 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,15 +11,20 @@ description: Exchange securely secrets between peer using P2P # 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: 1.0.0+1 +version: 0.1.0+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: ">=2.2.0 <3.0.0" dependencies: flutter: sdk: flutter + window_utils: ^1.0.2 + process_run: ^0.10.8 + path_provider: ^1.6.5 + http: ^0.12.1 + # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons.