[
  {
    "path": ".firebaserc",
    "content": "{\n  \"projects\": {\n    \"default\": \"amitjoki-enigma\"\n  }\n}\n"
  },
  {
    "path": ".flutter-plugins",
    "content": "# This is a generated file; do not edit or check into version control.\ncloud_firestore=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\cloud_firestore-0.12.11\\\\\ncontacts_service=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\contacts_service-0.2.9\\\\\nfile_picker=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\file_picker-1.5.0+2\\\\\nfirebase_auth=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\firebase_auth-0.11.1+12\\\\\nfirebase_core=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\firebase_core-0.4.4+3\\\\\nfirebase_core_web=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\firebase_core_web-0.1.1+2\\\\\nfirebase_messaging=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\firebase_messaging-5.1.8\\\\\nfirebase_storage=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\firebase_storage-3.1.3\\\\\nflutter_plugin_android_lifecycle=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\flutter_plugin_android_lifecycle-1.0.6\\\\\nflutter_secure_storage=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\flutter_secure_storage-3.3.1+1\\\\\nfluttertoast=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\fluttertoast-3.1.3\\\\\nimage_cropper=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\image_cropper-1.2.1\\\\\nimage_picker=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\image_picker-0.6.3+4\\\\\nlaunch_review=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\launch_review-2.0.0\\\\\nlocal_auth=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\local_auth-0.4.0+1\\\\\npath_provider=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider-1.6.5\\\\\npath_provider_macos=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\path_provider_macos-0.0.4\\\\\npermission_handler=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\permission_handler-3.3.0\\\\\nshare=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\share-0.6.3+6\\\\\nshared_preferences=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences-0.5.6+3\\\\\nshared_preferences_macos=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_macos-0.0.1+6\\\\\nshared_preferences_web=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\shared_preferences_web-0.1.2+4\\\\\nsqflite=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\sqflite-1.3.0\\\\\nurl_launcher=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher-5.4.2\\\\\nurl_launcher_macos=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_macos-0.0.1+4\\\\\nurl_launcher_web=F:\\\\tools\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.flutter-io.cn\\\\url_launcher_web-0.1.1+1\\\\\n"
  },
  {
    "path": ".flutter-plugins-dependencies",
    "content": "{\"_info\":\"// This is a generated file; do not edit or check into version control.\",\"dependencyGraph\":[{\"name\":\"cloud_firestore\",\"dependencies\":[\"firebase_core\"]},{\"name\":\"contacts_service\",\"dependencies\":[]},{\"name\":\"file_picker\",\"dependencies\":[\"flutter_plugin_android_lifecycle\"]},{\"name\":\"firebase_auth\",\"dependencies\":[\"firebase_core\"]},{\"name\":\"firebase_core\",\"dependencies\":[\"firebase_core_web\"]},{\"name\":\"firebase_core_web\",\"dependencies\":[]},{\"name\":\"firebase_messaging\",\"dependencies\":[]},{\"name\":\"firebase_storage\",\"dependencies\":[\"firebase_core\"]},{\"name\":\"flutter_plugin_android_lifecycle\",\"dependencies\":[]},{\"name\":\"flutter_secure_storage\",\"dependencies\":[]},{\"name\":\"fluttertoast\",\"dependencies\":[]},{\"name\":\"image_cropper\",\"dependencies\":[]},{\"name\":\"image_picker\",\"dependencies\":[\"flutter_plugin_android_lifecycle\"]},{\"name\":\"launch_review\",\"dependencies\":[]},{\"name\":\"local_auth\",\"dependencies\":[]},{\"name\":\"path_provider\",\"dependencies\":[\"path_provider_macos\"]},{\"name\":\"path_provider_macos\",\"dependencies\":[]},{\"name\":\"permission_handler\",\"dependencies\":[]},{\"name\":\"share\",\"dependencies\":[]},{\"name\":\"shared_preferences\",\"dependencies\":[\"shared_preferences_macos\",\"shared_preferences_web\"]},{\"name\":\"shared_preferences_macos\",\"dependencies\":[]},{\"name\":\"shared_preferences_web\",\"dependencies\":[]},{\"name\":\"sqflite\",\"dependencies\":[]},{\"name\":\"url_launcher\",\"dependencies\":[\"url_launcher_web\",\"url_launcher_macos\"]},{\"name\":\"url_launcher_macos\",\"dependencies\":[]},{\"name\":\"url_launcher_web\",\"dependencies\":[]}]}"
  },
  {
    "path": ".gitignore",
    "content": "# Project exclude paths\n/build/"
  },
  {
    "path": ".metadata",
    "content": "# This file tracks properties of this Flutter project.\n# Used by Flutter tool to assess capabilities and perform upgrades etc.\n#\n# This file should be version controlled and should not be manually edited.\n\nversion:\n  revision: c7ea3ca377e909469c68f2ab878a5bc53d3cf66b\n  channel: beta\n"
  },
  {
    "path": ".packages",
    "content": "# Generated by pub on 2020-04-04 23:16:35.612545.\nafter_layout:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/after_layout-1.0.7+2/lib/\nargs:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/args-1.5.4/lib/\nasn1lib:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/asn1lib-0.5.15/lib/\nasync:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/async-2.4.1/lib/\ncached_network_image:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/cached_network_image-2.0.0/lib/\ncharcode:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.3/lib/\nclock:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/clock-1.0.1/lib/\ncloud_firestore:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/cloud_firestore-0.12.11/lib/\ncollection:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/collection-1.14.11/lib/\ncommon_utils:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/common_utils-1.1.3/lib/\ncontacts_service:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/contacts_service-0.2.9/lib/\nconvert:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/convert-2.1.1/lib/\ncrypto:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.1.4/lib/\ncupertino_icons:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/cupertino_icons-0.1.3/lib/\ndecimal:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/decimal-0.3.5/lib/\ndiacritic:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/diacritic-0.1.1/lib/\ndio:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/dio-3.0.9/lib/\nencrypt:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/encrypt-3.3.1/lib/\nfile_picker:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/file_picker-1.5.0+2/lib/\nfirebase:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase-7.2.1/lib/\nfirebase_auth:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_auth-0.11.1+12/lib/\nfirebase_core:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_core-0.4.4+3/lib/\nfirebase_core_platform_interface:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_core_platform_interface-1.0.4/lib/\nfirebase_core_web:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_core_web-0.1.1+2/lib/\nfirebase_messaging:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_messaging-5.1.8/lib/\nfirebase_storage:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/firebase_storage-3.1.3/lib/\nflustars:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/flustars-0.2.6+1/lib/\nflutter:file:///F:/tools/flutter/packages/flutter/lib/\nflutter_cache_manager:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_cache_manager-1.1.3/lib/\nflutter_plugin_android_lifecycle:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_plugin_android_lifecycle-1.0.6/lib/\nflutter_secure_storage:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_secure_storage-3.3.1+1/lib/\nflutter_spinkit:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/flutter_spinkit-4.1.2+1/lib/\nflutter_web_plugins:file:///F:/tools/flutter/packages/flutter_web_plugins/lib/\nfluttertoast:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/fluttertoast-3.1.3/lib/\ngiphy_client:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/giphy_client-0.2.0/lib/\nhttp:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/http-0.12.0+4/lib/\nhttp_parser:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/http_parser-3.1.3/lib/\nimage_cropper:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_cropper-1.2.1/lib/\nimage_picker:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.3+4/lib/\nintl:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/intl-0.15.8/lib/\njs:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/js-0.6.1+1/lib/\nlaunch_review:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/launch_review-2.0.0/lib/\nlocal_auth:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/local_auth-0.4.0+1/lib/\nlocalstorage:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/localstorage-3.0.1+4/lib/\nmarquee:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/marquee-1.3.1/lib/\nmatcher:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.6/lib/\nmeta:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.8/lib/\nmime:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/mime-0.9.6+3/lib/\nntp:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/ntp-1.0.5/lib/\npath:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/path-1.6.4/lib/\npath_provider:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.5/lib/\npath_provider_macos:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4/lib/\npath_provider_platform_interface:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/path_provider_platform_interface-1.0.1/lib/\npedantic:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/pedantic-1.9.0/lib/\npermission_handler:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/permission_handler-3.3.0/lib/\nphoto_view:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/photo_view-0.4.2/lib/\nplatform:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/platform-2.2.1/lib/\nplugin_platform_interface:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/plugin_platform_interface-1.0.2/lib/\npointycastle:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/pointycastle-1.0.2/lib/\nquiver:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/quiver-2.1.3/lib/\nrational:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/rational-0.3.8/lib/\nrxdart:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/rxdart-0.23.1/lib/\nscoped_model:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/scoped_model-1.0.1/lib/\nsentry:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/sentry-2.3.1/lib/\nshare:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/share-0.6.3+6/lib/\nshared_preferences:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences-0.5.6+3/lib/\nshared_preferences_macos:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_macos-0.0.1+6/lib/\nshared_preferences_platform_interface:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_platform_interface-1.0.3/lib/\nshared_preferences_web:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/shared_preferences_web-0.1.2+4/lib/\nsky_engine:file:///F:/tools/flutter/bin/cache/pkg/sky_engine/lib/\nsource_span:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/source_span-1.6.0/lib/\nsqflite:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite-1.3.0/lib/\nsqflite_common:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/sqflite_common-1.0.0+1/lib/\nstack_trace:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/stack_trace-1.9.3/lib/\nstring_scanner:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/string_scanner-1.0.5/lib/\nsynchronized:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/synchronized-2.2.0/lib/\nterm_glyph:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/term_glyph-1.1.0/lib/\ntyped_data:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/typed_data-1.1.6/lib/\nurl_launcher:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.4.2/lib/\nurl_launcher_macos:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_macos-0.0.1+4/lib/\nurl_launcher_platform_interface:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_platform_interface-1.0.6/lib/\nurl_launcher_web:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/url_launcher_web-0.1.1+1/lib/\nusage:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/usage-3.4.1/lib/\nuuid:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/uuid-2.0.4/lib/\nvector_math:file:///F:/tools/flutter/.pub-cache/hosted/pub.flutter-io.cn/vector_math-2.0.8/lib/\nEnigma:lib/\n"
  },
  {
    "path": "LICENSE.md",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published\n    by the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<https://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "Privacy_Policy.md",
    "content": "# Privacy Policy\n\nEffective date: April 18, 2019\n\nEnigma (\"us\", \"we\", or \"our\") operates the Enigma mobile application (the \"Service\").\n\nThis page informs you of our policies regarding the collection, use, and disclosure of personal data when you use our Service and the choices you have associated with that data.\n\nWe use your data to provide and improve the Service. By using the Service, you agree to the collection and use of information in accordance with this policy. Unless otherwise defined in this Privacy Policy, terms used in this Privacy Policy have the same meanings as in our Terms and Conditions.\n\n## Information Collection And Use\n\nWe collect several different types of information for various purposes to provide and improve our Service to you.\n\n### Types of Data Collected\n\nWhile using our Service, we may ask you to provide us with certain personally identifiable information that can be used to contact or identify you (\"Personal Data\"). Personally identifiable information may include, but is not limited to:\n\n*   Your account information\n*   Your contacts\n*   Your messages\n*   Cookies and Usage Data\n\n### Your account information\n\nYou provide us your phone number for authentication purpose as well as to help other people connect to you.  You may also add additional information to identify yourself across our Services such as your name, status, profile picture.\n\n### Your contacts\n\nSimilar to how others can connect to you with your provided phone number, you can connect to others for which you provide the contacts in your mobile address book. These information will solely be used to identify prospective connections that you may make through our Services.\n\n### Your messages\n\nYour messages may include, but is not limited to: \n\n* Text Messages\n* Similies or Emoticons\n* Photos\n\nThe above information provided by you will be solely used to commmunicate with your connections. The security of these information is maintained during uploading and storing of the data by encryption provided by the Firebase service.\n\nYou are in complete control of your messages and can delete your messages at any point of time. Messages once deleted are deleted permanently with no other copies anywhere on the server.\n\n### Usage Data\n\nWhen you access the Service by or through a mobile device, we may collect certain information automatically, including, but not limited to, the type of mobile device you use, your mobile device unique ID, the IP address of your mobile device, your mobile operating system, the type of mobile Internet browser you use, unique device identifiers and other diagnostic data (\"Usage Data\").\n\n### Tracking & Cookies Data\n\nWe use cookies and similar tracking technologies to track the activity on our Service and hold certain information.\n\nCookies are files with small amount of data which may include an anonymous unique identifier. Cookies are sent to your browser from a website and stored on your device. Tracking technologies also used are beacons, tags, and scripts to collect and track information and to improve and analyze our Service.\n\nYou can instruct your browser to refuse all cookies or to indicate when a cookie is being sent. However, if you do not accept cookies, you may not be able to use some portions of our Service.\n\nExamples of Cookies we use:\n\n*   **Session Cookies.** We use Session Cookies to operate our Service.\n*   **Preference Cookies.** We use Preference Cookies to remember your preferences and various settings.\n*   **Security Cookies.** We use Security Cookies for security purposes.\n\n## Use of Data\n\nEnigma uses the collected data for various purposes:\n\n*   To provide and maintain the Service\n*   To notify you about changes to our Service\n*   To allow you to participate in interactive features of our Service when you choose to do so\n*   To provide customer care and support\n*   To provide analysis or valuable information so that we can improve the Service\n*   To monitor the usage of the Service\n*   To detect, prevent and address technical issues\n\n## Transfer Of Data\n\nYour information, including Personal Data, may be transferred to — and maintained on — computers located outside of your state, province, country or other governmental jurisdiction where the data protection laws may differ than those from your jurisdiction.\n\nIf you are located outside India and choose to provide information to us, please note that we transfer the data, including Personal Data, to India and process it there.\n\nYour consent to this Privacy Policy followed by your submission of such information represents your agreement to that transfer.\n\nEnigma will take all steps reasonably necessary to ensure that your data is treated securely and in accordance with this Privacy Policy and no transfer of your Personal Data will take place to an organization or a country unless there are adequate controls in place including the security of your data and other personal information.\n\n## Disclosure Of Data\n\n### Legal Requirements\n\nEnigma may disclose your Personal Data in the good faith belief that such action is necessary to:\n\n*   To comply with a legal obligation\n*   To protect and defend the rights or property of Enigma\n*   To prevent or investigate possible wrongdoing in connection with the Service\n*   To protect the personal safety of users of the Service or the public\n*   To protect against legal liability\n\n## Security Of Data\n\nThe security of your data is important to us, but remember that no method of transmission over the Internet, or method of electronic storage is 100% secure. While we strive to use commercially acceptable means to protect your Personal Data, we cannot guarantee its absolute security.\n\n## Service Providers\n\nWe may employ third party companies and individuals to facilitate our Service (\"Service Providers\"), to provide the Service on our behalf, to perform Service-related services or to assist us in analyzing how our Service is used.\n\nThese third parties have access to your Personal Data only to perform these tasks on our behalf and are obligated not to disclose or use it for any other purpose.\n\n### Analytics\n\nWe may use third-party Service Providers to monitor and analyze the use of our Service.\n\n#### Google Analytics\n\nGoogle Analytics is a web analytics service offered by Google that tracks and reports website traffic. Google uses the data collected to track and monitor the use of our Service. This data is shared with other Google services. Google may use the collected data to contextualize and personalize the ads of its own advertising network.\n\nYou may opt-out of certain Google Analytics features through your mobile device settings, such as your device advertising settings or by following the instructions provided by Google in their Privacy Policy: [https://policies.google.com/privacy?hl=en](https://policies.google.com/privacy?hl=en)\n\nFor more information on the privacy practices of Google, please visit the Google Privacy & Terms web page: [https://policies.google.com/privacy?hl=en](https://policies.google.com/privacy?hl=en)\n\n#### Firebase\n\nFirebase is analytics service provided by Google Inc.\n\nYou may opt-out of certain Firebase features through your mobile device settings, such as your device advertising settings or by following the instructions provided by Google in their Privacy Policy: [https://policies.google.com/privacy?hl=en](https://policies.google.com/privacy?hl=en)\n\nWe also encourage you to review the Google's policy for safeguarding your data: [https://support.google.com/analytics/answer/6004245](https://support.google.com/analytics/answer/6004245). For more information on what type of information Firebase collects, please visit please visit the Google Privacy & Terms web page: [https://policies.google.com/privacy?hl=en](https://policies.google.com/privacy?hl=en)\n\n## Links To Other Sites\n\nOur Service may contain links to other sites that are not operated by us. If you click on a third party link, you will be directed to that third party's site. We strongly advise you to review the Privacy Policy of every site you visit.\n\nWe have no control over and assume no responsibility for the content, privacy policies or practices of any third party sites or services.\n\n## Age Privacy\n\nOur Service does not address anyone under the age of 13.\n\nWe do not knowingly collect personally identifiable information from anyone under the age of 13 (or such greater age required in your country for you to be authorized to use our Services without parental approval). If you are a parent or guardian and you are aware that your children has provided us with Personal Data, please contact us. If we become aware that we have collected Personal Data from children without verification of parental consent, we take steps to remove that information from our servers.\n\n## Changes To This Privacy Policy\n\nWe may update our Privacy Policy from time to time. We will notify you of any changes by posting the new Privacy Policy on this page.\n\nWe will let you know via email and/or a prominent notice on our Service, prior to the change becoming effective and update the \"effective date\" at the top of this Privacy Policy.\n\nYou are advised to review this Privacy Policy periodically for any changes. Changes to this Privacy Policy are effective when they are posted on this page.\n\n## Contact Us\n\nIf you have any questions about this Privacy Policy, please contact us:\n\n*   By email: amitjoki@gmail.com\n*   By visiting this page on our website: https://amitjoki.github.io/Enigma/Privacy_Policy\n"
  },
  {
    "path": "analysis_options.yaml",
    "content": "linter:\n  rules:\n    - avoid_empty_else\n    - avoid_init_to_null\n    - avoid_relative_lib_imports\n    - avoid_return_types_on_setters\n    - avoid_shadowing_type_parameters\n    - avoid_types_as_parameter_names\n    - empty_constructor_bodies\n    - no_duplicate_case_values\n    - null_closures\n    - prefer_contains\n    - prefer_equal_for_default_values\n    - prefer_is_empty\n    - prefer_is_not_empty\n    - recursive_getters\n    - slash_for_doc_comments\n    - unawaited_futures\n    - unrelated_type_equality_checks\n    - use_rethrow_when_possible\n    - valid_regexps\n"
  },
  {
    "path": "android/.gitignore",
    "content": "*.iml\n*.class\n.gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\nGeneratedPluginRegistrant.java\n"
  },
  {
    "path": "android/app/build.gradle",
    "content": "def localProperties = new Properties()\ndef localPropertiesFile = rootProject.file('local.properties')\nif (localPropertiesFile.exists()) {\n    localPropertiesFile.withReader('UTF-8') { reader ->\n        localProperties.load(reader)\n    }\n}\n\ndef flutterRoot = localProperties.getProperty('flutter.sdk')\nif (flutterRoot == null) {\n    throw new GradleException(\"Flutter SDK not found. Define location with flutter.sdk in the local.properties file.\")\n}\n\napply plugin: 'com.android.application'\napply from: \"$flutterRoot/packages/flutter_tools/gradle/flutter.gradle\"\n\ndef keystoreProperties = new Properties()\ndef keystorePropertiesFile = rootProject.file('key.properties')\nif (keystorePropertiesFile.exists()) {\n    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))\n}\n\nandroid {\n    compileSdkVersion 28\n\n    lintOptions {\n        disable 'InvalidPackage'\n        checkReleaseBuilds false\n    }\n\n    defaultConfig {\n        applicationId \"com.mlx.ZH\"\n        minSdkVersion 18\n        targetSdkVersion 28\n        versionCode 13\n        versionName \"2.1\"\n        testInstrumentationRunner \"androidx.test.runner.AndroidJUnitRunner\"\n        multiDexEnabled true //Insert this line\n    }\n\n    signingConfigs {\n        debug {\n\n        }\n        release {\n\n        }\n    }\n\n    buildTypes {\n        release {\n            signingConfig signingConfigs.release\n            minifyEnabled true\n            useProguard false\n\n            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'\n        }\n        debug {\n            debuggable true\n            signingConfig signingConfigs.debug\n        }\n    }\n}\n\nflutter {\n    source '../..'\n}\n\ndependencies {\n    testImplementation 'junit:junit:4.12'\n    androidTestImplementation 'androidx.test:runner:1.1.0'\n    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'\n    implementation 'com.google.firebase:firebase-auth:17.0.0'\n    implementation 'com.google.firebase:firebase-inappmessaging-display:17.2.0'\n    implementation 'com.google.firebase:firebase-messaging:18.0.0'\n    implementation 'com.google.firebase:firebase-core:16.0.9'\n}\n\napply plugin: 'com.google.gms.google-services'\n"
  },
  {
    "path": "android/app/google-services.json",
    "content": "{\n  \"project_info\": {\n    \"project_number\": \"380383165909\",\n    \"firebase_url\": \"https://wechat-af1e1.firebaseio.com\",\n    \"project_id\": \"wechat-af1e1\",\n    \"storage_bucket\": \"wechat-af1e1.appspot.com\"\n  },\n  \"client\": [\n    {\n      \"client_info\": {\n        \"mobilesdk_app_id\": \"1:380383165909:android:7a8c2f1621bd632310915c\",\n        \"android_client_info\": {\n          \"package_name\": \"com.blackhole.chat_app\"\n        }\n      },\n      \"oauth_client\": [\n        {\n          \"client_id\": \"380383165909-12o7mhi72tsvg28ij81nkndt50nrfepp.apps.googleusercontent.com\",\n          \"client_type\": 1,\n          \"android_info\": {\n            \"package_name\": \"com.blackhole.chat_app\",\n            \"certificate_hash\": \"7984477e445cf4999eb2474f2c537f090dd62ee9\"\n          }\n        },\n        {\n          \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n          \"client_type\": 3\n        }\n      ],\n      \"api_key\": [\n        {\n          \"current_key\": \"AIzaSyDiqnr3_kgI6iofU7187VNLoAAcTEyU1bo\"\n        }\n      ],\n      \"services\": {\n        \"appinvite_service\": {\n          \"other_platform_oauth_client\": [\n            {\n              \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n              \"client_type\": 3\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"client_info\": {\n        \"mobilesdk_app_id\": \"1:380383165909:android:b559e6ef499cb1ce10915c\",\n        \"android_client_info\": {\n          \"package_name\": \"com.enigma.amitjoki\"\n        }\n      },\n      \"oauth_client\": [\n        {\n          \"client_id\": \"380383165909-qaihn47rhqch6cn8fa8cs1ibcqonemub.apps.googleusercontent.com\",\n          \"client_type\": 1,\n          \"android_info\": {\n            \"package_name\": \"com.enigma.amitjoki\",\n            \"certificate_hash\": \"7984477e445cf4999eb2474f2c537f090dd62ee9\"\n          }\n        },\n        {\n          \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n          \"client_type\": 3\n        }\n      ],\n      \"api_key\": [\n        {\n          \"current_key\": \"AIzaSyDiqnr3_kgI6iofU7187VNLoAAcTEyU1bo\"\n        }\n      ],\n      \"services\": {\n        \"appinvite_service\": {\n          \"other_platform_oauth_client\": [\n            {\n              \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n              \"client_type\": 3\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"client_info\": {\n        \"mobilesdk_app_id\": \"1:380383165909:android:4d9db80f3c6a713410915c\",\n        \"android_client_info\": {\n          \"package_name\": \"com.mlx.ZH\"\n        }\n      },\n      \"oauth_client\": [\n        {\n          \"client_id\": \"380383165909-vcbgpnibdo97538imamg91cl9ve0voa6.apps.googleusercontent.com\",\n          \"client_type\": 1,\n          \"android_info\": {\n            \"package_name\": \"com.mlx.ZH\",\n            \"certificate_hash\": \"7984477e445cf4999eb2474f2c537f090dd62ee9\"\n          }\n        },\n        {\n          \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n          \"client_type\": 3\n        }\n      ],\n      \"api_key\": [\n        {\n          \"current_key\": \"AIzaSyDiqnr3_kgI6iofU7187VNLoAAcTEyU1bo\"\n        }\n      ],\n      \"services\": {\n        \"appinvite_service\": {\n          \"other_platform_oauth_client\": [\n            {\n              \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n              \"client_type\": 3\n            }\n          ]\n        }\n      }\n    },\n    {\n      \"client_info\": {\n        \"mobilesdk_app_id\": \"1:380383165909:android:0f6aa2b1d01a955910915c\",\n        \"android_client_info\": {\n          \"package_name\": \"com.mlx.memechat\"\n        }\n      },\n      \"oauth_client\": [\n        {\n          \"client_id\": \"380383165909-guhd14pf9kff354nsappcki1jhj29jn8.apps.googleusercontent.com\",\n          \"client_type\": 1,\n          \"android_info\": {\n            \"package_name\": \"com.mlx.memechat\",\n            \"certificate_hash\": \"3d832e7cdc5817ccea06c41563180431703e3c11\"\n          }\n        },\n        {\n          \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n          \"client_type\": 3\n        }\n      ],\n      \"api_key\": [\n        {\n          \"current_key\": \"AIzaSyDiqnr3_kgI6iofU7187VNLoAAcTEyU1bo\"\n        }\n      ],\n      \"services\": {\n        \"appinvite_service\": {\n          \"other_platform_oauth_client\": [\n            {\n              \"client_id\": \"380383165909-s8k7v2umgj3tarl4k0p57clma82qmihi.apps.googleusercontent.com\",\n              \"client_type\": 3\n            }\n          ]\n        }\n      }\n    }\n  ],\n  \"configuration_version\": \"1\"\n}"
  },
  {
    "path": "android/app/proguard-rules.pro",
    "content": "#Flutter Wrapper\n-keep class io.flutter.app.** { *; }\n-keep class io.flutter.plugin.**  { *; }\n-keep class io.flutter.util.**  { *; }\n-keep class io.flutter.view.**  { *; }\n-keep class io.flutter.**  { *; }\n-keep class io.flutter.plugins.**  { *; }\n"
  },
  {
    "path": "android/app/src/main/AndroidManifest.xml",
    "content": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package=\"com.mlx.ZH\">\n\n    <!-- The INTERNET permission is required for development. Specifically,\n         flutter needs it to communicate with the running application\n         to allow setting breakpoints, to provide hot reload, etc.\n    -->\n    <uses-permission android:name=\"android.permission.INTERNET\"/>\n    <uses-permission android:name=\"android.permission.CAMERA\" />\n    <uses-permission android:name=\"android.permission.FLASHLIGHT\" />\n    <uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\" />\n    <uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>\n    <uses-permission android:name=\"android.permission.READ_CONTACTS\" />\n    <uses-permission android:name=\"android.permission.WRITE_CONTACTS\" />\n    <uses-permission android:name=\"android.permission.USE_FINGERPRINT\"/>\n    <!-- io.flutter.app.FlutterApplication is an android.app.Application that\n         calls FlutterMain.startInitialization(this); in its onCreate method.\n         In most cases you can leave this as-is, but you if you want to provide\n         additional functionality it is fine to subclass or reimplement\n         FlutterApplication and put your custom class here. -->\n    <application\n        android:name=\"io.flutter.app.FlutterApplication\"\n        android:label=\"ZH\"\n        android:icon=\"@mipmap/launcher_icon\">\n        <activity\n            android:name=\".MainActivity\"\n            android:launchMode=\"singleTop\"\n            android:theme=\"@style/LaunchTheme\"\n            android:configChanges=\"orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density\"\n            android:hardwareAccelerated=\"true\"\n            android:windowSoftInputMode=\"adjustResize\">\n            <!-- This keeps the window background of the activity showing\n                 until Flutter renders its first frame. It can be removed if\n                 there is no splash screen (such as the default splash screen\n                 defined in @style/LaunchTheme). -->\n            <meta-data\n                android:name=\"io.flutter.app.android.SplashScreenUntilFirstFrame\"\n                android:value=\"true\" />\n            <intent-filter>\n                <action android:name=\"android.intent.action.MAIN\"/>\n                <category android:name=\"android.intent.category.LAUNCHER\"/>\n            </intent-filter>\n            <intent-filter>\n                <action android:name=\"FLUTTER_NOTIFICATION_CLICK\" />\n                <category android:name=\"android.intent.category.DEFAULT\" />\n            </intent-filter>\n        </activity>\n        <activity\n            android:name=\"com.yalantis.ucrop.UCropActivity\"\n            android:screenOrientation=\"portrait\"\n            android:theme=\"@style/Theme.AppCompat.Light.NoActionBar\"/>\n    </application>\n</manifest>\n"
  },
  {
    "path": "android/app/src/main/java/com/dfa/flutterchatdemo/MainActivity.java",
    "content": "package com.mlx.ZH;\n\nimport android.os.Bundle;\nimport io.flutter.app.FlutterActivity;\nimport io.flutter.plugins.GeneratedPluginRegistrant;\n\npublic class MainActivity extends FlutterActivity {\n  @Override\n  protected void onCreate(Bundle savedInstanceState) {\n    super.onCreate(savedInstanceState);\n    GeneratedPluginRegistrant.registerWith(this);\n  }\n}\n"
  },
  {
    "path": "android/app/src/main/res/drawable/launch_background.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- Modify this file to customize your launch splash screen -->\n<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n    <item android:drawable=\"@color/enigma_black\" />\n    <item>\n        <bitmap android:gravity=\"fill\" android:src=\"@drawable/bg\" />\n    </item>\n</layer-list>\n"
  },
  {
    "path": "android/app/src/main/res/values/colors.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n  <color name=\"enigma_black\">#1e1e1e</color>\n</resources>\n"
  },
  {
    "path": "android/app/src/main/res/values/styles.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n    <style name=\"LaunchTheme\" parent=\"@android:style/Theme.Black.NoTitleBar\">\n        <!-- Show a splash screen on the activity. Automatically removed when\n             Flutter draws its first frame -->\n        <item name=\"android:windowBackground\">@drawable/launch_background</item>\n    </style>\n</resources>\n"
  },
  {
    "path": "android/build.gradle",
    "content": "buildscript {\n    repositories {\n        google()\n        jcenter()\n    }\n\n    dependencies {\n        classpath 'com.android.tools.build:gradle:3.3.0'\n        classpath 'com.google.gms:google-services:4.2.0'\n    }\n}\n\nallprojects {\n    repositories {\n        google()\n        jcenter()\n    }\n}\n\nrootProject.buildDir = '../build'\nsubprojects {\n    project.buildDir = \"${rootProject.buildDir}/${project.name}\"\n}\nsubprojects {\n    project.evaluationDependsOn(':app')\n}\nsubprojects {\n    project.configurations.all {\n        resolutionStrategy.eachDependency { details ->\n            if (details.requested.group == 'com.androidx'\n                    && !details.requested.name.contains('multidex') ) {\n                details.useVersion \"26.1.0\"\n            }\n        }\n    }\n}\ntask clean(type: Delete) {\n    delete rootProject.buildDir\n}\n"
  },
  {
    "path": "android/gradle/wrapper/gradle-wrapper.properties",
    "content": "#Fri Jun 23 08:50:38 CEST 2017\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dists\ndistributionUrl=https\\://services.gradle.org/distributions/gradle-4.10.2-all.zip\n"
  },
  {
    "path": "android/gradle.properties",
    "content": "org.gradle.jvmargs=-Xmx1536M\nandroid.useAndroidX=true\nandroid.enableJetifier=true\nandroid.enableR8=true\n"
  },
  {
    "path": "android/gradlew",
    "content": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start up script for UN*X\n##\n##############################################################################\n\n# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nDEFAULT_JVM_OPTS=\"\"\n\nAPP_NAME=\"Gradle\"\nAPP_BASE_NAME=`basename \"$0\"`\n\n# Use the maximum available, or set MAX_FD != -1 to use that value.\nMAX_FD=\"maximum\"\n\nwarn ( ) {\n    echo \"$*\"\n}\n\ndie ( ) {\n    echo\n    echo \"$*\"\n    echo\n    exit 1\n}\n\n# OS specific support (must be 'true' or 'false').\ncygwin=false\nmsys=false\ndarwin=false\ncase \"`uname`\" in\n  CYGWIN* )\n    cygwin=true\n    ;;\n  Darwin* )\n    darwin=true\n    ;;\n  MINGW* )\n    msys=true\n    ;;\nesac\n\n# Attempt to set APP_HOME\n# Resolve links: $0 may be a link\nPRG=\"$0\"\n# Need this for relative symlinks.\nwhile [ -h \"$PRG\" ] ; do\n    ls=`ls -ld \"$PRG\"`\n    link=`expr \"$ls\" : '.*-> \\(.*\\)$'`\n    if expr \"$link\" : '/.*' > /dev/null; then\n        PRG=\"$link\"\n    else\n        PRG=`dirname \"$PRG\"`\"/$link\"\n    fi\ndone\nSAVED=\"`pwd`\"\ncd \"`dirname \\\"$PRG\\\"`/\" >/dev/null\nAPP_HOME=\"`pwd -P`\"\ncd \"$SAVED\" >/dev/null\n\nCLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar\n\n# Determine the Java command to use to start the JVM.\nif [ -n \"$JAVA_HOME\" ] ; then\n    if [ -x \"$JAVA_HOME/jre/sh/java\" ] ; then\n        # IBM's JDK on AIX uses strange locations for the executables\n        JAVACMD=\"$JAVA_HOME/jre/sh/java\"\n    else\n        JAVACMD=\"$JAVA_HOME/bin/java\"\n    fi\n    if [ ! -x \"$JAVACMD\" ] ; then\n        die \"ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\n    fi\nelse\n    JAVACMD=\"java\"\n    which java >/dev/null 2>&1 || die \"ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\n\nPlease set the JAVA_HOME variable in your environment to match the\nlocation of your Java installation.\"\nfi\n\n# Increase the maximum file descriptors if we can.\nif [ \"$cygwin\" = \"false\" -a \"$darwin\" = \"false\" ] ; then\n    MAX_FD_LIMIT=`ulimit -H -n`\n    if [ $? -eq 0 ] ; then\n        if [ \"$MAX_FD\" = \"maximum\" -o \"$MAX_FD\" = \"max\" ] ; then\n            MAX_FD=\"$MAX_FD_LIMIT\"\n        fi\n        ulimit -n $MAX_FD\n        if [ $? -ne 0 ] ; then\n            warn \"Could not set maximum file descriptor limit: $MAX_FD\"\n        fi\n    else\n        warn \"Could not query maximum file descriptor limit: $MAX_FD_LIMIT\"\n    fi\nfi\n\n# For Darwin, add options to specify how the application appears in the dock\nif $darwin; then\n    GRADLE_OPTS=\"$GRADLE_OPTS \\\"-Xdock:name=$APP_NAME\\\" \\\"-Xdock:icon=$APP_HOME/media/gradle.icns\\\"\"\nfi\n\n# For Cygwin, switch paths to Windows format before running java\nif $cygwin ; then\n    APP_HOME=`cygpath --path --mixed \"$APP_HOME\"`\n    CLASSPATH=`cygpath --path --mixed \"$CLASSPATH\"`\n    JAVACMD=`cygpath --unix \"$JAVACMD\"`\n\n    # We build the pattern for arguments to be converted via cygpath\n    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`\n    SEP=\"\"\n    for dir in $ROOTDIRSRAW ; do\n        ROOTDIRS=\"$ROOTDIRS$SEP$dir\"\n        SEP=\"|\"\n    done\n    OURCYGPATTERN=\"(^($ROOTDIRS))\"\n    # Add a user-defined pattern to the cygpath arguments\n    if [ \"$GRADLE_CYGPATTERN\" != \"\" ] ; then\n        OURCYGPATTERN=\"$OURCYGPATTERN|($GRADLE_CYGPATTERN)\"\n    fi\n    # Now convert the arguments - kludge to limit ourselves to /bin/sh\n    i=0\n    for arg in \"$@\" ; do\n        CHECK=`echo \"$arg\"|egrep -c \"$OURCYGPATTERN\" -`\n        CHECK2=`echo \"$arg\"|egrep -c \"^-\"`                                 ### Determine if an option\n\n        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition\n            eval `echo args$i`=`cygpath --path --ignore --mixed \"$arg\"`\n        else\n            eval `echo args$i`=\"\\\"$arg\\\"\"\n        fi\n        i=$((i+1))\n    done\n    case $i in\n        (0) set -- ;;\n        (1) set -- \"$args0\" ;;\n        (2) set -- \"$args0\" \"$args1\" ;;\n        (3) set -- \"$args0\" \"$args1\" \"$args2\" ;;\n        (4) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" ;;\n        (5) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" ;;\n        (6) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" ;;\n        (7) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" ;;\n        (8) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" ;;\n        (9) set -- \"$args0\" \"$args1\" \"$args2\" \"$args3\" \"$args4\" \"$args5\" \"$args6\" \"$args7\" \"$args8\" ;;\n    esac\nfi\n\n# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules\nfunction splitJvmOpts() {\n    JVM_OPTS=(\"$@\")\n}\neval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS\nJVM_OPTS[${#JVM_OPTS[*]}]=\"-Dorg.gradle.appname=$APP_BASE_NAME\"\n\nexec \"$JAVACMD\" \"${JVM_OPTS[@]}\" -classpath \"$CLASSPATH\" org.gradle.wrapper.GradleWrapperMain \"$@\"\n"
  },
  {
    "path": "android/gradlew.bat",
    "content": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem  Gradle startup script for Windows\n@rem\n@rem ##########################################################################\n\n@rem Set local scope for the variables with windows NT shell\nif \"%OS%\"==\"Windows_NT\" setlocal\n\n@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.\nset DEFAULT_JVM_OPTS=\n\nset DIRNAME=%~dp0\nif \"%DIRNAME%\" == \"\" set DIRNAME=.\nset APP_BASE_NAME=%~n0\nset APP_HOME=%DIRNAME%\n\n@rem Find java.exe\nif defined JAVA_HOME goto findJavaFromJavaHome\n\nset JAVA_EXE=java.exe\n%JAVA_EXE% -version >NUL 2>&1\nif \"%ERRORLEVEL%\" == \"0\" goto init\n\necho.\necho ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:findJavaFromJavaHome\nset JAVA_HOME=%JAVA_HOME:\"=%\nset JAVA_EXE=%JAVA_HOME%/bin/java.exe\n\nif exist \"%JAVA_EXE%\" goto init\n\necho.\necho ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%\necho.\necho Please set the JAVA_HOME variable in your environment to match the\necho location of your Java installation.\n\ngoto fail\n\n:init\n@rem Get command-line arguments, handling Windowz variants\n\nif not \"%OS%\" == \"Windows_NT\" goto win9xME_args\nif \"%@eval[2+2]\" == \"4\" goto 4NT_args\n\n:win9xME_args\n@rem Slurp the command line arguments.\nset CMD_LINE_ARGS=\nset _SKIP=2\n\n:win9xME_args_slurp\nif \"x%~1\" == \"x\" goto execute\n\nset CMD_LINE_ARGS=%*\ngoto execute\n\n:4NT_args\n@rem Get arguments from the 4NT Shell from JP Software\nset CMD_LINE_ARGS=%$\n\n:execute\n@rem Setup the command line\n\nset CLASSPATH=%APP_HOME%\\gradle\\wrapper\\gradle-wrapper.jar\n\n@rem Execute Gradle\n\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% \"-Dorg.gradle.appname=%APP_BASE_NAME%\" -classpath \"%CLASSPATH%\" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%\n\n:end\n@rem End local scope for the variables with windows NT shell\nif \"%ERRORLEVEL%\"==\"0\" goto mainEnd\n\n:fail\nrem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of\nrem the _cmd.exe /c_ return code!\nif  not \"\" == \"%GRADLE_EXIT_CONSOLE%\" exit 1\nexit /b 1\n\n:mainEnd\nif \"%OS%\"==\"Windows_NT\" endlocal\n\n:omega\n"
  },
  {
    "path": "android/settings.gradle",
    "content": "include ':app'\n\ndef flutterProjectRoot = rootProject.projectDir.parentFile.toPath()\n\ndef plugins = new Properties()\ndef pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')\nif (pluginsFile.exists()) {\n    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }\n}\n\nplugins.each { name, path ->\n    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()\n    include \":$name\"\n    project(\":$name\").projectDir = pluginDirectory\n}\n"
  },
  {
    "path": "assets/fonts/montserrat/OFL.txt",
    "content": "Copyright 2011 The Montserrat Project Authors (https://github.com/JulietaUla/Montserrat)\n\nThis Font Software is licensed under the SIL Open Font License, Version 1.1.\nThis license is copied below, and is also available with a FAQ at:\nhttp://scripts.sil.org/OFL\n\n\n-----------------------------------------------------------\nSIL OPEN FONT LICENSE Version 1.1 - 26 February 2007\n-----------------------------------------------------------\n\nPREAMBLE\nThe goals of the Open Font License (OFL) are to stimulate worldwide\ndevelopment of collaborative font projects, to support the font creation\nefforts of academic and linguistic communities, and to provide a free and\nopen framework in which fonts may be shared and improved in partnership\nwith others.\n\nThe OFL allows the licensed fonts to be used, studied, modified and\nredistributed freely as long as they are not sold by themselves. The\nfonts, including any derivative works, can be bundled, embedded, \nredistributed and/or sold with any software provided that any reserved\nnames are not used by derivative works. The fonts and derivatives,\nhowever, cannot be released under any other type of license. The\nrequirement for fonts to remain under this license does not apply\nto any document created using the fonts or their derivatives.\n\nDEFINITIONS\n\"Font Software\" refers to the set of files released by the Copyright\nHolder(s) under this license and clearly marked as such. This may\ninclude source files, build scripts and documentation.\n\n\"Reserved Font Name\" refers to any names specified as such after the\ncopyright statement(s).\n\n\"Original Version\" refers to the collection of Font Software components as\ndistributed by the Copyright Holder(s).\n\n\"Modified Version\" refers to any derivative made by adding to, deleting,\nor substituting -- in part or in whole -- any of the components of the\nOriginal Version, by changing formats or by porting the Font Software to a\nnew environment.\n\n\"Author\" refers to any designer, engineer, programmer, technical\nwriter or other person who contributed to the Font Software.\n\nPERMISSION & CONDITIONS\nPermission is hereby granted, free of charge, to any person obtaining\na copy of the Font Software, to use, study, copy, merge, embed, modify,\nredistribute, and sell modified and unmodified copies of the Font\nSoftware, subject to the following conditions:\n\n1) Neither the Font Software nor any of its individual components,\nin Original or Modified Versions, may be sold by itself.\n\n2) Original or Modified Versions of the Font Software may be bundled,\nredistributed and/or sold with any software, provided that each copy\ncontains the above copyright notice and this license. These can be\nincluded either as stand-alone text files, human-readable headers or\nin the appropriate machine-readable metadata fields within text or\nbinary files as long as those fields can be easily viewed by the user.\n\n3) No Modified Version of the Font Software may use the Reserved Font\nName(s) unless explicit written permission is granted by the corresponding\nCopyright Holder. This restriction only applies to the primary font name as\npresented to the users.\n\n4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font\nSoftware shall not be used to promote, endorse or advertise any\nModified Version, except to acknowledge the contribution(s) of the\nCopyright Holder(s) and the Author(s) or with their explicit written\npermission.\n\n5) The Font Software, modified or unmodified, in part or in whole,\nmust be distributed entirely under this license, and must not be\ndistributed under any other license. The requirement for fonts to\nremain under this license does not apply to any document created\nusing the Font Software.\n\nTERMINATION\nThis license becomes null and void if any of the above conditions are\nnot met.\n\nDISCLAIMER\nTHE FONT SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT\nOF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE\nCOPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nINCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL\nDAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM\nOTHER DEALINGS IN THE FONT SOFTWARE.\n"
  },
  {
    "path": "firebase.json",
    "content": "{\n  \"functions\": {\n    \"predeploy\": [\n      \"npm --prefix \\\"$RESOURCE_DIR\\\" run lint\"\n    ]\n  }\n}\n"
  },
  {
    "path": "functions/.eslintrc.json",
    "content": "{\n  \"parserOptions\": {\n    // Required for certain syntax usages\n    \"ecmaVersion\": 2017\n  },\n  \"plugins\": [\n    \"promise\"\n  ],\n  \"extends\": \"eslint:recommended\",\n  \"rules\": {\n    // Removed rule \"disallow the use of console\" from recommended eslint rules\n    \"no-console\": \"off\",\n\n    // Removed rule \"disallow multiple spaces in regular expressions\" from recommended eslint rules\n    \"no-regex-spaces\": \"off\",\n\n    // Removed rule \"disallow the use of debugger\" from recommended eslint rules\n    \"no-debugger\": \"off\",\n\n    // Removed rule \"disallow unused variables\" from recommended eslint rules\n    \"no-unused-vars\": \"off\",\n\n    // Removed rule \"disallow mixed spaces and tabs for indentation\" from recommended eslint rules\n    \"no-mixed-spaces-and-tabs\": \"off\",\n\n    // Removed rule \"disallow the use of undeclared variables unless mentioned in /*global */ comments\" from recommended eslint rules\n    \"no-undef\": \"off\",\n\n    // Warn against template literal placeholder syntax in regular strings\n    \"no-template-curly-in-string\": 1,\n\n    // Warn if return statements do not either always or never specify values\n    \"consistent-return\": 1,\n\n    // Warn if no return statements in callbacks of array methods\n    \"array-callback-return\": 1,\n\n    // Require the use of === and !==\n    \"eqeqeq\": 2,\n\n    // Disallow the use of alert, confirm, and prompt\n    \"no-alert\": 2,\n\n    // Disallow the use of arguments.caller or arguments.callee\n    \"no-caller\": 2,\n\n    // Disallow null comparisons without type-checking operators\n    \"no-eq-null\": 2,\n\n    // Disallow the use of eval()\n    \"no-eval\": 2,\n\n    // Warn against extending native types\n    \"no-extend-native\": 1,\n\n    // Warn against unnecessary calls to .bind()\n    \"no-extra-bind\": 1,\n\n    // Warn against unnecessary labels    \n    \"no-extra-label\": 1,\n\n    // Disallow leading or trailing decimal points in numeric literals\n    \"no-floating-decimal\": 2,\n\n    // Warn against shorthand type conversions\n    \"no-implicit-coercion\": 1,\n\n    // Warn against function declarations and expressions inside loop statements\n    \"no-loop-func\": 1,\n\n    // Disallow new operators with the Function object\n    \"no-new-func\": 2,\n\n    // Warn against new operators with the String, Number, and Boolean objects\n    \"no-new-wrappers\": 1,\n\n    // Disallow throwing literals as exceptions\n    \"no-throw-literal\": 2,\n\n    // Require using Error objects as Promise rejection reasons\n    \"prefer-promise-reject-errors\": 2,\n\n    // Enforce “for” loop update clause moving the counter in the right direction\n    \"for-direction\": 2,\n\n    // Enforce return statements in getters\n    \"getter-return\": 2,\n\n    // Disallow await inside of loops\n    \"no-await-in-loop\": 2,\n\n    // Disallow comparing against -0\n    \"no-compare-neg-zero\": 2,\n\n    // Warn against catch clause parameters from shadowing variables in the outer scope\n    \"no-catch-shadow\": 1,\n\n    // Disallow identifiers from shadowing restricted names\n    \"no-shadow-restricted-names\": 2,\n\n    // Enforce return statements in callbacks of array methods\n    \"callback-return\": 2,\n\n    // Require error handling in callbacks\n    \"handle-callback-err\": 2,\n\n    // Warn against string concatenation with __dirname and __filename\n    \"no-path-concat\": 1,\n\n    // Prefer using arrow functions for callbacks\n    \"prefer-arrow-callback\": 1,\n\n    // Return inside each then() to create readable and reusable Promise chains.\n    // Forces developers to return console logs and http calls in promises. \n    \"promise/always-return\": 2,\n\n    //Enforces the use of catch() on un-returned promises\n    \"promise/catch-or-return\": 2,\n\n    // Warn against nested then() or catch() statements\n    \"promise/no-nesting\": 1\n  }\n}\n"
  },
  {
    "path": "functions/.gitignore",
    "content": "node_modules/"
  },
  {
    "path": "functions/index.js",
    "content": "'use strict';\n\nconst functions = require('firebase-functions');\nconst admin = require('firebase-admin');\nadmin.initializeApp();\n\n/**\n * Sends a notification to the recipient when a message is sent to.\n */\nexports.sendNewMessageNotification = functions.firestore.document('/messages/{chatId}/{chat_id}/{timestamp}')\n  .onCreate(async (snap, context) => {\n    const message = snap.data();\n    // Get the list of device notification tokens.\n    const getRecipientPromise = admin.firestore().collection('users').doc(message.to).get();\n\n    // The snapshot to the user's tokens.\n    let recipient;\n\n    // The array containing all the user's tokens.\n    let tokens;\n\n    const results = await Promise.all([getRecipientPromise]);\n\n    recipient = results[0];\n\n\n    tokens = recipient.data().notificationTokens || [];\n\n    // Check if there are any device tokens.\n    if (tokens.length === 0) {\n      return console.log('There are no notification tokens to send to.');\n    }\n\n    // Notification details.\n    const payload = {\n      notification: {\n        title: 'You have new message(s).',\n        body: 'Tap to view the message(s).',\n        click_action: 'FLUTTER_NOTIFICATION_CLICK'\n      }\n    };\n\n    // Send notifications to all tokens.\n    const response = await admin.messaging().sendToDevice(tokens, payload);\n    // For each message check if there was an error.\n    const tokensToRemove = [];\n    response.results.forEach((result, index) => {\n      const error = result.error;\n      if (error) {\n        console.error('Failure sending notification to', tokens[index], error);\n        // Cleanup the tokens who are not registered anymore.\n        if (error.code === 'messaging/invalid-registration-token' ||\n          error.code === 'messaging/registration-token-not-registered') {\n          tokensToRemove.push(tokens[index]);\n        }\n      }\n    });\n    return recipient.ref.update({\n      notificationTokens: tokens.filter((token) => !tokensToRemove.includes(token))\n    });\n  });\n"
  },
  {
    "path": "functions/package.json",
    "content": "{\n  \"name\": \"functions\",\n  \"description\": \"Cloud Functions for Firebase\",\n  \"scripts\": {\n    \"lint\": \"eslint .\",\n    \"serve\": \"firebase serve --only functions\",\n    \"shell\": \"firebase functions:shell\",\n    \"start\": \"npm run shell\",\n    \"deploy\": \"firebase deploy --only functions\",\n    \"logs\": \"firebase functions:log\"\n  },\n  \"engines\": {\n    \"node\": \"8\"\n  },\n  \"dependencies\": {\n    \"firebase-admin\": \"~7.0.0\",\n    \"firebase-functions\": \"^2.3.0\"\n  },\n  \"devDependencies\": {\n    \"eslint\": \"^5.12.0\",\n    \"eslint-plugin-promise\": \"^4.0.1\",\n    \"firebase-functions-test\": \"^0.1.6\"\n  },\n  \"private\": true\n}\n"
  },
  {
    "path": "ios/.gitignore",
    "content": ".idea/\n.vagrant/\n.sconsign.dblite\n.svn/\n\n.DS_Store\n*.swp\nprofile\n\nDerivedData/\nbuild/\nGeneratedPluginRegistrant.h\nGeneratedPluginRegistrant.m\n\n.generated/\n\n*.pbxuser\n*.mode1v3\n*.mode2v3\n*.perspectivev3\n\n!default.pbxuser\n!default.mode1v3\n!default.mode2v3\n!default.perspectivev3\n\nxcuserdata\n\n*.moved-aside\n\n*.pyc\n*sync/\nIcon?\n.tags*\n\n/Flutter/app.flx\n/Flutter/app.zip\n/Flutter/flutter_assets/\n/Flutter/App.framework\n/Flutter/Flutter.framework\n/Flutter/Generated.xcconfig\n/ServiceDefinitions.json\n\nPods/\n.symlinks/\n"
  },
  {
    "path": "ios/Flutter/AppFrameworkInfo.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n  <key>CFBundleDevelopmentRegion</key>\n  <string>en</string>\n  <key>CFBundleExecutable</key>\n  <string>App</string>\n  <key>CFBundleIdentifier</key>\n  <string>io.flutter.flutter.app</string>\n  <key>CFBundleInfoDictionaryVersion</key>\n  <string>6.0</string>\n  <key>CFBundleName</key>\n  <string>App</string>\n  <key>CFBundlePackageType</key>\n  <string>FMWK</string>\n  <key>CFBundleShortVersionString</key>\n  <string>1.0</string>\n  <key>CFBundleSignature</key>\n  <string>????</string>\n  <key>CFBundleVersion</key>\n  <string>1.0</string>\n  <key>MinimumOSVersion</key>\n  <string>8.0</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "ios/Flutter/Debug.xcconfig",
    "content": "#include \"Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig\"\n#include \"Generated.xcconfig\"\n"
  },
  {
    "path": "ios/Flutter/Release.xcconfig",
    "content": "#include \"Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig\"\n#include \"Generated.xcconfig\"\n"
  },
  {
    "path": "ios/Flutter/flutter_export_environment.sh",
    "content": "#!/bin/sh\n# This is a generated file; do not edit or check into version control.\nexport \"FLUTTER_ROOT=F:\\tools\\flutter\"\nexport \"FLUTTER_APPLICATION_PATH=E:\\github\\flutter\\Enigma\"\nexport \"FLUTTER_TARGET=lib\\main.dart\"\nexport \"FLUTTER_BUILD_DIR=build\"\nexport \"SYMROOT=${SOURCE_ROOT}/../build\\ios\"\nexport \"FLUTTER_FRAMEWORK_DIR=F:\\tools\\flutter\\bin\\cache\\artifacts\\engine\\ios\"\nexport \"FLUTTER_BUILD_NAME=1.0.0\"\nexport \"FLUTTER_BUILD_NUMBER=1\"\n"
  },
  {
    "path": "ios/GoogleService-Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>AD_UNIT_ID_FOR_BANNER_TEST</key>\n\t<string>ca-app-pub-3940256099942544/2934735716</string>\n\t<key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>\n\t<string>ca-app-pub-3940256099942544/4411468910</string>\n\t<key>CLIENT_ID</key>\n\t<string>347976604232-13h782ee23otgsaaiidgeb43jnp1jepd.apps.googleusercontent.com</string>\n\t<key>REVERSED_CLIENT_ID</key>\n\t<string>com.googleusercontent.apps.347976604232-13h782ee23otgsaaiidgeb43jnp1jepd</string>\n\t<key>API_KEY</key>\n\t<string>AIzaSyAdn3U0F35xhx2zUFfz6XPOcNm50erGZS0</string>\n\t<key>GCM_SENDER_ID</key>\n\t<string>347976604232</string>\n\t<key>PLIST_VERSION</key>\n\t<string>1</string>\n\t<key>BUNDLE_ID</key>\n\t<string>com.enigma.amitjoki</string>\n\t<key>PROJECT_ID</key>\n\t<string>flutterchatdemo</string>\n\t<key>STORAGE_BUCKET</key>\n\t<string>flutterchatdemo.appspot.com</string>\n\t<key>IS_ADS_ENABLED</key>\n\t<true></true>\n\t<key>IS_ANALYTICS_ENABLED</key>\n\t<false></false>\n\t<key>IS_APPINVITE_ENABLED</key>\n\t<false></false>\n\t<key>IS_GCM_ENABLED</key>\n\t<true></true>\n\t<key>IS_SIGNIN_ENABLED</key>\n\t<true></true>\n\t<key>GOOGLE_APP_ID</key>\n\t<string>1:347976604232:ios:f43eb2afc88737b9</string>\n\t<key>DATABASE_URL</key>\n\t<string>https://flutterchatdemo.firebaseio.com</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "ios/Podfile",
    "content": "# Uncomment this line to define a global platform for your project\n# platform :ios, '9.0'\n\n# CocoaPods analytics sends network stats synchronously affecting flutter build latency.\nENV['COCOAPODS_DISABLE_STATS'] = 'true'\n\ndef parse_KV_file(file, separator='=')\n  file_abs_path = File.expand_path(file)\n  if !File.exists? file_abs_path\n    return [];\n  end\n  pods_ary = []\n  skip_line_start_symbols = [\"#\", \"/\"]\n  File.foreach(file_abs_path) { |line|\n      next if skip_line_start_symbols.any? { |symbol| line =~ /^\\s*#{symbol}/ }\n      plugin = line.split(pattern=separator)\n      if plugin.length == 2\n        podname = plugin[0].strip()\n        path = plugin[1].strip()\n        podpath = File.expand_path(\"#{path}\", file_abs_path)\n        pods_ary.push({:name => podname, :path => podpath});\n      else\n        puts \"Invalid plugin specification: #{line}\"\n      end\n  }\n  return pods_ary\nend\n\ntarget 'Runner' do\n  # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock\n  # referring to absolute paths on developers' machines.\n  system('rm -rf .symlinks')\n  system('mkdir -p .symlinks/plugins')\n\n  # Flutter Pods\n  generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')\n  if generated_xcode_build_settings.empty?\n    puts \"Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first.\"\n  end\n  generated_xcode_build_settings.map { |p|\n    if p[:name] == 'FLUTTER_FRAMEWORK_DIR'\n      symlink = File.join('.symlinks', 'flutter')\n      File.symlink(File.dirname(p[:path]), symlink)\n      pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))\n    end\n  }\n\n  # Plugin Pods\n  plugin_pods = parse_KV_file('../.flutter-plugins')\n  plugin_pods.map { |p|\n    symlink = File.join('.symlinks', 'plugins', p[:name])\n    File.symlink(p[:path], symlink)\n    pod p[:name], :path => File.join(symlink, 'ios')\n  }\nend\n\npost_install do |installer|\n  installer.pods_project.targets.each do |target|\n    target.build_configurations.each do |config|\n      config.build_settings['ENABLE_BITCODE'] = 'NO'\n    end\n  end\nend\n"
  },
  {
    "path": "ios/Runner/AppDelegate.h",
    "content": "#import <Flutter/Flutter.h>\n#import <UIKit/UIKit.h>\n#import <Firebase/Firebase.h>\n\n@interface AppDelegate : FlutterAppDelegate\n\n@end\n"
  },
  {
    "path": "ios/Runner/AppDelegate.m",
    "content": "#include \"AppDelegate.h\"\n#include \"GeneratedPluginRegistrant.h\"\n\n@implementation AppDelegate\n\n- (BOOL)application:(UIApplication *)application\n    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {\n  [GeneratedPluginRegistrant registerWithRegistry:self];\n  // Override point for customization after application launch.\n  return [super application:application didFinishLaunchingWithOptions:launchOptions];\n}\n\n@end\n"
  },
  {
    "path": "ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"size\" : \"20x20\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-20x20@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"20x20\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-20x20@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-29x29@1x.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-29x29@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-29x29@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"40x40\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-40x40@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"40x40\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-40x40@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"60x60\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-60x60@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"60x60\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-App-60x60@3x.png\",\n      \"scale\" : \"3x\"\n    },\n    {\n      \"size\" : \"20x20\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-20x20@1x.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"size\" : \"20x20\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-20x20@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-29x29@1x.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"size\" : \"29x29\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-29x29@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"40x40\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-40x40@1x.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"size\" : \"40x40\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-40x40@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"76x76\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-76x76@1x.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"size\" : \"76x76\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-76x76@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"83.5x83.5\",\n      \"idiom\" : \"ipad\",\n      \"filename\" : \"Icon-App-83.5x83.5@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"size\" : \"1024x1024\",\n      \"idiom\" : \"ios-marketing\",\n      \"filename\" : \"Icon-App-1024x1024@1x.png\",\n      \"scale\" : \"1x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json",
    "content": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"LaunchImage.png\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"LaunchImage@2x.png\",\n      \"scale\" : \"2x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n      \"filename\" : \"LaunchImage@3x.png\",\n      \"scale\" : \"3x\"\n    }\n  ],\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}\n"
  },
  {
    "path": "ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md",
    "content": "# Launch Screen Assets\n\nYou can customize the launch screen with your own desired assets by replacing the image files in this directory.\n\nYou can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images."
  },
  {
    "path": "ios/Runner/Base.lproj/LaunchScreen.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"12121\" systemVersion=\"16G29\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" launchScreen=\"YES\" colorMatched=\"YES\" initialViewController=\"01J-lp-oVM\">\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"12089\"/>\n    </dependencies>\n    <scenes>\n        <!--View Controller-->\n        <scene sceneID=\"EHf-IW-A2E\">\n            <objects>\n                <viewController id=\"01J-lp-oVM\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"Ydg-fD-yQy\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"xbc-2k-c8Z\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"Ze5-6b-2t3\">\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <subviews>\n                            <imageView opaque=\"NO\" clipsSubviews=\"YES\" multipleTouchEnabled=\"YES\" contentMode=\"center\" image=\"LaunchImage\" translatesAutoresizingMaskIntoConstraints=\"NO\" id=\"YRO-k0-Ey4\">\n                            </imageView>\n                        </subviews>\n                        <color key=\"backgroundColor\" red=\"1\" green=\"1\" blue=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"sRGB\"/>\n                        <constraints>\n                            <constraint firstItem=\"YRO-k0-Ey4\" firstAttribute=\"centerX\" secondItem=\"Ze5-6b-2t3\" secondAttribute=\"centerX\" id=\"1a2-6s-vTC\"/>\n                            <constraint firstItem=\"YRO-k0-Ey4\" firstAttribute=\"centerY\" secondItem=\"Ze5-6b-2t3\" secondAttribute=\"centerY\" id=\"4X2-HB-R7a\"/>\n                        </constraints>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"iYj-Kq-Ea1\" userLabel=\"First Responder\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n            <point key=\"canvasLocation\" x=\"53\" y=\"375\"/>\n        </scene>\n    </scenes>\n    <resources>\n        <image name=\"LaunchImage\" width=\"168\" height=\"185\"/>\n    </resources>\n</document>\n"
  },
  {
    "path": "ios/Runner/Base.lproj/Main.storyboard",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB\" version=\"3.0\" toolsVersion=\"10117\" systemVersion=\"15F34\" targetRuntime=\"iOS.CocoaTouch\" propertyAccessControl=\"none\" useAutolayout=\"YES\" useTraitCollections=\"YES\" initialViewController=\"BYZ-38-t0r\">\n    <dependencies>\n        <deployment identifier=\"iOS\"/>\n        <plugIn identifier=\"com.apple.InterfaceBuilder.IBCocoaTouchPlugin\" version=\"10085\"/>\n    </dependencies>\n    <scenes>\n        <!--Flutter View Controller-->\n        <scene sceneID=\"tne-QT-ifu\">\n            <objects>\n                <viewController id=\"BYZ-38-t0r\" customClass=\"FlutterViewController\" sceneMemberID=\"viewController\">\n                    <layoutGuides>\n                        <viewControllerLayoutGuide type=\"top\" id=\"y3c-jy-aDJ\"/>\n                        <viewControllerLayoutGuide type=\"bottom\" id=\"wfy-db-euE\"/>\n                    </layoutGuides>\n                    <view key=\"view\" contentMode=\"scaleToFill\" id=\"8bC-Xf-vdC\">\n                        <rect key=\"frame\" x=\"0.0\" y=\"0.0\" width=\"600\" height=\"600\"/>\n                        <autoresizingMask key=\"autoresizingMask\" widthSizable=\"YES\" heightSizable=\"YES\"/>\n                        <color key=\"backgroundColor\" white=\"1\" alpha=\"1\" colorSpace=\"custom\" customColorSpace=\"calibratedWhite\"/>\n                    </view>\n                </viewController>\n                <placeholder placeholderIdentifier=\"IBFirstResponder\" id=\"dkx-z0-nzr\" sceneMemberID=\"firstResponder\"/>\n            </objects>\n        </scene>\n    </scenes>\n</document>\n"
  },
  {
    "path": "ios/Runner/Info.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>NSContactsUsageDescription</key>\n\t<string>This app requires contacts access to function properly.</string>\n\t<key>CFBundleDevelopmentRegion</key>\n\t<string>en</string>\n\t<key>CFBundleExecutable</key>\n\t<string>$(EXECUTABLE_NAME)</string>\n\t<key>CFBundleIdentifier</key>\n\t<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>\n\t<key>CFBundleInfoDictionaryVersion</key>\n\t<string>6.0</string>\n\t<key>CFBundleName</key>\n\t<string>Enigma</string>\n\t<key>CFBundlePackageType</key>\n\t<string>APPL</string>\n\t<key>CFBundleShortVersionString</key>\n\t<string>1.0</string>\n\t<key>CFBundleSignature</key>\n\t<string>????</string>\n\t<key>CFBundleVersion</key>\n\t<string>1</string>\n\t<key>LSRequiresIPhoneOS</key>\n\t<true/>\n\t<key>UILaunchStoryboardName</key>\n\t<string>LaunchScreen</string>\n\t<key>UIMainStoryboardFile</key>\n\t<string>Main</string>\n\t<key>CFBundleURLTypes</key>\n    \t<array>\n    \t\t<dict>\n    \t\t\t<key>CFBundleTypeRole</key>\n    \t\t\t<string>Editor</string>\n    \t\t\t<key>CFBundleURLSchemes</key>\n    \t\t\t<array>\n    \t\t\t\t<string>com.googleusercontent.apps.347976604232-13h782ee23otgsaaiidgeb43jnp1jepd</string>\n    \t\t\t</array>\n    \t\t</dict>\n    \t</array>\n\t<key>UISupportedInterfaceOrientations</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UISupportedInterfaceOrientations~ipad</key>\n\t<array>\n\t\t<string>UIInterfaceOrientationPortrait</string>\n\t\t<string>UIInterfaceOrientationPortraitUpsideDown</string>\n\t\t<string>UIInterfaceOrientationLandscapeLeft</string>\n\t\t<string>UIInterfaceOrientationLandscapeRight</string>\n\t</array>\n\t<key>UIViewControllerBasedStatusBarAppearance</key>\n\t<false/>\n</dict>\n</plist>\n"
  },
  {
    "path": "ios/Runner/main.m",
    "content": "#import <Flutter/Flutter.h>\n#import <UIKit/UIKit.h>\n#import \"AppDelegate.h\"\n\nint main(int argc, char* argv[]) {\n  @autoreleasepool {\n    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));\n  }\n}\n"
  },
  {
    "path": "ios/Runner.xcodeproj/project.pbxproj",
    "content": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section */\n\t\t03E80A4E2123CF78000CBC08 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 03E80A4D2123CF78000CBC08 /* GoogleService-Info.plist */; };\n\t\t1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };\n\t\t2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };\n\t\t31FEF151F1859E1D774F983A /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F87C65FAE473F13774A7A898 /* libPods-Runner.a */; };\n\t\t3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };\n\t\t3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };\n\t\t3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };\n\t\t9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };\n\t\t9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };\n\t\t9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };\n\t\t978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };\n\t\t97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };\n\t\t97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };\n\t\t97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };\n\t\t97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };\n/* End PBXBuildFile section */\n\n/* Begin PBXCopyFilesBuildPhase section */\n\t\t9705A1C41CF9048500538489 /* Embed Frameworks */ = {\n\t\t\tisa = PBXCopyFilesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tdstPath = \"\";\n\t\t\tdstSubfolderSpec = 10;\n\t\t\tfiles = (\n\t\t\t\t3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,\n\t\t\t\t9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,\n\t\t\t);\n\t\t\tname = \"Embed Frameworks\";\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXCopyFilesBuildPhase section */\n\n/* Begin PBXFileReference section */\n\t\t03E80A4D2123CF78000CBC08 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = \"GoogleService-Info.plist\"; sourceTree = SOURCE_ROOT; };\n\t\t1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = \"<group>\"; };\n\t\t1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = \"<group>\"; };\n\t\t2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };\n\t\t3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = \"<group>\"; };\n\t\t3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = \"<group>\"; };\n\t\t7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = \"<group>\"; };\n\t\t7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = \"<group>\"; };\n\t\t7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = \"<group>\"; };\n\t\t9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = \"<group>\"; };\n\t\t9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = \"<group>\"; };\n\t\t9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = \"<group>\"; };\n\t\t97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };\n\t\t97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = \"<group>\"; };\n\t\t97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = \"<group>\"; };\n\t\t97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \"<group>\"; };\n\t\t97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = \"<group>\"; };\n\t\t97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \"<group>\"; };\n\t\tF87C65FAE473F13774A7A898 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = \"libPods-Runner.a\"; sourceTree = BUILT_PRODUCTS_DIR; };\n/* End PBXFileReference section */\n\n/* Begin PBXFrameworksBuildPhase section */\n\t\t97C146EB1CF9000F007C117D /* Frameworks */ = {\n\t\t\tisa = PBXFrameworksBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,\n\t\t\t\t3B80C3941E831B6300D905FE /* App.framework in Frameworks */,\n\t\t\t\t31FEF151F1859E1D774F983A /* libPods-Runner.a in Frameworks */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXFrameworksBuildPhase section */\n\n/* Begin PBXGroup section */\n\t\t49464365B5D8D6A216DE2434 /* Pods */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t);\n\t\t\tname = Pods;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t9740EEB11CF90186004384FC /* Flutter */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t2D5378251FAA1A9400D5DBA9 /* flutter_assets */,\n\t\t\t\t3B80C3931E831B6300D905FE /* App.framework */,\n\t\t\t\t3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,\n\t\t\t\t9740EEBA1CF902C7004384FC /* Flutter.framework */,\n\t\t\t\t9740EEB21CF90195004384FC /* Debug.xcconfig */,\n\t\t\t\t7AFA3C8E1D35360C0083082E /* Release.xcconfig */,\n\t\t\t\t9740EEB31CF90195004384FC /* Generated.xcconfig */,\n\t\t\t);\n\t\t\tname = Flutter;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t97C146E51CF9000F007C117D = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t9740EEB11CF90186004384FC /* Flutter */,\n\t\t\t\t97C146F01CF9000F007C117D /* Runner */,\n\t\t\t\t97C146EF1CF9000F007C117D /* Products */,\n\t\t\t\t49464365B5D8D6A216DE2434 /* Pods */,\n\t\t\t\tC6BE70C6066498C18751121C /* Frameworks */,\n\t\t\t);\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t97C146EF1CF9000F007C117D /* Products */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t97C146EE1CF9000F007C117D /* Runner.app */,\n\t\t\t);\n\t\t\tname = Products;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t97C146F01CF9000F007C117D /* Runner */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t03E80A4D2123CF78000CBC08 /* GoogleService-Info.plist */,\n\t\t\t\t7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,\n\t\t\t\t7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,\n\t\t\t\t97C146FA1CF9000F007C117D /* Main.storyboard */,\n\t\t\t\t97C146FD1CF9000F007C117D /* Assets.xcassets */,\n\t\t\t\t97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,\n\t\t\t\t97C147021CF9000F007C117D /* Info.plist */,\n\t\t\t\t97C146F11CF9000F007C117D /* Supporting Files */,\n\t\t\t\t1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,\n\t\t\t\t1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,\n\t\t\t);\n\t\t\tpath = Runner;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t97C146F11CF9000F007C117D /* Supporting Files */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\t97C146F21CF9000F007C117D /* main.m */,\n\t\t\t);\n\t\t\tname = \"Supporting Files\";\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\tC6BE70C6066498C18751121C /* Frameworks */ = {\n\t\t\tisa = PBXGroup;\n\t\t\tchildren = (\n\t\t\t\tF87C65FAE473F13774A7A898 /* libPods-Runner.a */,\n\t\t\t);\n\t\t\tname = Frameworks;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXGroup section */\n\n/* Begin PBXNativeTarget section */\n\t\t97C146ED1CF9000F007C117D /* Runner */ = {\n\t\t\tisa = PBXNativeTarget;\n\t\t\tbuildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget \"Runner\" */;\n\t\t\tbuildPhases = (\n\t\t\t\t981C6FBC28196C6E8D1CFC1C /* [CP] Check Pods Manifest.lock */,\n\t\t\t\t9740EEB61CF901F6004384FC /* Run Script */,\n\t\t\t\t97C146EA1CF9000F007C117D /* Sources */,\n\t\t\t\t97C146EB1CF9000F007C117D /* Frameworks */,\n\t\t\t\t97C146EC1CF9000F007C117D /* Resources */,\n\t\t\t\t9705A1C41CF9048500538489 /* Embed Frameworks */,\n\t\t\t\t3B06AD1E1E4923F5004D2608 /* Thin Binary */,\n\t\t\t\t32D609ECAAA2436A5C1CA65E /* [CP] Embed Pods Frameworks */,\n\t\t\t\tD96270B7CCE0D3CF08DD9950 /* [CP] Copy Pods Resources */,\n\t\t\t);\n\t\t\tbuildRules = (\n\t\t\t);\n\t\t\tdependencies = (\n\t\t\t);\n\t\t\tname = Runner;\n\t\t\tproductName = Runner;\n\t\t\tproductReference = 97C146EE1CF9000F007C117D /* Runner.app */;\n\t\t\tproductType = \"com.apple.product-type.application\";\n\t\t};\n/* End PBXNativeTarget section */\n\n/* Begin PBXProject section */\n\t\t97C146E61CF9000F007C117D /* Project object */ = {\n\t\t\tisa = PBXProject;\n\t\t\tattributes = {\n\t\t\t\tLastUpgradeCheck = 0910;\n\t\t\t\tORGANIZATIONNAME = \"The Chromium Authors\";\n\t\t\t\tTargetAttributes = {\n\t\t\t\t\t97C146ED1CF9000F007C117D = {\n\t\t\t\t\t\tCreatedOnToolsVersion = 7.3.1;\n\t\t\t\t\t};\n\t\t\t\t};\n\t\t\t};\n\t\t\tbuildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject \"Runner\" */;\n\t\t\tcompatibilityVersion = \"Xcode 3.2\";\n\t\t\tdevelopmentRegion = English;\n\t\t\thasScannedForEncodings = 0;\n\t\t\tknownRegions = (\n\t\t\t\ten,\n\t\t\t\tBase,\n\t\t\t);\n\t\t\tmainGroup = 97C146E51CF9000F007C117D;\n\t\t\tproductRefGroup = 97C146EF1CF9000F007C117D /* Products */;\n\t\t\tprojectDirPath = \"\";\n\t\t\tprojectRoot = \"\";\n\t\t\ttargets = (\n\t\t\t\t97C146ED1CF9000F007C117D /* Runner */,\n\t\t\t);\n\t\t};\n/* End PBXProject section */\n\n/* Begin PBXResourcesBuildPhase section */\n\t\t97C146EC1CF9000F007C117D /* Resources */ = {\n\t\t\tisa = PBXResourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,\n\t\t\t\t03E80A4E2123CF78000CBC08 /* GoogleService-Info.plist in Resources */,\n\t\t\t\t9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */,\n\t\t\t\t3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,\n\t\t\t\t9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,\n\t\t\t\t97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,\n\t\t\t\t2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,\n\t\t\t\t97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXResourcesBuildPhase section */\n\n/* Begin PBXShellScriptBuildPhase section */\n\t\t32D609ECAAA2436A5C1CA65E /* [CP] Embed Pods Frameworks */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\",\n\t\t\t\t\"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework\",\n\t\t\t);\n\t\t\tname = \"[CP] Embed Pods Frameworks\";\n\t\t\toutputPaths = (\n\t\t\t\t\"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\t3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"Thin Binary\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"/bin/sh \\\"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\\" thin\";\n\t\t};\n\t\t9740EEB61CF901F6004384FC /* Run Script */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t);\n\t\t\tname = \"Run Script\";\n\t\t\toutputPaths = (\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"/bin/sh \\\"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\\" build\";\n\t\t};\n\t\t981C6FBC28196C6E8D1CFC1C /* [CP] Check Pods Manifest.lock */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"${PODS_PODFILE_DIR_PATH}/Podfile.lock\",\n\t\t\t\t\"${PODS_ROOT}/Manifest.lock\",\n\t\t\t);\n\t\t\tname = \"[CP] Check Pods Manifest.lock\";\n\t\t\toutputPaths = (\n\t\t\t\t\"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"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\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n\t\tD96270B7CCE0D3CF08DD9950 /* [CP] Copy Pods Resources */ = {\n\t\t\tisa = PBXShellScriptBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t);\n\t\t\tinputPaths = (\n\t\t\t\t\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\",\n\t\t\t\t\"${PODS_ROOT}/GTMOAuth2/Source/Touch/GTMOAuth2ViewTouch.xib\",\n\t\t\t\t\"${PODS_ROOT}/GoogleSignIn/Resources/GoogleSignIn.bundle\",\n\t\t\t\t\"${PODS_CONFIGURATION_BUILD_DIR}/gRPC/gRPCCertificates.bundle\",\n\t\t\t);\n\t\t\tname = \"[CP] Copy Pods Resources\";\n\t\t\toutputPaths = (\n\t\t\t\t\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMOAuth2ViewTouch.nib\",\n\t\t\t\t\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle\",\n\t\t\t\t\"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/gRPCCertificates.bundle\",\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t\tshellPath = /bin/sh;\n\t\t\tshellScript = \"\\\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\\\"\\n\";\n\t\t\tshowEnvVarsInLog = 0;\n\t\t};\n/* End PBXShellScriptBuildPhase section */\n\n/* Begin PBXSourcesBuildPhase section */\n\t\t97C146EA1CF9000F007C117D /* Sources */ = {\n\t\t\tisa = PBXSourcesBuildPhase;\n\t\t\tbuildActionMask = 2147483647;\n\t\t\tfiles = (\n\t\t\t\t978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,\n\t\t\t\t97C146F31CF9000F007C117D /* main.m in Sources */,\n\t\t\t\t1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,\n\t\t\t);\n\t\t\trunOnlyForDeploymentPostprocessing = 0;\n\t\t};\n/* End PBXSourcesBuildPhase section */\n\n/* Begin PBXVariantGroup section */\n\t\t97C146FA1CF9000F007C117D /* Main.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t97C146FB1CF9000F007C117D /* Base */,\n\t\t\t);\n\t\t\tname = Main.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n\t\t97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {\n\t\t\tisa = PBXVariantGroup;\n\t\t\tchildren = (\n\t\t\t\t97C147001CF9000F007C117D /* Base */,\n\t\t\t);\n\t\t\tname = LaunchScreen.storyboard;\n\t\t\tsourceTree = \"<group>\";\n\t\t};\n/* End PBXVariantGroup section */\n\n/* Begin XCBuildConfiguration section */\n\t\t97C147031CF9000F007C117D /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = dwarf;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tENABLE_TESTABILITY = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_DYNAMIC_NO_PIC = NO;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_OPTIMIZATION_LEVEL = 0;\n\t\t\t\tGCC_PREPROCESSOR_DEFINITIONS = (\n\t\t\t\t\t\"DEBUG=1\",\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t);\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = YES;\n\t\t\t\tONLY_ACTIVE_ARCH = YES;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t97C147041CF9000F007C117D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tALWAYS_SEARCH_USER_PATHS = NO;\n\t\t\t\tCLANG_ANALYZER_NONNULL = YES;\n\t\t\t\tCLANG_CXX_LANGUAGE_STANDARD = \"gnu++0x\";\n\t\t\t\tCLANG_CXX_LIBRARY = \"libc++\";\n\t\t\t\tCLANG_ENABLE_MODULES = YES;\n\t\t\t\tCLANG_ENABLE_OBJC_ARC = YES;\n\t\t\t\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\n\t\t\t\tCLANG_WARN_BOOL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_COMMA = YES;\n\t\t\t\tCLANG_WARN_CONSTANT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\n\t\t\t\tCLANG_WARN_EMPTY_BODY = YES;\n\t\t\t\tCLANG_WARN_ENUM_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_INFINITE_RECURSION = YES;\n\t\t\t\tCLANG_WARN_INT_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\n\t\t\t\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\n\t\t\t\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\n\t\t\t\tCLANG_WARN_STRICT_PROTOTYPES = YES;\n\t\t\t\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\n\t\t\t\tCLANG_WARN_UNREACHABLE_CODE = YES;\n\t\t\t\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\n\t\t\t\t\"CODE_SIGN_IDENTITY[sdk=iphoneos*]\" = \"iPhone Developer\";\n\t\t\t\tCOPY_PHASE_STRIP = NO;\n\t\t\t\tDEBUG_INFORMATION_FORMAT = \"dwarf-with-dsym\";\n\t\t\t\tENABLE_NS_ASSERTIONS = NO;\n\t\t\t\tENABLE_STRICT_OBJC_MSGSEND = YES;\n\t\t\t\tGCC_C_LANGUAGE_STANDARD = gnu99;\n\t\t\t\tGCC_NO_COMMON_BLOCKS = YES;\n\t\t\t\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\n\t\t\t\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\n\t\t\t\tGCC_WARN_UNDECLARED_SELECTOR = YES;\n\t\t\t\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\n\t\t\t\tGCC_WARN_UNUSED_FUNCTION = YES;\n\t\t\t\tGCC_WARN_UNUSED_VARIABLE = YES;\n\t\t\t\tIPHONEOS_DEPLOYMENT_TARGET = 8.0;\n\t\t\t\tMTL_ENABLE_DEBUG_INFO = NO;\n\t\t\t\tSDKROOT = iphoneos;\n\t\t\t\tTARGETED_DEVICE_FAMILY = \"1,2\";\n\t\t\t\tVALIDATE_PRODUCT = YES;\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n\t\t97C147061CF9000F007C117D /* Debug */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tENABLE_BITCODE = NO;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"$(PROJECT_DIR)/Flutter\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Runner/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tLIBRARY_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"$(PROJECT_DIR)/Flutter\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.enigma.amitjoki;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Debug;\n\t\t};\n\t\t97C147071CF9000F007C117D /* Release */ = {\n\t\t\tisa = XCBuildConfiguration;\n\t\t\tbaseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;\n\t\t\tbuildSettings = {\n\t\t\t\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\n\t\t\t\tCURRENT_PROJECT_VERSION = 1;\n\t\t\t\tENABLE_BITCODE = NO;\n\t\t\t\tFRAMEWORK_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"$(PROJECT_DIR)/Flutter\",\n\t\t\t\t);\n\t\t\t\tINFOPLIST_FILE = Runner/Info.plist;\n\t\t\t\tLD_RUNPATH_SEARCH_PATHS = \"$(inherited) @executable_path/Frameworks\";\n\t\t\t\tLIBRARY_SEARCH_PATHS = (\n\t\t\t\t\t\"$(inherited)\",\n\t\t\t\t\t\"$(PROJECT_DIR)/Flutter\",\n\t\t\t\t);\n\t\t\t\tPRODUCT_BUNDLE_IDENTIFIER = com.enigma.amitjoki;\n\t\t\t\tPRODUCT_NAME = \"$(TARGET_NAME)\";\n\t\t\t\tVERSIONING_SYSTEM = \"apple-generic\";\n\t\t\t};\n\t\t\tname = Release;\n\t\t};\n/* End XCBuildConfiguration section */\n\n/* Begin XCConfigurationList section */\n\t\t97C146E91CF9000F007C117D /* Build configuration list for PBXProject \"Runner\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t97C147031CF9000F007C117D /* Debug */,\n\t\t\t\t97C147041CF9000F007C117D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n\t\t97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget \"Runner\" */ = {\n\t\t\tisa = XCConfigurationList;\n\t\t\tbuildConfigurations = (\n\t\t\t\t97C147061CF9000F007C117D /* Debug */,\n\t\t\t\t97C147071CF9000F007C117D /* Release */,\n\t\t\t);\n\t\t\tdefaultConfigurationIsVisible = 0;\n\t\t\tdefaultConfigurationName = Release;\n\t\t};\n/* End XCConfigurationList section */\n\t};\n\trootObject = 97C146E61CF9000F007C117D /* Project object */;\n}\n"
  },
  {
    "path": "ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:Runner.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0910\"\n   version = \"1.3\">\n   <BuildAction\n      parallelizeBuildables = \"YES\"\n      buildImplicitDependencies = \"YES\">\n      <BuildActionEntries>\n         <BuildActionEntry\n            buildForTesting = \"YES\"\n            buildForRunning = \"YES\"\n            buildForProfiling = \"YES\"\n            buildForArchiving = \"YES\"\n            buildForAnalyzing = \"YES\">\n            <BuildableReference\n               BuildableIdentifier = \"primary\"\n               BlueprintIdentifier = \"97C146ED1CF9000F007C117D\"\n               BuildableName = \"Runner.app\"\n               BlueprintName = \"Runner\"\n               ReferencedContainer = \"container:Runner.xcodeproj\">\n            </BuildableReference>\n         </BuildActionEntry>\n      </BuildActionEntries>\n   </BuildAction>\n   <TestAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\">\n      <Testables>\n      </Testables>\n      <MacroExpansion>\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"97C146ED1CF9000F007C117D\"\n            BuildableName = \"Runner.app\"\n            BlueprintName = \"Runner\"\n            ReferencedContainer = \"container:Runner.xcodeproj\">\n         </BuildableReference>\n      </MacroExpansion>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </TestAction>\n   <LaunchAction\n      buildConfiguration = \"Debug\"\n      selectedDebuggerIdentifier = \"Xcode.DebuggerFoundation.Debugger.LLDB\"\n      selectedLauncherIdentifier = \"Xcode.DebuggerFoundation.Launcher.LLDB\"\n      language = \"\"\n      launchStyle = \"0\"\n      useCustomWorkingDirectory = \"NO\"\n      ignoresPersistentStateOnLaunch = \"NO\"\n      debugDocumentVersioning = \"YES\"\n      debugServiceExtension = \"internal\"\n      allowLocationSimulation = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"97C146ED1CF9000F007C117D\"\n            BuildableName = \"Runner.app\"\n            BlueprintName = \"Runner\"\n            ReferencedContainer = \"container:Runner.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n      <AdditionalOptions>\n      </AdditionalOptions>\n   </LaunchAction>\n   <ProfileAction\n      buildConfiguration = \"Release\"\n      shouldUseLaunchSchemeArgsEnv = \"YES\"\n      savedToolIdentifier = \"\"\n      useCustomWorkingDirectory = \"NO\"\n      debugDocumentVersioning = \"YES\">\n      <BuildableProductRunnable\n         runnableDebuggingMode = \"0\">\n         <BuildableReference\n            BuildableIdentifier = \"primary\"\n            BlueprintIdentifier = \"97C146ED1CF9000F007C117D\"\n            BuildableName = \"Runner.app\"\n            BlueprintName = \"Runner\"\n            ReferencedContainer = \"container:Runner.xcodeproj\">\n         </BuildableReference>\n      </BuildableProductRunnable>\n   </ProfileAction>\n   <AnalyzeAction\n      buildConfiguration = \"Debug\">\n   </AnalyzeAction>\n   <ArchiveAction\n      buildConfiguration = \"Release\"\n      revealArchiveInOrganizer = \"YES\">\n   </ArchiveAction>\n</Scheme>\n"
  },
  {
    "path": "ios/Runner.xcworkspace/contents.xcworkspacedata",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Workspace\n   version = \"1.0\">\n   <FileRef\n      location = \"group:Runner.xcodeproj\">\n   </FileRef>\n   <FileRef\n      location = \"group:Pods/Pods.xcodeproj\">\n   </FileRef>\n</Workspace>\n"
  },
  {
    "path": "ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>IDEDidComputeMac32BitWarning</key>\n\t<true/>\n</dict>\n</plist>\n"
  },
  {
    "path": "ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>BuildSystemType</key>\n\t<string>Original</string>\n</dict>\n</plist>\n"
  },
  {
    "path": "lib/DataModel.dart",
    "content": "import 'dart:core';\nimport 'dart:async';\nimport 'dart:io';\nimport 'package:Enigma/const.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:async/async.dart' show StreamGroup;\nimport 'package:path_provider/path_provider.dart';\nimport 'package:scoped_model/scoped_model.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:localstorage/localstorage.dart';\n\n//数据模型类\nclass DataModel extends Model {\n  //用户的数据以键值对形式存放\n  Map<String, Map<String, dynamic>> userData =\n      new Map<String, Map<String, dynamic>>();\n\n  Map<String, Future> _messageStatus = new Map<String, Future>();\n\n  _getMessageKey(String peerNo, int timestamp) => '$peerNo$timestamp';\n\n  getMessageStatus(String peerNo, int timestamp) {\n    final key = _getMessageKey(peerNo, timestamp);\n    return _messageStatus[key] ?? true;\n  }\n\n  bool _loaded = false;\n\n  LocalStorage _storage = LocalStorage('model');\n\n  //添加消息\n  addMessage(String peerNo, int timestamp, Future future) {\n    final key = _getMessageKey(peerNo, timestamp);\n    future.then((_) {\n      _messageStatus.remove(key);\n    });\n    _messageStatus[key] = future;\n  }\n\n  //添加用户\n  addUser(DocumentSnapshot user) {\n    userData[user.data[PHONE]] = user.data;\n    notifyListeners();\n  }\n\n  //添加壁纸\n  setWallpaper(String phone, File image) async {\n    if (image != null) {\n      final dir = await getDir();\n      int now = DateTime.now().millisecondsSinceEpoch;\n      String path = '${dir.path}/WALLPAPER-$phone-$now';\n      await image.copy(path);\n      userData[phone][WALLPAPER] = path;\n      updateItem(phone, {WALLPAPER: path});\n      notifyListeners();\n    }\n  }\n\n  //移出壁纸\n  removeWallpaper(String phone) {\n    userData[phone][WALLPAPER] = null;\n    String path = userData[phone][ALIAS_AVATAR];\n    if (path != null) {\n      File(path).delete();\n      userData[phone][WALLPAPER] = null;\n    }\n    updateItem(phone, {WALLPAPER: null});\n    notifyListeners();\n  }\n\n  getDir() async {\n    return await getApplicationDocumentsDirectory();\n  }\n\n  //更新条目\n  updateItem(String key, Map<String, dynamic> value) {\n    Map<String, dynamic> old = _storage.getItem(key) ?? Map<String, dynamic>();\n    ;\n    old.addAll(value);\n    _storage.setItem(key, old);\n  }\n\n  //设置备注\n  setAlias(String aliasName, File image, String phone) async {\n    userData[phone][ALIAS_NAME] = aliasName ?? null;\n    if (image != null) {\n      final dir = await getDir();\n      int now = DateTime.now().millisecondsSinceEpoch;\n      String path = '${dir.path}/$phone-$now';\n      await image.copy(path);\n      userData[phone][ALIAS_AVATAR] = path;\n    }\n    updateItem(phone, {\n      ALIAS_NAME: userData[phone][ALIAS_NAME],\n      ALIAS_AVATAR: userData[phone][ALIAS_AVATAR],\n    });\n    notifyListeners();\n  }\n\n  //移除备注\n  removeAlias(String phone) {\n    userData[phone][ALIAS_NAME] = null;\n    String path = userData[phone][ALIAS_AVATAR];\n    if (path != null) {\n      File(path).delete();\n      userData[phone][ALIAS_AVATAR] = null;\n    }\n    updateItem(phone, {ALIAS_NAME: null, ALIAS_AVATAR: null});\n    notifyListeners();\n  }\n\n  bool get loaded => _loaded;\n\n  Map<String, dynamic> get currentUser => _currentUser;\n\n  Map<String, dynamic> _currentUser;\n\n  Map<String, int> get lastSpokenAt => _lastSpokenAt;\n\n  Map<String, int> _lastSpokenAt = {};\n\n  //获取聊天的顺序\n  getChatOrder(List<String> chatsWith, String currentUserNo) {\n    List<Stream<QuerySnapshot>> messages = List<Stream<QuerySnapshot>>();\n    chatsWith.forEach((otherNo) {\n      String chatId = Enigma.getChatId(currentUserNo, otherNo);\n      messages.add(Firestore.instance\n          .collection(MESSAGES)\n          .document(chatId)\n          .collection(chatId)\n          .snapshots());\n    });\n    StreamGroup.merge(messages).listen((snapshot) {\n      if (snapshot.documents.isNotEmpty) {\n        DocumentSnapshot message = snapshot.documents.last;\n        _lastSpokenAt[message[FROM] == currentUserNo\n            ? message[TO]\n            : message[FROM]] = message[TIMESTAMP];\n        notifyListeners();\n      }\n    });\n  }\n\n  //根据传入的当前用户的手机号获取当前用户的最新数据\n  DataModel(String currentUserNo) {\n    //从firebase实时数据库中同步数据\n    Firestore.instance\n        .collection(USERS)\n        .document(currentUserNo)\n        .snapshots()\n        .listen((user) {\n      _currentUser = user.data;\n      notifyListeners();\n    });\n    //缓存数据\n    _storage.ready.then((ready) {\n      if (ready) {\n        //监听聊天的数据变化\n        Firestore.instance\n            .collection(USERS)\n            .document(currentUserNo)\n            .collection(CHATS_WITH)\n            .document(CHATS_WITH)\n            .snapshots()\n            .listen((_chatsWith) {\n          if (_chatsWith?.data != null) {\n            List<Stream<DocumentSnapshot>> users =\n                new List<Stream<DocumentSnapshot>>();\n            List<String> peers = [];\n            _chatsWith.data.entries.forEach((_data) {\n              peers.add(_data.key);\n              users.add(Firestore.instance\n                  .collection(USERS)\n                  .document(_data.key)\n                  .snapshots());\n              if (userData[_data.key] != null) {\n                userData[_data.key][CHAT_STATUS] = _chatsWith[_data.key];\n              }\n            });\n            getChatOrder(peers, currentUserNo);\n            notifyListeners();\n            Map<String, Map<String, dynamic>> newData =\n                Map<String, Map<String, dynamic>>();\n            StreamGroup.merge(users).listen((user) {\n              if (user.data != null) {\n                newData[user[PHONE]] = user.data;\n                newData[user[PHONE]][CHAT_STATUS] = _chatsWith[user[PHONE]];\n                Map<String, dynamic> _stored = _storage.getItem(user[PHONE]);\n                if (_stored != null) {\n                  newData[user[PHONE]].addAll(_stored);\n                }\n              }\n              userData = Map.from(newData);\n              notifyListeners();\n            });\n          }\n          if (!_loaded) {\n            _loaded = true;\n            notifyListeners();\n          }\n        });\n      }\n    });\n  }\n}\n"
  },
  {
    "path": "lib/E2EE/e2ee.dart",
    "content": "library e2ee;\n\nexport 'key.dart';\nexport 'x25519.dart';\n"
  },
  {
    "path": "lib/E2EE/key.dart",
    "content": "// Copyright 2019 Gohilla.com team.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport 'dart:convert';\nimport 'dart:typed_data';\n\nclass Key {\n  final Uint8List bytes;\n  final bool isPublic;\n\n  Key(this.bytes) : this.isPublic = false;\n\n  Key.withPublicBytes(this.bytes) : this.isPublic = true;\n\n  @override\n  int get hashCode => bytes.length;\n\n  @override\n  operator ==(other) {\n    if (other is Key) {\n      return _byteListEqual(bytes, other.bytes);\n    }\n    return false;\n  }\n\n  /// Returns  string representation of the key.\n  ///\n  /// If [isPublic] is true, returns the result of [toBase64].\n  ///\n  /// Otherwise a static string so developers don't accidentally print secrets\n  /// keys.\n  @override\n  String toString() {\n    if (isPublic) {\n      return \"Key('${toBase64()}')\";\n    }\n    return \"Key('some bytes')\";\n  }\n\n  /// Returns a Key from the base64 representation\n  static Key fromBase64(String encoded, bool isPublic) {\n    final bytes = base64.decode(encoded);\n    if (isPublic) return Key.withPublicBytes(bytes);\n    return Key(bytes);\n  }\n\n  /// Returns a base64 representation of the bytes.\n  String toBase64() {\n    return base64.encode(this.bytes);\n  }\n\n  static bool _byteListEqual(List<int> left, List<int> right) {\n    if (left.length != right.length) {\n      return false;\n    }\n    var result = true;\n    for (var i = 0; i < left.length; i++) {\n      if (left[i] != right[i]) {\n        result = false;\n      }\n    }\n    return result;\n  }\n}\n\n/// Holds a secret key and a public key.\nclass AsymmetricKeyPair {\n  final Key publicKey;\n  final Key secretKey;\n\n  AsymmetricKeyPair({this.secretKey, this.publicKey})\n      : assert(secretKey != null),\n        assert(publicKey != null);\n\n  @override\n  int get hashCode => publicKey.hashCode;\n\n  @override\n  operator ==(other) =>\n      other is AsymmetricKeyPair &&\n      secretKey == other.secretKey &&\n      publicKey == other.publicKey;\n}\n"
  },
  {
    "path": "lib/E2EE/x25519.dart",
    "content": "// Copyright 2019 Gohilla.com team.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport 'dart:async';\nimport 'dart:math';\nimport 'dart:typed_data';\n\nimport 'key.dart';\n\nconst x25519 = X25519();\n\n/// Implements X25519 key exchange ([RFC 7748](https://tools.ietf.org/html/rfc7748)).\nclass X25519 {\n  /// Constant [9, 0, ..., 0] is used when calculating shared secret.\n  static final Uint8List _constant9 = () {\n    final result = Uint8List(32);\n    result[0] = 9;\n    return result;\n  }();\n\n  /// Constant [0xdb41, 1, 0, ..., 0].\n  static final Int32List _constant121665 = () {\n    final result = Int32List(16);\n    result[0] = 0xdb41;\n    result[1] = 1;\n    return result;\n  }();\n\n  /// A secure random number generator.\n  static final Random _random = Random.secure();\n\n  const X25519();\n\n  /// Calculates the shared secret asynchronously.\n  /// The method is asynchronous, which enables implementers to use\n  /// platform-specific APIs and isolates.\n  ///\n  /// The synchronous version is [calculateSharedSecretSync].\n  Future<Key> calculateSharedSecret(Key secretKey, Key publicKey) async {\n    return calculateSharedSecretSync(secretKey, publicKey);\n  }\n\n  /// Calculates the shared secret synchronously.\n  ///\n  /// The asynchronous version is [calculateSharedSecret].\n  Key calculateSharedSecretSync(Key secretKey, Key publicKey) {\n    final secretKeyTransformed = Uint8List.fromList(secretKey.bytes);\n    replaceSeedWithSecretKey(secretKeyTransformed);\n    final result = Uint8List(32);\n    _scalarMultiply(result, secretKeyTransformed, publicKey.bytes);\n    return Key(result);\n  }\n\n  /// Generates a random Curve25519 keypair.\n  /// The method is asynchronous, which enables implementers to use\n  /// platform-specific APIs and isolates.\n  ///\n  /// If you need to perform the operation synchronously, use\n  /// [generateKeyPairSync].\n  Future<AsymmetricKeyPair> generateKeyPair({Uint8List seed}) async {\n    return generateKeyPairSync(seed: seed);\n  }\n\n  /// Generates a random Curve25519 keypair synchronously.\n  /// You can optionally give a seed, which is any 32-octet Uint8List.\n  ///\n  /// The use asynchronous version is [generateKeyPair].\n  AsymmetricKeyPair generateKeyPairSync({Uint8List seed}) {\n    if (seed == null) {\n      // Generate 32 random bytes using a secure random number generator\n      final random = X25519._random;\n      seed = Uint8List(32);\n      for (var i = 0; i < seed.length; i++) {\n        seed[i] = random.nextInt(256);\n      }\n    } else {\n      if (seed.length != 32) {\n        throw ArgumentError(\"Seed must have 32 bytes\");\n      }\n\n      // Create a copy of the seed\n      seed = Uint8List.fromList(seed);\n    }\n\n    // Create a secret key\n    replaceSeedWithSecretKey(seed);\n    final secretKey = Key(seed);\n\n    // Calculate public key\n    final publicKeyBytes = Uint8List(32);\n    _scalarMultiply(publicKeyBytes, seed, _constant9);\n\n    // Return a keypair\n    final publicKey = Key.withPublicBytes(publicKeyBytes);\n    return AsymmetricKeyPair(secretKey: secretKey, publicKey: publicKey);\n  }\n\n  /// Modifies certain bits of seed so that the result is a valid secret key.\n  static void replaceSeedWithSecretKey(Uint8List seed) {\n    // First 3 bits should be 0\n    seed[0] &= 0xf8;\n\n    // Bit 254 should be 1\n    seed[31] |= 0x40;\n\n    // Bit 255 should be 0\n    seed[31] &= 0x7f;\n  }\n\n  /// X25519 multiplication of two 32-octet scalar.\n  ///\n  /// Used by [generateKeyPairSync] and [calculateSharedSecretSync].\n  static void _scalarMultiply(\n    Uint8List result,\n    Uint8List secretKey,\n    Uint8List publicKey,\n  ) {\n    // Allocate temporary arrays\n    final unpacked = Int32List(16);\n\n    // -------------------------------------------------------------------------\n    // Unpack public key into the internal Int32List\n    // -------------------------------------------------------------------------\n\n    for (var i = 0; i < 16; i++) {\n      unpacked[i] = publicKey[2 * i] | (publicKey[2 * i + 1] << 8);\n    }\n    // Clear the last bit\n    unpacked[15] &= 0x7FFF;\n\n    // -------------------------------------------------------------------------\n    // Calculate\n    // -------------------------------------------------------------------------\n\n    // Allocate temporary arrays\n    final a = Int32List(16),\n        b = Int32List(16),\n        c = Int32List(16),\n        d = Int32List(16),\n        e = Int32List(16),\n        f = Int32List(16);\n\n    // Initialize 'b'\n    for (var i = 0; i < 16; i++) {\n      b[i] = unpacked[i];\n    }\n\n    // Initialize 'a' and 'd'\n    a[0] = 1;\n    d[0] = 1;\n\n    // For each bit in 'secretKey'\n    for (var i = 254; i >= 0; i--) {\n      // Get the bit\n      final bit = 1 & (secretKey[i >> 3] >> (7 & i));\n\n      // if bit == 1:\n      //   swap(a, b)\n      //   swap(c, d)\n      _conditionalSwap(a, b, bit);\n      _conditionalSwap(c, d, bit);\n\n      // e = a + c\n      // a = a + c\n      // c = b + d\n      // b = b - d\n      for (var i = 0; i < 16; i++) {\n        final ai = a[i];\n        final bi = b[i];\n        final ci = c[i];\n        final di = d[i];\n        e[i] = ai + ci;\n        a[i] = ai - ci;\n        c[i] = bi + di;\n        b[i] = bi - di;\n      }\n\n      // d = e^2\n      // f = a^2\n      // a = c * a\n      // c = b * e\n      _multiply(d, e, e);\n      _multiply(f, a, a);\n      _multiply(a, c, a);\n      _multiply(c, b, e);\n\n      // e = a + c\n      // a = a - c\n      // c = d - f\n      for (var i = 0; i < 16; i++) {\n        final ai = a[i];\n        final ci = c[i];\n        e[i] = ai + ci;\n        a[i] = ai - ci;\n        c[i] = d[i] - f[i];\n      }\n\n      // b = a^2\n      _multiply(b, a, a);\n\n      // a = c * _constant121665 + d\n      _multiply(a, c, _constant121665);\n      for (var i = 0; i < 16; i++) {\n        a[i] += d[i];\n      }\n\n      // c = c * a\n      // a = d * f\n      // d = b * unpacked\n      // b = e^2\n      _multiply(c, c, a);\n      _multiply(a, d, f);\n      _multiply(d, b, unpacked);\n      _multiply(b, e, e);\n\n      // if bit == 1:\n      //   swap(a, b)\n      //   swap(c, d)\n      _conditionalSwap(a, b, bit);\n      _conditionalSwap(c, d, bit);\n    }\n\n    // Copy 'c' to 'd'\n    for (var i = 0; i < 16; i++) {\n      d[i] = c[i];\n    }\n\n    // 254 times\n    for (var i = 253; i >= 0; i--) {\n      // c = c^2\n      _multiply(c, c, c);\n\n      if (i != 2 && i != 4) {\n        // c = c * d\n        _multiply(c, c, d);\n      }\n    }\n\n    // a = a * c\n    _multiply(a, a, c);\n\n    // 3 times\n    for (var i = 0; i < 3; i++) {\n      var x = 1;\n      for (var i = 0; i < 16; i++) {\n        final v = 0xFFFF + a[i] + x;\n        x = v ~/ 0x10000;\n        a[i] = v - 0x10000 * x;\n      }\n      a[0] += 38 * (x - 1);\n    }\n\n    // 2 times\n    for (var i = 0; i < 2; i++) {\n      // The first element\n      var previous = a[0] - 0xFFED;\n      b[0] = 0xFFFF & previous;\n\n      // Subsequent elements\n      for (var j = 1; j < 15; j++) {\n        final current = a[j] - 0xFFFF - (1 & (previous >> 16));\n        b[j] = 0xFFFF & current;\n        previous = current;\n      }\n\n      // The last element\n      b[15] = a[15] - 0x7FFF - (1 & (previous >> 16));\n\n      // if isSwap == 1:\n      //   swap(a, m)\n      final isSwap = 1 - (1 & (b[15] >> 16));\n      _conditionalSwap(a, b, isSwap);\n    }\n\n    // -------------------------------------------------------------------------\n    // Pack the internal Int32List into result bytes\n    // -------------------------------------------------------------------------\n    for (var i = 0; i < 16; i++) {\n      result[2 * i] = 0xFF & a[i];\n      result[2 * i + 1] = a[i] >> 8;\n    }\n  }\n\n  /// Constant-time conditional swap.\n  ///\n  /// If b is 0, the function does nothing.\n  /// If b is 1, elements of the arrays will be swapped.\n  static void _conditionalSwap(Int32List p, Int32List q, int b) {\n    final c = ~(b - 1);\n    for (var i = 0; i < 16; i++) {\n      final t = c & (p[i] ^ q[i]);\n      p[i] ^= t;\n      q[i] ^= t;\n    }\n  }\n\n  /// Constant-time multiplication of the two arguments.\n  static void _multiply(Int32List result, Int32List a, Int32List b) {\n    var t0 = 0,\n        t1 = 0,\n        t2 = 0,\n        t3 = 0,\n        t4 = 0,\n        t5 = 0,\n        t6 = 0,\n        t7 = 0,\n        t8 = 0,\n        t9 = 0,\n        t10 = 0,\n        t11 = 0,\n        t12 = 0,\n        t13 = 0,\n        t14 = 0,\n        t15 = 0,\n        t16 = 0,\n        t17 = 0,\n        t18 = 0,\n        t19 = 0,\n        t20 = 0,\n        t21 = 0,\n        t22 = 0,\n        t23 = 0,\n        t24 = 0,\n        t25 = 0,\n        t26 = 0,\n        t27 = 0,\n        t28 = 0,\n        t29 = 0,\n        t30 = 0,\n        b0 = b[0],\n        b1 = b[1],\n        b2 = b[2],\n        b3 = b[3],\n        b4 = b[4],\n        b5 = b[5],\n        b6 = b[6],\n        b7 = b[7],\n        b8 = b[8],\n        b9 = b[9],\n        b10 = b[10],\n        b11 = b[11],\n        b12 = b[12],\n        b13 = b[13],\n        b14 = b[14],\n        b15 = b[15];\n\n    var v = a[0];\n    t0 += v * b0;\n    t1 += v * b1;\n    t2 += v * b2;\n    t3 += v * b3;\n    t4 += v * b4;\n    t5 += v * b5;\n    t6 += v * b6;\n    t7 += v * b7;\n    t8 += v * b8;\n    t9 += v * b9;\n    t10 += v * b10;\n    t11 += v * b11;\n    t12 += v * b12;\n    t13 += v * b13;\n    t14 += v * b14;\n    t15 += v * b15;\n    v = a[1];\n    t1 += v * b0;\n    t2 += v * b1;\n    t3 += v * b2;\n    t4 += v * b3;\n    t5 += v * b4;\n    t6 += v * b5;\n    t7 += v * b6;\n    t8 += v * b7;\n    t9 += v * b8;\n    t10 += v * b9;\n    t11 += v * b10;\n    t12 += v * b11;\n    t13 += v * b12;\n    t14 += v * b13;\n    t15 += v * b14;\n    t16 += v * b15;\n    v = a[2];\n    t2 += v * b0;\n    t3 += v * b1;\n    t4 += v * b2;\n    t5 += v * b3;\n    t6 += v * b4;\n    t7 += v * b5;\n    t8 += v * b6;\n    t9 += v * b7;\n    t10 += v * b8;\n    t11 += v * b9;\n    t12 += v * b10;\n    t13 += v * b11;\n    t14 += v * b12;\n    t15 += v * b13;\n    t16 += v * b14;\n    t17 += v * b15;\n    v = a[3];\n    t3 += v * b0;\n    t4 += v * b1;\n    t5 += v * b2;\n    t6 += v * b3;\n    t7 += v * b4;\n    t8 += v * b5;\n    t9 += v * b6;\n    t10 += v * b7;\n    t11 += v * b8;\n    t12 += v * b9;\n    t13 += v * b10;\n    t14 += v * b11;\n    t15 += v * b12;\n    t16 += v * b13;\n    t17 += v * b14;\n    t18 += v * b15;\n    v = a[4];\n    t4 += v * b0;\n    t5 += v * b1;\n    t6 += v * b2;\n    t7 += v * b3;\n    t8 += v * b4;\n    t9 += v * b5;\n    t10 += v * b6;\n    t11 += v * b7;\n    t12 += v * b8;\n    t13 += v * b9;\n    t14 += v * b10;\n    t15 += v * b11;\n    t16 += v * b12;\n    t17 += v * b13;\n    t18 += v * b14;\n    t19 += v * b15;\n    v = a[5];\n    t5 += v * b0;\n    t6 += v * b1;\n    t7 += v * b2;\n    t8 += v * b3;\n    t9 += v * b4;\n    t10 += v * b5;\n    t11 += v * b6;\n    t12 += v * b7;\n    t13 += v * b8;\n    t14 += v * b9;\n    t15 += v * b10;\n    t16 += v * b11;\n    t17 += v * b12;\n    t18 += v * b13;\n    t19 += v * b14;\n    t20 += v * b15;\n    v = a[6];\n    t6 += v * b0;\n    t7 += v * b1;\n    t8 += v * b2;\n    t9 += v * b3;\n    t10 += v * b4;\n    t11 += v * b5;\n    t12 += v * b6;\n    t13 += v * b7;\n    t14 += v * b8;\n    t15 += v * b9;\n    t16 += v * b10;\n    t17 += v * b11;\n    t18 += v * b12;\n    t19 += v * b13;\n    t20 += v * b14;\n    t21 += v * b15;\n    v = a[7];\n    t7 += v * b0;\n    t8 += v * b1;\n    t9 += v * b2;\n    t10 += v * b3;\n    t11 += v * b4;\n    t12 += v * b5;\n    t13 += v * b6;\n    t14 += v * b7;\n    t15 += v * b8;\n    t16 += v * b9;\n    t17 += v * b10;\n    t18 += v * b11;\n    t19 += v * b12;\n    t20 += v * b13;\n    t21 += v * b14;\n    t22 += v * b15;\n    v = a[8];\n    t8 += v * b0;\n    t9 += v * b1;\n    t10 += v * b2;\n    t11 += v * b3;\n    t12 += v * b4;\n    t13 += v * b5;\n    t14 += v * b6;\n    t15 += v * b7;\n    t16 += v * b8;\n    t17 += v * b9;\n    t18 += v * b10;\n    t19 += v * b11;\n    t20 += v * b12;\n    t21 += v * b13;\n    t22 += v * b14;\n    t23 += v * b15;\n    v = a[9];\n    t9 += v * b0;\n    t10 += v * b1;\n    t11 += v * b2;\n    t12 += v * b3;\n    t13 += v * b4;\n    t14 += v * b5;\n    t15 += v * b6;\n    t16 += v * b7;\n    t17 += v * b8;\n    t18 += v * b9;\n    t19 += v * b10;\n    t20 += v * b11;\n    t21 += v * b12;\n    t22 += v * b13;\n    t23 += v * b14;\n    t24 += v * b15;\n    v = a[10];\n    t10 += v * b0;\n    t11 += v * b1;\n    t12 += v * b2;\n    t13 += v * b3;\n    t14 += v * b4;\n    t15 += v * b5;\n    t16 += v * b6;\n    t17 += v * b7;\n    t18 += v * b8;\n    t19 += v * b9;\n    t20 += v * b10;\n    t21 += v * b11;\n    t22 += v * b12;\n    t23 += v * b13;\n    t24 += v * b14;\n    t25 += v * b15;\n    v = a[11];\n    t11 += v * b0;\n    t12 += v * b1;\n    t13 += v * b2;\n    t14 += v * b3;\n    t15 += v * b4;\n    t16 += v * b5;\n    t17 += v * b6;\n    t18 += v * b7;\n    t19 += v * b8;\n    t20 += v * b9;\n    t21 += v * b10;\n    t22 += v * b11;\n    t23 += v * b12;\n    t24 += v * b13;\n    t25 += v * b14;\n    t26 += v * b15;\n    v = a[12];\n    t12 += v * b0;\n    t13 += v * b1;\n    t14 += v * b2;\n    t15 += v * b3;\n    t16 += v * b4;\n    t17 += v * b5;\n    t18 += v * b6;\n    t19 += v * b7;\n    t20 += v * b8;\n    t21 += v * b9;\n    t22 += v * b10;\n    t23 += v * b11;\n    t24 += v * b12;\n    t25 += v * b13;\n    t26 += v * b14;\n    t27 += v * b15;\n    v = a[13];\n    t13 += v * b0;\n    t14 += v * b1;\n    t15 += v * b2;\n    t16 += v * b3;\n    t17 += v * b4;\n    t18 += v * b5;\n    t19 += v * b6;\n    t20 += v * b7;\n    t21 += v * b8;\n    t22 += v * b9;\n    t23 += v * b10;\n    t24 += v * b11;\n    t25 += v * b12;\n    t26 += v * b13;\n    t27 += v * b14;\n    t28 += v * b15;\n    v = a[14];\n    t14 += v * b0;\n    t15 += v * b1;\n    t16 += v * b2;\n    t17 += v * b3;\n    t18 += v * b4;\n    t19 += v * b5;\n    t20 += v * b6;\n    t21 += v * b7;\n    t22 += v * b8;\n    t23 += v * b9;\n    t24 += v * b10;\n    t25 += v * b11;\n    t26 += v * b12;\n    t27 += v * b13;\n    t28 += v * b14;\n    t29 += v * b15;\n    v = a[15];\n    t15 += v * b0;\n    t16 += v * b1;\n    t17 += v * b2;\n    t18 += v * b3;\n    t19 += v * b4;\n    t20 += v * b5;\n    t21 += v * b6;\n    t22 += v * b7;\n    t23 += v * b8;\n    t24 += v * b9;\n    t25 += v * b10;\n    t26 += v * b11;\n    t27 += v * b12;\n    t28 += v * b13;\n    t29 += v * b14;\n    t30 += v * b15;\n\n    t0 += 38 * t16;\n    t1 += 38 * t17;\n    t2 += 38 * t18;\n    t3 += 38 * t19;\n    t4 += 38 * t20;\n    t5 += 38 * t21;\n    t6 += 38 * t22;\n    t7 += 38 * t23;\n    t8 += 38 * t24;\n    t9 += 38 * t25;\n    t10 += 38 * t26;\n    t11 += 38 * t27;\n    t12 += 38 * t28;\n    t13 += 38 * t29;\n    t14 += 38 * t30;\n\n    var c = 1;\n    v = t0 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t0 = v - c * 0x10000;\n    v = t1 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t1 = v - c * 0x10000;\n    v = t2 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t2 = v - c * 0x10000;\n    v = t3 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t3 = v - c * 0x10000;\n    v = t4 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t4 = v - c * 0x10000;\n    v = t5 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t5 = v - c * 0x10000;\n    v = t6 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t6 = v - c * 0x10000;\n    v = t7 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t7 = v - c * 0x10000;\n    v = t8 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t8 = v - c * 0x10000;\n    v = t9 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t9 = v - c * 0x10000;\n    v = t10 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t10 = v - c * 0x10000;\n    v = t11 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t11 = v - c * 0x10000;\n    v = t12 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t12 = v - c * 0x10000;\n    v = t13 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t13 = v - c * 0x10000;\n    v = t14 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t14 = v - c * 0x10000;\n    v = t15 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t15 = v - c * 0x10000;\n    t0 += c - 1 + 37 * (c - 1);\n\n    c = 1;\n    v = t0 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t0 = v - c * 0x10000;\n    v = t1 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t1 = v - c * 0x10000;\n    v = t2 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t2 = v - c * 0x10000;\n    v = t3 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t3 = v - c * 0x10000;\n    v = t4 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t4 = v - c * 0x10000;\n    v = t5 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t5 = v - c * 0x10000;\n    v = t6 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t6 = v - c * 0x10000;\n    v = t7 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t7 = v - c * 0x10000;\n    v = t8 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t8 = v - c * 0x10000;\n    v = t9 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t9 = v - c * 0x10000;\n    v = t10 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t10 = v - c * 0x10000;\n    v = t11 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t11 = v - c * 0x10000;\n    v = t12 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t12 = v - c * 0x10000;\n    v = t13 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t13 = v - c * 0x10000;\n    v = t14 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t14 = v - c * 0x10000;\n    v = t15 + c + 0xFFFF;\n    c = v ~/ 0x10000;\n    t15 = v - c * 0x10000;\n    t0 += c - 1 + 37 * (c - 1);\n\n    result[0] = t0;\n    result[1] = t1;\n    result[2] = t2;\n    result[3] = t3;\n    result[4] = t4;\n    result[5] = t5;\n    result[6] = t6;\n    result[7] = t7;\n    result[8] = t8;\n    result[9] = t9;\n    result[10] = t10;\n    result[11] = t11;\n    result[12] = t12;\n    result[13] = t13;\n    result[14] = t14;\n    result[15] = t15;\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/giphy_picker.dart",
    "content": "import 'dart:async';\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_context.dart';\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_search_page.dart';\nimport 'package:flutter/material.dart';\nimport 'package:giphy_client/giphy_client.dart';\n\ntypedef ErrorListener = void Function(dynamic error);\n\n/// Provides Giphy picker functionality.\nclass GiphyPicker {\n  /// Renders a full screen modal dialog for searching, and selecting a Giphy image.\n  static Future<GiphyGif> pickGif(\n      {@required BuildContext context,\n      @required String apiKey,\n      String rating = GiphyRating.g,\n      String lang = GiphyLanguage.english,\n      Widget title,\n      ErrorListener onError}) async {\n    GiphyGif result;\n\n    await Navigator.push(\n        context,\n        MaterialPageRoute(\n            builder: (BuildContext context) => GiphyContext(\n                child: GiphySearchPage(),\n                apiKey: apiKey,\n                rating: rating,\n                language: lang,\n                onError: onError ?? (error) => _showErrorDialog(context, error),\n                onSelected: (gif) {\n                  result = gif;\n                  Navigator.pop(context);\n                }),\n            fullscreenDialog: true));\n\n    return result;\n  }\n\n  static void _showErrorDialog(BuildContext context, dynamic error) {\n    showDialog(\n      context: context,\n      builder: (BuildContext context) {\n        return AlertDialog(\n          title: new Text('Giphy error'),\n          content: new Text('An error occurred. $error'),\n          actions: <Widget>[\n            new FlatButton(\n              child: new Text(\"Close\"),\n              onPressed: () {\n                Navigator.of(context).pop();\n              },\n            ),\n          ],\n        );\n      },\n    );\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/model/giphy_repository.dart",
    "content": "import 'dart:async';\nimport 'dart:collection';\nimport 'dart:typed_data';\n\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_image.dart';\nimport 'package:flutter/foundation.dart';\nimport 'package:Enigma/GiphyPicker/src/model/repository.dart';\nimport 'package:Enigma/GiphyPicker/giphy_picker.dart';\nimport 'package:giphy_client/giphy_client.dart';\nimport 'package:http/http.dart' as http;\n\ntypedef Future<GiphyCollection> GetCollection(\n    GiphyClient client, int offset, int limit);\n\n/// Retrieves and caches gif collections from Giphy.\nclass GiphyRepository extends Repository<GiphyGif> {\n  final _client = http.Client();\n  final _previewCompleters = HashMap<int, Completer<Uint8List>>();\n  final _previewQueue = Queue<int>();\n  final GetCollection getCollection;\n  final int maxConcurrentPreviewLoad;\n  GiphyClient _giphyClient;\n  int _previewLoad = 0;\n\n  GiphyRepository(\n      {@required String apiKey,\n      @required this.getCollection,\n      this.maxConcurrentPreviewLoad = 4,\n      int pageSize = 25,\n      ErrorListener onError})\n      : super(pageSize: pageSize, onError: onError) {\n    assert(getCollection != null);\n    assert(maxConcurrentPreviewLoad != null);\n    _giphyClient = GiphyClient(apiKey: apiKey, client: _client);\n  }\n\n  /// Retrieves specified page of gif data from Giphy.\n  Future<Page<GiphyGif>> getPage(int page) async {\n    final offset = page * pageSize;\n    final collection = await getCollection(_giphyClient, offset, pageSize);\n    return Page(collection.data, page, collection.pagination.totalCount);\n  }\n\n  /// Retrieves a preview Gif image at specified index.\n  Future<Uint8List> getPreview(int index) async {\n    assert(index != null);\n\n    var completer = _previewCompleters[index];\n    if (completer == null) {\n      completer = Completer<Uint8List>();\n      _previewCompleters[index] = completer;\n      _previewQueue.add(index);\n\n      // initiate next load\n      _loadNextPreview();\n    }\n\n    return completer.future;\n  }\n\n  /// Cancels retrieving specified preview image, by removing it from the queue.\n  void cancelGetPreview(int index) {\n    assert(index != null);\n\n    final completer = _previewCompleters.remove(index);\n    if (completer != null) {\n      // remove from queue\n      _previewQueue.remove(index);\n\n      // and complete with null\n      completer.complete(null);\n    }\n  }\n\n  void _loadNextPreview() {\n    if (_previewLoad < maxConcurrentPreviewLoad && _previewQueue.isNotEmpty) {\n      _previewLoad++;\n\n      final index = _previewQueue.removeLast();\n      final completer = _previewCompleters.remove(index);\n      if (completer != null) {\n        get(index).then(_loadPreviewImage).then((bytes) {\n          if (!completer.isCompleted) {\n            completer.complete(bytes);\n          }\n        }).whenComplete(() {\n          _previewLoad--;\n          _loadNextPreview();\n        });\n      } else {\n        _previewLoad--;\n      }\n\n      _loadNextPreview();\n    }\n  }\n\n  Future<Uint8List> _loadPreviewImage(GiphyGif gif) async {\n    // fallback to still image if preview is empty\n    final url =\n        gif.images.previewGif.url ?? gif.images.fixedWidthSmallStill.url;\n    if (url != null) {\n      return await GiphyImage.load(url, client: _client);\n    }\n\n    return null;\n  }\n\n  /// The repository of trending gif images.\n  static Future<GiphyRepository> trending(\n      {@required String apiKey,\n      String rating = GiphyRating.g,\n      ErrorListener onError}) async {\n    final repo = GiphyRepository(\n        apiKey: apiKey,\n        getCollection: (client, offset, limit) =>\n            client.trending(offset: offset, limit: limit, rating: rating),\n        onError: onError);\n\n    // retrieve first page\n    await repo.get(0);\n\n    return repo;\n  }\n\n  /// A repository of images for given search query.\n  static Future<GiphyRepository> search(\n      {@required String apiKey,\n      @required String query,\n      String rating = GiphyRating.g,\n      String lang = GiphyLanguage.english,\n      ErrorListener onError}) async {\n    final repo = GiphyRepository(\n        apiKey: apiKey,\n        getCollection: (client, offset, limit) => client.search(query,\n            offset: offset, limit: limit, rating: rating, lang: lang),\n        onError: onError);\n\n    // retrieve first page\n    await repo.get(0);\n\n    return repo;\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/model/repository.dart",
    "content": "import 'dart:async';\nimport 'dart:collection';\n\nimport 'package:Enigma/GiphyPicker/giphy_picker.dart';\n\n/// A general-purpose repository with support for on-demand paged retrieval and caching of values of type T.\nabstract class Repository<T> {\n  final HashMap<int, T> _cache = HashMap<int, T>();\n  final Set<int> _pagesLoading = Set<int>();\n  final HashMap<int, Completer<T>> _completers = HashMap<int, Completer<T>>();\n  final int pageSize;\n  final ErrorListener onError;\n  int _totalCount;\n\n  Repository({this.pageSize, this.onError}) {\n    assert(pageSize != null);\n    assert(onError != null);\n  }\n\n  /// The total number of values available.\n  int get totalCount => _totalCount;\n\n  /// Asynchronously retrieves the value at specified index. When not available in local cache\n  /// the page containing the value is retrieved.\n  Future<T> get(int index) {\n    assert(index != null);\n    // index must within bounds, or 0 if totalCount is null\n    assert(\n        _totalCount == null && index == 0 || index >= 0 && index < _totalCount);\n\n    final value = _cache[index];\n\n    // value is availableÍ\n    if (value != null) {\n      return Future.value(value);\n    }\n\n    final page = index ~/ pageSize;\n\n    // value is not available, retrieve page\n    if (!_pagesLoading.contains(page)) {\n      _pagesLoading.add(page);\n      final future = getPage(page);\n      future.then((page) => _onGetPage(page)).catchError(onError);\n    }\n\n    // value is being retrieved\n    var completer = _completers[index];\n    if (completer == null) {\n      completer = Completer<T>();\n      _completers[index] = completer;\n    }\n\n    return completer.future;\n  }\n\n  void _onGetPage(Page<T> page) {\n    _pagesLoading.remove(page);\n    _totalCount = page.totalCount;\n\n    if (_totalCount == 0) {\n      // complete all with null\n      _completers.values.forEach((c) => c.complete(null));\n      _completers.clear();\n    } else {\n      for (var i = 0; i < page.values.length; i++) {\n        // store value\n        final index = page.page * pageSize + i;\n        final value = page.values[i];\n        _cache[index] = value;\n\n        // complete optional completer\n        final completer = _completers.remove(index);\n        completer?.complete(value);\n      }\n    }\n  }\n\n  Future<Page<T>> getPage(int page);\n}\n\n/// Represents a page of values.\nclass Page<T> {\n  final List<T> values;\n  final int page;\n  final int totalCount;\n\n  const Page(this.values, this.page, this.totalCount);\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_context.dart",
    "content": "import 'package:flutter/material.dart';\nimport 'package:giphy_client/giphy_client.dart';\nimport 'package:Enigma/GiphyPicker/giphy_picker.dart';\n\n/// Provides the context for a Giphy search operation, and makes its data available to its widget sub-tree.\nclass GiphyContext extends InheritedWidget {\n  final String apiKey;\n  final String rating;\n  final String language;\n  final ValueChanged<GiphyGif> onSelected;\n  final ErrorListener onError;\n\n  const GiphyContext(\n      {Key key,\n      @required Widget child,\n      @required this.apiKey,\n      this.rating = GiphyRating.g,\n      this.language = GiphyLanguage.english,\n      this.onSelected,\n      this.onError})\n      : super(key: key, child: child);\n\n  void select(GiphyGif gif) {\n    if (onSelected != null) {\n      onSelected(gif);\n    }\n  }\n\n  void error(dynamic error) {\n    if (onError != null) {\n      onError(error);\n    }\n  }\n\n  @override\n  bool updateShouldNotify(InheritedWidget oldWidget) => false;\n\n  static GiphyContext of(BuildContext context) {\n    final settings = context\n        .ancestorInheritedElementForWidgetOfExactType(GiphyContext)\n        ?.widget as GiphyContext;\n\n    if (settings == null) {\n      throw 'Required GiphyContext widget not found. Make sure to wrap your widget with GiphyContext.';\n    }\n    return settings;\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_image.dart",
    "content": "import 'dart:typed_data';\n\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_overlay.dart';\nimport 'package:flutter/material.dart';\nimport 'package:http/http.dart';\nimport 'package:giphy_client/giphy_client.dart';\n\n/// Loads and renders a Giphy image.\nclass GiphyImage extends StatefulWidget {\n  final String url;\n  final Widget placeholder;\n  final double width;\n  final double height;\n  final BoxFit fit;\n  final bool renderGiphyOverlay;\n\n  /// Loads an image from given url.\n  const GiphyImage(\n      {Key key,\n      @required this.url,\n      this.placeholder,\n      this.width,\n      this.height,\n      this.fit,\n      this.renderGiphyOverlay = true})\n      : super(key: key);\n\n  /// Loads the original image for given Giphy gif.\n  GiphyImage.original(\n      {Key key,\n      @required GiphyGif gif,\n      this.placeholder,\n      this.width,\n      this.height,\n      this.fit,\n      this.renderGiphyOverlay = true})\n      : url = gif.images.original.url,\n        super(key: key ?? Key(gif.id));\n\n  /// Loads the original still image for given Giphy gif.\n  GiphyImage.originalStill(\n      {Key key,\n      @required GiphyGif gif,\n      this.placeholder,\n      this.width,\n      this.height,\n      this.fit,\n      this.renderGiphyOverlay = true})\n      : url = gif.images.originalStill.url,\n        super(key: key ?? Key(gif.id));\n\n  @override\n  _GiphyImageState createState() => _GiphyImageState();\n\n  /// Loads the images bytes for given url from Giphy.\n  static Future<Uint8List> load(String url, {Client client}) async {\n    assert(url != null);\n\n    final response =\n        await (client ?? Client()).get(url, headers: {'accept': 'image/*'});\n\n    if (response.statusCode == 200) {\n      return response.bodyBytes;\n    }\n    return null;\n  }\n}\n\nclass _GiphyImageState extends State<GiphyImage> {\n  Future<Uint8List> _loadImage;\n\n  @override\n  void initState() {\n    _loadImage = GiphyImage.load(widget.url);\n    super.initState();\n  }\n\n  @override\n  Widget build(BuildContext context) => FutureBuilder(\n      future: _loadImage,\n      builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {\n        if (snapshot.hasData) {\n          final image = Image.memory(snapshot.data,\n              width: widget.width, height: widget.height, fit: widget.fit);\n\n          if (widget.renderGiphyOverlay) {\n            return GiphyOverlay(child: image);\n          }\n          return image;\n        }\n        return widget.placeholder ?? Center(child: CircularProgressIndicator());\n      });\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_overlay.dart",
    "content": "import 'package:flutter/material.dart';\n\n/// Renders a 'Powered by GIPHY' overlay image over its content\nclass GiphyOverlay extends StatelessWidget {\n  final Widget child;\n\n  const GiphyOverlay({this.child});\n\n  @override\n  Widget build(BuildContext context) {\n    return Stack(children: <Widget>[\n      child,\n      Positioned(\n          left: 0,\n          right: 0,\n          bottom: 0,\n          height: 16,\n          child: IgnorePointer(\n              child: Container(\n                  alignment: Alignment.centerLeft,\n                  color: Colors.black45,\n                  padding: EdgeInsets.symmetric(vertical: 2),\n                  child: Image.asset(\n                      'assets/giphy.png',\n                      height: 14))))\n    ]);\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_preview_page.dart",
    "content": "import 'package:Enigma/GiphyPicker/src/widgets/giphy_image.dart';\nimport 'package:flutter/material.dart';\nimport 'package:giphy_client/giphy_client.dart';\nimport 'package:Enigma/const.dart';\n\n/// Presents a Giphy preview image.\nclass GiphyPreviewPage extends StatelessWidget {\n  final GiphyGif gif;\n  final Widget title;\n  final ValueChanged<GiphyGif> onSelected;\n\n  const GiphyPreviewPage(\n      {@required this.gif, @required this.onSelected, this.title});\n\n  @override\n  Widget build(BuildContext context) {\n    return Theme(\n        data: EnigmaTheme,\n        child: Scaffold(\n            appBar: AppBar(title: title, actions: <Widget>[\n              IconButton(\n                  icon: Icon(Icons.check), onPressed: () {\n                    onSelected(gif);\n                    Navigator.pop(context);\n                  })\n            ]),\n            body: SafeArea(\n                child: Center(child: GiphyImage.original(gif: gif)),\n                bottom: false)));\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_search_page.dart",
    "content": "import 'package:Enigma/GiphyPicker/src/widgets/giphy_search_view.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:flutter/material.dart';\n\nclass GiphySearchPage extends StatelessWidget {\n  final Widget title;\n\n  const GiphySearchPage({this.title});\n\n  @override\n  Widget build(BuildContext context) {\n    return Theme(\n        data: EnigmaTheme,\n        child: Scaffold(\n            appBar: AppBar(title: Image.asset('assets/giphy.png')),\n            body: SafeArea(child: GiphySearchView(), bottom: false)));\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_search_view.dart",
    "content": "import 'dart:async';\n\nimport 'package:Enigma/GiphyPicker/src/model/giphy_repository.dart';\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_context.dart';\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_thumbnail_grid.dart';\nimport 'package:flutter/material.dart';\n\n/// Provides the UI for searching Giphy gif images.\nclass GiphySearchView extends StatefulWidget {\n  @override\n  _GiphySearchViewState createState() => _GiphySearchViewState();\n}\n\nclass _GiphySearchViewState extends State<GiphySearchView> {\n  final _textController = TextEditingController();\n  final _scrollController = ScrollController();\n  final _repoController = StreamController<GiphyRepository>();\n\n  @override\n  void initState() {\n    // initiate search on next frame (we need context)\n    Future.delayed(Duration.zero, () {\n      final giphy = GiphyContext.of(context);\n      _search(giphy);\n    });\n    super.initState();\n  }\n\n  @override\n  void dispose() {\n    _repoController.close();\n    super.dispose();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    final giphy = GiphyContext.of(context);\n\n    return Column(children: <Widget>[\n      Padding(\n          padding: EdgeInsets.symmetric(horizontal: 10),\n          child: TextField(\n              controller: _textController,\n              decoration: InputDecoration(hintText: 'Search Giphy'),\n              onChanged: (value) => _delayedSearch(giphy, value))),\n      Expanded(\n          child: StreamBuilder(\n              stream: _repoController.stream,\n              builder: (BuildContext context,\n                  AsyncSnapshot<GiphyRepository> snapshot) {\n                if (snapshot.hasData) {\n                  return snapshot.data.totalCount > 0\n                      ? NotificationListener(\n                          child: RefreshIndicator(\n                              child: GiphyThumbnailGrid(\n                                  key: Key('${snapshot.data.hashCode}'),\n                                  repo: snapshot.data,\n                                  scrollController: _scrollController),\n                              onRefresh: () =>\n                                  _search(giphy, term: _textController.text)),\n                          onNotification: (n) {\n                            // hide keyboard when scrolling\n                            if (n is UserScrollNotification) {\n                              FocusScope.of(context).requestFocus(FocusNode());\n                            }\n                            return false;\n                          },\n                        )\n                      : Center(child: Text('No results'));\n                }\n                return Center(child: CircularProgressIndicator());\n              }))\n    ]);\n  }\n\n  void _delayedSearch(GiphyContext giphy, String term) => Future.delayed(\n      Duration(milliseconds: 500), () => _search(giphy, term: term));\n\n  Future _search(GiphyContext giphy, {String term = ''}) async {\n    // skip search if term does not match current search text\n    if (term != _textController.text) {\n      return;\n    }\n\n    try {\n      // search, or trending when term is empty\n      final repo = await (term.isEmpty\n          ? GiphyRepository.trending(\n              apiKey: giphy.apiKey,\n              rating: giphy.rating,\n              onError: giphy.onError)\n          : GiphyRepository.search(\n              apiKey: giphy.apiKey,\n              query: term,\n              rating: giphy.rating,\n              lang: giphy.language,\n              onError: giphy.onError));\n\n      // scroll up\n      if (_scrollController.hasClients) {\n        _scrollController.jumpTo(0);\n      }\n      _repoController.add(repo);\n    } catch (error) {\n      giphy.onError(error);\n    }\n  }\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_thumbnail.dart",
    "content": "import 'dart:typed_data';\n\nimport 'package:Enigma/GiphyPicker/src/model/giphy_repository.dart';\nimport 'package:flutter/material.dart';\n\n/// Loads and renders a gif thumbnail image using a GiphyRepostory and an index.\nclass GiphyThumbnail extends StatefulWidget {\n  final GiphyRepository repo;\n  final int index;\n  final Widget placeholder;\n\n  const GiphyThumbnail(\n      {Key key, @required this.repo, @required this.index, this.placeholder})\n      : super(key: key);\n\n  @override\n  _GiphyThumbnailState createState() => _GiphyThumbnailState();\n}\n\nclass _GiphyThumbnailState extends State<GiphyThumbnail> {\n  Future<Uint8List> _loadPreview;\n\n  @override\n  void initState() {\n    _loadPreview = widget.repo.getPreview(widget.index);\n    super.initState();\n  }\n\n  @override\n  void dispose() {\n    widget.repo.cancelGetPreview(widget.index);\n    super.dispose();\n  }\n\n  @override\n  Widget build(BuildContext context) => FutureBuilder(\n      future: _loadPreview,\n      builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {\n        if (!snapshot.hasData) {\n          return widget.placeholder ?? Container(color: Colors.grey.shade200);\n        }\n        return Image.memory(snapshot.data, fit: BoxFit.cover);\n      });\n}\n"
  },
  {
    "path": "lib/GiphyPicker/src/widgets/giphy_thumbnail_grid.dart",
    "content": "import 'package:Enigma/GiphyPicker/src/model/giphy_repository.dart';\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_context.dart';\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_preview_page.dart';\nimport 'package:Enigma/GiphyPicker/src/widgets/giphy_thumbnail.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:flutter/material.dart';\n\n/// A selectable grid view of gif thumbnails.\nclass GiphyThumbnailGrid extends StatelessWidget {\n  final GiphyRepository repo;\n  final ScrollController scrollController;\n\n  const GiphyThumbnailGrid(\n      {Key key, @required this.repo, this.scrollController})\n      : super(key: key);\n\n  @override\n  Widget build(BuildContext context) {\n    return GridView.builder(\n        padding: EdgeInsets.all(10),\n        controller: scrollController,\n        itemCount: repo.totalCount,\n        itemBuilder: (BuildContext context, int index) => GestureDetector(\n            child: GiphyThumbnail(key: Key('$index'), repo: repo, index: index),\n            onTap: () async {\n              // display preview page\n              final giphy = GiphyContext.of(context);\n              final gif = await repo.get(index);\n              unawaited(Navigator.push(\n                  context,\n                  MaterialPageRoute(\n                      builder: (BuildContext context) => GiphyPreviewPage(\n                          gif: gif, onSelected: giphy.onSelected))));\n            }),\n        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(\n            crossAxisCount:\n                MediaQuery.of(context).orientation == Orientation.portrait\n                    ? 2\n                    : 3,\n            childAspectRatio: 1.6,\n            crossAxisSpacing: 5,\n            mainAxisSpacing: 5));\n  }\n}\n"
  },
  {
    "path": "lib/ImagePicker/image_picker.dart",
    "content": "import 'dart:io';\n\nimport 'package:Enigma/open_settings.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:image_picker/image_picker.dart';\nimport 'package:image_cropper/image_cropper.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:permission_handler/permission_handler.dart';\n\n//图片选择界面\nclass HybridImagePicker extends StatefulWidget {\n  HybridImagePicker(\n      {Key key,\n      @required this.title,\n      @required this.callback,\n      this.profile = false})\n      : super(key: key);\n\n\n  //页面标题\n  final String title;\n  //回调\n  final Function callback;\n  //\n  final bool profile;\n\n  @override\n  _HybridImagePickerState createState() => new _HybridImagePickerState();\n}\n\nclass _HybridImagePickerState extends State<HybridImagePicker> {\n  //选择到的图片文件\n  File _imageFile;\n\n  //是否加载进度条\n  bool isLoading = false;\n\n  @override\n  void initState() {\n    //状态栏透明\n    SystemUiOverlayStyle systemUiOverlayStyle =\n    SystemUiOverlayStyle(statusBarColor: Colors.transparent);\n    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);\n    super.initState();\n\n  }\n\n  //将选择到的图片文件设置到属性中\n  void captureImage(ImageSource captureMode) async {\n    try {\n      var imageFile = await ImagePicker.pickImage(source: captureMode);\n      setState(() {\n        _imageFile = imageFile;\n      });\n    } catch (e) {}\n  }\n\n  //返回image组件\n  Widget _buildImage() {\n    if (_imageFile != null) {\n      return new Image.file(_imageFile);\n    } else {\n      return new Text('Take an image to start',\n          style: new TextStyle(fontSize: 18.0, color: enigmaWhite));\n    }\n  }\n\n  //裁剪图片\n  Future<Null> _cropImage() async {\n    double x, y;\n    if (widget.profile) {\n      x = 1.0;\n      y = 1.0;\n    }\n    //选择裁剪后的图片\n    File croppedFile = await ImageCropper.cropImage(\n        sourcePath: _imageFile.path);\n    setState(() {\n      if (croppedFile != null) _imageFile = croppedFile;\n    });\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Enigma.getNTPWrappedWidget(WillPopScope(\n      child: Scaffold(\n        backgroundColor: enigmaBlack,//背景颜色\n        appBar: new AppBar( //app的标题栏\n            title: new Text(widget.title),//标题文字\n            backgroundColor: Colors.blueAccent,//背景颜色\n            actions: _imageFile != null//如果图片文件不为空的话就显示两个图标按钮，一个裁剪，一个确定\n                ? <Widget>[\n                    IconButton(\n                        icon: Icon(Icons.edit, color: Colors.black),\n                        disabledColor: Colors.transparent,\n                        onPressed: () {\n                          //裁剪按钮的点击事件\n                          _cropImage();\n                        }),\n                    IconButton(\n                        icon: Icon(Icons.check, color: Colors.black),\n                        onPressed: () {\n                          //确定按钮的点击事件\n                          setState(() {\n                            isLoading = true;\n                          });\n                          //调用传来的回调，把文件传过去，让调用者自己处理\n                          widget.callback(_imageFile).then((imageUrl) {\n                            Navigator.pop(context, imageUrl);\n                          });\n                        }),\n                    SizedBox(\n                      width: 8.0,\n                    )\n                  ]\n                : []),\n        body: Stack(children: [//绝对布局\n          new Column(children: [//一列\n            new Expanded(child: new Center(child: _buildImage())),\n            _buildButtons()\n          ]),\n          Positioned( //进度条\n            child: isLoading //如果正在家在的话就显示进度条，如果没有的话就什么都不显示\n                ? Container(\n                    child: Center(\n                      child: CircularProgressIndicator(\n                          valueColor:\n                              AlwaysStoppedAnimation<Color>(enigmaBlue)),\n                    ),\n                    color: enigmaBlack.withOpacity(0.8),\n                  )\n                : Container(),\n          )\n        ]),\n      ),\n      onWillPop: () => Future.value(!isLoading),\n    ));\n  }\n\n  //构建按钮\n  Widget _buildButtons() {\n    //一个约束盒子\n    return new ConstrainedBox(\n      //高度60\n        constraints: BoxConstraints.expand(height: 60.0),\n        //新的一行\n        child: new Row(\n            crossAxisAlignment: CrossAxisAlignment.stretch,\n            mainAxisAlignment: MainAxisAlignment.spaceAround,\n            children: <Widget>[\n              //左下角选择图片按钮\n              _buildActionButton(new Key('retake'), Icons.photo_library, () {\n                //检查权限\n                Enigma.checkAndRequestPermission(PermissionGroup.storage)\n                    .then((res) {\n                  if (res) {\n                    captureImage(ImageSource.gallery);\n                  } else {\n                    Enigma.showRationale(\n                        'Permission to access gallery needed to send photos to your friends.');\n                    Navigator.pushReplacement(\n                        context,\n                        new MaterialPageRoute(\n                            builder: (context) => OpenSettings()));\n                  }\n                });\n              }),\n              //右下角选择拍照按钮\n              _buildActionButton(new Key('upload'), Icons.photo_camera, () {\n                //检查权限\n                Enigma.checkAndRequestPermission(PermissionGroup.camera)\n                    .then((res) {\n                  if (res) {\n                    captureImage(ImageSource.camera);\n                  } else {\n                    Enigma.showRationale(\n                        'Permission to access camera needed to take photos to share with your friends.');\n                    Navigator.pushReplacement(\n                        context,\n                        new MaterialPageRoute(\n                            builder: (context) => OpenSettings()));\n                  }\n                });\n              }),\n            ]));\n  }\n\n  Widget _buildActionButton(Key key, IconData icon, Function onPressed) {\n    return new Expanded(\n      child: new RaisedButton(\n          key: key,\n          child: Icon(icon, size: 30.0),\n          shape: new RoundedRectangleBorder(),\n          color: Colors.blueAccent,\n          textColor: Colors.white,\n          onPressed: onPressed),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/alias.dart",
    "content": "import 'dart:io';\n\nimport 'package:Enigma/DataModel.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:Enigma/util/const.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:flutter/material.dart';\nimport 'package:Enigma/ImagePicker/image_picker.dart';\n\n//修改备注的弹出框\nclass AliasForm extends StatefulWidget {\n  final Map<String, dynamic> user;//用户信息\n  final DataModel model;//数据模型\n  AliasForm(this.user, this.model);\n\n  @override\n  _AliasFormState createState() => _AliasFormState();\n}\n\nclass _AliasFormState extends State<AliasForm> {\n\n  //文本控制器，用于获得备注\n  TextEditingController _alias;\n\n  //头像文件\n  File _imageFile;\n\n  @override\n  void initState() {\n    super.initState();\n    _alias = new TextEditingController(text: Enigma.getNickname(widget.user));\n  }\n\n  //获得图片\n  Future getImage(File image) {\n    setState(() {\n      _imageFile = image;\n    });\n    return Future.value(false);\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    String name = Enigma.getNickname(widget.user);\n    return Theme(\n        child: AlertDialog(\n          actions: <Widget>[\n            //两个按钮，一个是添加备注，一个是删除备注\n            FlatButton(\n                child: Text(\n                  '删除备注',\n                  style: TextStyle(fontWeight: FontWeight.bold),\n                ),\n                onPressed: widget.user[ALIAS_NAME] != null ||\n                        widget.user[ALIAS_AVATAR] != null\n                    ? () {\n                  //删除备注\n                        widget.model.removeAlias(widget.user[PHONE]);\n                        Navigator.pop(context);\n                      }\n                    : null),\n            FlatButton(\n                child: Text(\n                  '添加备注',\n                  style: TextStyle(fontWeight: FontWeight.bold),\n                ),\n                onPressed: () {\n                  if (_alias.text.isNotEmpty) {\n                    if (_alias.text != name || _imageFile != null) {\n                      //添加备注\n                      widget.model.setAlias(\n                          _alias.text, _imageFile, widget.user[PHONE]);\n                    }\n                    Navigator.pop(context);\n                  }\n                })\n          ],\n          contentPadding: EdgeInsets.all(20),\n          content: SingleChildScrollView(\n            child: Column(mainAxisSize: MainAxisSize.min, children: [\n              Container(\n                  width: 120,\n                  height: 120,\n                  child: Stack(children: [\n                    Center( //头像\n                        child: Enigma.avatar(widget.user,\n                            image: _imageFile, radius: 50)),\n                    Positioned(//修改按钮\n                        bottom: 0,\n                        right: 0,\n                        child: FloatingActionButton(\n                          mini: true,\n                          child: Icon(Icons.edit),\n                          onPressed: () {\n                            Navigator.push(\n                                context,\n                                MaterialPageRoute(\n                                    builder: (context) => HybridImagePicker(\n                                          title: 'Pick an image',\n                                          callback: getImage,\n                                          profile: true,\n                                        )));\n                          },\n                        )),\n                  ])),\n              TextFormField( //备注文本的输入框\n                autovalidate: true,\n                controller: _alias,\n                decoration: InputDecoration(hintText: '备注'),\n                validator: (val) {\n                  if (val.trim().isEmpty) return '备注不能为空!';\n                  return null;\n                },\n              )\n            ]),\n          ),\n        ),\n        data: Constants.lightTheme);\n  }\n}\n"
  },
  {
    "path": "lib/bubble.dart",
    "content": "import 'package:flutter/material.dart';\nimport 'package:intl/intl.dart';\n\nimport 'const.dart';\nimport 'seen_provider.dart';\n\n//聊天的信息框\nclass Bubble extends StatelessWidget {\n  const Bubble(\n      {@required this.child,\n      @required this.timestamp,\n      @required this.delivered,\n      @required this.isMe,\n      @required this.isContinuing});\n\n  final int timestamp;//聊天的时间\n  final Widget child;//子组件\n  final dynamic delivered;//分割线\n  final bool isMe, isContinuing;//是否是我，是否继续\n\n  //时间格式\n  humanReadableTime() => DateFormat('hh:mm')\n      .format(DateTime.fromMillisecondsSinceEpoch(timestamp));\n\n  //获取最近的状态\n  getSeenStatus(seen) {\n    if (seen is bool) return true;\n    if (seen is String) return true;\n    return timestamp <= seen;\n  }\n\n  //构建界面\n  @override\n  Widget build(BuildContext context) {\n    //获取最近的状态以及时间\n    final bool seen = getSeenStatus(SeenProvider.of(context).value);\n    final bg = isMe ? Theme.of(context).accentColor : Colors.grey[200];\n    final align = isMe ? CrossAxisAlignment.end : CrossAxisAlignment.start;\n\n    dynamic icon = delivered is bool && delivered\n        ? (seen ? Icons.done_all : Icons.done)\n        : Icons.access_time;\n    final color = isMe ? Colors.white : Colors.black;\n    icon = Icon(icon, size: 13.0, color: seen ? Colors.greenAccent : color);\n    if (delivered is Future) {\n      icon = FutureBuilder(\n          future: delivered,\n          builder: (context, res) {\n            switch (res.connectionState) {\n              case ConnectionState.done:\n                return Icon((seen ? Icons.done_all : Icons.done),\n                    size: 13.0, color: seen ? Colors.greenAccent : color);\n              case ConnectionState.none:\n              case ConnectionState.active:\n              case ConnectionState.waiting:\n              default:\n                return Icon(Icons.access_time,\n                    size: 13.0, color: seen ? Colors.greenAccent : color);\n            }\n          });\n    }\n    dynamic radius = isMe\n        ? BorderRadius.only(\n            topLeft: Radius.circular(5.0),\n            bottomLeft: Radius.circular(5.0),\n            bottomRight: Radius.circular(10.0),\n          )\n        : BorderRadius.only(\n            topRight: Radius.circular(5.0),\n            bottomLeft: Radius.circular(10.0),\n            bottomRight: Radius.circular(5.0),\n          );\n    dynamic margin = const EdgeInsets.only(top: 20.0, bottom: 1.5);\n    if (isContinuing) {\n      radius = BorderRadius.all(Radius.circular(5.0));\n      margin = const EdgeInsets.all(1.5);\n    }\n\n    return SingleChildScrollView(\n        child: Column(\n      crossAxisAlignment: align,\n      children: <Widget>[\n        Container(\n          margin: margin,\n          padding: const EdgeInsets.all(8.0),\n          constraints: BoxConstraints(\n              maxWidth: MediaQuery.of(context).size.width * 0.75),\n          decoration: BoxDecoration(\n            color: bg,\n            borderRadius: radius,\n          ),\n          child: Stack(\n            children: <Widget>[\n              Padding(\n                  padding: child is Container\n                      ? EdgeInsets.all(0.0)\n                      : EdgeInsets.only(right: isMe ? 10.0 : 15.0),\n                  child: child),\n\n            ],\n          ),\n        ),\n        Padding(\n          padding: isMe\n              ? EdgeInsets.only(\n                  right: 0,\n                  bottom: 10.0,\n                )\n              : EdgeInsets.only(\n                  left: 10,\n                  bottom: 10.0,\n                ),\n          child: Text(\n            humanReadableTime().toString() + (isMe ? ' ' : ''),\n            style: TextStyle(\n              color: Colors.black,\n              fontSize: 10.0,\n            ),\n          ),\n        )\n      ],\n    ));\n  }\n}\n"
  },
  {
    "path": "lib/chat.dart",
    "content": "import 'dart:async';\nimport 'dart:io';\nimport 'package:Enigma/photo_view.dart';\nimport 'package:Enigma/screens/profile.dart';\nimport 'package:dio/dio.dart';\nimport 'package:flutter_spinkit/flutter_spinkit.dart';\nimport 'package:path/path.dart' as path;\n\nimport 'package:Enigma/util/const.dart';\nimport 'package:collection/collection.dart';\nimport 'package:file_picker/file_picker.dart';\nimport 'package:intl/intl.dart';\nimport 'package:cached_network_image/cached_network_image.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:firebase_storage/firebase_storage.dart';\nimport 'package:flutter/material.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:shared_preferences/shared_preferences.dart';\nimport 'package:Enigma/ImagePicker/image_picker.dart';\nimport 'package:Enigma/bubble.dart';\nimport 'package:Enigma/E2EE/e2ee.dart' as e2ee;\nimport 'package:Enigma/seen_provider.dart';\nimport 'package:Enigma/seen_state.dart';\nimport 'package:Enigma/message.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:Enigma/chat_controller.dart';\nimport 'package:Enigma/DataModel.dart';\nimport 'package:scoped_model/scoped_model.dart';\nimport 'package:Enigma/save.dart';\nimport 'package:flutter/services.dart';\nimport 'package:encrypt/encrypt.dart' as encrypt;\nimport 'package:flutter_secure_storage/flutter_secure_storage.dart';\n\n//聊天界面\nclass ChatScreen extends StatefulWidget {\n  //对方用户，当前用户\n  final String peerNo, currentUserNo;\n  //数据模型\n  final DataModel model;\n  //未读消息数量\n  final int unread;\n\n  ChatScreen(\n      {Key key,\n      @required this.currentUserNo,\n      @required this.peerNo,\n      @required this.model,\n      @required this.unread});\n\n  @override\n  State createState() =>\n      new _ChatScreenState(currentUserNo: currentUserNo, peerNo: peerNo);\n}\n\nclass _ChatScreenState extends State<ChatScreen> with WidgetsBindingObserver {\n  //\n  GlobalKey<ScaffoldState> _scaffold = new GlobalKey<ScaffoldState>();\n\n  //对方的头像，手机号，当前用户的手机号，私钥，分享密钥\n  String peerAvatar, peerNo, currentUserNo, privateKey, sharedSecret;\n\n  //对方用户信息和当前用户信息\n  Map<String, dynamic> peer, currentUser;\n  //聊天状态和未读消息\n  int chatStatus, unread;\n\n  _ChatScreenState({@required this.peerNo, @required this.currentUserNo});\n\n  //会话id\n  String chatId;\n  SharedPreferences prefs;//存储\n\n  bool typing = false;\n\n  File imageFile;//图片文件\n  bool isLoading;//是否加载状态\n  String imageUrl;//图片地址\n  SeenState seenState;//最近的状态\n  List<Message> messages = new List<Message>();//聊天消息\n  //保存的聊天消息\n  List<Map<String, dynamic>> _savedMessageDocs =\n      new List<Map<String, dynamic>>();\n\n  //上传的时间\n  int uploadTimestamp;\n\n  //订阅  最近状态的订阅，消息事件的订阅，删除更新事件的订阅\n  StreamSubscription seenSubscription, msgSubscription, deleteUptoSubscription;\n\n  //消息文本框\n  final TextEditingController textEditingController =\n      new TextEditingController();\n  //滚动控制器\n  final ScrollController realtime = new ScrollController();\n  //保存控制器\n  final ScrollController saved = new ScrollController();\n  //缓存的当前用户数据\n  DataModel _cachedModel;\n\n  @override\n  //初始化状态\n  void initState() {\n    super.initState();\n    //沉浸式状态栏\n    SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(\n        statusBarColor: Colors.white, statusBarIconBrightness: Brightness.dark);\n    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);\n\n    //检查网络状态\n    Enigma.internetLookUp();\n    //将获得的数据缓存\n    _cachedModel = widget.model;\n    //更新本地缓存用户\n    updateLocalUserData(_cachedModel);\n    //读取本地缓存的消息\n    readLocal();\n    seenState = new SeenState(false);\n    //组件订阅观察者\n    WidgetsBinding.instance.addObserver(this);\n    chatId = '';\n    unread = widget.unread;\n    isLoading = false;\n    imageUrl = '';\n    //加载本地存储的消息\n    loadSavedMessages();\n  }\n\n  //更新本地用户数据\n  updateLocalUserData(model) {\n    peer = model.userData[peerNo];\n    currentUser = _cachedModel.currentUser;\n    if (currentUser != null && peer != null) {\n      chatStatus = peer[CHAT_STATUS];\n      peerAvatar = peer[PHOTO_URL];\n    }\n  }\n\n  //当界面释放时，释放所有的订阅\n  @override\n  void dispose() {\n    super.dispose();\n    WidgetsBinding.instance.removeObserver(this);\n    setLastSeen();\n    msgSubscription?.cancel();\n    seenSubscription?.cancel();\n    deleteUptoSubscription?.cancel();\n  }\n\n  //设置最后的在线时间\n  void setLastSeen() async {\n    if (chatStatus != ChatStatus.blocked.index) {\n      if (chatId != null) {\n        await Firestore.instance.collection(MESSAGES).document(chatId).setData(\n            {'$currentUserNo': DateTime.now().millisecondsSinceEpoch},\n            merge: true);\n      }\n    }\n  }\n\n\n\n  //设置是否在线\n  @override\n  void didChangeAppLifecycleState(AppLifecycleState state) {\n    if (state == AppLifecycleState.resumed)\n      setIsActive();\n    else\n      setLastSeen();\n  }\n\n  //设置在线\n  void setIsActive() async {\n    //在firebase中更新在线状态\n    await Firestore.instance\n        .collection(MESSAGES)\n        .document(chatId)\n        .setData({'$currentUserNo': true}, merge: true);\n  }\n\n  //上次在线时间\n  dynamic lastSeen;\n\n  //存储\n  FlutterSecureStorage storage = new FlutterSecureStorage();\n  //加密\n  encrypt.Encrypter cryptor;\n  final iv = encrypt.IV.fromLength(8);\n\n  //异步读取本地数据\n  readLocal() async {\n    prefs = await SharedPreferences.getInstance();\n    try {\n      //读取本地消息并解密\n      privateKey = await storage.read(key: PRIVATE_KEY);\n      sharedSecret = (await e2ee.X25519().calculateSharedSecret(\n              e2ee.Key.fromBase64(privateKey, false),\n              e2ee.Key.fromBase64(peer[PUBLIC_KEY], true)))\n          .toBase64();\n      final key = encrypt.Key.fromBase64(sharedSecret);\n      print(\"key:\" + sharedSecret);\n      cryptor = new encrypt.Encrypter(encrypt.Salsa20(key));\n    } catch (e) {\n      sharedSecret = null;\n    }\n    try {\n      seenState.value = prefs.getInt(getLastSeenKey());\n    } catch (e) {\n      seenState.value = false;\n    }\n    chatId = Enigma.getChatId(currentUserNo, peerNo);\n    //监听文本消息框\n    textEditingController.addListener(() {\n\n      if (textEditingController.text.isNotEmpty && typing == false) {\n        lastSeen = peerNo;\n        Firestore.instance\n            .collection(USERS)\n            .document(currentUserNo)\n            .setData({LAST_SEEN: peerNo}, merge: true);\n        typing = true;\n      }\n      if (textEditingController.text.isEmpty && typing == true) {\n        lastSeen = true;\n        Firestore.instance\n            .collection(USERS)\n            .document(currentUserNo)\n            .setData({LAST_SEEN: true}, merge: true);\n        typing = false;\n      }\n    });\n    setIsActive();\n    //初始化删除订阅\n    deleteUptoSubscription = Firestore.instance\n        .collection(MESSAGES)\n        .document(chatId)\n        .snapshots()\n        .listen((doc) {\n      if (doc != null && mounted) {\n        deleteMessagesUpto(doc.data[DELETE_UPTO]);\n      }\n    });\n    //初始化最近消息订阅\n    seenSubscription = Firestore.instance\n        .collection(MESSAGES)\n        .document(chatId)\n        .snapshots()\n        .listen((doc) {\n      if (doc != null && mounted) {\n        seenState.value = doc[peerNo] ?? false;\n        if (seenState.value is int) {\n          prefs.setInt(getLastSeenKey(), seenState.value);\n        }\n      }\n    });\n    //加载消息并且实时监听消息的变化\n    loadMessagesAndListen();\n  }\n\n  //获得密钥\n  String getLastSeenKey() {\n    return \"$peerNo-$LAST_SEEN\";\n  }\n\n  //获得图片\n  getImage(File image) {\n    if (image != null) {\n      setState(() {\n        imageFile = image;\n      });\n    }\n    return uploadFile();\n  }\n\n\n  //获得消息壁纸\n  getWallpaper(File image) {\n    if (image != null) {\n      _cachedModel.setWallpaper(peerNo, image);\n    }\n    return Future.value(false);\n  }\n\n  //获取文件名字\n  getImageFileName(id, timestamp) {\n    return \"$id-$timestamp\";\n  }\n\n  //上传聊天文件\n  Future uploadChatFile(File file) async {\n    //设置上传时间，上传文件名，然后上传后获得文件的地址\n    uploadTimestamp = DateTime.now().millisecondsSinceEpoch;\n    String fileName = path.basename(file.path) + \"$uploadTimestamp}\";\n    StorageReference reference = FirebaseStorage.instance.ref().child(fileName);\n    StorageTaskSnapshot uploading = await reference.putFile(file).onComplete;\n    return uploading.ref.getDownloadURL();\n  }\n\n  //上传文件\n  Future uploadFile() async {\n    //设置上传时间，上传文件名，然后上传后获得文件的地址\n    uploadTimestamp = DateTime.now().millisecondsSinceEpoch;\n    String fileName = getImageFileName(currentUserNo, '$uploadTimestamp');\n    StorageReference reference = FirebaseStorage.instance.ref().child(fileName);\n    StorageTaskSnapshot uploading =\n        await reference.putFile(imageFile).onComplete;\n    return uploading.ref.getDownloadURL();\n  }\n\n  //异步发送消息方法\n  void onSendMessage(String content, MessageType type, int timestamp,\n      {String filename}) async {\n    //如果内容不为空才继续\n    if (content.trim() != '') {\n\n      content = content.trim();\n      //如果聊天状态为空就发送好友请求\n      if (chatStatus == null) ChatController.request(currentUserNo, peerNo);\n      textEditingController.clear();\n      //内容不为空则继续\n      if (content.isNotEmpty) {\n        if (filename == null) {\n          filename = \"\";\n        }\n        print(\"send:$content\");\n        //firebase中添加一个消息\n        Future messaging = Firestore.instance\n            .collection(MESSAGES)\n            .document(chatId)\n            .collection(chatId)\n            .document('$timestamp')\n            .setData({\n          FROM: currentUserNo,\n          TO: peerNo,\n          TIMESTAMP: timestamp,\n          CONTENT: content,\n          TYPE: type.index,\n          CHAT_FILENAME: filename\n        });\n        //本地数据中添加消息\n        _cachedModel.addMessage(peerNo, timestamp, messaging);\n        //设置消息\n        var tempDoc = {\n          TIMESTAMP: timestamp,\n          TYPE: type.index,\n          CONTENT: content,\n          FROM: currentUserNo,\n          CHAT_FILENAME: filename\n        };\n        //更新状态\n        setState(() {\n          //设置不加载\n          isLoading = false;\n          //添加消息到列表中\n          messages = List.from(messages)\n            ..add(Message(\n              buildTempMessage(type, content, timestamp, messaging,\n                  fileName: filename),\n              onTap: type == MessageType.image //如果消息是图片的话，点击可查看大图\n                  ? () => Navigator.push(\n                      context,\n                      MaterialPageRoute(\n                        builder: (context) => PhotoViewWrapper(\n                          tag: timestamp.toString(),\n                          imageProvider: CachedNetworkImageProvider(content),\n                        ),\n                      ))\n                  : null,\n              onDismiss: null,\n              onDoubleTap: () {//双击的话就保存这个消息\n                save(tempDoc);\n              },\n              onLongPress: () {\n                contextMenu(tempDoc);\n              },\n              from: currentUserNo,\n              timestamp: timestamp,\n            ));\n        });\n\n        unawaited(realtime.animateTo(0.0,\n            duration: Duration(milliseconds: 300), curve: Curves.easeOut));\n      } else {\n        Enigma.toast('Nothing to send');\n      }\n    }\n  }\n\n  //删除消息\n  delete(int ts) {\n    setState(() {\n      messages.removeWhere((msg) => msg.timestamp == ts);\n      messages = List.from(messages);\n    });\n  }\n\n  //显示消息的各种操作\n  contextMenu(Map<String, dynamic> doc, {bool saved = false}) {\n    List<Widget> tiles = List<Widget>();\n    //显示保存按钮并保存消息\n    if (saved == false) {\n      tiles.add(ListTile(\n          dense: true,\n          leading: Icon(Icons.save_alt),\n          title: Text(\n            'Save',\n            style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),\n          ),\n          onTap: () {\n            save(doc);\n            Navigator.pop(context);\n          }));\n    }\n    //删除消息\n    if (doc[FROM] == currentUserNo && saved == false) {\n      tiles.add(ListTile(\n          dense: true,\n          leading: Icon(Icons.delete),\n          title: Text(\n            'Delete',\n            style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),\n          ),\n          onTap: () {\n            delete(doc[TIMESTAMP]);\n            Firestore.instance\n                .collection(MESSAGES)\n                .document(chatId)\n                .collection(chatId)\n                .document('${doc[TIMESTAMP]}')\n                .delete();\n            Navigator.pop(context);\n            Enigma.toast('Deleted!');\n          }));\n    }\n    //删除保存的消息\n    if (saved == true) {\n      tiles.add(ListTile(\n          dense: true,\n          leading: Icon(Icons.delete),\n          title: Text(\n            'Delete',\n            style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),\n          ),\n          onTap: () {\n            Save.deleteMessage(peerNo, doc);\n            _savedMessageDocs\n                .removeWhere((msg) => msg[TIMESTAMP] == doc[TIMESTAMP]);\n            setState(() {\n              _savedMessageDocs = List.from(_savedMessageDocs);\n            });\n            Navigator.pop(context);\n            Enigma.toast('Deleted!');\n          }));\n    }\n    //复制消息\n    if (doc[TYPE] == MessageType.text.index) {\n      tiles.add(ListTile(\n          dense: true,\n          leading: Icon(Icons.content_copy),\n          title: Text(\n            'Copy',\n            style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),\n          ),\n          onTap: () {\n            Clipboard.setData(ClipboardData(text: doc[CONTENT]));\n            Navigator.pop(context);\n            Enigma.toast('Copied!');\n          }));\n    }\n    showDialog(\n        context: context,\n        builder: (context) {\n          return Theme(data: EnigmaTheme, child: SimpleDialog(children: tiles));\n        });\n  }\n\n  //删除对话\n  deleteUpto(int upto) {\n    Firestore.instance\n        .collection(MESSAGES)\n        .document(chatId)\n        .collection(chatId)\n        .where(TIMESTAMP, isLessThanOrEqualTo: upto)\n        .getDocuments()\n        .then((query) {\n      query.documents.forEach((msg) {\n        if (msg[TYPE] == MessageType.image.index) {\n          FirebaseStorage.instance\n              .ref()\n              .child(getImageFileName(msg[FROM], msg[TIMESTAMP]))\n              .delete();\n        }\n        msg.reference.delete();\n      });\n    });\n\n    //firebase删除对话并更新数据\n    Firestore.instance\n        .collection(MESSAGES)\n        .document(chatId)\n        .setData({DELETE_UPTO: upto}, merge: true);\n    deleteMessagesUpto(upto);\n    empty = true;\n  }\n\n  //从本地消息列表中删除消息\n  deleteMessagesUpto(int upto) {\n    if (upto != null) {\n      int before = messages.length;\n      setState(() {\n        messages = List.from(messages.where((msg) => msg.timestamp > upto));\n        if (messages.length < before) Enigma.toast('Conversation Ended!');\n      });\n    }\n  }\n\n  //保存消息\n  save(Map<String, dynamic> doc) async {\n    Enigma.toast('Saved');\n    if (!_savedMessageDocs.any((_doc) => _doc[TIMESTAMP] == doc[TIMESTAMP])) {\n      String content;\n      if (doc[TYPE] == MessageType.image.index) {\n        content = doc[CONTENT].toString().startsWith('http')\n            ? await Save.getBase64FromImage(imageUrl: doc[CONTENT] as String)\n            : doc[CONTENT]; // if not a url, it is a base64 from saved messages\n      } else {\n        // If text\n        content = doc[CONTENT];\n      }\n      doc[CONTENT] = content;\n      Save.saveMessage(peerNo, doc);\n      _savedMessageDocs.add(doc);\n      setState(() {\n        _savedMessageDocs = List.from(_savedMessageDocs);\n      });\n    }\n  }\n\n  //获取文本消息\n  Widget getTextMessage(bool isMe, Map<String, dynamic> doc, bool saved) {\n    return Text(\n      doc[CONTENT],\n      style:\n          TextStyle(color: isMe ? enigmaWhite : Colors.black, fontSize: 16.0),\n    );\n  }\n\n  //获取对方的文本消息\n  Widget getTempTextMessage(String message) {\n    return Text(\n      message,\n      style: TextStyle(color: enigmaWhite, fontSize: 16.0),\n    );\n  }\n\n  //获取图片消息\n  Widget getImageMessage(Map<String, dynamic> doc, {bool saved = false}) {\n    return Container(\n      child: saved\n          ? doc[TYPE] == MessageType.image\n              ? Container(\n                  decoration: BoxDecoration(\n                    image: DecorationImage(\n                        image: Save.getImageFromBase64(doc[CONTENT]).image,\n                        fit: BoxFit.cover),\n                  ),\n                  width: 200.0,\n                  height: 200.0,\n                )\n              : Container(\n                  child: Row(\n                    children: <Widget>[\n                      Image.asset(\n                        \"assets/file.png\",\n                        width: 100,\n                      ),\n                      ConstrainedBox(\n                        constraints: BoxConstraints(\n                            //宽度尽可能大\n                            maxWidth: 160),\n                        child: Text(\n                          \"${doc[CHAT_FILENAME]}\",\n                          softWrap: true,\n                          overflow: TextOverflow.ellipsis,\n                          maxLines: 2,\n                        ),\n                      )\n                    ],\n                  ),\n                )\n          : doc[TYPE] == MessageType.image.index\n              ? CachedNetworkImage(\n                  placeholder: (context, url) => Container(\n                    child: CircularProgressIndicator(\n                      valueColor: AlwaysStoppedAnimation<Color>(enigmaBlue),\n                    ),\n                    width: 200.0,\n                    height: 200.0,\n                    padding: EdgeInsets.all(80.0),\n                    decoration: BoxDecoration(\n                      color: Colors.blueGrey,\n                      borderRadius: BorderRadius.all(\n                        Radius.circular(8.0),\n                      ),\n                    ),\n                  ),\n                  errorWidget: (context, str, error) => Material(\n                    child: Image.asset(\n                      'assets/img_not_available.jpeg',\n                      width: 200.0,\n                      height: 200.0,\n                      fit: BoxFit.cover,\n                    ),\n                    borderRadius: BorderRadius.all(\n                      Radius.circular(8.0),\n                    ),\n                    clipBehavior: Clip.hardEdge,\n                  ),\n                  imageUrl: doc[CONTENT],\n                  width: 200.0,\n                  height: 200.0,\n                  fit: BoxFit.cover,\n                )\n              : Container(\n                  child: Row(\n                    children: <Widget>[\n                      Image.asset(\n                        \"assets/file.png\",\n                        width: 100,\n                      ),\n                      ConstrainedBox(\n                        constraints: BoxConstraints(\n                            //宽度尽可能大\n                            maxWidth: 160),\n                        child: Text(\n                          \"${doc[CHAT_FILENAME]}\",\n                          softWrap: true,\n                          overflow: TextOverflow.ellipsis,\n                          maxLines: 2,\n                        ),\n                      )\n                    ],\n                  ),\n                ),\n    );\n  }\n\n  //获取对面的图片消息\n  Widget getTempImageMessage({String url, String fileName}) {\n    return imageFile != null\n        ? Container(\n            child: Image.file(\n              imageFile,\n              width: 200.0,\n              height: 200.0,\n              fit: BoxFit.cover,\n            ),\n          )\n        : getImageMessage({CONTENT: url, CHAT_FILENAME: fileName});\n  }\n\n  //构建消息\n  Widget buildMessage(Map<String, dynamic> doc,\n      {bool saved = false, List<Message> savedMsgs}) {\n    final bool isMe = doc[FROM] == currentUserNo;\n    bool isContinuing;\n    if (savedMsgs == null)\n      isContinuing =\n          messages.isNotEmpty ? messages.last.from == doc[FROM] : false;\n    else {\n      isContinuing =\n          savedMsgs.isNotEmpty ? savedMsgs.last.from == doc[FROM] : false;\n    }\n    return SeenProvider(\n        timestamp: doc[TIMESTAMP].toString(),\n        data: seenState,\n        child: Bubble(\n            child: doc[TYPE] == MessageType.text.index\n                ? getTextMessage(isMe, doc, saved)\n                : getImageMessage(\n                    doc,\n                    saved: saved,\n                  ),\n            isMe: isMe,\n            timestamp: doc[TIMESTAMP],\n            delivered: _cachedModel.getMessageStatus(peerNo, doc[TIMESTAMP]),\n            isContinuing: isContinuing));\n  }\n\n  //构建对方的消息\n  Widget buildTempMessage(MessageType type, content, timestamp, delivered,\n      {String fileName}) {\n    final bool isMe = true;\n    return SeenProvider(\n        timestamp: timestamp.toString(),\n        data: seenState,\n        child: Bubble(\n          child: type == MessageType.text\n              ? getTempTextMessage(content)\n              : getTempImageMessage(url: content, fileName: fileName),\n          isMe: isMe,\n          timestamp: timestamp,\n          delivered: delivered,\n          isContinuing:\n              messages.isNotEmpty && messages.last.from == currentUserNo,\n        ));\n  }\n\n  //构建进度条\n  Widget buildLoading() {\n    return isLoading\n        ? SpinKitCubeGrid(\n            color: Colors.white,\n            size: 50.0,\n          )\n        : Container();\n  }\n\n  //构建输入框\n  Widget buildInput() {\n    if (chatStatus == ChatStatus.requested.index) {\n      //这是接受请求的\n      return AlertDialog(\n        backgroundColor: Colors.black12,\n        elevation: 10.0,\n        title: Text(\n          '接受 ${peer[NICKNAME]}\\'的好友请求吗？?',\n          style: TextStyle(color: enigmaWhite),\n        ),\n        actions: <Widget>[ //接受和拒绝聊天请求\n          FlatButton(\n              child: Text('拒绝'),\n              onPressed: () {\n                ChatController.block(currentUserNo, peerNo);\n                setState(() {\n                  chatStatus = ChatStatus.blocked.index;\n                });\n              }),\n          FlatButton(\n              child: Text('接受'),\n              onPressed: () {\n                ChatController.accept(currentUserNo, peerNo);\n                setState(() {\n                  chatStatus = ChatStatus.accepted.index;\n                });\n              })\n        ],\n      );\n    }\n    //构建界面\n    return Container(\n      child: Align(\n        alignment: Alignment.bottomCenter,\n        child: Container( //容器\n//                height: 140,\n          decoration: BoxDecoration(\n            color: Theme.of(context).primaryColor,\n            boxShadow: [\n              BoxShadow(\n                color: Colors.grey[500],\n                offset: Offset(0.0, 1.5),\n                blurRadius: 4.0,\n              ),\n            ],\n          ),\n          constraints: BoxConstraints(\n            maxHeight: 190,\n          ),\n          child: Column(\n            mainAxisSize: MainAxisSize.min,\n            children: <Widget>[\n              Flexible(\n                child: ListTile(\n                  //这个是左下角的加号按钮\n                  leading: IconButton(\n                    icon: Icon(\n                      Icons.add,\n                      color: Theme.of(context).accentColor,\n                    ),\n                    onPressed: chatStatus == ChatStatus.blocked.index\n                        ? null\n                        : () async {\n                      //点击事件，点击后弹出对话框选择是分享图片还是文件\n                            int i = await showDialog<int>(\n                                context: context,\n                                builder: (BuildContext context) {\n                                  //弹出对话框\n                                  return SimpleDialog(\n                                    title: const Text('请选择分享的类型'),\n                                    children: <Widget>[\n                                      SimpleDialogOption(//图片选项\n                                        onPressed: () {\n                                          // 返回1\n                                          Navigator.pop(context, 1);\n                                        },\n                                        child: Padding(\n                                          padding: const EdgeInsets.symmetric(\n                                              vertical: 6),\n                                          child: const Text('图片'),\n                                        ),\n                                      ),\n                                      SimpleDialogOption(//文件选项\n                                        onPressed: () {\n                                          // 返回2\n                                          Navigator.pop(context, 2);\n                                        },\n                                        child: Padding(\n                                          padding: const EdgeInsets.symmetric(\n                                              vertical: 6),\n                                          child: const Text('文件'),\n                                        ),\n                                      ),\n                                    ],\n                                  );\n                                });\n\n                            //获得用户的选项后，根据用户的选择做对应的操作\n                            if (i != null) {\n                              if (i == 1) {//打开相册\n                                await Navigator.push(\n                                    context,\n                                    MaterialPageRoute(\n                                        builder: (context) => HybridImagePicker(\n                                              title: 'Pick an image',\n                                              callback: getImage,\n                                            ))).then((url) {\n                                  if (url != null) {\n                                    onSendMessage(url, MessageType.image,\n                                        uploadTimestamp);\n                                  }\n                                });\n                              } else {//设置进度条，获得文件并上传\n                                setState(() {\n                                  isLoading = true;\n                                });\n                                File selectfile = await FilePicker.getFile();\n                                String url = await uploadChatFile(selectfile);\n                                if (url != null) {\n                                  onSendMessage(\n                                      url, MessageType.file, uploadTimestamp,\n                                      filename: path.basename(selectfile.path));\n                                }\n                              }\n                            }\n                          },\n                  ),\n                  contentPadding: EdgeInsets.all(0),\n                  title: TextField( //中间的输入框\n                    style: TextStyle(\n                      fontSize: 15.0,\n                      color: Theme.of(context).textTheme.title.color,\n                    ),\n                    decoration: InputDecoration(\n                      contentPadding: EdgeInsets.all(10.0),\n                      border: OutlineInputBorder(\n                        borderRadius: BorderRadius.circular(5.0),\n                        borderSide: BorderSide(\n                          color: Theme.of(context).primaryColor,\n                        ),\n                      ),\n                      enabledBorder: OutlineInputBorder(\n                        borderSide: BorderSide(\n                          color: Theme.of(context).primaryColor,\n                        ),\n                        borderRadius: BorderRadius.circular(5.0),\n                      ),\n                      hintText: \"Write your message...\",\n                      hintStyle: TextStyle(\n                        fontSize: 15.0,\n                        color: Theme.of(context).textTheme.title.color,\n                      ),\n                    ),\n                    maxLines: null,\n                    controller: textEditingController,\n                  ),\n                  trailing: IconButton( //发送按钮\n                    icon: Icon(\n                      Icons.send,\n                      color: Theme.of(context).accentColor,\n                    ),\n                    onPressed: chatStatus == ChatStatus.blocked.index //点击发送按钮以后发送消息\n                        ? null\n                        : () => onSendMessage(\n                            textEditingController.text,\n                            MessageType.text,\n                            DateTime.now().millisecondsSinceEpoch),\n                  ),\n                ),\n              ),\n            ],\n          ),\n        ),\n      ),\n      width: double.infinity,\n      height: 60.0,\n      decoration: new BoxDecoration(\n        border:\n            new Border(top: new BorderSide(color: Colors.white, width: 0.5)),\n        color: Colors.white,\n      ),\n    );\n  }\n\n\n  bool empty = true;\n\n  //加载消息并且异步实时监听消息的更新\n  loadMessagesAndListen() async {\n    //等待firebase同步消息\n    await Firestore.instance\n        .collection(MESSAGES)\n        .document(chatId)\n        .collection(chatId)\n        .orderBy(TIMESTAMP)\n        .getDocuments()\n        .then((docs) {\n          //如果文档不为空的话就迭代读取文档中的消息并保存\n      if (docs.documents.isNotEmpty) empty = false;\n      docs.documents.forEach((doc) {\n        Map<String, dynamic> _doc = Map.from(doc.data);\n        int ts = _doc[TIMESTAMP];\n        // _doc[CONTENT] = decryptWithCRC(_doc[CONTENT]);\n        //添加消息到列表中\n        messages.add(Message(buildMessage(_doc),\n            onDismiss: _doc[FROM] == peerNo ? () => deleteUpto(ts) : null,\n            //点击事件，如果是图片就显示大图，如果是文件就下载文件\n            onTap: _doc[TYPE] == MessageType.image.index\n                ? () {\n                    Navigator.push(\n                        context,\n                        MaterialPageRoute(\n                          builder: (context) => PhotoViewWrapper(\n                            tag: ts.toString(),\n                            imageProvider:\n                                CachedNetworkImageProvider(_doc[CONTENT]),\n                          ),\n                        ));\n                  }\n                : _doc[TYPE] == MessageType.file\n                    ? () async {\n                        var dio = Dio();\n                        Enigma.toast(\"开始下载\");\n\n                        var save = Directory(\"/storage/emulated/0/ZH/\");\n                        if (!save.existsSync()) {\n                          await save.create(recursive: true);\n                        }\n                        try {\n                          var response = await dio.download(_doc[CONTENT],\n                              \"${save.path}${_doc[CHAT_FILENAME]}\");\n                          if (response.statusCode == 200) {\n                            Enigma.toast(\"已下载到${save.path}\");\n                          }\n                        } catch (e) {\n                          print(\"${e}\");\n                          Enigma.toast(\"下载失败:错误${e}\");\n                        }\n                      }\n                    : null, onDoubleTap: () {\n          save(_doc);\n        }, onLongPress: () {\n          contextMenu(_doc);\n        }, from: _doc[FROM], timestamp: ts));\n      });\n      if (mounted) {\n        setState(() {\n          messages = List.from(messages);\n        });\n      }\n      //消息监听事件监听当前会话\n      msgSubscription = Firestore.instance\n          .collection(MESSAGES)\n          .document(chatId)\n          .collection(chatId)\n          .where(FROM, isEqualTo: peerNo)\n          .snapshots()\n          .listen((query) {\n            //如果有更新并且内容不为空的话就把消息缓存，并把消息的内容读取出来添加到消息列表中\n        if (empty == true ||\n            query.documents.length != query.documentChanges.length) {\n          query.documentChanges.where((doc) {\n            return doc.oldIndex <= doc.newIndex;\n          }).forEach((change) {\n            Map<String, dynamic> _doc = Map.from(change.document.data);\n            int ts = _doc[TIMESTAMP];\n            //_doc[CONTENT] = decryptWithCRC(_doc[CONTENT]);\n            messages.add(Message(buildMessage(_doc),\n                onLongPress: () {\n                  contextMenu(_doc);\n                },\n                onTap: _doc[TYPE] == MessageType.image.index\n                    ? () => Navigator.push(\n                        context,\n                        MaterialPageRoute(\n                          builder: (context) => PhotoViewWrapper(\n                            tag: ts.toString(),\n                            imageProvider:\n                                CachedNetworkImageProvider(_doc[CONTENT]),\n                          ),\n                        ))\n                    : null,\n                onDoubleTap: () {\n                  save(_doc);\n                },\n                from: _doc[FROM],\n                timestamp: ts,\n                onDismiss: () => deleteUpto(ts)));\n          });\n          if (mounted) {\n            setState(() {\n              messages = List.from(messages);\n            });\n          }\n        }\n      });\n    });\n  }\n\n  //加载本地保存的消息\n  void loadSavedMessages() {\n    if (_savedMessageDocs.isEmpty) {\n      Save.getSavedMessages(peerNo).then((_msgDocs) {\n        if (_msgDocs != null) {\n          setState(() {\n            _savedMessageDocs = _msgDocs;\n          });\n        }\n      });\n    }\n  }\n\n  //排序分组的消息\n  List<Widget> sortAndGroupSavedMessages(List<Map<String, dynamic>> _msgs) {\n    _msgs.sort((a, b) => a[TIMESTAMP] - b[TIMESTAMP]);\n    List<Message> _savedMessages = new List<Message>();\n    List<Widget> _groupedSavedMessages = new List<Widget>();\n    _msgs.forEach((msg) {\n      _savedMessages.add(Message(\n          buildMessage(msg, saved: true, savedMsgs: _savedMessages),\n          saved: true,\n          from: msg[FROM],\n          onDoubleTap: () {}, onLongPress: () {\n        contextMenu(msg, saved: true);\n      },\n          onDismiss: null,\n          onTap: msg[TYPE] == MessageType.image.index\n              ? () => Navigator.push(\n                  context,\n                  MaterialPageRoute(\n                    builder: (context) => PhotoViewWrapper(\n                      tag: \"saved_\" + msg[TIMESTAMP].toString(),\n                      imageProvider: msg[CONTENT].toString().startsWith(\n                              'http') // See if it is an online or saved\n                          ? CachedNetworkImageProvider(msg[CONTENT])\n                          : Save.getImageFromBase64(msg[CONTENT]).image,\n                    ),\n                  ))\n              : null,\n          timestamp: msg[TIMESTAMP]));\n    });\n\n    _groupedSavedMessages\n        .add(Center(child: Chip(label: Text('Saved Conversations'))));\n\n    groupBy<Message, String>(_savedMessages, (msg) {\n      return getWhen(DateTime.fromMillisecondsSinceEpoch(msg.timestamp));\n    }).forEach((when, _actualMessages) {\n      _groupedSavedMessages.add(Center(\n          child: Chip(\n        label: Text(when),\n      )));\n      _actualMessages.forEach((msg) {\n        _groupedSavedMessages.add(msg.child);\n      });\n    });\n    return _groupedSavedMessages;\n  }\n\n  //获得分组的消息\n  List<Widget> getGroupedMessages() {\n    List<Widget> _groupedMessages = new List<Widget>();\n    int count = 0;\n    groupBy<Message, String>(messages, (msg) {\n      return getWhen(DateTime.fromMillisecondsSinceEpoch(msg.timestamp));\n    }).forEach((when, _actualMessages) {\n      _groupedMessages.add(Center(\n          child: Chip(\n        label: Text(when),\n      )));\n      _actualMessages.forEach((msg) {\n        count++;\n        if (unread != 0 && (messages.length - count) == unread - 1) {\n          _groupedMessages.add(Center(\n              child: Chip(\n            label: Text('${unread} unread messages'),\n          )));\n          unread = 0; // reset\n        }\n        _groupedMessages.add(msg.child);\n      });\n    });\n    return _groupedMessages.reversed.toList();\n  }\n\n  //构建保存消息的界面\n  Widget buildSavedMessages() {\n    return Flexible(\n        child: ListView(\n      padding: EdgeInsets.all(10.0),\n      children: _savedMessageDocs.isEmpty\n          ? [\n              Padding(\n                  padding: EdgeInsets.only(top: 200.0),\n                  child: Text('No saved messages.',\n                      textAlign: TextAlign.center,\n                      style: TextStyle(color: enigmaWhite, fontSize: 18)))\n            ]\n          : sortAndGroupSavedMessages(_savedMessageDocs),\n      controller: saved,\n    ));\n  }\n\n  //构建消息界面\n  Widget buildMessages() {\n    if (chatStatus == ChatStatus.blocked.index) {\n      return AlertDialog(\n        backgroundColor: Colors.black12,\n        elevation: 10.0,\n        title: Text(\n          '接受 ${peer[NICKNAME]}的消息吗?',\n          style: TextStyle(color: enigmaWhite),\n        ),\n        actions: <Widget>[\n          FlatButton(\n              child: Text('不接受'),\n              onPressed: () {\n                Navigator.pop(context);\n              }),\n          FlatButton(\n              child: Text('接受'),\n              onPressed: () {\n                ChatController.accept(currentUserNo, peerNo);\n                setState(() {\n                  chatStatus = ChatStatus.accepted.index;\n                });\n              })\n        ],\n      );\n    }\n    return Flexible(\n        child: chatId == '' || messages.isEmpty || sharedSecret == null\n            ? ListView(\n                children: <Widget>[\n                  Padding(\n                      padding: EdgeInsets.only(top: 200.0),\n                      child: Text(\n                          sharedSecret == null\n                              ? 'Setting things up.'\n                              : 'Say Hi!',\n                          textAlign: TextAlign.center,\n                          style: TextStyle(color: enigmaWhite, fontSize: 18))),\n                ],\n                controller: realtime,\n              )\n            : ListView(\n                padding: EdgeInsets.all(10.0),\n                children: getGroupedMessages(),\n                controller: realtime,\n                reverse: true,\n              ));\n  }\n\n  //获得时间\n  getWhen(date) {\n    DateTime now = DateTime.now();\n    String when;\n    if (date.day == now.day)\n      when = '今天';\n    else if (date.day == now.subtract(Duration(days: 1)).day)\n      when = '昨天';\n    else\n      when = DateFormat.MMMd().format(date);\n    return when;\n  }\n\n  //获得对方的状态\n  getPeerStatus(val) {\n    if (val is bool && val == true) {\n      return '在线';\n    } else if (val is int) {\n      DateTime date = DateTime.fromMillisecondsSinceEpoch(val);\n      String at = DateFormat.jm().format(date), when = getWhen(date);\n      return '上次在线： $when $at';\n    } else if (val is String) {\n      if (val == currentUserNo) return 'typing…';\n      return '在线';\n    }\n    return 'loading…';\n  }\n\n  bool isBlocked() {\n    return chatStatus == ChatStatus.blocked.index ?? true;\n  }\n\n  //构建真正的用户界面\n  @override\n  Widget build(BuildContext context) {\n    //沉浸式状态栏\n    SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);\n    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(\n      statusBarColor: Constants.lightPrimary,\n      statusBarIconBrightness: Brightness.dark,\n    ));\n    return Enigma.getNTPWrappedWidget(WillPopScope(\n        onWillPop: () async {\n          setLastSeen();\n          if (lastSeen == peerNo)\n            await Firestore.instance\n                .collection(USERS)\n                .document(currentUserNo)\n                .setData({LAST_SEEN: true}, merge: true);\n          return Future.value(true);\n        },\n        child: ScopedModel<DataModel>(\n            model: _cachedModel,\n            child: ScopedModelDescendant<DataModel>(\n                builder: (context, child, _model) {\n              _cachedModel = _model;\n              updateLocalUserData(_model);\n              return peer != null\n                  ? Padding(\n                      padding: EdgeInsets.only(\n                          top: MediaQuery.of(context).padding.top),\n                      child: Scaffold(\n                          key: _scaffold,\n                          backgroundColor: Colors.white,\n                          appBar: PreferredSize(\n                            preferredSize: Size.fromHeight(40.0),\n                            child: Material(\n                              child: ListTile(\n                                  onTap: () {\n                                    Navigator.push(\n                                        context,\n                                        MaterialPageRoute(\n                                            builder: (context) => Profile(\n                                                  unread: 0,\n                                                  currentUserNo:\n                                                      widget.currentUserNo,\n                                                  model: widget.model,\n                                                  peeruser: widget.model\n                                                      .userData[widget.peerNo],\n                                                )));\n                                  },\n                                  dense: true,\n                                  leading: Enigma.avatar(peer),\n                                  title: Text(\n                                    Enigma.getNickname(peer),\n                                    style: TextStyle(\n                                        color: Colors.black,\n                                        fontSize: 16.0,\n                                        fontWeight: FontWeight.bold),\n                                  ),\n                                  trailing: Theme(\n                                      data: Constants.lightTheme,\n                                      child: PopupMenuButton(\n                                        onSelected: (val) {\n                                          switch (val) {\n                                            case 'remove_wallpaper':\n                                              _cachedModel\n                                                  .removeWallpaper(peerNo);\n                                              Enigma.toast(\n                                                  'Wallpaper removed.');\n                                              break;\n                                            case 'set_wallpaper':\n                                              Navigator.push(\n                                                  context,\n                                                  MaterialPageRoute(\n                                                      builder: (context) =>\n                                                          HybridImagePicker(\n                                                            title: '选择一个图片',\n                                                            callback:\n                                                                getWallpaper,\n                                                          )));\n                                              break;\n                                          }\n                                        },\n                                        itemBuilder: (context) =>\n                                            <PopupMenuItem<String>>[\n                                          PopupMenuItem<String>(\n                                              value: 'set_wallpaper',\n                                              child: Text('设置壁纸')),\n                                          peer[WALLPAPER] != null\n                                              ? PopupMenuItem<String>(\n                                                  value: 'remove_wallpaper',\n                                                  child: Text('删除壁纸'))\n                                              : null,\n                                        ].where((o) => o != null).toList(),\n                                      )),\n                                  subtitle: chatId.isNotEmpty\n                                      ? Text(\n                                          getPeerStatus(peer[LAST_SEEN]),\n                                          style: TextStyle(\n                                              color: Colors.black,\n                                              fontSize: 12,\n                                              fontWeight: FontWeight.w400),\n                                        )\n                                      : Text('loading…',\n                                          style:\n                                              TextStyle(color: Colors.black))),\n                              elevation: 4,\n                              color: Colors.white,\n                            ),\n                          ),\n                          body: Stack(\n                            alignment: Alignment.center,\n                            children: <Widget>[\n                              new Container(\n                                decoration: new BoxDecoration(\n                                  image: new DecorationImage(\n                                      image: peer[WALLPAPER] == null\n                                          ? AssetImage(\"assets/bg.jpg\")\n                                          : Image.file(File(peer[WALLPAPER]))\n                                              .image,\n                                      fit: BoxFit.cover),\n                                ),\n                              ),\n                              PageView(\n                                children: <Widget>[\n                                  Column(\n                                    children: [\n                                      // List of messages\n                                      buildMessages(),\n                                      // Input content\n                                      isBlocked() ? Container() : buildInput(),\n                                    ],\n                                  ),\n                                  Column(\n                                    children: [\n                                      // List of saved messages\n                                      buildSavedMessages()\n                                    ],\n                                  ),\n                                ],\n                              ),\n\n                              // Loading\n                              buildLoading()\n                            ],\n                          )))\n                  : Container();\n            }))));\n  }\n}\n"
  },
  {
    "path": "lib/chat_controller.dart",
    "content": "import 'dart:core';\nimport 'dart:async';\nimport 'package:Enigma/DataModel.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:flutter/material.dart';\nimport 'package:shared_preferences/shared_preferences.dart';\n//聊天管理类\nclass ChatController {\n\n\n  //聊天的请求\n  static request(currentUserNo, peerNo) {\n    Firestore.instance\n        .collection(USERS)\n        .document(currentUserNo)\n        .collection(CHATS_WITH)\n        .document(CHATS_WITH)\n        .setData({'$peerNo': ChatStatus.waiting.index}, merge: true);\n    Firestore.instance\n        .collection(USERS)\n        .document(peerNo)\n        .collection(CHATS_WITH)\n        .document(CHATS_WITH)\n        .setData({'$currentUserNo': ChatStatus.requested.index}, merge: true);\n  }\n\n  //接受聊天请求\n  static accept(currentUserNo, peerNo) {\n    Firestore.instance\n        .collection(USERS)\n        .document(currentUserNo)\n        .collection(CHATS_WITH)\n        .document(CHATS_WITH)\n        .setData({'$peerNo': ChatStatus.accepted.index}, merge: true);\n  }\n\n  //拒绝聊天请求\n  static block(currentUserNo, peerNo) {\n    Firestore.instance\n        .collection(USERS)\n        .document(currentUserNo)\n        .collection(CHATS_WITH)\n        .document(CHATS_WITH)\n        .setData({'$peerNo': ChatStatus.blocked.index}, merge: true);\n    Firestore.instance\n        .collection(MESSAGES)\n        .document(Enigma.getChatId(currentUserNo, peerNo))\n        .setData({'$currentUserNo': DateTime.now().millisecondsSinceEpoch},\n            merge: true);\n    Enigma.toast('Blocked.');\n  }\n\n  //获取聊天的状态\n  static Future<ChatStatus> getStatus(currentUserNo, peerNo) async {\n    var doc = await Firestore.instance\n        .collection(USERS)\n        .document(currentUserNo)\n        .collection(CHATS_WITH)\n        .document(CHATS_WITH)\n        .get();\n    return ChatStatus.values[doc[peerNo]];\n  }\n\n  //隐藏聊天\n  static hideChat(currentUserNo, peerNo) {\n    Firestore.instance.collection(USERS).document(currentUserNo).setData({\n      HIDDEN: FieldValue.arrayUnion([peerNo])\n    }, merge: true);\n    Enigma.toast('Chat hidden.');\n  }\n\n  //显示聊天\n  static unhideChat(currentUserNo, peerNo) {\n    Firestore.instance.collection(USERS).document(currentUserNo).setData({\n      HIDDEN: FieldValue.arrayRemove([peerNo])\n    }, merge: true);\n    Enigma.toast('Chat is visible.');\n  }\n\n  //锁定聊天\n  static lockChat(currentUserNo, peerNo) {\n    Firestore.instance.collection(USERS).document(currentUserNo).setData({\n      LOCKED: FieldValue.arrayUnion([peerNo])\n    }, merge: true);\n    Enigma.toast('Chat locked.');\n  }\n\n  //解锁聊天\n  static unlockChat(currentUserNo, peerNo) {\n    Firestore.instance.collection(USERS).document(currentUserNo).setData({\n      LOCKED: FieldValue.arrayRemove([peerNo])\n    }, merge: true);\n    Enigma.toast('Chat unlocked.');\n  }\n\n  //聊天的消息验证\n  static void authenticate(DataModel model, String caption,\n      {@required NavigatorState state,\n      AuthenticationType type = AuthenticationType.passcode,\n      @required SharedPreferences prefs,\n      @required Function onSuccess,\n      @required bool shouldPop}) {\n    Map<String, dynamic> user = model.currentUser;\n    if (user != null && model != null) {\n\n    }\n  }\n}\n"
  },
  {
    "path": "lib/const.dart",
    "content": "import 'dart:ui';\n\nimport 'package:flutter/material.dart';\n\n//定义了颜色，文字的常量类\n\nconst MAIN_COLOR = Color(0xFF303030);\nconst DARK_COLOR = Color(0xFFBDBDBD);\nconst BOTTOM_COLORS = [MAIN_COLOR, DARK_COLOR];\nconst YELLOW = Color(0xfffbed96);\nconst BLUE = Color(0xffabecd6);\nconst BLUE_DEEP = Color(0xffA8CBFD);\nconst BLUE_LIGHT = Color(0xffAED3EA);\nconst PURPLE = Color(0xffccc3fc);\nconst SIGNUP_LIGHT_RED = Color(0xffffc2a1);\nconst SIGNUP_RED = Color(0xffffb1bb);\nconst RED = Color(0xffF2A7B3);\nconst GREEN = Color(0xffc7e5b4);\nconst RED_LIGHT = Color(0xffFFC3A0);\nconst TEXT_BLACK = Color(0xFF353535);\nconst TEXT_BLACK_LIGHT = Color(0xFF34323D);\n\nfinal enigmaBlack = Colors.white;\nfinal enigmaBlue = new Color(0xFFE0E0E0);\nfinal enigmaGreen = new Color(0xFFE0E0E0);\nfinal enigmaWhite = Colors.white;\nconst IS_TOKEN_GENERATED = 'isTokenGenerated';\nconst NOTIFICATION_TOKENS = 'notificationTokens';\nconst PHOTO_URL = 'photoUrl';\nconst USERS = 'users';\nconst MESSAGES = 'messages';\nconst ANSWER_TRIES = 'answerTries';\nconst PASSCODE_TRIES = 'passcodeTries';\nconst ABOUT_ME = 'aboutMe';\nconst NICKNAME = 'nickname';\nconst TYPE = 'type';\nconst FROM = 'from';\nconst CHAT_FILENAME=\"chatFileName\";\nconst TO = 'to';\nconst CONTENT = 'content';\nconst CHATS_WITH = 'chatsWith';\nconst CHAT_STATUS = 'chatStatus';\nconst LAST_SEEN = 'lastSeen';\nconst PHONE = 'phone';\nconst PASS=\"pass\";\nconst Sex=\"sex\";\nconst ID = 'id';\nconst BIRTHDAY=\"birthday\";\nconst EMAIL=\"email\";\nconst ANSWER = 'answer';\nconst QUESTION = 'question';\nconst PASSCODE = 'passcode';\nconst HIDDEN = 'hidden';\nconst LOCKED = 'locked';\nconst DELETE_UPTO = 'deleteUpto';\nconst TIMESTAMP = 'timestamp';\nconst LAST_ANSWERED = 'lastAnswered';\nconst LAST_ATTEMPT = 'lastAttempt';\nconst AUTHENTICATION_TYPE = 'authenticationType';\nconst CACHED_CONTACTS = 'cachedContacts';\nconst SAVED = 'saved';\nconst ALIAS_NAME = 'aliasName';\nconst ALIAS_AVATAR = 'aliasAvatar';\nconst PUBLIC_KEY = 'publicKey';\nconst PRIVATE_KEY = 'privateKey';\nconst PRIVACY_POLICY_URL =\n    'https://amitjoki.github.io/Enigma/Privacy_Policy';\nconst COUNTRY_CODE = 'countryCode';\nconst WALLPAPER = 'wallpaper';\nconst CRC_SEPARATOR = '&';\nconst TRIES_THRESHOLD = 3;\nconst TIME_BASE = 2;\nconst POST=\"post\";\n\nconst POST_CONTENT=\"postContent\";\nconst POST_FILE_PATH=\"postFilePath\";\nconst POST_IMAGE_URL=\"postImageUrl\";\nconst POST_FILE_NAME=\"postFileName\";\nconst POST_NICK_NAME=\"postNickName\";\nconst POST_PHOTO_URL=\"postPhotoUrl\";\nconst POST_PHONE=\"postPhone\";\nconst POST_TIME=\"postTime\";\n\n\n//Colors for theme\nconst Color lightPrimary = Color(0xfffcfcff);\nconst Color darkPrimary = Colors.black;\nconst Color lightAccent = Colors.blue;\nconst Color darkAccent = Colors.blueAccent;\nconst Color lightBG = Color(0xfffcfcff);\nconst Color darkBG = Colors.black;\nconst Color badgeColor = Colors.red;\n\nfinal EnigmaTheme = ThemeData(\n  backgroundColor: lightBG,\n  primaryColor: lightPrimary,\n  accentColor:  lightAccent,\n  cursorColor: lightAccent,\n  scaffoldBackgroundColor: lightBG,\n  appBarTheme: AppBarTheme(\n    elevation: 0,\n    textTheme: TextTheme(\n      title: TextStyle(\n        color: darkBG,\n        fontSize: 18.0,\n        fontWeight: FontWeight.w800,\n      ),\n    ),\n  ),\n  buttonColor: enigmaBlue,\n  dialogBackgroundColor: Colors.white,\n  primaryColorDark: Colors.white,\n  indicatorColor: enigmaBlue.withOpacity(0.8),\n  primarySwatch: Colors.blue,\n  dialogTheme: DialogTheme(backgroundColor: Colors.white, elevation: 48.0),\n  primaryColorBrightness: Brightness.dark,\n  brightness: Brightness.dark,\n\n);\n\nenum ChatStatus { blocked, waiting, requested, accepted }\nenum MessageType { text, image ,file}\nenum AuthenticationType { passcode, biometric }\nvoid unawaited(Future<void> future) {}\n"
  },
  {
    "path": "lib/login.dart",
    "content": "import 'dart:async';\nimport 'dart:developer';\nimport 'dart:io';\nimport 'dart:math';\n\nimport 'package:Enigma/main.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:Enigma/widgets/signup_apbar.dart';\nimport 'package:Enigma/widgets/signup_arrow_button.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:firebase_auth/firebase_auth.dart';\nimport 'package:firebase_storage/firebase_storage.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\nimport 'package:flutter_spinkit/flutter_spinkit.dart';\nimport 'package:shared_preferences/shared_preferences.dart';\nimport 'package:url_launcher/url_launcher.dart';\nimport 'package:Enigma/E2EE/e2ee.dart' as e2ee;\nimport 'package:flutter_secure_storage/flutter_secure_storage.dart';\nimport 'ImagePicker/image_picker.dart';\nimport 'const.dart';\n\n//登录界面\nclass LoginScreen extends StatefulWidget {\n  LoginScreen({Key key, this.title}) : super(key: key);\n\n  final String title;\n\n  @override\n  LoginScreenState createState() => new LoginScreenState();\n}\n\nclass LoginScreenState extends State<LoginScreen>\n    with SingleTickerProviderStateMixin {\n\n  //firebase的用户验证\n  final FirebaseAuth firebaseAuth = FirebaseAuth.instance;\n  SharedPreferences prefs;\n  //手机号\n  final _phoneNo = TextEditingController();\n //手机号的国际码，国内为+86\n  String phoneCode = '+86';\n  //用户存储\n  final storage = new FlutterSecureStorage();\n  //手机号和短信验证码\n  String phone;\n  String smsCode;\n  //用户名和密码 在本页面中是手机号和验证码\n  TextEditingController _username = TextEditingController();\n  TextEditingController _password = TextEditingController();\n\n  //以下五个为颜色渐变，分别为注册时候的各种颜色渐变\n  LinearGradient SIGNUP_BACKGROUND = LinearGradient(\n    begin: FractionalOffset(0.0, 0.4), end: FractionalOffset(0.9, 0.7),\n    // Add one stop for each color. Stops should increase from 0 to 1\n    stops: [0.1, 0.9], colors: [Color(0xfffbed96), Color(0xffabecd6)],\n  );\n  LinearGradient SIGNUP_CARD_BACKGROUND = LinearGradient(\n    tileMode: TileMode.clamp,\n    begin: FractionalOffset.centerLeft,\n    end: FractionalOffset.centerRight,\n    stops: [0.1, 1.0],\n    colors: [Color(0xffffc2a1), Color(0xffffb1bb)],\n  );\n  LinearGradient SIGNUP_CIRCLE_BUTTON_BACKGROUND = LinearGradient(\n    tileMode: TileMode.clamp,\n    begin: FractionalOffset.centerLeft,\n    end: FractionalOffset.centerRight,\n    // Add one stop for each color. Stops should increase from 0 to 1\n    stops: [0.4, 1],\n    colors: [Colors.black, Colors.black54],\n  );\n  LinearGradient SIGNUP_SIX_FACEBOOK_BG = LinearGradient(\n    begin: FractionalOffset.bottomLeft,\n    end: FractionalOffset.topRight,\n    // Add one stop for each color. Stops should increase from 0 to 1\n    stops: [0.1, 0.3],\n    colors: [\n      Color(0xffe0c3fc),\n      Color(0xff8ec5fc),\n    ],\n  );\n  LinearGradient SIGNUP_SIX_TWITTER_BG = LinearGradient(\n    begin: FractionalOffset.centerLeft,\n    end: FractionalOffset.centerRight,\n    // Add one stop for each color. Stops should increase from 0 to 1\n    stops: [0.2, 0.6],\n    colors: [\n      Color(0xFFc2e9fb),\n      Color(0xFFa1c4fd),\n    ],\n  );\n\n\n\n  //验证id\n  String verificationId;\n  bool isLoading = false;//是否处于加载状态\n  dynamic isLoggedIn = false;//是否处于登录状态\n  FirebaseUser currentUser;//当前登录用户\n\n  bool tosign = false;//是否跳转到注册页面\n\n  bool showLoginCode = false;//是否严重验证码框\n\n  /*\n  *   注册\n  */\n  String _currentDate = '选择日期';\n\n\n  //手机号，验证码，邮箱和用户名\n  TextEditingController _controller = TextEditingController();\n  TextEditingController _Passcontroller = TextEditingController();\n  TextEditingController _Emailcontroller = TextEditingController();\n  TextEditingController _Codecontroller = TextEditingController();\n\n  //头像\n  File avatarImageFile;\n  String avatartImageUrl;//头像的url\n\n  bool showCodeBox = false;//注册界面的是否显示验证码\n\n\n\n  //选择时间\n  Future _selectDate() async {\n    DateTime picked = await showDatePicker(\n        context: context,\n        initialDate: new DateTime.now(),\n        firstDate: new DateTime(2016),\n        lastDate: new DateTime(2050));\n\n    if (picked != null)\n\n      setState(\n        () => _currentDate = \"${picked.year}-${picked.month}-${picked.day}\",\n      );\n  }\n\n  bool _male = true; //男\n  bool _famele = false;//女\n\n  @override\n  void initState() {\n    SystemUiOverlayStyle systemUiOverlayStyle =\n        SystemUiOverlayStyle(statusBarColor: Colors.transparent);\n    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);\n    super.initState();\n  }\n\n  //获取图像\n  Future getImage(File image) async {\n    if (image != null) {\n      setState(() {\n        avatarImageFile = image;\n      });\n    }\n  }\n\n  //验证手机号\n  Future<void> verifyPhoneNumber() async {\n    //定义验证完成的回调函数\n    final PhoneVerificationCompleted verificationCompleted =\n        (AuthCredential phoneAuthCredential) {\n      //跳转到登录/注册上\n      handleSignIn(authCredential: phoneAuthCredential);\n    };\n\n    //定义验证失败的回调函数\n    final PhoneVerificationFailed verificationFailed =\n        (AuthException authException) {\n      Enigma.reportError(\n          '${authException.message} Phone: ${_phoneNo.text} Country Code: $phoneCode ',\n          authException.code);\n      setState(() {\n        isLoading = false;\n      });\n\n      Enigma.toast('验证失败 - ${authException.message}. 请重新尝试');\n    };\n\n    //定义发送验证码的回调函数\n    final PhoneCodeSent codeSent =\n        (String verificationId, [int forceResendingToken]) async {\n      setState(() {\n        isLoading = false;\n      });\n\n      this.verificationId = verificationId;\n    };\n\n    //定义验证码超时函数\n    final PhoneCodeAutoRetrievalTimeout codeAutoRetrievalTimeout =\n        (String verificationId) {\n      setState(() {\n        isLoading = false;\n      });\n\n      this.verificationId = verificationId;\n    };\n\n    //firebase的用户验证手机号\n    await firebaseAuth.verifyPhoneNumber(\n        phoneNumber: (phoneCode + phone).trim(),\n        timeout: const Duration(minutes: 2),\n        verificationCompleted: verificationCompleted,\n        verificationFailed: verificationFailed,\n        codeSent: codeSent,\n        codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);\n  }\n\n  //登录/注册函数\n  Future<Null> handleSignIn({AuthCredential authCredential}) async {\n    prefs = await SharedPreferences.getInstance();\n    if (isLoading == false) {\n      this.setState(() {\n        isLoading = true;\n      });\n    }\n\n    //拼接手机号\n    var phoneNo = (phoneCode + _Emailcontroller.text).trim();\n\n    //验证码校验\n    AuthCredential credential;\n    if (authCredential == null) if (_password.text.isNotEmpty ||\n        _Codecontroller.text.isNotEmpty) {\n      credential = PhoneAuthProvider.getCredential(\n        verificationId: verificationId,\n        smsCode: _password.text.isEmpty ? _Codecontroller.text : _password.text,\n      );\n    } else {\n      Enigma.toast(\"验证码不能为空\");\n    }\n    else\n      credential = authCredential;\n    FirebaseUser firebaseUser;\n    try {\n      //获取用户信息\n      firebaseUser = await firebaseAuth\n          .signInWithCredential(credential)\n          .catchError((err) async {\n        await Enigma.reportError(err, 'signInWithCredential');\n        Enigma.toast(\n            '验证码输入错误，请重试');\n        return;\n      });\n    } catch (e) {\n      await Enigma.reportError(e, 'signInWithCredential catch block');\n      Enigma.toast(\n          'Make sure your Phone Number/OTP Code is correct and try again later.');\n\n\n      return;\n    }\n\n    //如果用户信息不为空的话就继续，否则是验证失败\n    if (firebaseUser != null) {\n      // 检查是否已经注册\n      final QuerySnapshot result = await Firestore.instance\n          .collection(USERS)\n          .where(ID, isEqualTo: firebaseUser.uid)\n          .getDocuments();\n      //获得用户信息并且加密后存储\n      final List<DocumentSnapshot> documents = result.documents;\n      final pair = await e2ee.X25519().generateKeyPair();\n      await storage.write(key: PRIVATE_KEY, value: pair.secretKey.toBase64());\n      //如果用户信息为空的话就代表是新用户，就注册\n      if (documents.isEmpty) {\n        // 注册新用户\n        await Firestore.instance.collection(USERS).document(phoneNo).setData({\n          PUBLIC_KEY: pair.publicKey.toBase64(),\n          COUNTRY_CODE: phoneCode,\n          NICKNAME: _controller.text.trim(),\n          PHOTO_URL: avatartImageUrl?.trim(),\n          ID: firebaseUser.uid,\n          PHONE: phoneNo,\n          Sex: _male ? \"男\" : \"女\",\n          BIRTHDAY: _currentDate,\n          EMAIL: _Passcontroller.text.trim(),\n          AUTHENTICATION_TYPE: AuthenticationType.passcode.index,\n          ABOUT_ME: ''\n        }, merge: true);\n\n        // 写入数据到本地\n        currentUser = firebaseUser;\n        await prefs.setString(ID, currentUser.uid);\n        await prefs.setString(NICKNAME, _controller.text.trim());\n        await prefs.setString(Sex, _male ? \"男\" : \"女\");\n        await prefs.setString(BIRTHDAY, _currentDate);\n        await prefs.setString(PHOTO_URL, currentUser.photoUrl);\n        await prefs.setString(PHONE, phoneNo);\n        await prefs.setString(COUNTRY_CODE, phoneCode);\n        await prefs.setString(EMAIL, _Passcontroller.text.trim());\n\n        //如果用户头像不为孔德华就上传头像，并将头像的url更新到用户的数据中，并再次写入本地\n        if(avatarImageFile!=null){\n          var url=await uploadFile();\n          if (url != null) {\n            var photoUrl = url.toString();\n            print(\"photourl:$photoUrl\");\n            await Firestore.instance\n                .collection(USERS)\n                .document(phoneNo)\n                .updateData({\n              PHOTO_URL: photoUrl\n            }).then((data) async {\n              await prefs.setString(\n                  PHOTO_URL, photoUrl);\n              setState(() {\n                isLoading = false;\n              });\n              Enigma.toast(\n                  \"Profile Picture Changed!\");\n            }).catchError((err) {\n\n              Enigma.toast(err.toString());\n            });\n          }\n        }\n\n        unawaited(Navigator.pushReplacement(context,\n            new MaterialPageRoute(builder: (context) => EnigmaWrapper())));\n      } else {\n        //如果不为空的话就是登录\n        await Firestore.instance.collection(USERS).document(phoneNo).setData({\n          AUTHENTICATION_TYPE: AuthenticationType.passcode.index,\n          PUBLIC_KEY: pair.publicKey.toBase64()\n        }, merge: true);\n        // 写入用户数据到本地\n        await prefs.setString(ID, documents[0][ID]);\n        await prefs.setString(NICKNAME, documents[0][NICKNAME]);\n        await prefs.setString(Sex, documents[0][Sex]);\n        await prefs.setString(BIRTHDAY, documents[0][BIRTHDAY]);\n        await prefs.setString(PHOTO_URL, documents[0][PHOTO_URL]);\n        await prefs.setString(ABOUT_ME, documents[0][ABOUT_ME] ?? '');\n        await prefs.setString(PHONE, documents[0][PHONE]);\n        await prefs.setString(EMAIL, documents[0][EMAIL]);\n        unawaited(Navigator.pushReplacement(context,\n            new MaterialPageRoute(builder: (context) => EnigmaWrapper())));\n        Enigma.toast('欢迎回来');\n      }\n    } else {\n      Enigma.toast(\"登录失败，请重试\");\n    }\n  }\n\n  //上传文件\n  Future uploadFile() async {\n    String fileName = _Emailcontroller.text;\n    StorageReference reference = FirebaseStorage.instance.ref().child(fileName);\n    StorageTaskSnapshot uploading =\n        await reference.putFile(avatarImageFile).onComplete;\n\n    return await uploading.ref.getDownloadURL();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    final _media = MediaQuery.of(context).size;\n\n\n    //构建登录界面\n    var login = Scaffold(\n      body: Container(\n        height: double.infinity,\n        width: double.infinity,\n        decoration: BoxDecoration(\n          gradient: SIGNUP_BACKGROUND,\n        ),\n        child: SingleChildScrollView(\n          physics: BouncingScrollPhysics(),\n          child: Stack(\n            alignment: Alignment.center,\n            children: <Widget>[\n              Column(\n                children: <Widget>[\n                  Padding(\n                    padding: const EdgeInsets.symmetric(\n                        vertical: 60.0, horizontal: 40),\n                    child: Column(\n                      crossAxisAlignment: CrossAxisAlignment.start,\n                      children: <Widget>[\n                        Center(\n                          child: Image.asset(\n                            \"assets/logo_signup.png\",\n                            height: _media.height / 7,\n                          ),\n                        ),\n                        SizedBox(\n                          height: 30,\n                        ),\n                        Text(\n                          \"WELCOME BACK!\",\n                          style: TextStyle(\n                            letterSpacing: 4,\n                            fontFamily: \"Mlx\",\n                            fontWeight: FontWeight.bold,\n                            fontSize: 22.0,\n                          ),\n                        ),\n                        SizedBox(height: 30),\n                        Text(\n                          'Log in',\n                          style: TextStyle(\n                              fontFamily: \"Mlx\",\n                              fontWeight: FontWeight.w400,\n                              fontSize: 40),\n                        ),\n                        Text(\n                          'to continue.',\n                          style: TextStyle(\n                              fontFamily: \"Mlx\",\n                              fontWeight: FontWeight.w200,\n                              fontSize: 40),\n                        ),\n                        SizedBox(\n                          height: 50,\n                        ),\n                        Container(\n                          height: _media.height / 6,\n                          decoration: BoxDecoration(\n                            gradient: SIGNUP_CARD_BACKGROUND,\n                            borderRadius: BorderRadius.circular(15),\n                            boxShadow: [\n                              BoxShadow(\n                                color: Colors.black12,\n                                blurRadius: 15,\n                                spreadRadius: 8,\n                              ),\n                            ],\n                          ),\n                          child: Padding(\n                            padding: const EdgeInsets.all(30.0),\n                            child: Column(\n                              children: <Widget>[\n                                showLoginCode\n                                    ? Container(\n                                        height: 0,\n                                      )\n                                    : Expanded(\n                                        child: inputText(\n                                            \"手机号\", '', _username, false),\n                                      ),\n                                showLoginCode\n                                    ? Expanded(\n                                        child: inputText(\n                                            \"验证码\", '', _password, true))\n                                    : Container(\n                                        height: 0,\n                                      ),\n                              ],\n                            ),\n                          ),\n                        ),\n                      ],\n                    ),\n                  ),\n                  Row(\n                    mainAxisAlignment: MainAxisAlignment.center,\n                    crossAxisAlignment: CrossAxisAlignment.center,\n                    children: <Widget>[\n                      Text(\n                        \"没有账号？\",\n                        style: TextStyle(color: Color(0xFF303030)),\n                      ),\n                      SizedBox(\n                        width: 5,\n                      ),\n                      GestureDetector(\n                        onTap: () => this.setState(() {\n                          print(tosign);\n                          tosign = true;\n                        }),\n                        child: Text(\"注册\"),\n                      ),\n                    ],\n                  ),\n                  SizedBox(\n                    height: 50,\n                  )\n                ],\n              ),\n              Positioned(\n                bottom: _media.height / 6.3,\n                right: 15,\n                child: SignUpArrowButton(\n                  icon: IconData(0xe901, fontFamily: 'Icons'),\n                  iconSize: 9,\n                  onTap: () async {\n                    if (!showLoginCode) {\n                      if (_username.text.isNotEmpty) {\n                        this.setState(() {\n                          isLoading = true;\n                        });\n                        phone=_username.text.toString();\n                        await verifyPhoneNumber();\n                        this.setState(() {\n                          showLoginCode = true;\n                          isLoading = false;\n                        });\n                      } else {\n                        Enigma.toast(\"手机号不能为空\");\n                      }\n                    } else {\n                      if (_password.text.length == 6) {\n                        handleSignIn();\n                      } else {\n                        Enigma.toast(\"x`验证码不能为空\");\n                      }\n                    }\n                  },\n                ),\n              ),\n              isLoading\n                  ? SpinKitCubeGrid(\n                color: Colors.white,\n                size: 50.0,\n              )\n                  : SizedBox(\n                height: 0,\n              )\n            ],\n          ),\n        ),\n      ),\n    );\n    //构建注册界面\n    var sign = Scaffold(\n      appBar: SignupApbar(\n        title: \"创建帐户\",\n        tap: () => this.setState(() => tosign = false),\n      ),\n      body: SingleChildScrollView(\n        physics: BouncingScrollPhysics(),\n        child: Stack(\n          alignment: Alignment.center,\n          children: <Widget>[\n            Container(\n              height: _media.height,\n              width: _media.width,\n              decoration: BoxDecoration(\n                gradient: SIGNUP_BACKGROUND,\n              ),\n            ),\n            Column(\n              children: <Widget>[\n                SizedBox(\n                  height: 30,\n                ),\n                (avatarImageFile == null)\n                    ? SignUpArrowButton(\n                        height: 70,\n                        width: 70,\n                        icon: IconData(0xe903, fontFamily: 'Icons'),\n                        iconSize: 30,\n                        onTap: () {\n                          Navigator.push(\n                              context,\n                              MaterialPageRoute(\n                                  builder: (context) => HybridImagePicker(\n                                      title: 'Pick an image',\n                                      callback: getImage,\n                                      profile: true)));\n                        },\n                      )\n                    : GestureDetector(\n                        child: Material(\n                          child: Image.file(\n                            avatarImageFile,\n                            width: 150.0,\n                            height: 150.0,\n                            fit: BoxFit.cover,\n                          ),\n                          borderRadius: BorderRadius.all(Radius.circular(75.0)),\n                          clipBehavior: Clip.hardEdge,\n                        ),\n                        onTap: () {\n                          Navigator.push(\n                              context,\n                              MaterialPageRoute(\n                                  builder: (context) => HybridImagePicker(\n                                      title: 'Pick an image',\n                                      callback: getImage,\n                                      profile: true)));\n                        },\n                      ),\n                SizedBox(\n                  height: 30,\n                ),\n                Text(\n                  \"上传头像\",\n                  style: TextStyle(\n                    fontSize: 13,\n                  ),\n                ),\n                SizedBox(\n                  height: 20,\n                ),\n                fieldColorBox(SIGNUP_BACKGROUND, \"USERNAME\", \"\",\n                    TextInputType.text, _controller),\n                fieldColorBox(SIGNUP_CARD_BACKGROUND, \"Email\", \"\",\n                    TextInputType.emailAddress, _Passcontroller),\n                fieldColorBox(SIGNUP_SIX_FACEBOOK_BG, \"PHONE\", \"\",\n                    TextInputType.phone, _Emailcontroller),\n                dateColorBox(\n                    SIGNUP_SIX_TWITTER_BG, \"生日\", _currentDate, _selectDate),\n                shadowColorBox(SIGNUP_CARD_BACKGROUND, \"性别\", \"男\", \"女\"),\n                showCodeBox\n                    ? fieldColorBox(SIGNUP_SIX_FACEBOOK_BG, \"验证码\", \"\",\n                        TextInputType.number, _Codecontroller)\n                    : Container(\n                        height: 0,\n                      ),\n                SizedBox(\n                  height: 20,\n                ),\n                nexButton(\"next\"),\n              ],\n            ),\n            isLoading\n                ? SpinKitCubeGrid(\n              color: Colors.white,\n              size: 50.0,\n            )\n                : Container(),\n          ],\n        ),\n      ),\n    );\n\n    //根据是否跳转注册 显示注册/登录界面\n    if (tosign) {\n      return sign;\n    } else {\n      return login;\n    }\n  }\n\n  //构建输入框\n  Widget inputText(\n    String fieldName,\n    String hintText,\n    TextEditingController controller,\n    bool obSecure,\n  ) {\n    return TextField(\n      style: TextStyle(height: 1.3),\n      controller: controller,\n      keyboardType: TextInputType.number,\n      decoration: InputDecoration(\n        hintText: hintText,\n        labelText: fieldName,\n        labelStyle: TextStyle(\n          fontSize: 14.0,\n          fontFamily: \"Mlx\",\n          fontWeight: FontWeight.w400,\n          letterSpacing: 1,\n          height: 0,\n        ),\n        border: InputBorder.none,\n      ),\n      obscureText: obSecure,\n    );\n  }\n\n\n\n  //注册界面的信息框\n  Widget shadowColorBox(\n      Gradient gradient, String title, String male, String famale) {\n    return Padding(\n      padding: const EdgeInsets.only(\n        left: 30.0,\n        right: 30,\n        bottom: 8,\n      ),\n      child: Container(\n        height: 60,\n        decoration: BoxDecoration(\n          gradient: gradient,\n          borderRadius: BorderRadius.circular(10),\n          boxShadow: [\n            BoxShadow(\n              color: Colors.black38,\n              blurRadius: 30,\n              offset: Offset(1.0, 9.0),\n            ),\n          ],\n        ),\n        child: Row(\n          crossAxisAlignment: CrossAxisAlignment.center,\n          children: <Widget>[\n            SizedBox(\n              width: 30,\n            ),\n            Expanded(\n              flex: 3,\n              child: Text(\n                title,\n                style: TextStyle(fontSize: 14.0, color: Colors.grey),\n              ),\n            ),\n            Expanded(\n              flex: 2,\n              child: Wrap(\n                children: <Widget>[\n                  GestureDetector(\n                    child: Text(\n                      male,\n                      style: TextStyle(\n                        fontSize: 14,\n                        color: _male ? Colors.black : Colors.grey,\n                        fontWeight: FontWeight.w400,\n                      ),\n                      overflow: TextOverflow.ellipsis,\n                    ),\n                    onTap: () {\n                      setState(() {\n                        _famele = false;\n                        _male = true;\n                      });\n                    },\n                  ),\n                  SizedBox(\n                    width: 15,\n                  ),\n                  GestureDetector(\n                    child: Text(\n                      famale,\n                      style: TextStyle(\n                        fontSize: 14,\n                        color: _famele ? Colors.black : Colors.grey,\n                        fontWeight: FontWeight.w400,\n                      ),\n                      overflow: TextOverflow.ellipsis,\n                    ),\n                    onTap: () {\n                      setState(() {\n                        _famele = true;\n                        _male = false;\n                      });\n                    },\n                  ),\n                ],\n              ),\n            ),\n          ],\n        ),\n      ),\n    );\n  }\n\n  //\n  Widget fieldColorBox(Gradient gradient, String title, String text,\n      TextInputType type, TextEditingController controller) {\n    return Padding(\n      padding: const EdgeInsets.only(\n        left: 30.0,\n        right: 30,\n        bottom: 8,\n      ),\n      child: Container(\n        height: 60,\n        decoration: BoxDecoration(\n          gradient: gradient,\n          borderRadius: BorderRadius.circular(10),\n          boxShadow: [\n            BoxShadow(\n              color: Colors.black38,\n              blurRadius: 30,\n              offset: Offset(1.0, 9.0),\n            ),\n          ],\n        ),\n        child: Row(\n          crossAxisAlignment: CrossAxisAlignment.center,\n          children: <Widget>[\n            SizedBox(\n              width: 30,\n            ),\n            Expanded(\n              flex: 3,\n              child: Text(\n                title,\n                style: TextStyle(fontSize: 14.0, color: Colors.grey),\n              ),\n            ),\n            Expanded(\n              flex: 2,\n              child: Wrap(\n                children: <Widget>[\n                  TextField(\n                    controller: controller,\n                    keyboardType: type,\n                    autofocus: false,\n                    obscureText:\n                        type == TextInputType.visiblePassword ? true : false,\n                    decoration: InputDecoration(\n                        hintText: text,\n                        border: InputBorder.none,\n                        hintStyle:\n                            TextStyle(fontSize: 14.0, color: Colors.black)),\n                  ),\n                ],\n              ),\n            ),\n          ],\n        ),\n      ),\n    );\n  }\n\n  Widget dateColorBox(\n      Gradient gradient, String title, String data, Function function) {\n    return Padding(\n      padding: const EdgeInsets.only(\n        left: 30.0,\n        right: 30,\n        bottom: 8,\n      ),\n      child: Container(\n        height: 60,\n        decoration: BoxDecoration(\n          gradient: gradient,\n          borderRadius: BorderRadius.circular(10),\n        ),\n        child: Row(\n          crossAxisAlignment: CrossAxisAlignment.center,\n          children: <Widget>[\n            SizedBox(\n              width: 30,\n            ),\n            Expanded(\n              flex: 3,\n              child: Text(\n                title,\n                style: TextStyle(fontSize: 14.0, color: Colors.grey),\n              ),\n            ),\n            Expanded(\n              flex: 2,\n              child: Wrap(\n                children: <Widget>[\n                  FlatButton(\n                    child: Text(\n                      data,\n                      style: TextStyle(\n                        fontSize: 12,\n                        color: Colors.black,\n                        fontWeight: FontWeight.w400,\n                      ),\n                      overflow: TextOverflow.ellipsis,\n                    ),\n                    onPressed: function,\n                  ),\n                ],\n              ),\n            ),\n          ],\n        ),\n      ),\n    );\n  }\n  //按钮\n  Widget nexButton(String text) {\n    return InkWell(\n      child: Container(\n        alignment: Alignment.center,\n        height: 45,\n        width: 120,\n        decoration: BoxDecoration(\n          gradient: SIGNUP_CIRCLE_BUTTON_BACKGROUND,\n          borderRadius: BorderRadius.circular(50),\n        ),\n        child: Text(\n          text,\n          style: TextStyle(\n            color: Color(0xfffbed96),\n            fontWeight: FontWeight.w700,\n            fontSize: 14.0,\n          ),\n        ),\n      ),\n      onTap: () async {\n        //注册按钮\n        if (!showCodeBox) {\n          if (_Emailcontroller.text.isNotEmpty &&\n              _controller.text.isNotEmpty &&\n              _Passcontroller.text.isNotEmpty &&\n              _currentDate.isNotEmpty) {\n            this.setState(() => showCodeBox = true);\n\n            String _phone = _Emailcontroller.text.toString().trim();\n            RegExp e164 = new RegExp(r'^\\+[1-9]\\d{1,14}$');\n            if (_phone.isNotEmpty && e164.hasMatch(\"+86\" + _phone)) {\n              setState(() {\n                isLoading = true;\n              });\n              phone = _phone;\n              await verifyPhoneNumber();\n              setState(() {\n                isLoading = false;\n              });\n            } else {\n              Enigma.toast('请输入正确的手机号码.');\n            }\n          } else {\n            Enigma.toast(\"个人信息不能为空\");\n          }\n        } else {\n          if (_Codecontroller.text.length == 6) {\n            setState(() {\n              isLoading = true;\n            });\n            await handleSignIn();\n          }\n        }\n      },\n    );\n  }\n}\n"
  },
  {
    "path": "lib/main.dart",
    "content": "import 'dart:async';\nimport 'dart:core';\n\nimport 'package:Enigma/screens/main_screen.dart';\nimport 'package:Enigma/screens/profile.dart';\nimport 'package:Enigma/util/const.dart';\nimport 'package:Enigma/widgets/chat_item.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:flutter/cupertino.dart';\nimport 'package:flutter/material.dart';\nimport 'package:Enigma/chat.dart';\nimport 'package:Enigma/const.dart';\n\nimport 'package:flutter/services.dart';\nimport 'package:Enigma/login.dart';\nimport 'package:intl/intl.dart';\nimport 'package:shared_preferences/shared_preferences.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:Enigma/DataModel.dart';\nimport 'package:scoped_model/scoped_model.dart';\nimport 'package:local_auth/local_auth.dart';\nimport 'package:firebase_messaging/firebase_messaging.dart';\n\nvoid main() {\n  //全局定义错误事件处理\n  FlutterError.onError = (FlutterErrorDetails details) {\n    if (Enigma.isInDebugMode) {\n      // In development mode, simply print to console.\n      FlutterError.dumpErrorToConsole(details);\n    } else {\n      // In production mode, report to the application zone to report to\n      // Sentry.\n      Zone.current.handleUncaughtError(details.exception, details.stack);\n    }\n  };\n\n  //\n  runZoned<Future<void>>(() async {\n    //运行app\n    runApp(EnigmaWrapper());\n    await SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);\n    SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(\n      statusBarColor: Constants.lightPrimary,\n      statusBarIconBrightness: Brightness.dark,\n    ));\n  }, onError: (error, stackTrace) async {\n    // Whenever an error occurs, call the `_reportError` function. This sends\n    // Dart errors to the dev console or Sentry depending on the environment.\n    await Enigma.reportError(error, stackTrace);\n  });\n}\n\nclass EnigmaWrapper extends StatelessWidget {\n  bool isDark = false;\n\n  @override\n  Widget build(BuildContext context) {\n    return FutureBuilder(\n        future: SharedPreferences.getInstance(), //获取本地数据，如果没有就登陆\n        builder: (context, AsyncSnapshot<SharedPreferences> snapshot) {\n          if (snapshot.hasData) {\n            //显示主界面\n            return MaterialApp(\n              home: MainScreen2(\n                  mainUI: MainScreen(\n                      currentUserNo: snapshot.data.getString(PHONE))),\n              theme: Constants.lightTheme,\n            );\n          }\n          return MaterialApp(\n            home: Container(\n              child: Center(\n                child: CircularProgressIndicator(\n                    valueColor: AlwaysStoppedAnimation<Color>(enigmaBlue)),\n              ),\n              color: enigmaBlack.withOpacity(0.8),\n            ),\n          );\n        });\n  }\n}\n\nclass MainScreen extends StatefulWidget {\n  MainScreen({@required this.currentUserNo, key}) : super(key: key);\n  final String currentUserNo;\n\n  @override\n  State createState() => new MainScreenState(currentUserNo: this.currentUserNo);\n}\n\nclass MainScreenState extends State<MainScreen>\n    with WidgetsBindingObserver, AutomaticKeepAliveClientMixin {\n  MainScreenState({Key key, this.currentUserNo}) {\n    //查找框注册监听器，监听查找框文本变化\n    _filter.addListener(() {\n      _userQuery.add(_filter.text.isEmpty ? '' : _filter.text);\n    });\n  }\n\n  @override\n  bool get wantKeepAlive => true;\n\n  //获得消息通知\n  FirebaseMessaging notifications = new FirebaseMessaging();\n\n  //本地存储\n  SharedPreferences prefs;\n\n  @override\n  void didChangeAppLifecycleState(AppLifecycleState state) {\n    //如果app处于前台就更新当前为在线状态，否则就为离线状态\n    if (state == AppLifecycleState.resumed)\n      setIsActive();\n    else\n      setLastSeen();\n  }\n\n  //设置在线\n  void setIsActive() async {\n    if (currentUserNo != null)\n      await Firestore.instance\n          .collection(USERS)\n          .document(currentUserNo)\n          .setData({LAST_SEEN: true}, merge: true);\n  }\n\n  //设置最后登录时间\n  void setLastSeen() async {\n    if (currentUserNo != null)\n      await Firestore.instance\n          .collection(USERS)\n          .document(currentUserNo)\n          .setData({LAST_SEEN: DateTime.now().millisecondsSinceEpoch},\n              merge: true);\n  }\n\n  //查找框的控制器\n  final TextEditingController _filter = new TextEditingController();\n  bool isAuthenticating = false;\n\n  //对方手机号的内容控制器\n  TextEditingController _peerPhone = new TextEditingController();\n\n  //\n  //未读消息的订阅\n  List<StreamSubscription> unreadSubscriptions = List<StreamSubscription>();\n  //stream的控制器\n  List<StreamController> controllers = new List<StreamController>();\n\n  @override\n  void initState() {\n    //初始化登录，如果有数据就显示主界面，没有本地数据就跳转到登陆界面\n    LocalAuthentication().canCheckBiometrics.then((res) {\n      if (res) biometricEnabled = true;\n    });\n    getSignedInUserOrRedirect();\n    Enigma.internetLookUp();\n    super.initState();\n\n    WidgetsBinding.instance.addObserver(this);\n  }\n\n  @override\n  void dispose() {\n    super.dispose();\n    //释放所有资源，并且清空所有的内容\n    WidgetsBinding.instance.removeObserver(this);\n    controllers.forEach((controller) {\n      controller.close();\n    });\n    _filter.dispose();\n\n    _userQuery.close();\n    cancelUnreadSubscriptions();\n    //设置最后在线时间\n    setLastSeen();\n  }\n\n  //取消未读订阅\n  void cancelUnreadSubscriptions() {\n    unreadSubscriptions.forEach((subscription) {\n      subscription?.cancel();\n    });\n  }\n\n  DataModel _cachedModel;//当前用户数据\n  bool biometricEnabled = false;\n\n  //获取当前登录状态 并判断是否跳转到登陆界面\n  getSignedInUserOrRedirect() async {\n    prefs = await SharedPreferences.getInstance();\n    //跳转登录界面\n    if (currentUserNo == null || currentUserNo.isEmpty)\n      unawaited(Navigator.pushReplacement(\n        context,\n        new MaterialPageRoute(\n            builder: (context) => new LoginScreen(title: 'Sign in to ZH')),\n      ));\n    else {\n      //设置在线状态 并更新数据，通知所有好友在线\n      setIsActive();\n      String fcmToken = await notifications.getToken();\n      if (prefs.getBool(IS_TOKEN_GENERATED) != true) {\n        await Firestore.instance\n            .collection(USERS)\n            .document(currentUserNo)\n            .setData({\n          NOTIFICATION_TOKENS: FieldValue.arrayUnion([fcmToken])\n        }, merge: true);\n        unawaited(prefs.setBool(IS_TOKEN_GENERATED, true));\n      }\n    }\n  }\n\n  String currentUserNo; //当前用户的手机号\n\n  bool isLoading = false;//是否处于加载状态\n\n  //构建用户界面中的好友条目\n  Widget buildItem(BuildContext context, Map<String, dynamic> user) {\n    NavigatorState state = Navigator.of(context);\n    //如果对方用户手机号是当前用户就不显示\n    if (user[PHONE] as String == currentUserNo) {\n      return Container(width: 0, height: 0);\n    } else {\n      return StreamBuilder(\n          stream: getUnread(user).asBroadcastStream(),//获取未读消息\n          builder: (context, AsyncSnapshot<MessageData> unreadData) {\n            int unread = unreadData.hasData &&\n                    unreadData.data.snapshot.documents.isNotEmpty\n                ? unreadData.data.snapshot.documents\n                    .where((t) => t[TIMESTAMP] > unreadData.data.lastSeen)\n                    .length\n                : 0;\n            //定义未读消息的内容\n            var unreadString = \"\";\n            var unreadTime = \"\";//未读消息的时间\n            if (unread != 0) {//如果未读消息不为0就继续\n              var doc = unreadData.data.snapshot.documents\n                  .where((t) => t[TIMESTAMP] > unreadData.data.lastSeen)\n                  .toList()\n                  .last;//得到未读消息的文档\n              unreadTime = DateFormat('hh:mm')\n                  .format(DateTime.fromMillisecondsSinceEpoch(doc[TIMESTAMP]));//获取未读消息的时间\n              //判断未读消息的内容，如果是图片就只是显示图片，如果是文件就只是显示文件\n              if (doc[TYPE] == MessageType.image.index) {\n                unreadString = \"[图片]\";\n              } else if (doc[TYPE] == MessageType.file.index) {\n                unreadString = \"[文件]\";\n              } else {\n                //如果是文字就显示未读消息的文字\n                unreadString = unreadData.data.snapshot.documents\n                    .where((t) => t[TIMESTAMP] > unreadData.data.lastSeen)\n                    .toList()\n                    .last[CONTENT];\n                print(\"reciver:$unreadString\");\n              }\n            }\n            //定义一个主题\n            return Theme(\n                data: ThemeData(\n                    splashColor: enigmaWhite,\n                    highlightColor: Colors.transparent),\n                child: ChatItem( //列表的条目，也就是每一个好友的item的样式\n                    //以下分别是头像，姓名，未读消息，未读消息时间，是否在线和未读消息数量\n                    dp: Enigma.avatar(user),\n                    name: Enigma.getNickname(user),\n                    msg: unreadString,\n                    time: unreadTime,\n                    isOnline: user[LAST_SEEN] == true,\n                    counter: unread == 0 ? 0 : int.parse(unread.toString()),\n                    tap: () {\n                      //点击事件，点击后进入聊天界面\n                      if (_cachedModel.currentUser[LOCKED] != null &&\n                          _cachedModel.currentUser[LOCKED]\n                              .contains(user[PHONE])) {\n                        NavigatorState state = Navigator.of(context);\n                      } else {\n                        Navigator.push(\n                            context,\n                            new MaterialPageRoute(\n                                builder: (context) => new ChatScreen(\n                                    unread: unread,\n                                    model: _cachedModel,\n                                    currentUserNo: currentUserNo,\n                                    peerNo: user[PHONE] as String)));\n                      }\n                    }));\n          });\n    }\n  }\n\n  //获得未读消息\n  Stream<MessageData> getUnread(Map<String, dynamic> user) {\n    //得到会话id\n    String chatId = Enigma.getChatId(currentUserNo, user[PHONE]);\n    var controller = StreamController<MessageData>.broadcast();\n    //未读订阅监听firebase实时数据库去同步数据\n    unreadSubscriptions.add(Firestore.instance\n        .collection(MESSAGES)\n        .document(chatId)\n        .snapshots()\n        .listen((doc) {\n      if (doc[currentUserNo] != null && doc[currentUserNo] is int) {\n        //当有新消息的时候且不为0的时候 添加一个新的消息\n        unreadSubscriptions.add(Firestore.instance\n            .collection(MESSAGES)\n            .document(chatId)\n            .collection(chatId)\n            .snapshots()\n            .listen((snapshot) {\n          controller.add(\n              MessageData(snapshot: snapshot, lastSeen: doc[currentUserNo]));\n        }));\n      }\n    }));\n    controllers.add(controller);\n    return controller.stream;\n  }\n\n  _isHidden(phoneNo) {\n    Map<String, dynamic> _currentUser = _cachedModel.currentUser;\n    return _currentUser[HIDDEN] != null &&\n        _currentUser[HIDDEN].contains(phoneNo);\n  }\n\n  //定义一个用户查询\n  StreamController<String> _userQuery =\n      new StreamController<String>.broadcast();\n  //定义用户的好友列表\n  List<Map<String, dynamic>> _users = List<Map<String, dynamic>>();\n\n  _chats(Map<String, Map<String, dynamic>> _userData,\n      Map<String, dynamic> currentUser) {\n    //获取所有的用户好友\n    _users = Map.from(_userData)\n        .values\n        .where((_user) => _user.keys.contains(CHAT_STATUS))\n        .toList()\n        .cast<Map<String, dynamic>>();\n    Map<String, int> _lastSpokenAt = _cachedModel.lastSpokenAt;\n    List<Map<String, dynamic>> filtered = List<Map<String, dynamic>>();\n\n    //排序\n    _users.sort((a, b) {\n      int aTimestamp = _lastSpokenAt[a[PHONE]] ?? 0;\n      int bTimestamp = _lastSpokenAt[b[PHONE]] ?? 0;\n      return bTimestamp - aTimestamp;\n    });\n\n\n\n    //返回页面布局\n    return Stack(\n      children: <Widget>[\n        RefreshIndicator(\n            onRefresh: () {\n              return Future.value(false);\n            },\n            child: Container(\n                child: _users.isNotEmpty //如果用户好友不为空的话就显示好友列表\n                    ? StreamBuilder(\n                        stream: _userQuery.stream.asBroadcastStream(),//查询好友\n                        builder: (context, snapshot) {\n                          //如果用户的查询好友关键字不为空的话就从好友列表中筛选出符合的好友\n                          if (_filter.text.isNotEmpty ||\n                              snapshot.hasData && snapshot.data.isNotEmpty) {\n                            filtered = this._users.where((user) {\n                              return user[NICKNAME]\n                                  .toLowerCase()\n                                  .trim()\n                                  .contains(new RegExp(r'' +\n                                      _filter.text.toLowerCase().trim() +\n                                      ''));\n                            }).toList();\n                            //如果是空的话就不显示\n                            if (filtered.isNotEmpty)\n                              return ListView.separated(\n                                padding: EdgeInsets.all(10),\n                                separatorBuilder:\n                                    (BuildContext context, int index) {\n                                  return Align(\n                                    alignment: Alignment.centerRight,\n                                    child: Container(\n                                      height: 0.5,\n                                      width: MediaQuery.of(context).size.width /\n                                          1.3,\n                                      child: Divider(),\n                                    ),\n                                  );\n                                },\n                                itemBuilder: (context, index) => buildItem(\n                                    context, filtered.elementAt(index)),\n                                itemCount: filtered.length,\n                              );\n                            else//如果没有好友显示此界面 或者显示没有查找到结果\n                              return ListView(children: [\n                                Padding(\n                                    padding: EdgeInsets.only(\n                                        top:\n                                            MediaQuery.of(context).size.height /\n                                                3.5),\n                                    child: Center(\n                                      child: Text('No search results.',\n                                          textAlign: TextAlign.center,\n                                          style: TextStyle(\n                                            fontSize: 18,\n                                            color: enigmaWhite,\n                                          )),\n                                    ))\n                              ]);\n                          }//显示用户界面\n                          return ListView.builder(\n                            padding: EdgeInsets.all(10.0),\n                            itemBuilder: (context, index) =>\n                                buildItem(context, _users.elementAt(index)),\n                            itemCount: _users.length,\n                          );\n                        })\n                    : ListView(children: [ //好友数量为0 就显示此界面\n                        Padding(\n                            padding: EdgeInsets.only(\n                                top: MediaQuery.of(context).size.height / 3.5),\n                            child: Center(\n                              child: Padding(\n                                  padding: EdgeInsets.all(30.0),\n                                  child: Text('快去添加一个好友聊天吧~',\n                                      textAlign: TextAlign.center,\n                                      style: TextStyle(\n                                        fontSize: 18,\n                                        color: enigmaWhite,\n                                      ))),\n                            ))\n                      ]))),\n      ],\n    );\n  }\n\n  //缓存用户数据\n  DataModel getModel() {\n    _cachedModel ??= DataModel(currentUserNo);\n    return _cachedModel;\n  }\n\n  //背景颜色渐变\n  LinearGradient SIGNUP_CARD_BACKGROUND = LinearGradient(\n    tileMode: TileMode.clamp,\n    begin: FractionalOffset.centerLeft,\n    end: FractionalOffset.centerRight,\n    stops: [0.1, 1.0],\n    colors: [Color(0xffffc2a1), Color(0xffffb1bb)],\n  );\n\n  //输入框\n  Widget inputText(\n    String fieldName,\n    String hintText,\n    TextEditingController controller,\n    bool obSecure,\n  ) {\n    return TextField(\n      style: TextStyle(height: 1.3),\n      controller: controller,\n      keyboardType: TextInputType.number,\n      decoration: InputDecoration(\n        hintText: hintText,\n        labelText: fieldName,\n        labelStyle: TextStyle(\n          fontSize: 14.0,\n          fontFamily: \"Mlx\",\n          fontWeight: FontWeight.w400,\n          letterSpacing: 1,\n          height: 0,\n        ),\n        border: InputBorder.none,\n      ),\n      obscureText: obSecure,\n    );\n  }\n\n  @override //构建用户界面\n  Widget build(BuildContext context) {\n    super.build(context);\n    final _media = MediaQuery.of(context).size;\n    return Enigma.getNTPWrappedWidget(WillPopScope(\n        onWillPop: () {\n          if (!isAuthenticating) setLastSeen();\n          return Future.value(true);\n        },\n        child: ScopedModel<DataModel>(\n          model: getModel(),\n          child: ScopedModelDescendant<DataModel>(\n              builder: (context, child, _model) {\n            _cachedModel = _model;\n            return Scaffold(\n                floatingActionButton: _model.loaded //添加好友按钮\n                    ? FloatingActionButton(\n                        child: Icon(\n                          Icons.person_add,\n                          size: 30.0,\n                        ),\n                        onPressed: () { //点击事件\n                          //点击后显示一个对话框， 提示让用户输入手机号，然后有结果的话就进入用户的详情页\n                          //没有的话就提示用户此用户不存在\n                          showDialog(\n                              context: context,\n                              builder: (context) {\n                                return AlertDialog(\n                                  title: Text('查找'),\n                                  content: inputText(\n                                      \"请输入对方手机号\", '', _peerPhone, false),\n                                  actions: <Widget>[\n                                    new FlatButton(\n                                      onPressed: () {\n                                        //正则表达式，验证是否是手机号\n                                        RegExp e164 =\n                                            new RegExp(r'^\\+[1-9]\\d{1,14}$');\n                                        print(_peerPhone.text);\n                                        if (_peerPhone.text.isNotEmpty &&\n                                            e164.hasMatch(\n                                                \"+86${_peerPhone.text.trim()}\")) {\n                                          dynamic wUser = _cachedModel.userData[\n                                              \"+86${_peerPhone.text.trim()}\"];\n                                          if (wUser != null &&\n                                              wUser[CHAT_STATUS] != null) {\n                                            //如果是手机号的话并且是好友就直接进入聊天界面\n                                            Navigator.pushReplacement(\n                                                context,\n                                                new MaterialPageRoute(\n                                                    builder: (context) => new ChatScreen(\n                                                        model: _cachedModel,\n                                                        currentUserNo: _cachedModel\n                                                            .currentUser[PHONE],\n                                                        peerNo:\n                                                            \"+86${_peerPhone.text.trim()}\",\n                                                        unread: 0)));\n                                          } else {\n                                            //如果不是好友就进入对方的资料界面\n                                            getUser(\n                                                phone:\n                                                    \"+86${_peerPhone.text.trim()}\");\n                                          }\n                                        } else {\n\n                                          Enigma.toast(\"请输入正确的手机号\");\n                                        }\n                                      },\n                                      child: new Text(\"确认\"),\n                                    ),\n                                    new FlatButton(\n                                      onPressed: () {\n                                        Navigator.of(context).pop();\n                                      },\n                                      child: new Text(\"取消\"),\n                                    ),\n                                  ],\n                                );\n                              });\n//                          Navigator.push(\n//                              context,\n//                              new MaterialPageRoute(\n//                                  builder: (context) => new Contacts(\n//                                      prefs: prefs,\n//                                      biometricEnabled: biometricEnabled,\n//                                      currentUserNo: currentUserNo,\n//                                      model: _cachedModel)));\n                        })\n                    : Container(),\n                appBar: AppBar( //查找好友的输入框\n                  bottom: PreferredSize(\n                      preferredSize: Size.fromHeight(40.0),\n                      child: TextField(\n                        autofocus: false,\n                        style: TextStyle(color: Colors.black),\n                        controller: _filter, //控制器，用来获得用户输入的信息\n                        decoration: new InputDecoration(\n                            focusedBorder: InputBorder.none,\n                            prefixIcon: Icon(\n                              Icons.search,\n                              color: Colors.grey,\n                            ),\n                            hintText: 'Search ',\n                            hintStyle: TextStyle(color: Colors.black26)),\n                      )),\n                  backgroundColor: Colors.white,\n                  title: Text(\n                    'ZH',\n                    style: TextStyle(\n                        color: Colors.black, fontWeight: FontWeight.bold),\n                  ),\n                  centerTitle: false,\n                ),\n                body: _chats(_model.userData, _model.currentUser));\n          }),\n        )));\n  }\n\n  //查找用户\n  getUser({phone: String}) {\n    //firebase数据库查找用户\n    Firestore.instance.collection(USERS).document(phone).get().then((user) {\n      setState(() {\n        bool isUser = user.exists;\n        if (isUser) { //如果用户存在就得到对方信息并进入资料页面\n          var peeruser;\n          if (_cachedModel.userData[phone] == null) {\n            peeruser = user.data;\n          } else {\n            peeruser = _cachedModel.userData[phone];\n          }\n          Navigator.push(\n              context,\n              MaterialPageRoute(\n                  builder: (context) => Profile(\n                        unread: 0,\n                        currentUserNo: widget.currentUserNo,\n                        model: _cachedModel,\n                        peeruser: peeruser,\n                      )));\n        } else {\n          Enigma.toast(\"没有找到此用户\");\n        }\n      });\n    });\n  }\n}\n\n//颜色渐变\nLinearGradient SIGNUP_SIX_FACEBOOK_BG = LinearGradient(\n  begin: FractionalOffset.bottomLeft,\n  end: FractionalOffset.topRight,\n  // Add one stop for each color. Stops should increase from 0 to 1\n  stops: [0.1, 0.3],\n  colors: [\n    Color(0xffe0c3fc),\n    Color(0xff8ec5fc),\n  ],\n);\n\nclass MessageData {\n  int lastSeen;\n  QuerySnapshot snapshot;\n\n  MessageData({@required this.snapshot, @required this.lastSeen});\n}\n"
  },
  {
    "path": "lib/message.dart",
    "content": "import 'package:Enigma/const.dart';\nimport 'package:flutter/material.dart';\nimport 'package:Enigma/seen_provider.dart';\n\n//消息实体类，用于对应聊天消息\nclass Message {\n  Message(Widget child,\n      {@required this.timestamp,\n      @required this.from,\n      @required this.onTap,\n      @required this.onDoubleTap,\n      @required this.onDismiss,\n      @required this.onLongPress,\n      this.saved = false})\n      : child = wrapMessage(\n            child: child,\n            onDismiss: onDismiss,\n            onDoubleTap: onDoubleTap,\n            onTap: onTap,\n            onLongPress: onLongPress,\n            saved: saved);\n\n  final String from; //从哪里发出\n  final Widget child;\n  final int timestamp;//时间\n  final VoidCallback onTap, onDoubleTap, onDismiss, onLongPress;//各种点击事件\n  final bool saved;//是否保存了\n  static Widget wrapMessage(\n      {@required SeenProvider child,\n      @required onDismiss,\n      @required onDoubleTap,\n      @required onTap,\n      @required onLongPress,\n      @required bool saved}) {\n    return child.child.isMe\n        ? GestureDetector(\n            child: child,\n            onTap: onTap,\n            onDoubleTap: onDoubleTap,\n            onLongPress: onLongPress,\n          )\n        : Dismissible(\n            background: Align(\n              child: Icon(Icons.delete_sweep, color: enigmaWhite, size: 40),\n              alignment: Alignment.bottomLeft,\n            ),\n            key: Key(child.timestamp),\n            dismissThresholds: {DismissDirection.startToEnd: 0.9},\n            child: GestureDetector(\n              child: child,\n              onDoubleTap: onDoubleTap,\n              onTap: onTap,\n              onLongPress: onLongPress,\n            ),\n            onDismissed: (direction) {\n              if (onDismiss != null) onDismiss();\n            },\n            direction: DismissDirection.startToEnd,\n          );\n  }\n}\n"
  },
  {
    "path": "lib/open_settings.dart",
    "content": "import 'package:Enigma/const.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:flutter/material.dart';\nimport 'package:permission_handler/permission_handler.dart';\n\n//打开设置界面\nclass OpenSettings extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return Enigma.getNTPWrappedWidget(Material(\n        color: enigmaBlack,\n        child: Center(\n            child: Padding(\n                padding: EdgeInsets.symmetric(horizontal: 30.0),\n                child: RaisedButton(\n                    color: Colors.blue,\n                    textColor: enigmaWhite,\n                    onPressed: () {\n                      PermissionHandler().openAppSettings();\n                    },\n                    child: Text('Open App Settings'))))));\n  }\n}\n"
  },
  {
    "path": "lib/photo_view.dart",
    "content": "import 'package:Enigma/open_settings.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:flutter/material.dart';\nimport 'package:photo_view/photo_view.dart';\nimport 'package:Enigma/save.dart';\nimport 'package:permission_handler/permission_handler.dart';\n\n//大图显示的界面\nclass PhotoViewWrapper extends StatelessWidget {\n  const PhotoViewWrapper(\n      {this.imageProvider,\n      this.loadingChild,\n      this.backgroundDecoration,\n      this.minScale,\n      this.maxScale,\n      @required this.tag});\n\n  final String tag; //标记\n  //图片提供者\n  final ImageProvider imageProvider;\n  //加载进度条\n  final Widget loadingChild;\n  //背景颜色\n  final Decoration backgroundDecoration;\n  final dynamic minScale;//最小尺寸\n  final dynamic maxScale;//最大尺寸\n\n  @override\n  Widget build(BuildContext context) {\n    return Enigma.getNTPWrappedWidget(Scaffold(\n        floatingActionButton: FloatingActionButton(\n          onPressed: () {\n            //检查存储权限，如果有的话就保存到内存卡中，没有的话就提示用户没有权限\n            Enigma.checkAndRequestPermission(PermissionGroup.storage)\n                .then((res) {\n              if (res) {\n                Save.saveToDisk(imageProvider, tag);\n                Enigma.toast('Saved!');\n              } else {\n                Enigma.showRationale(\n                    '需要存储权限才可以保存图片哦');\n                Navigator.push(\n                    context,\n                    new MaterialPageRoute(\n                        builder: (context) => OpenSettings()));\n              }\n            });\n          },\n          child: Icon(Icons.file_download),\n        ),\n        body: Container( //显示大图\n            constraints: BoxConstraints.expand(\n              height: MediaQuery.of(context).size.height,\n            ),\n            child: PhotoView(\n              imageProvider: imageProvider,\n              loadingChild: loadingChild,\n              backgroundDecoration: backgroundDecoration,\n              minScale: minScale,\n              maxScale: maxScale,\n              heroTag: tag,\n            ))));\n  }\n}\n"
  },
  {
    "path": "lib/save.dart",
    "content": "import 'dart:io';\nimport 'dart:ui';\n\nimport 'package:Enigma/const.dart';\nimport 'package:cached_network_image/cached_network_image.dart';\nimport 'package:flutter_cache_manager/flutter_cache_manager.dart';\nimport 'dart:convert';\nimport 'dart:async';\nimport 'package:flutter/material.dart';\nimport 'package:localstorage/localstorage.dart';\nimport 'package:path/path.dart';\nimport 'package:path_provider/path_provider.dart';\nimport 'package:mime/mime.dart';\n//聊天信息的保存\nclass Save {\n  static final LocalStorage storage = new LocalStorage(SAVED);\n\n  //通过base64获取图片，存储图片是以base64的方式保存在本地的\n  static Future<String> getBase64FromImage({String imageUrl, File file}) {\n    Completer<String> complete = new Completer<String>();\n    if (file == null) {\n      DefaultCacheManager().getFile(imageUrl).listen((stream) {\n        stream.file.readAsBytes().then((imageBytes) {\n          complete.complete(base64Encode(imageBytes));\n        });\n      });\n    } else {\n      List<int> imageBytes = file.readAsBytesSync();\n      complete.complete(base64Encode(imageBytes));\n    }\n    return complete.future;\n  }\n\n  //通过base64的方式获取图片\n  static Image getImageFromBase64(String encoded) =>\n      Image.memory(base64.decode(encoded));\n\n  //保存信息\n  static saveMessage(String peerNo, Map<String, dynamic> doc) {\n    storage.ready.then((ready) {\n      if (ready) {\n        List<Map<String, dynamic>> saved =\n            storage.getItem(peerNo)?.cast<Map<String, dynamic>>() ?? List<Map<String, dynamic>>();\n        if (!(saved.any((_doc) => _doc[TIMESTAMP] == doc[TIMESTAMP]))) {\n          // Don't repeat the saved ones\n          saved.add(doc);\n          storage.setItem(peerNo, saved);\n        }\n      }\n    });\n  }\n\n  //删除信息\n  static deleteMessage(String peerNo, Map<String, dynamic> doc) {\n    storage.ready.then((ready) {\n      if (ready) {\n        List<Map<String, dynamic>> saved =\n            storage.getItem(peerNo)?.cast<Map<String, dynamic>>() ??\n                List<Map<String, dynamic>>();\n        saved.removeWhere((_d) =>\n            _d[TIMESTAMP] == doc[TIMESTAMP] && _d[CONTENT] == doc[CONTENT]);\n        storage.setItem(peerNo, saved);\n      }\n    });\n  }\n\n  //获取保存的信息\n  static Future<List<Map<String, dynamic>>> getSavedMessages(String peerNo) {\n    Completer<List<Map<String, dynamic>>> completer =\n        new Completer<List<Map<String, dynamic>>>();\n    storage.ready.then((ready) {\n      if (ready) {\n        completer\n            .complete(storage.getItem(peerNo)?.cast<Map<String, dynamic>>());\n      }\n    });\n    return completer.future;\n  }\n\n  //保存的内存卡中\n  static void saveToDisk(ImageProvider provider, String filename) async {\n    Directory appDocDirectory = await getExternalStorageDirectory();\n    Directory dir = Directory(appDocDirectory.path + '/Enigma/photos');\n    filename = filename.replaceAll(RegExp(r'[^\\d]'), '');\n    save(Function callback) {\n      dir.exists().then((res) {\n        if (res) {\n          callback(dir);\n        } else {\n          dir.create(recursive: true).then((_dir) {\n            callback(_dir);\n          });\n        }\n      });\n    }\n\n    if (provider is CachedNetworkImageProvider) {\n      CachedNetworkImageProvider _cache = provider;\n      DefaultCacheManager().getFile(_cache.url).listen((stream) {\n        _save(Directory directory) {\n          stream.file.readAsBytes().then((bytes) {\n            String extension =\n                lookupMimeType('', headerBytes: bytes).split('/')[1];\n            File f = new File(join(directory.path, '$filename.$extension'));\n            f.writeAsBytes(bytes);\n          });\n        }\n\n        save(_save);\n      });\n    } else {\n      MemoryImage image = provider;\n      _save(Directory directory) {\n        String extension =\n            lookupMimeType('', headerBytes: image.bytes).split('/')[1];\n        File f = new File(join(directory.path, '$filename.$extension'));\n        f.writeAsBytes(image.bytes);\n      }\n\n      save(_save);\n    }\n  }\n}\n"
  },
  {
    "path": "lib/screens/feed_five_page.dart",
    "content": "import 'dart:io';\nimport 'dart:ui';\n\nimport 'package:Enigma/ImagePicker/image_picker.dart';\nimport 'package:Enigma/util/GradientUtil.dart';\nimport 'package:Enigma/util/SizeUtil.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:file_picker/file_picker.dart';\nimport 'package:firebase_auth/firebase_auth.dart';\nimport 'package:firebase_storage/firebase_storage.dart';\n\n///\nimport \"package:flutter/material.dart\";\nimport 'package:flutter/src/scheduler/ticker.dart';\nimport 'package:flutter_spinkit/flutter_spinkit.dart';\nimport 'package:path/path.dart' as path;\nimport 'package:shared_preferences/shared_preferences.dart';\n\nimport '../const.dart';\n\n\n//发布分享页面\nclass FeedFivePage extends StatefulWidget {\n  @override\n  _FeedFiveState createState() => _FeedFiveState();\n}\n\nclass _FeedFiveState extends State<FeedFivePage> {\n\n  var _value = \"\";\n\n  //内容控制器，用来控制文本的输入和获取\n  TextEditingController _content = TextEditingController();\n  //图片\n  File imgFile;\n  //选择的文件\n  File selectFile;\n  //是否显示加载框\n  bool isLoading = false;\n  //获取图片\n  void getImage(File image) async {\n    if (image != null) {\n      setState(() {\n        imgFile = image;\n      });\n    }\n  }\n\n  //图片选择框\n  Widget _content2() => Container(\n        margin: EdgeInsets.symmetric(\n          vertical: SizeUtil.getAxisY(50),\n        ),\n        child: GestureDetector(//点击事件组件\n          onTap: () {\n            Navigator.push(\n                context,\n                MaterialPageRoute(\n                    builder: (context) => HybridImagePicker(\n                        title: 'Pick an image',\n                        callback: getImage,\n                        profile: true)));\n          },\n          child: Row(\n            children: <Widget>[\n              SizedBox(width: SizeUtil.getAxisX(22)),\n              Icon(\n                Icons.camera_alt,\n                size: SizeUtil.getAxisBoth(28),\n              ),\n              SizedBox(width: SizeUtil.getAxisX(64)),\n              Text(\"分享照片\", style: TextStyle(color: TEXT_BLACK)),\n              Expanded(\n                  child: Container(\n                constraints: BoxConstraints.expand(\n                  height: SizeUtil.getAxisBoth(78),\n                ),\n                alignment: Alignment.centerRight,\n                child: Container(\n                  height: SizeUtil.getAxisBoth(78),\n                  width: SizeUtil.getAxisBoth(78),\n                  child: imgFile == null\n                      ? Icon(\n                          Icons.add_a_photo,\n                          color: Colors.black,\n                        )\n                      : SizedBox(\n                          height: 0,\n                        ),\n                  decoration: imgFile == null\n                      ? BoxDecoration(borderRadius: BorderRadius.circular(4))\n                      : BoxDecoration(\n                          image: DecorationImage(\n                              image: FileImage(imgFile), fit: BoxFit.fill),\n                          borderRadius: BorderRadius.circular(4)),\n                ),\n              ))\n            ],\n          ),\n        ),\n      );\n\n  //获取本地文件\n  Future<File> _getLocalFile() async {\n    // 获取应用目录\n    File selectfile = await FilePicker.getFile();\n    this.setState(() => this.selectFile = selectfile);\n  }\n\n  //上传文件\n  Future uploadFile(String name, File file) async {\n    //firebase上传文件并获取文件的下载地址\n    StorageReference reference = FirebaseStorage.instance.ref().child(name);\n    StorageTaskSnapshot uploading = await reference.putFile(file).onComplete;\n    var s = await uploading.ref.getDownloadURL();\n    return s;\n  }\n\n  //文件选择框\n  Widget _content3() => Container(\n        margin: EdgeInsets.symmetric(\n          vertical: SizeUtil.getAxisY(50),\n        ),\n        child: GestureDetector(//点击事件，用于获得本地文件\n          onTap: () {\n            _getLocalFile();\n          },\n          child: Row(\n            children: <Widget>[\n              SizedBox(width: SizeUtil.getAxisX(22)),\n              Icon(\n                Icons.file_upload,\n                size: SizeUtil.getAxisBoth(28),\n              ),\n              SizedBox(width: SizeUtil.getAxisX(64)),\n              Text(\n                \"分享文件\",\n                style: TextStyle(color: TEXT_BLACK),\n              ),\n              SizedBox(\n                width: 30,\n              ),\n              Expanded(\n                child: Container(\n                  constraints: BoxConstraints.expand(\n                    height: SizeUtil.getAxisBoth(78),\n                  ),\n                  alignment: Alignment.centerRight,\n                  child: selectFile == null//如果选择的文件不为空就显示文件的名字，否则显示默认图标\n                      ? Icon(\n                          Icons.cloud_upload,\n                          color: Colors.black,\n                        )\n                      : Text(\n                          path.basename(selectFile.path),\n                          softWrap: true,\n                          maxLines: 1,\n                          style: TextStyle(color: Colors.white),\n                          overflow: TextOverflow.ellipsis,\n                        ),\n                ),\n              )\n            ],\n          ),\n        ),\n      );\n\n  //文本编辑框\n  Widget _content4() => Container(\n        margin: EdgeInsets.symmetric(\n          vertical: SizeUtil.getAxisY(50),\n        ),\n        child: Row(\n          children: <Widget>[\n            SizedBox(width: SizeUtil.getAxisX(22)),\n            Icon(\n              Icons.mode_edit,\n              size: SizeUtil.getAxisBoth(28),\n            ),\n            SizedBox(width: SizeUtil.getAxisX(64)),\n            Text(\n              \"写下此时的心情吧\",\n              style: TextStyle(color: Colors.black),\n            ),\n          ],\n        ),\n      );\n\n  //文本编辑框\n  Widget _upContent() => Container(\n        constraints: BoxConstraints.expand(height: SizeUtil.getAxisY(900)),\n        margin: EdgeInsets.symmetric(\n          vertical: SizeUtil.getAxisY(48),\n          horizontal: SizeUtil.getAxisX(44),\n        ),\n        padding: EdgeInsets.symmetric(\n          horizontal: SizeUtil.getAxisX(38),\n          vertical: SizeUtil.getAxisY(50),\n        ),\n        child: SingleChildScrollView(\n          child: Column(\n            children: <Widget>[\n              _content2(),\n              _content3(),\n              _content4(),\n              TextField(\n                controller: _content,\n                maxLines: 3,\n                maxLength: 140,\n                autofocus: false,\n                decoration: InputDecoration(hintText: \"随便写写\"),\n              ),\n              nexButton(\"发布\")//发布按钮\n            ],\n          ),\n        ),\n        decoration: BoxDecoration(\n            borderRadius: BorderRadius.circular(10),\n            gradient: GradientUtil.greenPurple()),\n      );\n\n  //构建用户界面\n  @override\n  Widget build(BuildContext context) {\n    //带appbar的用户界面\n    return Scaffold(\n      body: Stack(//绝对定位\n        alignment: Alignment.center,\n        children: <Widget>[\n          Container(//容器\n            child: Column(\n              children: <Widget>[\n                Expanded(\n                  child: Stack(//绝对定位\n                    alignment: Alignment.center,\n                    children: <Widget>[\n                      Container(//容器\n                        width: double.infinity,\n                        height: double.infinity,\n                        alignment: Alignment.center,\n                        decoration: BoxDecoration(\n                          image: DecorationImage(\n                            image: AssetImage(\"assets/share.jpeg\"),\n                            fit: BoxFit.cover,\n                            colorFilter: ColorFilter.mode(\n                                Colors.black26, BlendMode.multiply),\n                          ),\n                        ),\n                      ),\n                      _upContent(),\n                    ],\n                  ),\n                )\n              ],\n            ),\n          ),\n          Positioned(//返回按钮\n            top: 50,\n            left: 30,\n            child: GestureDetector(\n              child: Icon(\n                Icons.arrow_back,\n                color: Colors.white,\n                size: 30,\n              ),\n            ),\n          ),\n          isLoading //是否处于加载状态，是的话显示进度条\n              ? SpinKitCubeGrid(\n                  color: Colors.white,\n                  size: 50.0,\n                )\n              : SizedBox(\n                  height: 0,\n                )\n        ],\n      ),\n    );\n  }\n\n  //完成按钮\n  Widget nexButton(String text) {\n    return InkWell(\n      child: Container(\n        alignment: Alignment.center,\n        height: 45,\n        width: 120,\n        decoration: BoxDecoration(\n          gradient: GradientUtil.greenPurple(),\n          borderRadius: BorderRadius.circular(50),\n        ),\n        child: Text(\n          text,\n          style: TextStyle(\n            color: Colors.white,\n            fontWeight: FontWeight.w700,\n            fontSize: 14.0,\n          ),\n        ),\n      ),\n      onTap: () async { //点击事件\n        //先获取到当前登陆用户的信息，如果没有就无权限发布\n        var prefs = await SharedPreferences.getInstance();\n        var nickname = prefs.getString(NICKNAME) ?? '';\n        var phone = prefs.getString(PHONE) ?? '';\n        var photoUrl = prefs.getString(PHOTO_URL) ?? '';\n        print(nickname);\n        if (nickname.isEmpty || phone.isEmpty) {\n          Enigma.toast(\"当前状态无权限发布\");\n          return;\n        }\n        //内容不能为空\n        if (_content.text.isEmpty) {\n          Enigma.toast(\"总要写点什么吧亲~~\");\n        } else {\n          //设置处于加载状态，同时如果有图片的话就上传图片，有文件的话就上传文件，拿回文件和图片的URL以后，组装分享的model\n          //然后发布到firebase的实时数据库中\n          String imgUrl = \"\", fileUrl = \"\";\n          setState(() {\n            isLoading = true;\n          });\n          if (imgFile != null) {\n            imgUrl = await uploadFile(\n                \"${DateTime.now().millisecondsSinceEpoch}${path.extension(imgFile.path)}\",\n                imgFile);\n          }\n          if (selectFile != null) {\n            fileUrl = await uploadFile(\n                \"${path.basename(selectFile.path)}\", selectFile);\n          }\n\n          //firebase发布到数据库中\n          var result = await Firestore.instance.collection(POST).add({\n            POST_PHOTO_URL: photoUrl??\"\",\n            POST_NICK_NAME: nickname,\n            POST_PHONE: phone,\n            POST_TIME: DateTime.now().millisecondsSinceEpoch,\n            POST_CONTENT: _content.text,\n            POST_IMAGE_URL: imgUrl,\n            POST_FILE_NAME:\n                selectFile == null ? \"\" : path.basename(selectFile.path),\n            POST_FILE_PATH: fileUrl,\n          }).catchError((e) {\n            Enigma.toast(\"发布失败:错误:${e.toString()}\");\n          });\n\n          setState(() {\n            isLoading = false;\n          });\n          if (result != null) {\n            Enigma.toast(\"发布成功\");\n            Navigator.pop(context);\n          }\n        }\n      },\n    );\n  }\n}\n"
  },
  {
    "path": "lib/screens/home.dart",
    "content": "import 'package:Enigma/screens/feed_five_page.dart';\nimport 'package:Enigma/util/SizeUtil.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:Enigma/widgets/post_item.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:flustars/flustars.dart';\nimport 'package:flutter/material.dart';\n\nimport '../const.dart';\n\n//分享界面\nclass Home extends StatefulWidget {\n  @override\n  _HomeState createState() => _HomeState();\n}\n\nclass _HomeState extends State<Home> {\n  //是否启用了搜索\n  bool isSearch = false;\n  //搜索的内容控制器\n  TextEditingController searchController = TextEditingController();\n  //默认的搜索时间\n  String dropdownValue = \"过去一小时\";\n  //是否启用了时间选择按钮\n  bool isTimeSelect = false;\n  //是否启动了时间搜索\n  bool isTimeSearch = false;\n\n  _buildList(BuildContext contxt, List<DocumentSnapshot> snapshot) {\n    print(snapshot.length);\n  }\n\n  //获取最新的分享信息\n  Stream<QuerySnapshot> getdata() {\n    /*\n      因为是Stream，所以可以实时的从firebase的数据库中同步信息\n      首先是创建一个从firebase中读取信息的输入流，然后根据是否启用了搜索和时间选择来构建\n    */\n\n    var stream1 = Firestore.instance\n        .collection(POST)\n        .orderBy(POST_TIME, descending: true)\n        .snapshots();\n    if (isSearch && searchController.text.isNotEmpty) {\n      stream1 = Firestore.instance\n          .collection(POST)\n          .where(POST_NICK_NAME, isEqualTo: searchController.text.trim())\n          .orderBy(POST_TIME, descending: true)\n          .snapshots();\n    }\n    if (isTimeSelect && isTimeSearch) {\n      var time = 0;\n      switch (dropdownValue) {\n        case \"过去一小时\":\n          {\n            time = 60 * 60 * 1000;\n            break;\n          }\n        case \"过去一天\":\n          {\n            time = 60 * 60 * 1000 * 24;\n            break;\n          }\n        case \"过去一周\":\n          {\n            time = 60 * 60 * 1000 * 24 * 7;\n            break;\n          }\n        case \"过去一个月\":\n          {\n            time = 60 * 60 * 1000 * 24 * 30;\n            break;\n          }\n        case \"过去一年\":\n          {\n            time = 60 * 60 * 1000 * 24 * 365;\n            break;\n          }\n      }\n      if(isSearch && searchController.text.isNotEmpty){\n        stream1 = Firestore.instance\n            .collection(POST)\n            .where(POST_NICK_NAME, isEqualTo: searchController.text.trim())\n            .where(POST_TIME,\n            isGreaterThanOrEqualTo:\n            DateTime.now().millisecondsSinceEpoch - time)\n            .orderBy(POST_TIME, descending: true)\n            .snapshots();\n      }else{\n        stream1 = Firestore.instance\n            .collection(POST)\n            .where(POST_TIME,\n            isGreaterThanOrEqualTo:\n            DateTime.now().millisecondsSinceEpoch - time)\n            .orderBy(POST_TIME, descending: true)\n            .snapshots();\n      }\n\n    }\n\n    return stream1;\n  }\n\n  //初始化状态，并且初始化搜索选择器\n  @override\n  void initState() {\n    // TODO: implement initState\n    super.initState();\n    searchController.addListener(() {\n      if (searchController.text.isEmpty) {\n        this.setState(() {\n          isSearch = false;\n        });\n      }\n    });\n  }\n\n  //构建界面\n  @override\n  Widget build(BuildContext context) {\n    SizeUtil.size = MediaQuery.of(context).size;//获取手机实际的大小\n    //创建一个最中间的listview，用于填充数据和显示数据\n    var home = StreamBuilder<QuerySnapshot>(\n      stream: getdata(), //获取数据\n      builder: (context, snapshot) {\n        //如果没有数据就显示无数据\n        if (!snapshot.hasData) {\n          if (isSearch) {\n            print(\"isserch:$isSearch\");\n            Enigma.toast(\"没有查询到结果哦\");\n          }\n          return Container();\n        }\n        return Scaffold(//构建Listview并填充数据\n          body: ListView.builder(\n            padding: EdgeInsets.symmetric(horizontal: 20),\n            itemCount: snapshot.data.documents.length,\n            itemBuilder: (BuildContext context, int index) {\n              var post = snapshot.data.documents[index];\n              return PostItem(\n                name: post.data[POST_NICK_NAME],\n                avatar: post.data[POST_PHOTO_URL],\n                content: post.data[POST_CONTENT],\n                time: TimelineUtil.format(post.data[POST_TIME]),\n                img: post.data[POST_IMAGE_URL],\n                fileName: post.data[POST_FILE_NAME],\n                filePath: post.data[POST_FILE_PATH],\n              );\n            },\n          ),\n          floatingActionButton: FloatingActionButton(//添加分享的按钮，点击后进入分享界面\n            heroTag: \"btn1\",\n            child: Icon(\n              Icons.add,\n            ),\n            onPressed: () {//点击事件\n              Navigator.push(context,\n                  MaterialPageRoute(builder: (context) => FeedFivePage()));\n            },\n          ),\n        );\n      },\n    );\n\n    //构建搜索栏\n    var searchBar = Container(\n      width: 300,\n      child: DropdownButton<String>(\n        value: dropdownValue,\n        isExpanded: true,\n        icon: Icon(Icons.arrow_downward),\n        iconSize: 24,\n        elevation: 16,\n        hint: Text(\"请选择时间范围\"),\n        style: TextStyle(fontSize: 20, color: Colors.deepPurple),\n        onChanged: (String newValue) {\n          setState(() {\n            isTimeSearch = true;\n            dropdownValue = newValue;\n          });\n        },\n        items: <String>[\n          '过去一小时',\n          '过去一天',\n          '过去一周',\n          '过去一个月',\n          '过去一年',\n        ].map<DropdownMenuItem<String>>((String value) {\n          return DropdownMenuItem<String>(\n            value: value,\n            child: Text(value),\n          );\n        }).toList(),\n      ),\n    );\n\n    //构建真正的界面，并且把搜索栏和列表放在一起\n    return Scaffold(\n      appBar: AppBar(\n        title: TextField(\n          controller: searchController,\n          onSubmitted: (value) {\n            this.setState(() {\n              isSearch = true;\n            });\n          },\n          decoration: InputDecoration.collapsed(\n            hintText: 'Search',\n          ),\n        ),\n        centerTitle: true,\n        actions: <Widget>[\n          IconButton(\n            icon: Icon(\n              Icons.filter_list,\n            ),\n            onPressed: () {\n              this.setState(() {\n                if (isTimeSelect) {\n                  isTimeSearch = false;\n                }\n                isTimeSelect = !isTimeSelect;\n              });\n            },\n          ),\n        ],\n      ),\n      body: Column(\n        children: <Widget>[\n          isTimeSelect\n              ? searchBar\n              : SizedBox(\n                  height: 0,\n                ),\n          Expanded(\n            child: home,\n          )\n        ],\n      ),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/screens/main_screen.dart",
    "content": "import 'package:Enigma/main.dart';\n\n\nimport 'package:Enigma/settings.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\n\nimport 'home.dart';\n\n//主界面，负责加载聊天界面，分享界面和个人设置界面\nclass MainScreen2 extends StatefulWidget {\n  MainScreen2({Key key, this.mainUI}) : super(key: key);\n\n  MainScreen mainUI;\n\n  @override\n  _MainScreenState createState() => _MainScreenState();\n}\n\nclass _MainScreenState extends State<MainScreen2> {\n  PageController _pageController;\n  int _page = 0;\n\n  @override\n  Widget build(BuildContext context) {\n    //构建一个界面\n    return Scaffold(\n      //背景颜色\n      backgroundColor: Colors.transparent,\n      //内容是一个pageview，主要用来加载三个界面，类似Android中的viewpager\n      body: PageView(\n        physics: NeverScrollableScrollPhysics(),\n        controller: _pageController,//页面控制器\n        onPageChanged: onPageChanged,//当页面改变以后的监听事件\n        children: <Widget>[\n          //加载三个界面\n          widget.mainUI,\n          Home(),\n          Settings(),\n        ],\n      ),\n      bottomNavigationBar: Theme(//底部导航按钮\n        data: Theme.of(context).copyWith(//主题\n          // sets the background color of the `BottomNavigationBar`\n          canvasColor: Theme.of(context).primaryColor,\n          // sets the active color of the `BottomNavigationBar` if `Brightness` is light\n          primaryColor: Theme.of(context).accentColor,\n          textTheme: Theme.of(context).textTheme.copyWith(\n                caption: TextStyle(color: Colors.grey[500]),\n              ),\n        ),\n        child: BottomNavigationBar(//底部三个导航按钮\n          type: BottomNavigationBarType.fixed,\n          items: <BottomNavigationBarItem>[\n            BottomNavigationBarItem(\n              icon: Icon(\n                Icons.message,\n              ),\n              title: Container(height: 0.0),\n            ),\n            BottomNavigationBarItem(\n              icon: Icon(\n                Icons.share,\n              ),\n              title: Container(\n                height: 0.0,\n                child: Text(\"分享\"),\n              ),\n            ),\n            BottomNavigationBarItem(\n              icon: Icon(\n                Icons.person,\n              ),\n              title: Container(\n                height: 0.0,\n                child: Text(\"我的\"),\n              ),\n            ),\n          ],\n          onTap: navigationTapped,\n          currentIndex: _page,\n        ),\n      ),\n    );\n  }\n\n  //页面跳转逻辑\n  void navigationTapped(int page) {\n    _pageController.jumpToPage(page);\n  }\n\n  @override\n  void initState() {\n    super.initState();\n    //沉浸式状态栏\n    SystemUiOverlayStyle systemUiOverlayStyle =\n        SystemUiOverlayStyle(statusBarColor: Colors.transparent);\n    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);\n    //初始界面为聊天界面\n    _pageController = PageController(initialPage: 0);\n  }\n\n  @override\n  void dispose() {\n    super.dispose();\n    _pageController.dispose();\n  }\n\n  void onPageChanged(int page) {\n    setState(() {\n      this._page = page;\n    });\n  }\n}\n"
  },
  {
    "path": "lib/screens/profile.dart",
    "content": "import 'dart:math';\n\n\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/services.dart';\n\nimport '../DataModel.dart';\nimport '../alias.dart';\nimport '../chat.dart';\nimport '../const.dart';\n\n//好友信息界面\nclass Profile extends StatefulWidget {\n  @override\n  _ProfileState createState() => _ProfileState();\n\n  //当前用户的手机号\n  final String currentUserNo;\n  //对方用户的信息\n  final DataModel model;\n  //未读消息的数量\n  final int unread;\n  //对方用户\n  final Map<String, dynamic> peeruser;\n\n  //接受四个参数\n  Profile(\n      {Key key,\n      @required this.currentUserNo,\n      @required this.peeruser,\n      @required this.model,\n      @required this.unread});\n}\n\nclass _ProfileState extends State<Profile> {\n  static Random random = Random();\n\n  //四个文本控制器，分别是姓名，性别，生日和邮箱\n  TextEditingController _name = TextEditingController();\n  TextEditingController _sex = TextEditingController();\n  TextEditingController _birthday = TextEditingController();\n  TextEditingController _email = TextEditingController();\n\n  @override\n  void initState() {\n    super.initState();\n    //沉浸式状态栏\n    SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(\n        statusBarColor: Colors.transparent,\n        statusBarIconBrightness: Brightness.dark,\n        systemNavigationBarColor: Colors.transparent);\n    SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);\n    //如果目标用户不为空就获取他的信息并填充到文本中\n    if(widget.peeruser!=null){\n\n      _sex.text = widget.peeruser[Sex];\n      _birthday.text = widget.peeruser[BIRTHDAY];\n      if (widget.peeruser[EMAIL] == null) {\n        _email.text = \"此用户还没有留下他的邮箱哦\";\n      } else {\n        if (widget.peeruser[EMAIL].toString().isEmpty) {\n          _email.text = \"此用户还没有留下他的邮箱哦\";\n        } else {\n          _email.text = widget.peeruser[EMAIL];\n        }\n      }\n      if (widget.peeruser[ALIAS_NAME] == null) {\n        _name.text = \"\";\n      } else {\n        if (widget.peeruser[ALIAS_NAME].toString().isEmpty) {\n          _name.text = \"\";\n        } else {\n          _name.text = widget.peeruser[ALIAS_NAME];\n        }\n      }\n    }\n  }\n\n  //定义一个文本输入框\n  Widget inputText(\n    String fieldName,\n    String hintText,\n    TextEditingController controller,\n    bool obSecure,\n  ) {\n    return TextField(\n      style: TextStyle(height: 1.3),\n      controller: controller,\n      keyboardType: TextInputType.number,\n      decoration: InputDecoration(\n        hintText: hintText,\n        labelText: fieldName,\n        labelStyle: TextStyle(\n          fontSize: 14.0,\n          fontFamily: \"Mlx\",\n          fontWeight: FontWeight.w400,\n          letterSpacing: 1,\n          height: 0,\n        ),\n        border: InputBorder.none,\n      ),\n      obscureText: obSecure,\n    );\n  }\n\n  //构建界面\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      body: ConstrainedBox(\n        constraints: BoxConstraints.expand(),\n        child: Stack(//绝对布局\n          alignment: Alignment.center,\n          children: <Widget>[\n            //背景图片，如果用户头像不是空的话就加载用户的头像否则加载默认图片\n            Container(\n              width: double.infinity,\n              height: double.infinity,\n              alignment: Alignment.center,\n              decoration: BoxDecoration(\n                image: DecorationImage(\n                  image: (widget.peeruser == null)\n                      ? AssetImage(\"assets/proBg.jpg\")\n                      : widget.peeruser[PHOTO_URL].toString().isEmpty\n                          ? AssetImage(\"assets/proBg.jpg\")\n                          : NetworkImage(widget.peeruser[PHOTO_URL]),\n                  fit: BoxFit.cover,\n                  colorFilter:\n                      ColorFilter.mode(Colors.black26, BlendMode.multiply),\n                ),\n              ),\n            ),\n\n            Container(//遮罩层\n              color: Colors.black.withOpacity(0.1),\n            ),\n            SingleChildScrollView(child: Container(//可以滚动的View 用于放用户信息\n              child: Column(\n                crossAxisAlignment: CrossAxisAlignment.center,\n                mainAxisSize: MainAxisSize.min,\n                children: <Widget>[\n                  SizedBox(height: 40),\n                  CircleAvatar(//头像，如果有头像就加载头像，没有就加载默认图标\n                    child: (widget.peeruser == null)\n                        ? Image.asset(\"assets/avatar.png\",\n                        width: 150, height: 150, fit: BoxFit.cover)\n                        : widget.peeruser[PHOTO_URL].toString().isEmpty\n                        ? Image.asset(\"assets/avatar.png\",\n                        width: 150, height: 150, fit: BoxFit.cover)\n                        : Image.network(widget.peeruser[PHOTO_URL],\n                        width: 150, height: 150, fit: BoxFit.cover),\n                    radius: 50,\n                  ),\n                  SizedBox(height: 10),\n                  Text(//用户的名字\n                    (widget.peeruser == null)\n                        ? \"ceshi\"\n                        : widget.peeruser[NICKNAME],\n                    style: TextStyle(\n                        fontWeight: FontWeight.bold,\n                        fontSize: 22,\n                        color: Colors.white),\n                  ),\n                  SizedBox(height: 3),\n                  Text(//用户的座右铭\n                    (widget.peeruser == null)\n                        ? \"ceshi\"\n                        : (widget.peeruser[ABOUT_ME] == null)\n                        ? \"他很懒还没有留下座右铭哦\"\n                        : widget.peeruser[ABOUT_ME].toString().isEmpty\n                        ? \"他很懒还没有留下座右铭哦\"\n                        : widget.peeruser[ABOUT_ME],\n                    style: TextStyle(color: Colors.white),\n                  ),\n                  SizedBox(height: 20),\n                  Row(//聊天按钮\n                    mainAxisSize: MainAxisSize.min,\n                    mainAxisAlignment: MainAxisAlignment.center,\n                    children: <Widget>[\n                      FlatButton(\n                        child: Icon(\n                          Icons.message,\n                          color: Colors.white,\n                        ),\n                        color: Theme.of(context).accentColor,\n                        onPressed: () {//聊天按钮的点击事件\n                          //获取用户的信息然后跳转到聊天界面\n                          Firestore.instance\n                              .collection(USERS)\n                              .document(widget.peeruser[PHONE])\n                              .get()\n                              .then((user) {\n                            widget.model.addUser(user);\n                            Navigator.pushReplacement(\n                                context,\n                                new MaterialPageRoute(\n                                    builder: (context) => new ChatScreen(\n                                        unread: 0,\n                                        currentUserNo: widget.currentUserNo,\n                                        model: widget.model,\n                                        peerNo: user[PHONE])));\n                          });\n                        },\n                      ),\n                    ],\n                  ),\n                  ListTile( //性别信息框\n                      title: TextFormField(\n                        style: TextStyle(\n                          color: Colors.white,\n                        ),\n                        showCursor: false,\n                        autofocus: false,\n                        enabled: false,\n                        controller: _sex,\n                        decoration: InputDecoration(\n                            labelText: '性别',\n                            disabledBorder: new UnderlineInputBorder(\n                                borderSide: new BorderSide(color: Colors.white)),\n                            labelStyle: TextStyle(\n                              color: Colors.white,\n                            )),\n                      )),\n                  ListTile(//生日信息框\n                      title: TextFormField(\n                        showCursor: false,\n                        enabled: false,\n                        autofocus: false,\n                        style: TextStyle(\n                          color: Colors.white,\n                        ),\n                        controller: _birthday,\n                        decoration: InputDecoration(\n                            labelText: '生日',\n                            disabledBorder: new UnderlineInputBorder(\n                                borderSide: new BorderSide(color: Colors.white)),\n                            fillColor: Colors.white,\n                            labelStyle: TextStyle(\n                              color: Colors.white,\n                            )),\n                      )),\n                  GestureDetector(//点击组件，用于放备注\n                    onTap: () {//点击事件，点击后显示添加备注的弹出框\n                      showDialog(\n                          context: context,\n                          builder: (context) {\n\n                            return AliasForm(widget.peeruser, widget.model);\n                          });\n                    },\n                    child: ListTile(//备注信息框\n                        title: TextFormField(\n                          showCursor: false,\n                          enabled: false,\n                          autofocus: false,\n                          style: TextStyle(\n                            color: Colors.white,\n                          ),\n                          controller: _name,\n                          decoration: InputDecoration(\n                            disabledBorder: new UnderlineInputBorder(\n                                borderSide: new BorderSide(color: Colors.white)),\n                            labelStyle: TextStyle(\n                              color: Colors.white,\n                            ),\n                            labelText: '备注',\n                          ),\n                        )),\n                  ),\n                  ListTile(\n                      title: TextFormField(//邮箱信息框\n                        showCursor: false,\n                        autofocus: false,\n                        enabled: false,\n                        style: TextStyle(\n                          color: Colors.white,\n                        ),\n                        controller: _email,\n                        decoration: InputDecoration(\n                            labelText: '邮箱',\n                            disabledBorder: new UnderlineInputBorder(\n                                borderSide: new BorderSide(color: Colors.white)),\n                            labelStyle: TextStyle(\n                              color: Colors.white,\n                            )),\n                      )),\n                ],\n              ),\n            ),),\n            Positioned(//返回按钮\n              top: 50,\n              left: 20,\n              child: GestureDetector(\n                child: Icon(\n                  Icons.arrow_back,\n                  color: Colors.white,\n                  size: 30,\n                ),\n                onTap: () => Navigator.pop(context),\n              ),\n            )\n          ],\n        ),\n      ),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/seen_provider.dart",
    "content": "import 'package:Enigma/seen_state.dart';\nimport 'package:flutter/widgets.dart';\nimport 'package:Enigma/bubble.dart';\n\n//最近状态的提供者\nclass SeenProvider extends StatefulWidget {\n  const SeenProvider({this.timestamp, this.data, this.child});\n  final SeenState data; //最近的状态\n  final Bubble child;//\n  final String timestamp;//最近状态更新时间\n  static of(BuildContext context) {\n    _SeenInheritedProvider p =\n        context.inheritFromWidgetOfExactType(_SeenInheritedProvider);\n    return p.data;\n  }\n\n  @override\n  State<StatefulWidget> createState() => new _SeenProviderState();\n}\n\nclass _SeenProviderState extends State<SeenProvider> {\n  @override\n  initState() {\n    super.initState();\n    //监听状态更改信息\n    widget.data.addListener(didValueChange);\n  }\n\n  didValueChange() {\n    if (mounted) this.setState(() {});\n  }\n\n  @override\n  dispose() {\n    widget.data.removeListener(didValueChange);\n    super.dispose();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return new _SeenInheritedProvider(\n      data: widget.data,\n      child: widget.child,\n    );\n  }\n}\n\nclass _SeenInheritedProvider extends InheritedWidget {\n  _SeenInheritedProvider({this.data, this.child})\n      : _dataValue = data.value,\n        super(child: child);\n  final data;\n  final child;\n  final _dataValue;\n  @override\n  bool updateShouldNotify(_SeenInheritedProvider oldWidget) {\n    return _dataValue != oldWidget._dataValue;\n  }\n}\n"
  },
  {
    "path": "lib/seen_state.dart",
    "content": "import 'package:flutter/material.dart';\n\n//最最近状态\nclass SeenState extends ValueNotifier {\n  SeenState(value) : super(value);\n}\n"
  },
  {
    "path": "lib/settings.dart",
    "content": "import 'dart:async';\nimport 'dart:io';\n\nimport 'package:Enigma/login.dart';\nimport 'package:Enigma/utils.dart';\nimport 'package:cached_network_image/cached_network_image.dart';\nimport 'package:cloud_firestore/cloud_firestore.dart';\nimport 'package:firebase_storage/firebase_storage.dart';\nimport 'package:flutter/cupertino.dart';\nimport 'package:flutter/material.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:Enigma/util/const.dart';\n\nimport 'package:shared_preferences/shared_preferences.dart';\nimport 'package:Enigma/ImagePicker/image_picker.dart';\n\nclass Settings extends StatefulWidget {\n  final bool biometricEnabled;\n  final AuthenticationType type;\n\n  Settings({this.biometricEnabled, this.type});\n\n  @override\n  State createState() => new SettingsState();\n}\n\nclass SettingsState extends State<Settings> {\n  //以下分别为姓名，座右铭，生日，性别和邮箱的控制器\n  TextEditingController controllerNickname;\n  TextEditingController controllerAboutMe;\n  TextEditingController birthdayController;\n  TextEditingController sexController;\n  TextEditingController emailControll=TextEditingController();\n\n  SharedPreferences prefs;\n\n  //定义姓名，座右铭，生日，性别和邮箱\n  String phone = '';\n  String nickname = '';\n  String aboutMe = '';\n  String photoUrl = '';\n  String birthday = '';\n  String sex = '';\n  String email='';\n\n  //是否处于加载状态\n  bool isLoading = false;\n  //头像文件\n  File avatarImageFile;\n\n  //姓名和关于我\n  final FocusNode focusNodeNickname = new FocusNode();\n  final FocusNode focusNodeAboutMe = new FocusNode();\n\n  @override\n  void initState() {\n    super.initState();\n    //检查网络状态\n    Enigma.internetLookUp();\n    //读取本地信息\n    readLocal();\n\n  }\n\n  //读取本地信息并设置到界面中\n  void readLocal() async {\n    prefs = await SharedPreferences.getInstance();\n    phone = prefs.getString(PHONE) ?? '';\n    nickname = prefs.getString(NICKNAME) ?? '';\n    aboutMe = prefs.getString(ABOUT_ME) ?? '';\n    photoUrl = prefs.getString(PHOTO_URL) ?? '';\n    birthday = prefs.getString(BIRTHDAY) ?? '';\n    sex = prefs.getString(Sex) ?? '';\n    email = prefs.getString(EMAIL) ?? '';\n\n    controllerNickname = new TextEditingController(text: nickname);\n    controllerAboutMe = new TextEditingController(text: aboutMe);\n    birthdayController = new TextEditingController(text: birthday);\n    sexController = new TextEditingController(text: sex);\n    emailControll.text=email;\n    // Force refresh input\n    setState(() {});\n  }\n\n  //获取到图片\n  Future getImage(File image) async {\n    if (image != null) {\n      setState(() {\n        avatarImageFile = image;\n      });\n    }\n    return uploadFile();\n  }\n\n  //上传文件并获取到文件的地址\n  Future uploadFile() async {\n    String fileName = phone;\n    StorageReference reference = FirebaseStorage.instance.ref().child(fileName);\n    StorageTaskSnapshot uploading =\n        await reference.putFile(avatarImageFile).onComplete;\n    var s = await uploading.ref.getDownloadURL();\n\n    return uploading.ref.getDownloadURL();\n  }\n\n  //更新数据\n  void handleUpdateData() {\n    focusNodeNickname.unfocus();\n    focusNodeAboutMe.unfocus();\n\n    setState(() {\n      isLoading = true;\n    });\n    nickname =\n        controllerNickname.text.isEmpty ? nickname : controllerNickname.text;\n    aboutMe = controllerAboutMe.text.isEmpty ? aboutMe : controllerAboutMe.text;\n    email = emailControll.text.isEmpty ? email : emailControll.text;\n\n    //更新用户的信息然后缓存到本地\n    Firestore.instance.collection(USERS).document(phone).updateData({\n      NICKNAME: nickname,\n      ABOUT_ME: aboutMe,\n      EMAIL:email\n    }).then((data) async {\n      await prefs.setString(NICKNAME, nickname);\n      await prefs.setString(ABOUT_ME, aboutMe);\n      await prefs.setString(EMAIL, email);\n      setState(() {\n        isLoading = false;\n      });\n      Enigma.toast(\"保存成功!\");\n    }).catchError((err) {\n      setState(() {\n        isLoading = false;\n      });\n\n      Enigma.toast(err.toString());\n    });\n  }\n\n  //构建用户界面\n  @override\n  Widget build(BuildContext context) {\n    return Enigma.getNTPWrappedWidget(Theme(\n        data: Constants.lightTheme,\n        child: Scaffold(\n            appBar: new AppBar(\n              title: new Text( //标题\n                'Settings',\n              ),\n              actions: <Widget>[ //保存按钮\n                FlatButton(\n                  textColor: Colors.blue,\n                  onPressed: handleUpdateData,\n                  child: Text(\n                    'Save',\n                    style: TextStyle(fontSize: 16),\n                  ),\n                )\n              ],\n            ),\n            body: Stack(\n              children: <Widget>[\n                SingleChildScrollView(\n                  child: Column(\n                    children: <Widget>[\n                      // Avatar\n                      Container(\n                        child: Center(\n                          child: Stack(\n                            children: <Widget>[\n                              (avatarImageFile == null)\n                                  ? (photoUrl != ''\n                                      ? Material(\n                                          child: CachedNetworkImage(\n                                            placeholder: (context, url) =>\n                                                Container(\n                                                    child: Padding(\n                                                        padding: EdgeInsets.all(\n                                                            50.0),\n                                                        child:\n                                                            CircularProgressIndicator(\n                                                          valueColor:\n                                                              AlwaysStoppedAnimation<\n                                                                      Color>(\n                                                                  enigmaBlue),\n                                                        )),\n                                                    width: 150.0,\n                                                    height: 150.0),\n                                            imageUrl: photoUrl,\n                                            width: 150.0,\n                                            height: 150.0,\n                                            fit: BoxFit.cover,\n                                          ),\n                                          borderRadius: BorderRadius.all(\n                                              Radius.circular(75.0)),\n                                          clipBehavior: Clip.hardEdge,\n                                        )\n                                      : Icon(\n                                          Icons.account_circle,\n                                          size: 150.0,\n                                          color: Colors.grey,\n                                        ))\n                                  : Material(\n                                      child: Image.file(\n                                        avatarImageFile,\n                                        width: 150.0,\n                                        height: 150.0,\n                                        fit: BoxFit.cover,\n                                      ),\n                                      borderRadius: BorderRadius.all(\n                                          Radius.circular(75.0)),\n                                      clipBehavior: Clip.hardEdge,\n                                    ),\n                              Positioned( //选择图片按钮\n                                  bottom: 0,\n                                  right: 0,\n                                  child: FloatingActionButton(\n                                      heroTag: \"setting_pick\",\n                                      child: Icon(Icons.camera_alt),\n                                      onPressed: () {\n                                        Navigator.push(\n                                            context,\n                                            MaterialPageRoute(\n                                                builder: (context) =>\n                                                    HybridImagePicker(\n                                                        title: 'Pick an image',\n                                                        callback: getImage,\n                                                        profile: true))).then(\n                                            (url) {\n                                          if (url != null) {\n                                            photoUrl = url.toString();\n                                            Firestore.instance\n                                                .collection(USERS)\n                                                .document(phone)\n                                                .updateData({\n                                              PHOTO_URL: photoUrl\n                                            }).then((data) async {\n                                              await prefs.setString(\n                                                  PHOTO_URL, photoUrl);\n                                              setState(() {\n                                                isLoading = false;\n                                              });\n                                              Enigma.toast(\n                                                  \"Profile Picture Changed!\");\n                                            }).catchError((err) {\n                                              setState(() {\n                                                isLoading = false;\n                                              });\n\n                                              Enigma.toast(err.toString());\n                                            });\n                                          }\n                                        });\n                                      })),\n                            ],\n                          ),\n                        ),\n                        width: double.infinity,\n                        margin: EdgeInsets.all(20.0),\n                      ),\n                      ListTile( //姓名\n                          title: TextFormField(\n                        autovalidate: true,\n                        autofocus: false,\n                        controller: controllerNickname,\n                        validator: (v) {\n                          return v.isEmpty ? 'Name cannot be empty!' : null;\n                        },\n                        decoration: InputDecoration(labelText: '昵称'),\n                      )),\n                      ListTile( //签名\n                          title: TextFormField(\n                        controller: controllerAboutMe,\n                        autofocus: false,\n                        decoration: InputDecoration(labelText: '座右铭'),\n                      )),\n                      ListTile( //生日\n                          title: TextFormField(\n                        enabled: false,\n                        controller: birthdayController,\n                        decoration: InputDecoration(\n                          labelText: '生日',\n                        ),\n                      )),\n                      ListTile( //性别\n                          title: TextFormField(\n                        enabled: false,\n                        controller: sexController,\n                        decoration: InputDecoration(labelText: '性别'),\n                      )),\n                      ListTile(//邮箱\n                          title: TextFormField(\n                        autofocus: false,\n                        controller: emailControll,\n                        decoration: InputDecoration(labelText: '邮箱'),\n                      )),\n                      SizedBox(\n                        height: 20,\n                      ),\n                      ListTile(\n                          title: Row(children: [\n                        Expanded( //退出登录按钮\n                            child: RaisedButton.icon(\n                                icon: Icon(Icons.cancel),\n                                label: Text('退出登录'),\n                                color: Constants.darkAccent,\n                                textColor: Colors.white,\n                                onPressed: () async {\n                                  var pf =\n                                      await SharedPreferences.getInstance();\n                                  await pf.clear();\n                                  unawaited(Navigator.pushReplacement(\n                                    context,\n                                    new MaterialPageRoute(\n                                        builder: (context) => new LoginScreen(\n                                            title: 'Sign in to ZH')),\n                                  ));\n                                  ;\n                                }))\n                      ])),\n                    ],\n                  ),\n                  padding: EdgeInsets.only(left: 15.0, right: 15.0),\n                ),\n                // Loading\n                Positioned( //进度条\n                  child: isLoading\n                      ? Container(\n                          child: Center(\n                            child: CircularProgressIndicator(\n                                valueColor:\n                                    AlwaysStoppedAnimation<Color>(enigmaBlue)),\n                          ),\n                          color: Colors.black.withOpacity(0.8),\n                        )\n                      : Container(),\n                ),\n              ],\n            ))));\n  }\n\n  final StreamController<bool> _verificationNotifier =\n      StreamController<bool>.broadcast();\n\n  _onPasscodeEntered(String enteredPasscode) {\n    bool isValid = enteredPasscode.length == 4;\n    _verificationNotifier.add(isValid);\n  }\n\n  _onSubmit(String newPasscode) {\n    setState(() {\n      isLoading = true;\n    });\n    Firestore.instance\n        .collection(USERS)\n        .document(phone)\n        .updateData({PASSCODE: Enigma.getHashedString(newPasscode)}).then((_) {\n      prefs.setInt(ANSWER_TRIES, 0);\n      prefs.setInt(PASSCODE_TRIES, 0);\n      setState(() {\n        isLoading = false;\n        Enigma.toast('Updated!');\n      });\n    });\n  }\n\n\n}\n"
  },
  {
    "path": "lib/util/GradientUtil.dart",
    "content": "///\n///\nimport \"package:flutter/material.dart\";\n\nimport '../const.dart';\n\nclass GradientUtil {\n  static LinearGradient _getLinearGradient(Color left, Color right,\n          {begin = AlignmentDirectional.centerStart,\n          end = AlignmentDirectional.centerEnd,\n          opacity = 1.0}) =>\n      LinearGradient(\n        colors: [\n          left.withOpacity(opacity),\n          right.withOpacity(opacity),\n        ],\n        begin: begin,\n        end: end,\n      );\n\n  static LinearGradient yellowGreen(\n          {begin = AlignmentDirectional.centerStart,\n          end = AlignmentDirectional.centerEnd,\n          opacity = 1.0}) =>\n      _getLinearGradient(YELLOW, GREEN,\n          begin: begin, end: end, opacity: opacity);\n\n  static LinearGradient red(\n          {begin = AlignmentDirectional.centerStart,\n          end = AlignmentDirectional.centerEnd,\n          opacity = 1.0}) =>\n      _getLinearGradient(RED_LIGHT, RED,\n          begin: begin, end: end, opacity: opacity);\n\n  static LinearGradient yellowBlue(\n          {begin = AlignmentDirectional.centerStart,\n          end = AlignmentDirectional.centerEnd,\n          opacity = 1.0}) =>\n      _getLinearGradient(YELLOW, BLUE,\n          begin: begin, end: end, opacity: opacity);\n\n  static LinearGradient blue(\n          {begin = AlignmentDirectional.centerStart,\n          end = AlignmentDirectional.centerEnd,\n          opacity = 1.0}) =>\n      _getLinearGradient(BLUE_LIGHT, BLUE_DEEP,\n          begin: begin, end: end, opacity: opacity);\n\n  static LinearGradient greenRed(\n          {begin = AlignmentDirectional.centerStart,\n          end = AlignmentDirectional.centerEnd,\n          opacity = 1.0}) =>\n      _getLinearGradient(GREEN, RED, begin: begin, end: end, opacity: opacity);\n\n  static LinearGradient greenPurple(\n          {begin = AlignmentDirectional.centerStart,\n          end = AlignmentDirectional.centerEnd,\n          opacity = 0.5}) =>\n      _getLinearGradient(GREEN, PURPLE,\n          begin: begin, end: end, opacity: opacity);\n}\n"
  },
  {
    "path": "lib/util/SizeUtil.dart",
    "content": "///\n/// Created by NieBin on 2018/12/26\n/// Github: https://github.com/nb312\n/// Email: niebin312@gmail.com\n///\nimport 'package:flutter/material.dart';\nimport 'dart:math';\n\nclass SizeUtil {\n  static const _DESIGN_WIDTH = 750;\n  static const _DESIGN_HEIGHT = 1334;\n\n  //logic size in device\n  static Size _logicSize;\n\n  //device pixel radio.\n\n  static get width {\n    return _logicSize.width;\n  }\n\n  static get height {\n    return _logicSize.height;\n  }\n\n  static set size(size) {\n    _logicSize = size;\n  }\n\n  //@param w is the design w;\n  static double getAxisX(double w) {\n    return (w * width) / _DESIGN_WIDTH;\n  }\n\n// the y direction\n  static double getAxisY(double h) {\n    return (h * height) / _DESIGN_HEIGHT;\n  }\n\n  // diagonal direction value with design size s.\n  static double getAxisBoth(double s) {\n    return s *\n        sqrt((width * width + height * height) /\n            (_DESIGN_WIDTH * _DESIGN_WIDTH + _DESIGN_HEIGHT * _DESIGN_HEIGHT));\n  }\n}\n"
  },
  {
    "path": "lib/util/color_const.dart",
    "content": "///\n/// Created by NieBin on 18-12-14\n/// Github: https://github.com/nb312\n/// Email: niebin312@gmail.com\n///\nimport \"package:flutter/material.dart\";\n\nconst MAIN_COLOR = Color(0xFF303030);\nconst DARK_COLOR = Color(0xFFBDBDBD);\nconst BOTTOM_COLORS = [MAIN_COLOR, DARK_COLOR];\nconst YELLOW = Color(0xfffbed96);\nconst BLUE = Color(0xffabecd6);\nconst BLUE_DEEP = Color(0xffA8CBFD);\nconst BLUE_LIGHT = Color(0xffAED3EA);\nconst PURPLE = Color(0xffccc3fc);\nconst SIGNUP_LIGHT_RED = Color(0xffffc2a1);\nconst SIGNUP_RED = Color(0xffffb1bb);\nconst RED = Color(0xffF2A7B3);\nconst GREEN = Color(0xffc7e5b4);\nconst RED_LIGHT = Color(0xffFFC3A0);\nconst TEXT_BLACK = Color(0xFF353535);\nconst TEXT_BLACK_LIGHT = Color(0xFF34323D);\n"
  },
  {
    "path": "lib/util/const.dart",
    "content": "import 'package:flutter/material.dart';\nclass Constants{\n\n  static String appName = \"Social app\";\n\n  //Colors for theme\n  static Color lightPrimary = Color(0xfffcfcff);\n  static Color darkPrimary = Colors.black;\n  static Color lightAccent = Colors.blue;\n  static Color darkAccent = Colors.blueAccent;\n  static Color lightBG = Color(0xfffcfcff);\n  static Color darkBG = Colors.black;\n  static Color badgeColor = Colors.red;\n\n  static ThemeData lightTheme = ThemeData(\n    backgroundColor: lightBG,\n    primaryColor: lightPrimary,\n    accentColor:  lightAccent,\n    cursorColor: lightAccent,\n    scaffoldBackgroundColor: lightBG,\n    appBarTheme: AppBarTheme(\n      elevation: 0,\n      textTheme: TextTheme(\n        title: TextStyle(\n          color: darkBG,\n          fontSize: 18.0,\n          fontWeight: FontWeight.w800,\n        ),\n      ),\n    ),\n  );\n\n  static ThemeData darkTheme = ThemeData(\n    brightness: Brightness.dark,\n    backgroundColor: darkBG,\n    primaryColor: darkPrimary,\n    accentColor: darkAccent,\n    scaffoldBackgroundColor: darkBG,\n    cursorColor: darkAccent,\n    appBarTheme: AppBarTheme(\n      elevation: 0,\n      textTheme: TextTheme(\n        title: TextStyle(\n          color: lightBG,\n          fontSize: 18.0,\n          fontWeight: FontWeight.w800,\n        ),\n      ),\n    ),\n  );\n\n\n}"
  },
  {
    "path": "lib/utils.dart",
    "content": "import 'dart:async';\nimport 'dart:io';\n\nimport 'package:Enigma/DataModel.dart';\nimport 'package:cached_network_image/cached_network_image.dart';\nimport 'package:flutter/material.dart';\nimport 'package:Enigma/const.dart';\nimport 'package:crypto/crypto.dart';\nimport 'package:fluttertoast/fluttertoast.dart';\nimport 'package:ntp/ntp.dart';\nimport 'package:permission_handler/permission_handler.dart';\nimport 'package:sentry/sentry.dart';\nimport 'dart:convert';\n\nimport 'package:share/share.dart';\n\nclass Enigma {\n  static final SentryClient _sentry = SentryClient(\n      dsn: \"ENTER YOUR SENTRY DSN HERE\");\n\n  //设置是否处于debug模式\n  static bool get isInDebugMode {\n    // Assume you're in production mode\n    bool inDebugMode = false;\n\n    // Assert expressions are only evaluated during development. They are ignored\n    // in production. Therefore, this code only sets `inDebugMode` to true\n    // in a development environment.\n    assert(inDebugMode = true);\n\n    return inDebugMode;\n  }\n\n  //报告错误\n  static Future<void> reportError(dynamic error, dynamic stackTrace) async {\n    // Print the exception to the console\n    print('Caught error: $error');\n    if (isInDebugMode) {\n      // Print the full stacktrace in debug mode\n      print(stackTrace);\n      return;\n    } else {\n      // Send the Exception and Stacktrace to Sentry in Production mode\n      await _sentry.captureException(\n        exception: error,\n        stackTrace: stackTrace,\n      );\n    }\n  }\n\n  static String getNickname(Map<String, dynamic> user) =>\n      user[ALIAS_NAME] ?? user[NICKNAME];\n\n  //显示Toast\n  static void toast(String message) {\n    Fluttertoast.showToast(\n        msg: message,\n        backgroundColor: enigmaBlack.withOpacity(0.95),\n        textColor: enigmaWhite);\n  }\n\n  //检查网络\n  static void internetLookUp() {\n    try {\n      InternetAddress.lookup('example.com').catchError((e) {\n        Enigma.toast('No internet connection.');\n      });\n    } catch (_) {\n      Enigma.toast('No internet connection.');\n    }\n  }\n\n  static void invite() {\n    Share.share(\n        'Let\\'s chat on Enigma, join me at - https://play.google.com/store/apps/details?id=com.enigma.amitjoki');\n  }\n\n  static Widget avatar(Map<String, dynamic> user,\n      {File image, double radius = 22.5}) {\n    if (image == null) {\n      if (user[ALIAS_AVATAR] == null)\n        return (user[PHOTO_URL] ?? '').isNotEmpty\n            ? CircleAvatar(\n                backgroundImage: CachedNetworkImageProvider(user[PHOTO_URL]),\n                radius: radius)\n            : CircleAvatar(\n                backgroundColor: enigmaBlue,\n                foregroundColor: Colors.white,\n                child: Text(getInitials(Enigma.getNickname(user))),\n                radius: radius,\n              );\n      return CircleAvatar(\n        backgroundImage: Image.file(File(user[ALIAS_AVATAR])).image,\n        radius: radius,\n      );\n    }\n    return CircleAvatar(\n        backgroundImage: Image.file(image).image, radius: radius);\n  }\n\n  static Future<int> getNTPOffset() {\n    return NTP.getNtpOffset();\n  }\n\n  static Widget getNTPWrappedWidget(Widget child) {\n    return FutureBuilder(\n        future: NTP.getNtpOffset(),\n        builder: (context, AsyncSnapshot<int> snapshot) {\n          if (snapshot.connectionState == ConnectionState.done &&\n              snapshot.hasData) {\n            if (snapshot.data > Duration(minutes: 1).inMilliseconds ||\n                snapshot.data < -Duration(minutes: 1).inMilliseconds)\n              return Material(\n                  color: Colors.white,\n                  child: Center(\n                      child: Padding(\n                          padding: EdgeInsets.symmetric(horizontal: 30.0),\n                          child: Text(\n                            \"时间不对，请重新设置时间\",\n                            style: TextStyle(color: enigmaWhite, fontSize: 18),\n                          ))));\n          }\n          return child;\n        });\n  }\n\n  static void showRationale(rationale) async {\n    Enigma.toast(rationale);\n    await Future.delayed(Duration(seconds: 2));\n    Enigma.toast(\n        'If you change your mind, you can grant the permission through App Settings > Permissions');\n  }\n\n  static Future<bool> checkAndRequestPermission(PermissionGroup permission) {\n    Completer<bool> completer = new Completer<bool>();\n    PermissionHandler().checkPermissionStatus(permission).then((status) {\n      if (status != PermissionStatus.granted) {\n        PermissionHandler().requestPermissions([permission]).then((_status) {\n          bool granted = _status.values.first == PermissionStatus.granted;\n          completer.complete(granted);\n        });\n      } else\n        completer.complete(true);\n    });\n    return completer.future;\n  }\n\n  static String getInitials(String name) {\n    try {\n      List<String> names = name\n          .trim()\n          .replaceAll(new RegExp(r'[\\W]'), '')\n          .toUpperCase()\n          .split(' ');\n      names.retainWhere((s) => s.trim().isNotEmpty);\n      if (names.length >= 2)\n        return names.elementAt(0)[0] + names.elementAt(1)[0];\n      else if (names.elementAt(0).length >= 2)\n        return names.elementAt(0).substring(0, 2);\n      else\n        return names.elementAt(0)[0];\n    } catch (e) {\n      return '?';\n    }\n  }\n\n  static String getChatId(String currentUserNo, String peerNo) {\n    if (currentUserNo.hashCode <= peerNo.hashCode)\n      return '$currentUserNo-$peerNo';\n    return '$peerNo-$currentUserNo';\n  }\n\n  static AuthenticationType getAuthenticationType(\n      bool biometricEnabled, DataModel model) {\n    if (biometricEnabled && model?.currentUser != null) {\n      return AuthenticationType.values[model.currentUser[AUTHENTICATION_TYPE]];\n    }\n    return AuthenticationType.passcode;\n  }\n\n  static ChatStatus getChatStatus(int index) => ChatStatus.values[index];\n\n  static String normalizePhone(String phone) =>\n      phone.replaceAll(new RegExp(r\"\\s+\\b|\\b\\s\"), \"\");\n\n  static String getHashedAnswer(String answer) {\n    answer = answer.toLowerCase().replaceAll(new RegExp(r\"[^a-z0-9]\"), \"\");\n    var bytes = utf8.encode(answer); // data being hashed\n    Digest digest = sha1.convert(bytes);\n    return digest.toString();\n  }\n\n  static String getHashedString(String str) {\n    var bytes = utf8.encode(str); // data being hashed\n    Digest digest = sha1.convert(bytes);\n    return digest.toString();\n  }\n}\n"
  },
  {
    "path": "lib/widgets/chat_bubble.dart",
    "content": "import 'dart:async';\nimport 'dart:math';\nimport 'package:flutter/material.dart';\n\nclass ChatBubble extends StatefulWidget {\n\n\n  final String message, time, username, type, replyText, replyName;\n  final bool isMe, isGroup, isReply;\n\n  ChatBubble({\n    @required this.message,\n    @required this.time,\n    @required this.isMe,\n    @required this.isGroup,\n    @required this.username,\n    @required this.type,\n    @required this.replyText,\n    @required this.isReply,\n    @required this.replyName});\n\n\n  @override\n  _ChatBubbleState createState() => _ChatBubbleState();\n}\n\n\nclass _ChatBubbleState extends State<ChatBubble> {\n\n\n  List colors = Colors.primaries;\n  static Random random = Random();\n  int rNum = random.nextInt(18);\n\n\n\n  @override\n  Widget build(BuildContext context) {\n    final bg = widget.isMe ?Theme.of(context).accentColor : Colors.grey[200];\n    final align = widget.isMe ? CrossAxisAlignment.end: CrossAxisAlignment.start;\n    final radius = widget.isMe\n        ? BorderRadius.only(\n      topLeft: Radius.circular(5.0),\n      bottomLeft: Radius.circular(5.0),\n      bottomRight: Radius.circular(10.0),\n    )\n        : BorderRadius.only(\n      topRight: Radius.circular(5.0),\n      bottomLeft: Radius.circular(10.0),\n      bottomRight: Radius.circular(5.0),\n    );\n    return Column(\n      crossAxisAlignment: align,\n      children: <Widget>[\n        Container(\n          margin: const EdgeInsets.all(3.0),\n          padding: const EdgeInsets.all(5.0),\n          decoration: BoxDecoration(\n            color: bg,\n            borderRadius: radius,\n          ),\n          constraints: BoxConstraints(\n            maxWidth:  MediaQuery.of(context).size.width/1.3,\n            minWidth: 20.0,\n          ),\n          child: Column(\n            mainAxisSize: MainAxisSize.min,\n            mainAxisAlignment: MainAxisAlignment.start,\n            children: <Widget>[\n              widget.isMe?SizedBox():\n              widget.isGroup?Padding(\n                padding: EdgeInsets.only(right: 48.0),\n                child: Container(\n                  child: Text(\n                    widget.username,\n                    style: TextStyle(\n                      fontSize: 13,\n                      color: colors[rNum],\n                      fontWeight: FontWeight.bold,\n                    ),\n                    textAlign: TextAlign.left,\n                  ),\n                  alignment: Alignment.centerLeft,\n                ),\n              )\n                  :SizedBox(),\n              widget.isGroup?widget.isMe?SizedBox():SizedBox(height: 5):SizedBox(),\n\n\n              widget.isReply?Container(\n                decoration: BoxDecoration(\n                  color: !widget.isMe\n                      ?Colors.grey[50]\n                      :Colors.blue[50],\n                  borderRadius: BorderRadius.all(Radius.circular(5.0)),\n                ),\n                constraints: BoxConstraints(\n                  minHeight: 25,\n                  maxHeight: 100,\n                  minWidth: 80,\n                ),\n                child: Padding(\n                  padding: EdgeInsets.all(5),\n                  child: Column(\n                    mainAxisSize: MainAxisSize.min,\n                    children: <Widget>[\n\n                      Container(\n                        child: Text(\n                          widget.isMe?\"You\":widget.replyName,\n                          style: TextStyle(\n                            color: Theme.of(context).accentColor,\n                            fontWeight: FontWeight.bold,\n                            fontSize: 12,\n                          ),\n                          maxLines: 1,\n                          textAlign: TextAlign.left,\n                        ),\n                        alignment: Alignment.centerLeft,\n                      ),\n\n                      SizedBox(height: 2),\n                      Container(\n                        child:Text(\n                          widget.replyText,\n                          style: TextStyle(\n                            color: Colors.black,\n                            fontSize: 10,\n                          ),\n                          maxLines: 2,\n                        ),\n                        alignment: Alignment.centerLeft,\n                      ),\n\n                    ],\n                  ),\n                ),\n              ):SizedBox(width: 2),\n\n              widget.isReply?SizedBox(height: 5):SizedBox(),\n              Padding(\n                padding: EdgeInsets.all(widget.type == \"text\" ? 5:0),\n                child: widget.type == \"text\"? !widget.isReply\n                    ?Text(\n                  widget.message,\n                  style:  TextStyle(\n                    color: widget.isMe\n                        ?Colors.white\n                        :Colors.black,\n                  ),\n                )\n                    :Container(\n                  alignment: Alignment.centerLeft,\n                  child: Text(\n                    widget.message,\n                    style:  TextStyle(\n                      color: widget.isMe\n                          ?Colors.white\n                          :Colors.black,\n                    ),\n                  ),\n                ):Image.asset(\n                  \"${widget.message}\",\n                  height: 130,\n                  width: MediaQuery.of(context).size.width/1.3,\n                  fit: BoxFit.cover,\n                ),\n              ),\n            ],\n          ),\n        ),\n\n        Padding(\n          padding: widget.isMe\n              ? EdgeInsets.only(right: 10, bottom: 10.0,)\n              :EdgeInsets.only(left: 10, bottom: 10.0,),\n          child: Text(widget.time,\n            style: TextStyle(\n              color: Colors.black,\n              fontSize: 10.0,\n            ),\n          ),\n        ),\n      ],\n    );\n  }\n}\n"
  },
  {
    "path": "lib/widgets/chat_item.dart",
    "content": "\nimport 'package:flutter/material.dart';\n\n\nclass ChatItem extends StatefulWidget {\n\n  final Widget dp;\n  final String name;\n  final String time;\n  final String msg;\n  final bool isOnline;\n  final int counter;\n  final Function tap;\n\n  ChatItem({\n    Key key,\n    @required this.dp,\n    @required this.name,\n    @required this.time,\n    @required this.msg,\n    @required this.isOnline,\n    @required this.counter,\n    @required this.tap\n  }) : super(key: key);\n\n  @override\n  _ChatItemState createState() => _ChatItemState();\n}\n\nclass _ChatItemState extends State<ChatItem> {\n  @override\n  Widget build(BuildContext context) {\n    return Padding(\n      padding: const EdgeInsets.symmetric(horizontal: 8.0),\n      child: ListTile(\n        contentPadding: EdgeInsets.all(0),\n        leading: Stack(\n          children: <Widget>[\n            widget.dp,\n\n            Positioned(\n              bottom: 0.0,\n              left: 6.0,\n              child: Container(\n                decoration: BoxDecoration(\n                  color: Colors.white,\n                  borderRadius: BorderRadius.circular(6),\n                ),\n                height: 11,\n                width: 11,\n                child: Center(\n                  child: Container(\n                    decoration: BoxDecoration(\n                      color: widget.isOnline\n                          ?Colors.greenAccent\n                          :Colors.grey,\n                      borderRadius: BorderRadius.circular(6),\n                    ),\n                    height: 7,\n                    width: 7,\n                  ),\n                ),\n              ),\n            ),\n\n          ],\n        ),\n\n        title: Text(\n          \"${widget.name}\",\n          style: TextStyle(\n            fontWeight: FontWeight.bold,\n          ),\n        ),\n        subtitle: Text(\"${widget.msg}\"),\n        trailing: Column(\n          crossAxisAlignment: CrossAxisAlignment.end,\n          children: <Widget>[\n            SizedBox(height: 10),\n            Text(\n              \"${widget.time}\",\n              style: TextStyle(\n                fontWeight: FontWeight.w300,\n                fontSize: 11,\n              ),\n            ),\n\n            SizedBox(height: 5),\n            widget.counter == 0\n                ?SizedBox()\n                :Container(\n              padding: EdgeInsets.all(1),\n              decoration: BoxDecoration(\n                color: Colors.red,\n                borderRadius: BorderRadius.circular(6),\n              ),\n              constraints: BoxConstraints(\n                minWidth: 11,\n                minHeight: 11,\n              ),\n              child: Padding(\n                padding: EdgeInsets.only(top: 1, left: 5, right: 5),\n                child:Text(\n                  \"${widget.counter}\",\n                  style: TextStyle(\n                    color: Colors.white,\n                    fontSize: 10,\n                  ),\n                  textAlign: TextAlign.center,\n                ),\n              ),\n            ),\n          ],\n        ),\n        onTap: widget.tap,\n      ),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/widgets/icon_badge.dart",
    "content": "import 'package:flutter/material.dart';\n\nclass IconBadge extends StatefulWidget {\n\n  final IconData icon;\n  final double size;\n  final Color color;\n\n  IconBadge({Key key, @required this.icon, this.size, this.color})\n      : super(key: key);\n\n  @override\n  _IconBadgeState createState() => _IconBadgeState();\n}\n\nclass _IconBadgeState extends State<IconBadge> {\n\n  int counter = 0;\n\n  @override\n  void initState() {\n    super.initState();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Stack(\n      children: <Widget>[\n        Icon(\n          widget.icon,\n          size: widget.size,\n          color: widget.color ?? null,\n        ),\n        Positioned(\n          right: 0.0,\n          child: Container(\n            padding: EdgeInsets.all(1),\n            decoration: BoxDecoration(\n              color: Colors.red,\n              borderRadius: BorderRadius.circular(6),\n            ),\n            constraints: BoxConstraints(\n              minWidth: 11,\n              minHeight: 11,\n            ),\n            child: Padding(\n              padding: EdgeInsets.only(top: 1),\n              child:Text(\n                '',\n                style: TextStyle(\n                  color: Colors.white,\n                  fontSize: 9,\n                ),\n                textAlign: TextAlign.center,\n              ),\n            ),\n          ),\n        ),\n      ],\n    );\n  }\n}\n"
  },
  {
    "path": "lib/widgets/post_item.dart",
    "content": "import 'dart:io';\n\nimport 'package:Enigma/utils.dart';\nimport 'package:dio/dio.dart';\nimport 'package:flutter/material.dart';\nimport 'package:flutter/rendering.dart';\nimport 'package:path/path.dart' as path;\nimport 'package:marquee/marquee.dart';\nimport 'package:path_provider/path_provider.dart';\n\nclass PostItem extends StatefulWidget {\n  final String avatar;\n  final String name;\n  final String time;\n  final String content;\n  final String img;\n  final String filePath;\n  final String fileName;\n\n  PostItem(\n      {Key key,\n      @required this.avatar,\n      @required this.name,\n      @required this.time,\n      @required this.content,\n      @required this.img,\n      @required this.filePath,\n      @required this.fileName})\n      : super(key: key);\n\n  @override\n  _PostItemState createState() => _PostItemState();\n}\n\nclass _PostItemState extends State<PostItem> {\n  @override\n  Widget build(BuildContext context) {\n    return Padding(\n      padding: EdgeInsets.symmetric(vertical: 5),\n      child: InkWell(\n        child: Column(\n          crossAxisAlignment: CrossAxisAlignment.start,\n          children: <Widget>[\n            ListTile(\n              leading: CircleAvatar(\n                backgroundImage: widget.avatar.isEmpty\n                    ? AssetImage(\n                        \"assets/avatar.png\",\n                      )\n                    : NetworkImage(widget.avatar),\n              ),\n              contentPadding: EdgeInsets.all(0),\n              title: Text(\n                widget.name,\n                style: TextStyle(\n                  fontWeight: FontWeight.bold,\n                ),\n              ),\n              trailing: Text(\n                widget.time,\n                style: TextStyle(\n                  fontWeight: FontWeight.w300,\n                  fontSize: 11,\n                ),\n              ),\n            ),\n            SizedBox(height: 10,),\n            Text(\n              widget.content,\n              textAlign: TextAlign.end,\n              style: TextStyle(fontSize: 20),\n            ),\n            widget.img.isEmpty\n                ? SizedBox(\n              height: 0,\n            )\n                : SizedBox(\n              height: 20,\n            ),\n            widget.img.isEmpty\n                ? SizedBox(\n                    height: 0,\n                  )\n                : Image.network(\n                    widget.img,\n                    height: 170,\n                    width: MediaQuery.of(context).size.width,\n                    fit: BoxFit.cover,\n                  ),\n            SizedBox(\n              height: 15,\n            ),\n            widget.fileName.isEmpty\n                ? SizedBox(\n                    height: 0,\n                  )\n                : GestureDetector(\n                    onTap: () async{\n                      var dio=Dio();\n                      Enigma.toast(\"开始下载\");\n\n                      var save=Directory(\"/storage/emulated/0/ZH/\");\n                      if(!save.existsSync()){\n                        await save.create(recursive: true);\n                      }\n                      try{\n                        var response=await dio.download(widget.filePath,\"${save.path}${widget.fileName}\");\n                        if(response.statusCode==200){\n                          Enigma.toast(\"已下载到${save.path}\");\n                        }\n                      }catch(e){\n                        print(\"${e}\");\n                          Enigma.toast(\"下载失败:错误${e}\");\n                      }\n                    },\n                    child: Row(children: <Widget>[\n                      Icon(\n                        Icons.file_download,\n                        color: Colors.blueAccent,\n                      ),\n                      Container(\n\n                        width: 300,\n                        child: Text(\n                          widget.fileName,\n                          softWrap: true,\n                          maxLines: 2,\n                          style: TextStyle(color: Colors.blueAccent, fontSize: 15),\n                        ),\n                      )\n                    ]),\n                  )\n          ],\n        ),\n        onTap: () {},\n      ),\n    );\n  }\n}\n"
  },
  {
    "path": "lib/widgets/signup_apbar.dart",
    "content": "import 'package:Enigma/util/color_const.dart';\nimport 'package:Enigma/widgets/signup_arrow_button.dart';\nimport 'package:flutter/material.dart';\n\n\nclass SignupApbar extends StatelessWidget implements PreferredSizeWidget {\n  final String title;\n  Function tap;\n  SignupApbar({this.title,this.tap});\n  @override\n  Widget build(BuildContext context) {\n    final double statusbarHeight = MediaQuery.of(context).padding.top;\n\n    return Container(\n      padding: EdgeInsets.only(top: statusbarHeight),\n      decoration: BoxDecoration(\n          gradient: LinearGradient(\n        begin: FractionalOffset(0.5, 0.0), end: FractionalOffset(0.6, 0.8),\n        // Add one stop for each color. Stops should increase from 0 to 1\n        stops: [0.0, 0.9], colors: [YELLOW, BLUE],\n      )),\n      child: NavigationToolbar(\n        leading: Align(\n          alignment: Alignment(-0.5, 4),\n          child: SignUpArrowButton(\n            onTap: tap==null?() => Navigator.maybePop(context):tap,\n            icon: IconData(\n              0xe900,\n              fontFamily: \"Icons\",\n            ),\n            iconSize: 9,\n            height: 48,\n            width: 48,\n          ),\n        ),\n        centerMiddle: true,\n        middle: Text(\n          title,\n          style: TextStyle(fontWeight: FontWeight.bold),\n        ),\n      ),\n    );\n  }\n\n  @override\n  Size get preferredSize => Size.fromHeight(kToolbarHeight);\n}\n"
  },
  {
    "path": "lib/widgets/signup_arrow_button.dart",
    "content": "import 'package:flutter/material.dart';\n\nclass SignUpArrowButton extends StatelessWidget {\n  final IconData icon;\n  final Function onTap;\n  final double iconSize;\n  final double height;\n  final double width;\n  final Color iconColor;\n\n  SignUpArrowButton({\n    this.icon,\n    this.iconSize,\n    this.onTap,\n    this.height = 50.0,\n    this.width = 50.0,\n    this.iconColor = const Color(0xFFdbedb0),\n  });\n\n  @override\n  Widget build(BuildContext context) {\n    return InkWell(\n      onTap: onTap,\n      child: Container(\n        height: height,\n        width: width,\n        decoration: BoxDecoration(\n          shape: BoxShape.circle,\n          boxShadow: [\n            BoxShadow(\n                color: Colors.black12,\n                blurRadius: 15,\n                spreadRadius: 0,\n                offset: Offset(0.0, 16.0)),\n          ],\n          gradient: LinearGradient(begin: FractionalOffset.centerLeft,\n// Add one stop for each color. Stops should increase from 0 to 1\n              stops: [\n                0.2,\n                1\n              ], colors: [\n            Color(0xff000000),\n            Color(0xff434343),\n          ]),\n        ),\n        child: Icon(\n          icon,\n          size: iconSize,\n          color: iconColor,\n        ),\n      ),\n    );\n  }\n}\n"
  },
  {
    "path": "pubspec.yaml",
    "content": "name: Enigma\ndescription: This is the demo for chat app by Flutter\nenvironment:\n  sdk: \">=2.2.0 <3.0.0\"\ndependencies:\n  flutter:\n    sdk: flutter\n\n  # The following adds the Cupertino Icons font to your application.\n  # Use with the CupertinoIcons class for iOS style icons.\n  firebase_auth: ^0.11.1+7\n  cloud_firestore: ^0.12.5+2\n  fluttertoast: ^3.1.0\n  image_picker:  ^0.6.0+9\n  shared_preferences: ^0.5.3+1\n  firebase_storage: ^3.0.1\n  cached_network_image: ^2.0.0\n  path_provider: ^1.6.5\n  path: ^1.6.4\n  flutter_spinkit: ^4.1.2\n  flustars: ^0.2.6+1\n  marquee: ^1.3.1\n  file_picker: ^1.5.0\n  intl: ^0.15.8\n  diacritic: ^0.1.1\n  sentry: ^2.2.0\n  image_cropper: ^1.0.2\n  contacts_service: ^0.2.4\n  permission_handler: ^3.0.0\n  share: ^0.6.1\n  scoped_model: ^1.0.1\n  local_auth: ^0.4.0+1\n  crypto: ^2.0.6\n  encrypt: ^3.0.0\n  localstorage: ^3.0.1\n  flutter_cache_manager: ^1.1.2\n  photo_view: ^0.4.0\n  mime: ^0.9.6+2\n  dio: ^3.0.9\n  ntp: ^1.0.3\n  rxdart: ^0.23.1\n  url_launcher: ^5.0.2\n  launch_review: ^2.0.0\n  flutter_secure_storage: ^3.2.1+1\n  giphy_client: ^0.2.0\n  firebase_messaging: ^5.0.2\n  cupertino_icons: ^0.1.2\n\ndev_dependencies:\nflutter_test:\n  sdk: flutter\n\n\n# For information on the generic Dart part of this file, see the\n# following page: https://www.dartlang.org/tools/pub/pubspec\n\n# The following section is specific to Flutter.\nflutter:\n\n  # The following line ensures that the Material Icons font is\n  # included with your application, so that you can use the icons in\n  # the material Icons class.\n  uses-material-design: true\n\n  fonts:\n    - family: Mlx\n      fonts:\n        - asset: assets/fonts/montserrat/Montserrat-Regular.ttf\n        - asset: assets/fonts/montserrat/Montserrat-Medium.ttf\n          weight: 400\n        - asset: assets/fonts/montserrat/Montserrat-Italic.ttf\n          style: italic\n        - asset: assets/fonts/montserrat/Montserrat-Light.ttf\n          weight: 200\n        - asset: assets/fonts/montserrat/Montserrat-SemiBold.ttf\n          weight: 500\n        - asset: assets/fonts/montserrat/Montserrat-Bold.ttf\n          weight: 700\n    - family: Icons\n      fonts:\n        - asset: assets/fonts/icons.ttf\n  # To add assets to your application, add an assets section, like this:\n  assets:\n    - assets/img_not_available.jpeg\n    - assets/bg.png\n    - assets/bg.jpg\n    - assets/giphy.png\n    - assets/cm1.jpeg\n    - assets/cm2.jpeg\n    - assets/cm3.jpeg\n    - assets/cm4.jpeg\n    - assets/cm5.jpeg\n    - assets/cm6.jpeg\n    - assets/cm7.jpeg\n    - assets/cm8.jpeg\n    - assets/cm9.jpeg\n    - assets/cm0.jpeg\n    - assets/logo_signup.png\n    - assets/signup_page_11_bg.png\n    - assets/avatar.png\n    - assets/proBg.jpg\n    - assets/share.jpeg\n    - assets/file.png\n\n\n  # An image asset can refer to one or more resolution-specific \"variants\", see\n  # https://flutter.io/assets-and-images/#resolution-aware.\n\n  # For details regarding adding assets from package dependencies, see\n  # https://flutter.io/assets-and-images/#from-packages\n\n  # To add custom fonts to your application, add a fonts section here,\n  # in this \"flutter\" section. Each entry in this list should have a\n  # \"family\" key with the font family name, and a \"fonts\" key with a\n  # list giving the asset and other descriptors for the font. For\n  # example:\n  # fonts:\n  #   - family: Schyler\n  #     fonts:\n  #       - asset: fonts/Schyler-Regular.ttf\n  #       - asset: fonts/Schyler-Italic.ttf\n  #         style: italic\n  #   - family: Trajan Pro\n  #     fonts:\n  #       - asset: fonts/TrajanPro.ttf\n  #       - asset: fonts/TrajanPro_Bold.ttf\n  #         weight: 700\n  #\n  # For details regarding fonts from package dependencies,\n  # see https://flutter.io/custom-fonts/#from-packages\n"
  }
]