Full Code of netyouli/react-native-whcapp for AI

master ef4e450ca563 cached
104 files
997.1 KB
300.0k tokens
146 symbols
1 requests
Download .txt
Showing preview only (1,042K chars total). Download the full file or copy to clipboard to get everything.
Repository: netyouli/react-native-whcapp
Branch: master
Commit: ef4e450ca563
Files: 104
Total size: 997.1 KB

Directory structure:
gitextract_rvuho2zj/

├── .babelrc
├── .buckconfig
├── .flowconfig
├── .gitattributes
├── .gitignore
├── .tern-project
├── .watchmanconfig
├── LICENSE
├── README.md
├── __tests__/
│   └── App.js
├── android/
│   ├── app/
│   │   ├── BUCK
│   │   ├── app-release.apk
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── whcapp/
│   │           │           ├── MainActivity.java
│   │           │           └── MainApplication.java
│   │           └── res/
│   │               ├── values/
│   │               │   ├── dimens.xml
│   │               │   ├── strings.xml
│   │               │   └── styles.xml
│   │               ├── values-v21/
│   │               │   └── styles.xml
│   │               └── values-w820dp/
│   │                   └── dimens.xml
│   ├── build.gradle
│   ├── gradle/
│   │   └── wrapper/
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── keystores/
│   │   ├── BUCK
│   │   └── debug.keystore.properties
│   └── settings.gradle
├── app/
│   ├── App.js
│   ├── actions/
│   │   └── login-action.js
│   ├── api/
│   │   ├── account.js
│   │   └── api.js
│   ├── base/
│   │   ├── base-list.js
│   │   └── controller.js
│   ├── components/
│   │   ├── storage.js
│   │   ├── tool.js
│   │   ├── whc-banner.js
│   │   ├── whc-button.js
│   │   ├── whc-grid-view.js
│   │   ├── whc-image-button.js
│   │   ├── whc-line.js
│   │   ├── whc-loading.js
│   │   ├── whc-text.js
│   │   └── whc-toast.js
│   ├── constants/
│   │   ├── action-type.js
│   │   ├── app-constant.js
│   │   ├── color.js
│   │   └── screen.js
│   ├── containers/
│   │   ├── navigation.js
│   │   └── tabbar.js
│   ├── pages/
│   │   ├── blank/
│   │   │   └── blank.js
│   │   ├── community/
│   │   │   ├── activity/
│   │   │   │   └── offline-activity.js
│   │   │   ├── collect/
│   │   │   │   ├── collect-cell.js
│   │   │   │   └── collect.js
│   │   │   ├── column/
│   │   │   │   └── special-column.js
│   │   │   ├── community-cell.js
│   │   │   ├── community-section.js
│   │   │   ├── community.js
│   │   │   └── week/
│   │   │       └── week-hot.js
│   │   ├── home/
│   │   │   ├── home-cell.js
│   │   │   └── home.js
│   │   ├── launch/
│   │   │   └── launch.js
│   │   ├── my/
│   │   │   ├── feedback/
│   │   │   │   └── feedback.js
│   │   │   ├── like/
│   │   │   │   └── my-like.js
│   │   │   ├── login/
│   │   │   │   ├── forget.js
│   │   │   │   ├── login.js
│   │   │   │   └── register.js
│   │   │   ├── my-header.js
│   │   │   ├── my-item.js
│   │   │   ├── my.js
│   │   │   ├── read/
│   │   │   │   └── did-read.js
│   │   │   ├── set/
│   │   │   │   ├── modity/
│   │   │   │   │   ├── modify.js
│   │   │   │   │   └── modity-input-item.js
│   │   │   │   ├── set-item.js
│   │   │   │   └── set.js
│   │   │   └── user/
│   │   │       └── user.js
│   │   └── webview/
│   │       └── webv.js
│   ├── reducers/
│   │   ├── index.js
│   │   └── login.js
│   └── store/
│       └── configure-stroe.js
├── app.json
├── index.js
├── ios/
│   ├── whcapp/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── Base.lproj/
│   │   │   └── LaunchScreen.xib
│   │   ├── Images.xcassets/
│   │   │   ├── AppIcon.appiconset/
│   │   │   │   └── Contents.json
│   │   │   ├── Contents.json
│   │   │   ├── launch.imageset/
│   │   │   │   └── Contents.json
│   │   │   └── loading.imageset/
│   │   │       └── Contents.json
│   │   ├── Info.plist
│   │   └── main.m
│   ├── whcapp-tvOS/
│   │   └── Info.plist
│   ├── whcapp-tvOSTests/
│   │   └── Info.plist
│   ├── whcapp.xcodeproj/
│   │   ├── project.pbxproj
│   │   └── xcshareddata/
│   │       └── xcschemes/
│   │           ├── whcapp-tvOS.xcscheme
│   │           └── whcapp.xcscheme
│   └── whcappTests/
│       ├── Info.plist
│       └── whcappTests.m
├── package.json
└── release_ios/
    ├── main.jsbundle
    └── main.jsbundle.meta

================================================
FILE CONTENTS
================================================

================================================
FILE: .babelrc
================================================
{
  "presets": ["react-native"]
}


================================================
FILE: .buckconfig
================================================

[android]
  target = Google Inc.:Google APIs:23

[maven_repositories]
  central = https://repo1.maven.org/maven2


================================================
FILE: .flowconfig
================================================
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore unexpected extra "@providesModule"
.*/node_modules/.*/node_modules/fbjs/.*

; Ignore duplicate module providers
; For RN Apps installed via npm, "Libraries" folder is inside
; "node_modules/react-native" but in the source repo it is in the root
.*/Libraries/react-native/React.js

; Ignore polyfills
.*/Libraries/polyfills/.*

[include]

[libs]
node_modules/react-native/Libraries/react-native/react-native-interface.js
node_modules/react-native/flow/

[options]
emoji=true

module.system=haste

munge_underscores=true

module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState
suppress_type=$FixMe

suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(5[0-6]\\|[1-4][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError

unsafe.enable_getters_and_setters=true

[version]
^0.53.0


================================================
FILE: .gitattributes
================================================
*.pbxproj -text


================================================
FILE: .gitignore
================================================
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

*/fastlane/report.xml
*/fastlane/Preview.html
*/fastlane/screenshots


================================================
FILE: .tern-project
================================================
{
  "ecmaVersion": 6,
  "libs": [
    "browser"
  ],
  "loadEagerly": [
    "**/*.js",
    "**/*.png",
    "**/*.jpg",
    "**/*.jpeg"
  ],
  "dontLoad": [
    "node_modules/**"
  ],
  "plugins": {
    "es_modules": {},
    "node": {},
    "doc_comment": {
      "fullDocs": true,
      "strong": true
    }
  }
}


================================================
FILE: .watchmanconfig
================================================
{}

================================================
FILE: LICENSE
================================================
                                 Apache License
                           Version 2.0, January 2004
                        http://www.apache.org/licenses/

   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

   1. Definitions.

      "License" shall mean the terms and conditions for use, reproduction,
      and distribution as defined by Sections 1 through 9 of this document.

      "Licensor" shall mean the copyright owner or entity authorized by
      the copyright owner that is granting the License.

      "Legal Entity" shall mean the union of the acting entity and all
      other entities that control, are controlled by, or are under common
      control with that entity. For the purposes of this definition,
      "control" means (i) the power, direct or indirect, to cause the
      direction or management of such entity, whether by contract or
      otherwise, or (ii) ownership of fifty percent (50%) or more of the
      outstanding shares, or (iii) beneficial ownership of such entity.

      "You" (or "Your") shall mean an individual or Legal Entity
      exercising permissions granted by this License.

      "Source" form shall mean the preferred form for making modifications,
      including but not limited to software source code, documentation
      source, and configuration files.

      "Object" form shall mean any form resulting from mechanical
      transformation or translation of a Source form, including but
      not limited to compiled object code, generated documentation,
      and conversions to other media types.

      "Work" shall mean the work of authorship, whether in Source or
      Object form, made available under the License, as indicated by a
      copyright notice that is included in or attached to the work
      (an example is provided in the Appendix below).

      "Derivative Works" shall mean any work, whether in Source or Object
      form, that is based on (or derived from) the Work and for which the
      editorial revisions, annotations, elaborations, or other modifications
      represent, as a whole, an original work of authorship. For the purposes
      of this License, Derivative Works shall not include works that remain
      separable from, or merely link (or bind by name) to the interfaces of,
      the Work and Derivative Works thereof.

      "Contribution" shall mean any work of authorship, including
      the original version of the Work and any modifications or additions
      to that Work or Derivative Works thereof, that is intentionally
      submitted to Licensor for inclusion in the Work by the copyright owner
      or by an individual or Legal Entity authorized to submit on behalf of
      the copyright owner. For the purposes of this definition, "submitted"
      means any form of electronic, verbal, or written communication sent
      to the Licensor or its representatives, including but not limited to
      communication on electronic mailing lists, source code control systems,
      and issue tracking systems that are managed by, or on behalf of, the
      Licensor for the purpose of discussing and improving the Work, but
      excluding communication that is conspicuously marked or otherwise
      designated in writing by the copyright owner as "Not a Contribution."

      "Contributor" shall mean Licensor and any individual or Legal Entity
      on behalf of whom a Contribution has been received by Licensor and
      subsequently incorporated within the Work.

   2. Grant of Copyright License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      copyright license to reproduce, prepare Derivative Works of,
      publicly display, publicly perform, sublicense, and distribute the
      Work and such Derivative Works in Source or Object form.

   3. Grant of Patent License. Subject to the terms and conditions of
      this License, each Contributor hereby grants to You a perpetual,
      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
      (except as stated in this section) patent license to make, have made,
      use, offer to sell, sell, import, and otherwise transfer the Work,
      where such license applies only to those patent claims licensable
      by such Contributor that are necessarily infringed by their
      Contribution(s) alone or by combination of their Contribution(s)
      with the Work to which such Contribution(s) was submitted. If You
      institute patent litigation against any entity (including a
      cross-claim or counterclaim in a lawsuit) alleging that the Work
      or a Contribution incorporated within the Work constitutes direct
      or contributory patent infringement, then any patent licenses
      granted to You under this License for that Work shall terminate
      as of the date such litigation is filed.

   4. Redistribution. You may reproduce and distribute copies of the
      Work or Derivative Works thereof in any medium, with or without
      modifications, and in Source or Object form, provided that You
      meet the following conditions:

      (a) You must give any other recipients of the Work or
          Derivative Works a copy of this License; and

      (b) You must cause any modified files to carry prominent notices
          stating that You changed the files; and

      (c) You must retain, in the Source form of any Derivative Works
          that You distribute, all copyright, patent, trademark, and
          attribution notices from the Source form of the Work,
          excluding those notices that do not pertain to any part of
          the Derivative Works; and

      (d) If the Work includes a "NOTICE" text file as part of its
          distribution, then any Derivative Works that You distribute must
          include a readable copy of the attribution notices contained
          within such NOTICE file, excluding those notices that do not
          pertain to any part of the Derivative Works, in at least one
          of the following places: within a NOTICE text file distributed
          as part of the Derivative Works; within the Source form or
          documentation, if provided along with the Derivative Works; or,
          within a display generated by the Derivative Works, if and
          wherever such third-party notices normally appear. The contents
          of the NOTICE file are for informational purposes only and
          do not modify the License. You may add Your own attribution
          notices within Derivative Works that You distribute, alongside
          or as an addendum to the NOTICE text from the Work, provided
          that such additional attribution notices cannot be construed
          as modifying the License.

      You may add Your own copyright statement to Your modifications and
      may provide additional or different license terms and conditions
      for use, reproduction, or distribution of Your modifications, or
      for any such Derivative Works as a whole, provided Your use,
      reproduction, and distribution of the Work otherwise complies with
      the conditions stated in this License.

   5. Submission of Contributions. Unless You explicitly state otherwise,
      any Contribution intentionally submitted for inclusion in the Work
      by You to the Licensor shall be under the terms and conditions of
      this License, without any additional terms or conditions.
      Notwithstanding the above, nothing herein shall supersede or modify
      the terms of any separate license agreement you may have executed
      with Licensor regarding such Contributions.

   6. Trademarks. This License does not grant permission to use the trade
      names, trademarks, service marks, or product names of the Licensor,
      except as required for reasonable and customary use in describing the
      origin of the Work and reproducing the content of the NOTICE file.

   7. Disclaimer of Warranty. Unless required by applicable law or
      agreed to in writing, Licensor provides the Work (and each
      Contributor provides its Contributions) on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
      implied, including, without limitation, any warranties or conditions
      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
      PARTICULAR PURPOSE. You are solely responsible for determining the
      appropriateness of using or redistributing the Work and assume any
      risks associated with Your exercise of permissions under this License.

   8. Limitation of Liability. In no event and under no legal theory,
      whether in tort (including negligence), contract, or otherwise,
      unless required by applicable law (such as deliberate and grossly
      negligent acts) or agreed to in writing, shall any Contributor be
      liable to You for damages, including any direct, indirect, special,
      incidental, or consequential damages of any character arising as a
      result of this License or out of the use or inability to use the
      Work (including but not limited to damages for loss of goodwill,
      work stoppage, computer failure or malfunction, or any and all
      other commercial damages or losses), even if such Contributor
      has been advised of the possibility of such damages.

   9. Accepting Warranty or Additional Liability. While redistributing
      the Work or Derivative Works thereof, You may choose to offer,
      and charge a fee for, acceptance of support, warranty, indemnity,
      or other liability obligations and/or rights consistent with this
      License. However, in accepting such obligations, You may act only
      on Your own behalf and on Your sole responsibility, not on behalf
      of any other Contributor, and only if You agree to indemnify,
      defend, and hold each Contributor harmless for any liability
      incurred by, or claims asserted against, such Contributor by reason
      of your accepting any such warranty or additional liability.

   END OF TERMS AND CONDITIONS

   APPENDIX: How to apply the Apache License to your work.

      To apply the Apache License to your work, attach the following
      boilerplate notice, with the fields enclosed by brackets "{}"
      replaced with your own identifying information. (Don't include
      the brackets!)  The text should be enclosed in the appropriate
      comment syntax for the file format. We also recommend that a
      file or class name and description of purpose be included on the
      same "printed page" as the copyright notice for easier
      identification within third-party archives.

   Copyright {yyyy} {name of copyright owner}

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.



================================================
FILE: README.md
================================================
# react-native whcapp

[![License Apache2.0](https://img.shields.io/hexpm/l/plug.svg)](https://raw.githubusercontent.com/attentiveness/whcapp/master/LICENSE)

A complete react-native app with complete data interaction capabilities.

Provide learning advice for learning react-native development

一个完整的react-native app 并且带有完整的数据交互实现

**Flutter版本:**[whc_flutter_app](https://github.com/netyouli/whc_flutter_app)

**android版本体验:** [https://fir.im/whcandroid](https://fir.im/whcandroid)

**ios版本体验(内测):** [https://fir.im/whcios](https://fir.im/whcios)

**app所使用数据接口文档地址:**[http://www.wuhaichao.com/api_doc/](http://www.wuhaichao.com/api_doc/)

**Support: Android 5+   iOS 8.0+**

## App Architecture

```
"react": "16.0.0-beta.5",
"react-native": "0.49.5",
"react-navigation": "1.0.0-beta.19",

"react-redux": "^5.0.5",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0"
```

## Screenshot
<img src = "./screenshot/home.png" width = "375"><img src = "./screenshot/android_home.png" width = "375">
<img src = "./screenshot/community.png" width = "375"><img src = "./screenshot/android_community.png" width = "375">
<img src = "./screenshot/my.png" width = "375"><img src = "./screenshot/android_my.png" width = "375">

## Development

### Step One

```
npm install -g react-native-cli
```
### Step Two

```
npm install
```
### Step Three

```
react-native start
```
### Step Four

```
react-native run-ios
react-native run-android
```

## Contributing

Any good Suggestions or questions to ask or email

## License

Apache License 2.0


================================================
FILE: __tests__/App.js
================================================
import 'react-native';
import React from 'react';
import App from '../App';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
  const tree = renderer.create(
    <App />
  );
});


================================================
FILE: android/app/BUCK
================================================
# To learn about Buck see [Docs](https://buckbuild.com/).
# To run your application with Buck:
# - install Buck
# - `npm start` - to start the packager
# - `cd android`
# - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"`
# - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck
# - `buck install -r android/app` - compile, install and run application
#

lib_deps = []

for jarfile in glob(['libs/*.jar']):
  name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')]
  lib_deps.append(':' + name)
  prebuilt_jar(
    name = name,
    binary_jar = jarfile,
  )

for aarfile in glob(['libs/*.aar']):
  name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')]
  lib_deps.append(':' + name)
  android_prebuilt_aar(
    name = name,
    aar = aarfile,
  )

android_library(
    name = "all-libs",
    exported_deps = lib_deps,
)

android_library(
    name = "app-code",
    srcs = glob([
        "src/main/java/**/*.java",
    ]),
    deps = [
        ":all-libs",
        ":build_config",
        ":res",
    ],
)

android_build_config(
    name = "build_config",
    package = "com.whcapp",
)

android_resource(
    name = "res",
    package = "com.whcapp",
    res = "src/main/res",
)

android_binary(
    name = "app",
    keystore = "//android/keystores:debug",
    manifest = "src/main/AndroidManifest.xml",
    package_type = "debug",
    deps = [
        ":app-code",
    ],
)


================================================
FILE: android/app/build.gradle
================================================
apply plugin: "com.android.application"

import com.android.build.OutputFile

/**
 * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
 * and bundleReleaseJsAndAssets).
 * These basically call `react-native bundle` with the correct arguments during the Android build
 * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
 * bundle directly from the development server. Below you can see all the possible configurations
 * and their defaults. If you decide to add a configuration block, make sure to add it before the
 * `apply from: "../../node_modules/react-native/react.gradle"` line.
 *
 * project.ext.react = [
 *   // the name of the generated asset file containing your JS bundle
 *   bundleAssetName: "index.android.bundle",
 *
 *   // the entry file for bundle generation
 *   entryFile: "index.android.js",
 *
 *   // whether to bundle JS and assets in debug mode
 *   bundleInDebug: false,
 *
 *   // whether to bundle JS and assets in release mode
 *   bundleInRelease: true,
 *
 *   // whether to bundle JS and assets in another build variant (if configured).
 *   // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
 *   // The configuration property can be in the following formats
 *   //         'bundleIn${productFlavor}${buildType}'
 *   //         'bundleIn${buildType}'
 *   // bundleInFreeDebug: true,
 *   // bundleInPaidRelease: true,
 *   // bundleInBeta: true,
 *
 *   // whether to disable dev mode in custom build variants (by default only disabled in release)
 *   // for example: to disable dev mode in the staging build type (if configured)
 *   devDisabledInStaging: true,
 *   // The configuration property can be in the following formats
 *   //         'devDisabledIn${productFlavor}${buildType}'
 *   //         'devDisabledIn${buildType}'
 *
 *   // the root of your project, i.e. where "package.json" lives
 *   root: "../../",
 *
 *   // where to put the JS bundle asset in debug mode
 *   jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
 *
 *   // where to put the JS bundle asset in release mode
 *   jsBundleDirRelease: "$buildDir/intermediates/assets/release",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in debug mode
 *   resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
 *
 *   // where to put drawable resources / React Native assets, e.g. the ones you use via
 *   // require('./image.png')), in release mode
 *   resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
 *
 *   // by default the gradle tasks are skipped if none of the JS files or assets change; this means
 *   // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
 *   // date; if you have any other folders that you want to ignore for performance reasons (gradle
 *   // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
 *   // for example, you might want to remove it from here.
 *   inputExcludes: ["android/**", "ios/**"],
 *
 *   // override which node gets called and with what additional arguments
 *   nodeExecutableAndArgs: ["node"],
 *
 *   // supply additional arguments to the packager
 *   extraPackagerArgs: []
 * ]
 */

project.ext.react = [
        entryFile: "index.js"
]

apply from: "../../node_modules/react-native/react.gradle"

/**
 * Set this to true to create two separate APKs instead of one:
 *   - An APK that only works on ARM devices
 *   - An APK that only works on x86 devices
 * The advantage is the size of the APK is reduced by about 4MB.
 * Upload all the APKs to the Play Store and people will download
 * the correct one based on the CPU architecture of their device.
 */
def enableSeparateBuildPerCPUArchitecture = false

/**
 * Run Proguard to shrink the Java bytecode in release builds.
 */
def enableProguardInReleaseBuilds = false

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        applicationId "com.whcapp"
        minSdkVersion 16
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        ndk {
            abiFilters "armeabi-v7a", "x86"
        }
    }
    splits {
        abi {
            reset()
            enable enableSeparateBuildPerCPUArchitecture
            universalApk false  // If true, also generate a universal APK
            include "armeabi-v7a", "x86"
        }
    }
    signingConfigs {
        release {
            storeFile file(MYAPP_RELEASE_STORE_FILE)
            storePassword MYAPP_RELEASE_STORE_PASSWORD
            keyAlias MYAPP_RELEASE_KEY_ALIAS
            keyPassword MYAPP_RELEASE_KEY_PASSWORD
        }
    }

    buildTypes {
        release {
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"

            signingConfig signingConfigs.release
        }
    }
    // applicationVariants are e.g. debug, release
    applicationVariants.all { variant ->
        variant.outputs.each { output ->
            // For each separate APK per architecture, set a unique version code as described here:
            // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
            def versionCodes = ["armeabi-v7a": 1, "x86": 2]
            def abi = output.getFilter(OutputFile.ABI)
            if (abi != null) {  // null for the universal-debug, universal-release variants
                output.versionCodeOverride =
                        versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
            }
        }
    }
}

dependencies {
    compile fileTree(dir: "libs", include: ["*.jar"])
    // From node_modules
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.facebook.react:react-native:+'
    compile 'com.android.support:design:23.4.0'
}

// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
    from configurations.compile
    into 'libs'
}


================================================
FILE: android/app/proguard-rules.pro
================================================
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# Disabling obfuscation is useful if you collect stack traces from production crashes
# (unless you are using a system that supports de-obfuscate the stack traces).
-dontobfuscate

# React Native

# Keep our interfaces so they can be used by other ProGuard rules.
# See http://sourceforge.net/p/proguard/bugs/466/
-keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip
-keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters
-keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip

# Do not strip any method/class that is annotated with @DoNotStrip
-keep @com.facebook.proguard.annotations.DoNotStrip class *
-keep @com.facebook.common.internal.DoNotStrip class *
-keepclassmembers class * {
    @com.facebook.proguard.annotations.DoNotStrip *;
    @com.facebook.common.internal.DoNotStrip *;
}

-keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * {
  void set*(***);
  *** get*();
}

-keep class * extends com.facebook.react.bridge.JavaScriptModule { *; }
-keep class * extends com.facebook.react.bridge.NativeModule { *; }
-keepclassmembers,includedescriptorclasses class * { native <methods>; }
-keepclassmembers class *  { @com.facebook.react.uimanager.UIProp <fields>; }
-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactProp <methods>; }
-keepclassmembers class *  { @com.facebook.react.uimanager.annotations.ReactPropGroup <methods>; }

-dontwarn com.facebook.react.**

# TextLayoutBuilder uses a non-public Android constructor within StaticLayout.
# See libs/proxy/src/main/java/com/facebook/fbui/textlayoutbuilder/proxy for details.
-dontwarn android.text.StaticLayout

# okhttp

-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }
-dontwarn okhttp3.**

# okio

-keep class sun.misc.Unsafe { *; }
-dontwarn java.nio.file.*
-dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
-dontwarn okio.**


================================================
FILE: android/app/src/main/AndroidManifest.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.whcapp"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-sdk
        android:minSdkVersion="16"
        android:targetSdkVersion="22" />

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

    <android:uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <android:uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <android:uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

    <application
        android:name=".MainApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

================================================
FILE: android/app/src/main/java/com/whcapp/MainActivity.java
================================================
package com.whcapp;

import com.facebook.react.ReactActivity;

public class MainActivity extends ReactActivity {

    /**
     * Returns the name of the main component registered from JavaScript.
     * This is used to schedule rendering of the component.
     */
    @Override
    protected String getMainComponentName() {
        return "whcapp";
    }
}


================================================
FILE: android/app/src/main/java/com/whcapp/MainApplication.java
================================================
package com.whcapp;

import android.app.Application;

import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;

public class MainApplication extends Application implements ReactApplication {

  private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
    @Override
    public boolean getUseDeveloperSupport() {
      return BuildConfig.DEBUG;
    }

    @Override
    protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new MainReactPackage()
      );
    }

    @Override
    protected String getJSMainModuleName() {
      return "index";
    }
  };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
  }
}


================================================
FILE: android/app/src/main/res/values/dimens.xml
================================================
<resources>
    <!-- Default screen margins, per the Android Design guidelines. -->
    <dimen name="activity_horizontal_margin">16dp</dimen>
    <dimen name="activity_vertical_margin">16dp</dimen>
    <dimen name="fab_margin">16dp</dimen>
</resources>


================================================
FILE: android/app/src/main/res/values/strings.xml
================================================
<resources>
    <string name="app_name">whc</string>
    <string name="title_activity_launch">LaunchActivity</string>
</resources>


================================================
FILE: android/app/src/main/res/values/styles.xml
================================================
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="android:windowBackground">@mipmap/launch</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />


</resources>


================================================
FILE: android/app/src/main/res/values-v21/styles.xml
================================================
<resources></resources>


================================================
FILE: android/app/src/main/res/values-w820dp/dimens.xml
================================================
<resources>
    <!-- Example customization of dimensions originally defined in res/values/dimens.xml
         (such as screen margins) for screens with more than 820dp of available width. This
         would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
    <dimen name="activity_horizontal_margin">64dp</dimen>
</resources>


================================================
FILE: android/build.gradle
================================================
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        jcenter()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}


================================================
FILE: android/gradle/wrapper/gradle-wrapper.properties
================================================
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip


================================================
FILE: android/gradle.properties
================================================
## Project-wide Gradle settings.
#
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Thu Dec 21 19:04:51 CST 2017
systemProp.http.proxyHost=mirrors.zzu.edu.cn
systemProp.http.proxyPort=80
android.useDeprecatedNdk=true


================================================
FILE: android/gradlew
================================================
#!/usr/bin/env bash

##############################################################################
##
##  Gradle start up script for UN*X
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

warn ( ) {
    echo "$*"
}

die ( ) {
    echo
    echo "$*"
    echo
    exit 1
}

# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
  CYGWIN* )
    cygwin=true
    ;;
  Darwin* )
    darwin=true
    ;;
  MINGW* )
    msys=true
    ;;
esac

# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
    [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
    ls=`ls -ld "$PRG"`
    link=`expr "$ls" : '.*-> \(.*\)$'`
    if expr "$link" : '/.*' > /dev/null; then
        PRG="$link"
    else
        PRG=`dirname "$PRG"`"/$link"
    fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
    if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
        # IBM's JDK on AIX uses strange locations for the executables
        JAVACMD="$JAVA_HOME/jre/sh/java"
    else
        JAVACMD="$JAVA_HOME/bin/java"
    fi
    if [ ! -x "$JAVACMD" ] ; then
        die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
    fi
else
    JAVACMD="java"
    which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
    MAX_FD_LIMIT=`ulimit -H -n`
    if [ $? -eq 0 ] ; then
        if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
            MAX_FD="$MAX_FD_LIMIT"
        fi
        ulimit -n $MAX_FD
        if [ $? -ne 0 ] ; then
            warn "Could not set maximum file descriptor limit: $MAX_FD"
        fi
    else
        warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
    fi
fi

# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
    GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
    APP_HOME=`cygpath --path --mixed "$APP_HOME"`
    CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

    # We build the pattern for arguments to be converted via cygpath
    ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
    SEP=""
    for dir in $ROOTDIRSRAW ; do
        ROOTDIRS="$ROOTDIRS$SEP$dir"
        SEP="|"
    done
    OURCYGPATTERN="(^($ROOTDIRS))"
    # Add a user-defined pattern to the cygpath arguments
    if [ "$GRADLE_CYGPATTERN" != "" ] ; then
        OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
    fi
    # Now convert the arguments - kludge to limit ourselves to /bin/sh
    i=0
    for arg in "$@" ; do
        CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
        CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option

        if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition
            eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
        else
            eval `echo args$i`="\"$arg\""
        fi
        i=$((i+1))
    done
    case $i in
        (0) set -- ;;
        (1) set -- "$args0" ;;
        (2) set -- "$args0" "$args1" ;;
        (3) set -- "$args0" "$args1" "$args2" ;;
        (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
        (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
        (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
        (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
        (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
        (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
    esac
fi

# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
    JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"

exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"


================================================
FILE: android/gradlew.bat
================================================
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem  Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto init

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:init
@rem Get command-line arguments, handling Windowz variants

if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args

:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2

:win9xME_args_slurp
if "x%~1" == "x" goto execute

set CMD_LINE_ARGS=%*
goto execute

:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega


================================================
FILE: android/keystores/BUCK
================================================
keystore(
    name = "debug",
    properties = "debug.keystore.properties",
    store = "debug.keystore",
    visibility = [
        "PUBLIC",
    ],
)


================================================
FILE: android/keystores/debug.keystore.properties
================================================
key.store=debug.keystore
key.alias=androiddebugkey
key.store.password=android
key.alias.password=android


================================================
FILE: android/settings.gradle
================================================
rootProject.name = 'whcapp'

include ':app'


================================================
FILE: app/App.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React, { Component } from 'react';

import { Provider } from 'react-redux';
import configureStore from './store/configure-stroe';

import AppNavigation from "./containers/navigation";

const store = configureStore();

export default class App extends Component {

  render() {
    return (
        <Provider store={store}>
            <AppNavigation/>
        </Provider>
    );
  }
}


================================================
FILE: app/actions/login-action.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import * as types from '../constants/action-type';

export function did_login(userInfo = {}) {
    return {
        type: types.DID_LOGIN,
        userInfo,
    }
}

export function did_logout() {
    return {
        type: types.DID_LOGOUT,
        userInfo: {},
    }
}



================================================
FILE: app/api/account.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import storage from '../components/storage';

export default class Account {
    static user_info = {};
    static token = '';
    static did_login = false;


    /**
     * 退出登录
     */
    static exit_login() {
        this.username = '';
        this.password = '';
        this.did_login = false;
        storage.remove('login');
    }
}


================================================
FILE: app/api/api.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import account from './account';

export default class Api {
    static main_url = 'http://www.wuhaichao.com/app/';

    /**
     * 发送get请求
     */
    static get({api, param, headers}, block) {
        this.request({
            api: api,
            param: param,
            headers: headers,
            method: 'GET',
        }, block);
    }

    /**
     * 发送post请求
     */
    static post({api, param, headers}, block) {
        this.request({
            api: api,
            param: param,
            headers: headers,
            method: 'POST',
        }, block);
    }

    /**
     * 发送请求
     */
    static request({api = null,
                       param = {},
                       headers = {
                        'Accept': 'application/json',
                        'Content-Type': 'multipart/form-data',},
                       method = 'GET'}, block) {
        if (api && api.length > 0) {
            param.token = account.token;
            if (headers.Accept === void 0) {
                headers.Accept = 'application/json';
            }
            if (headers['Content-Type'] === void 0) {
                headers['Content-Type'] = 'multipart/form-data';
            }
            let config = {
                method: method,
                headers: headers,
            };
            let url = this.main_url + api;
            if (method === 'GET') {
                let param_str = '';
                let index = 0;
                for(let key in param) {
                    param_str +=  (index === 0 ? '' : '&') + key + '=' + param[key];
                    index += 1;
                }
                url += (param_str === '' ? '' : '?') + param_str;
            } else {
                const formdata = new FormData();
                for(let key in param) {
                    formdata.append(key, param[key]);
                }
                config.body = formdata;
            }
            fetch(url, config)
            .then((response) => response.json())
            .then((json) => {
                const {token = ''} = json;
                if (token.length > 0) {
                    account.token = token;
                }
                account.did_login = account.token !== '';
                block && block(json || {
                    code: 1,
                    message: '发送请求失败',
                });
            });
        }else {
            block && block({
                code: 1,
                message: '发送请求失败',
            });
        }
    }
}


================================================
FILE: app/base/base-list.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */


import React from 'react';
import {
    FlatList,
    StyleSheet,
    View,
} from 'react-native';

import CommunityCell from '../pages/community/community-cell';
import Controller from './controller';

export default class BaseList extends Controller {

    constructor(props) {
        super(props);
        this.datas = [];
    }

    reloadData = (data) => {
        setTimeout(() => {
            this.datas = data;
            this.loading(false);
        }, 1000);
    };

    clickItem = (item) => {
        this.push('Webv', {linkUrl: item.linkUrl, title: item.title});
    };

    render() {
        return (
            <View style = {styles.view}>
                <FlatList
                    style = {styles.list}
                    data = {this.datas}
                    renderItem = {
                        ({item, index}) => (
                            <CommunityCell key = {index} item = {item} click = {() => {
                                this.clickItem(item);
                            }}/>
                        )
                    }
                />
                {super.render()}
            </View>
        );
    }
}


const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    list: {
        flex: 1,
    },
});


================================================
FILE: app/base/controller.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React, {Component} from 'react';
import {
    TouchableHighlight,
    Image,
    Platform,
    View,
} from 'react-native';
import {NavigationActions} from 'react-navigation';
import WHCToast from '../components/whc-toast';
import WHCLoading from '../components/whc-loading';

/**
 * 基类控制器
 */

export default class Controller extends Component {
    /**
     * 存储界面路由信息
     * @type {Map<any, any>}
     */
    static routerMap = new Map();

    /**
     * 路由名称数组
     * @type {Array}
     */
    static routerNames = [];


    static navigationOptions = (options) => {
        const {navigation = null, navigationOptions} = options;
        if (navigation) {
            const  {params = null} = navigation.state;
            const {headerLeft = null, headerRight = null} = navigationOptions;
            if (params) {
                const {title = null} = params;
                if (title) {
                    options.title = title;
                }
            }
            const {key = ''} = navigation.state;
            if (key.toLowerCase().indexOf('init') !== 0 && !headerLeft) {
                options.headerLeft = (
                    <TouchableHighlight style = {{
                        backgroundColor: 'transparent',
                        width: 70,
                        height: 40,
                        justifyContent: 'center',
                    }} onPress={() => {
                        const {goBackBlock = null} = navigation.state.params;
                        goBackBlock && goBackBlock();
                    }} underlayColor={'transparent'}>
                        <Image style = {{
                            width: 20,
                            height: 20,
                            marginLeft: 5,
                        }} source={require('../images/nav-back-icon.png')}/>
                    </TouchableHighlight>
                );
                if (!headerRight && Platform.OS === 'android') {
                    options.headerRight = (<View/>);
                }
            }
        }
        return options;
    };

    /**
     * 基类视图构造方法
     * @param props
     */
    constructor(props) {
        super(props);
        this.state = {
            message: null,
            loading: false,
        };
        if (this.props.navigation.state.params === void 0) {
            this.props.navigation.state.params = {};
        }
        this.props.navigation.state.params.goBackBlock = this.goBack;
    }


    /**
     * 是否可以返回
     * @returns {boolean}
     */
    canBack() {
        return true;
    }

    /**
     * pop返回回调
     */
    goBack = () => {
        if (this.canBack()) {
            this.pop();
        }
    };

    /**
     * push跳转新页面
     * @param name 路由名称
     * @param param 路由参数
     */
    push = (name = null, param = {}) => {
        const {routerMap, routerNames} = Controller;
        if (name) {
            const {navigation = null} = this.props;
            if (navigation) {
                const {state = null} = navigation;
                if (state) {
                    const {routeName = null, key = null} = state;
                    if (routeName && key) {
                        routerNames.push(routeName);
                        routerMap.set(routeName, key);
                    }
                }
            }
            const {navigate} = this.props.navigation;
            navigate(name, param);
        }else {
            console.error('push name not null');
        }
    };

    /**
     * 设置导航标题
     * @param title
     */
    setTitle = (title = null) => {
        if (title) {
            const {key = null} = this.props.navigation.state;
            if (key) {
                const setParam = NavigationActions.setParams({
                    key: key,
                    params: {
                        title: title,
                    }
                });
                this.props.navigation.dispatch(setParam);
            }
        }
    };

    /**
     * 设置根路由
     * @param name 路由名称
     */
    setRootController = (name = null) => {
        const {routerMap, routerNames} = Controller;
        if (name && name.length > 0) {
            const reset = NavigationActions.reset({
                index: 0,
                actions: [NavigationActions.navigate({routeName: name})]
            });
            routerMap.clear();
            routerNames.splice(0, routerNames.length);
            this.props.navigation.dispatch(reset);
        }else {
            console.warn('root constroller name not null');
        }
    };


    /**
     * pop返回指定name路由界面
     * @param name 路由名称
     */
    pop = (name = null) => {
        const {routerMap, routerNames} = Controller;
        const {goBack} = this.props.navigation;
        if (name) {
            let key = routerMap.get(name);
            if (key) {
                const routerLength = routerNames.length;
                const index = routerNames.indexOf(name);
                if (index + 1 < routerLength) {
                    let routerName = routerNames[index + 1];
                    key = routerMap.get(routerName);
                    if (!goBack(key)) {
                        this.setRootController(name);
                    }else {
                        routerMap.delete(name);
                        routerNames.splice(index,1);
                    }
                }else {
                    routerMap.delete(name);
                    routerNames.splice(index,1);
                    goBack();
                }
            }else {
                console.warn(`not found router ${name} for key`);
            }
        }else {
            const routerName = routerNames.pop();
            routerMap.delete(routerName);
            goBack();
        }
    };

    /**
     * toast 弹窗
     * @param message 要显示的消息
     * message = null 隐藏toast
     */
    toast = (message = null) => {
        this.setState((state) => {
            state.message = message;
            state.loading = false;
            return state;
        });
    };

    /**
     * 网络菊花加载
     * @param loading 是否加载 默认true加载 false 隐藏
     */
    loading = (loading = true) => {
        this.setState((state) => {
            state.loading = loading;
            state.message = null;
            return state;
        });
    };

    render() {
        const {message = null, loading = false} = this.state;
        return (
            [
                <WHCToast key = {1}
                          message = {message}
                          onHide = {() => {
                              this.toast();
                          }}/>,
                <WHCLoading key = {2} show = {loading}/>
            ]
        );
    }
}


================================================
FILE: app/components/storage.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {AsyncStorage} from 'react-native';

export default class Storage {

    /**
     * 通过key获取存储值
     * @param key
     * @param block
     */
    static value(key, block) {
        if (key) {
            AsyncStorage.getItem(key, (error, value) => {
                block && !error && block(JSON.parse(value));
            });
        }
    }


    /**
     * 存储key,value
     * @param key
     * @param value
     * @param block
     */
    static set(key, value, block) {
        if (value && key) {
            if (typeof value === 'string') {
                AsyncStorage.setItem(key, value);
            }else if (value instanceof Object) {
                AsyncStorage.setItem(key, JSON.stringify(value), block);
            }
        }
    }

    /**
     * 移除key对应值
     * @param key
     * @param block
     */
    static remove(key, block) {
        if (key) {
            AsyncStorage.removeItem(key, block);
        }
    }
}


================================================
FILE: app/components/tool.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

export default class Tool {
    /**
     *  检查是否为电话号码
     */
    static istel(tel) {
        if (tel) {
            const check_tel = /(^1\d{10})/;
            return check_tel.test(tel);
        }
        return false;
    }

    /**
     * 检查是否为电子邮件
     */
    static isemail(email) {
        if (email) {
            const check_email = /^([0-9A-Za-z\-_\.]+)@([0-9a-z]+\.[a-z]{2,3}(\.[a-z]{2})?)$/;
            return check_email.test(email);
        }
        return false;
    }

    /**
     * 获取对象属性个数
     */
    static count(object) {
        if (object) {
            let count = 0;
            for (let key in object) {
                if (object.hasOwnProperty(key)) {
                    count += 1;
                }
            }
            return count;
        }
        return 0;
    }
}


================================================
FILE: app/components/whc-banner.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    ScrollView,
    Image,
    StyleSheet,
    TouchableHighlight,
} from 'react-native';

import * as screen from '../constants/screen';
import * as color from '../constants/color'

class WHCBannerIndicater extends Component {
    constructor(props) {
        super(props);
        this.state = {
            pageindex: 0,
        };
    }

    updatePageIndex = (index) => {
        this.setState({
            pageindex: index,
        });
    };

    render() {
        const {page} = this.props;
        const pageIndex = this.state.pageindex;
        let pageTexts = [];
        for (let i = 0; i < page; i++) {
            if (i === pageIndex) {
                pageTexts.push((<View key = {i} style = {[styles.dot, {backgroundColor: color.theme}]}/>))
            }else {
                pageTexts.push((<View key = {i} style = {styles.dot}/>))
            }
        }
        return (
            <View style = {styles.indicater}>
                {pageTexts}
            </View>
        );
    }
}

class WHCBanner extends Component {
    constructor(props) {
        super(props);
        this.state = {};
        this.pageindex = 0;
        this.offsetx = 0;
    }

    componentDidMount() {
        this.timout = setTimeout(() => {
            this._goIndex(1);
        }, 100);
        this._makeTimer();
    }

    componentWillUnmount() {
        this.timeout && clearTimeout(this.timout);
        this._clearTimer();
    }

    _onMomentumScrollEnd = (e) => {
        const offsetx = e.nativeEvent.contentOffset.x;
        const count = this.imagecount;
        const index = Math.floor((offsetx - screen.width / 2.0) / screen.width) + 1;
        if (index === 0) {
            this.pageindex = count - 1;
        }else if (index === count + 1) {
            this.pageindex = 0;
        }else {
            this.pageindex = index - 1;
        }
        this.indicater.updatePageIndex(this.pageindex);
    };

    _onScrollBeginDrag = (e) => {
        this._clearTimer();
    };

    _onScrollEndDrag = (e) => {
        const offsetx = e.nativeEvent.contentOffset.x;
        const count = this.imagecount;
        if (offsetx === (count + 1) * screen.width) {
            this._goIndex(1);
        }else if (offsetx === 0) {
            this._goIndex(count);
        }
        this._makeTimer();
    };

    _onScroll = (e) => {
        const offsetx = e.nativeEvent.contentOffset.x;
        const index = Math.floor((offsetx - screen.width / 2.0) / screen.width) + 1;
        const count = this.imagecount;
        const isLeftScroll = this.offsetx <= offsetx;
        if (offsetx <= 0) {
            if (isLeftScroll) {
                return;
            }
            this._goIndex(count);
        }else if (offsetx >= (count + 1) * screen.width) {
            if (!isLeftScroll) {
                return;
            }
            this._goIndex(1);
        }
        this.offsetx = offsetx;
    };

    _goIndex = (index, animated) => {
        this.offsetx = index * screen.width;
        this.scrollview.scrollTo({x: index * screen.width, y: 0, animated: animated || false});
    };

    _makeTimer = () => {
        const interval = this.props.interval || 3;
        this.timer = setInterval(() => {
            this.offsetx = -1;
            this.pageindex += 1;
            this._goIndex(this.pageindex, true);
        }, interval * 1000);
    };

    _clearTimer = () => {
        this.timer && clearTimeout(this.timer);
    };

    render() {
        const {urls, style, renderIndicater, onPress} = this.props;
        if (urls != null && urls.length > 0) {
            const column = urls.length;
            let imagelist = [];
            this.imagecount = column;
            let url_list = [urls[column - 1]];
            url_list = url_list.concat(urls);
            url_list.push(urls[0]);
            url_list.forEach((e, index) => {
                let source = null;
                if (e.startsWith('http')) {
                    source = {uri: e};
                }else {
                    source = e;
                }
                imagelist.push((
                    <TouchableHighlight key = {index} onPress = {() => {onPress !== void 0 && onPress(e, index)}}>
                        <Image style = {styles.img} source = {source} resizeMode = {'stretch'}/>
                    </TouchableHighlight>
                ))
            });
            return (
                <View style = {style}>
                    <ScrollView
                        ref = {(ref) => {this.scrollview = ref}}
                        style = {{flex: 1}}
                        horizontal = {true}
                        showsHorizontalScrollIndicator = {false}
                        pagingEnabled = {true}
                        bounces = {false}
                        // scrollEventThrottle = {1}
                        onMomentumScrollEnd = {this._onMomentumScrollEnd}
                        onScrollBeginDrag = {this._onScrollBeginDrag}
                        onScrollEndDrag = {this._onScrollEndDrag}
                        onScroll = {this._onScroll}>
                        {imagelist}
                    </ScrollView>
                    {renderIndicater === void 0 ? (<WHCBannerIndicater
                        ref = {(ref) => {this.indicater = ref}}
                        page = {column}
                    />) : renderIndicater(column)}
                </View>
            );
        }
        return null;
    }
}

const styles = StyleSheet.create({
    img: {
        flex: 1,
        width: screen.width,
    },
    indicater: {
        position: 'absolute',
        height: 30,
        flexDirection: 'row',
        padding: 10,
        justifyContent: 'center',
        bottom: 0,
        width: screen.width,
        backgroundColor: 'rgba(0,0,0,0.4)',
    },
    dot: {
        backgroundColor: 'white',
        width: 10,
        height: 10,
        borderRadius: 5,
        marginLeft: 10,
    },
});

export default WHCBanner;


================================================
FILE: app/components/whc-button.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    Text,
    TouchableHighlight,
} from 'react-native';


export default WHCButton = ({
    style,
    text,
    textColor,
    fontSize,
    onClick,
}) => {
    return (
        <TouchableHighlight style = {[style, {justifyContent:'center', alignItems: 'center'}]}
            onPress = {onClick}
            underlayColor = {'transparent'}>
            <Text style = {{color: (textColor !== void 0 ? textColor : 'black'),
                           fontSize: (fontSize !== void 0 ? fontSize : 14)}}>
               {text}
            </Text>
        </TouchableHighlight>
    );
};


================================================
FILE: app/components/whc-grid-view.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import PropTypes from 'prop-types';
import {
    View,
    StyleSheet,
    FlatList,
    ViewPropTypes,
} from 'react-native';

const propTypes = {
    column:                    PropTypes.number,
    data:                      PropTypes.array,
    renderItem:                PropTypes.func,
    style:                     ViewPropTypes.style,
    rowSeparatorLineRender:    PropTypes.func,
    columnSeparatorLineRender: PropTypes.func,
};

const WHCGridView = ({
column,
data,
renderItem,
style,
rowSeparatorLineRender,
columnSeparatorLineRender,
}) => {
    if (column === 0 || data.length === 0) {
        return null;
    }else {
        const length = data.length;
        const rowCount = length / column + (length % column !== 0 ? 1 : 0);
        let datas = [];
        for (let r = 0; r < rowCount; r++) {
            let items = [];
            for (let c = 0; c < column; c++) {
                const index = r * column + c;
                if (index < length) {
                    items.push(data[index]);
                }else {
                    items.push({});
                }
            }
            datas.push(items);
        }
        return (
            <View style = {style}>
                <FlatList style = {styles.list}
                    data = {datas}
                    ItemSeparatorComponent = {rowSeparatorLineRender != null ? rowSeparatorLineRender : null}
                    renderItem = {({item, index}) => {
                        let itemview = [];
                        let linecount = columnSeparatorLineRender != null ? Math.min(0, column - 1) : 0;
                        item.forEach((e, idx) => {
                            itemview.push(renderItem(e, index * column + idx));
                            if (idx < column - 1 && columnSeparatorLineRender != null) {
                                itemview.push(columnSeparatorLineRender());
                            }
                        });
                        return (<View style = {styles.item} key = {index}>
                            {itemview}
                        </View>);
                    }}
                />
            </View>
        );
    }
};

WHCGridView.propTypes = propTypes;

WHCGridView.defaultProps = {
    column: 1,
    data: [],
    renderItem(){},
};

const styles = StyleSheet.create({
    list: {
        flex: 1,
    },
    item: {
        flex: 1,
        flexDirection: 'row',
        justifyContent: 'space-between',
    },
});

export default WHCGridView;


================================================
FILE: app/components/whc-image-button.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    TouchableHighlight,
    Text,
    Image,
    View,
}from 'react-native';

class WHCImageButton extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    render() {
        const {onPress, style, imageStyle, textStyle, imageSource, text, underlayColor} = this.props;
        return (
            <TouchableHighlight
                underlayColor = {underlayColor}
                onPress = {onPress}>
                <View style = {style}>
                    <Image style = {imageStyle} source = {imageSource}/>
                    <Text style = {textStyle}>{text}</Text>
                </View>
            </TouchableHighlight>
        );
    }
}

export default WHCImageButton;


================================================
FILE: app/components/whc-line.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    StyleSheet,
} from 'react-native';

import * as color from '../constants/color';

class WHCLine extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    render() {
        return (
            <View style = {styles.line}>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    line: {
        height: 0.5,
        backgroundColor: color.line,
    },
});

export default WHCLine;


================================================
FILE: app/components/whc-loading.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React, {Component} from 'react';
import {
    View,
    Modal,
    StyleSheet,
    Animated,
    Easing,
} from 'react-native';


export default class WHCLoading extends Component {
    constructor(props) {
        super(props);
        this.rotateValue = new Animated.Value(0);
        this.show = true;
        this.didAnimation = false;
    }

    componentWillUnmount() {
        this.show = false;
    }

    _rotateValue = (value) => {
        this.rotateValue.setValue(value);
    };

    _startAnimation = () => {
        this.didAnimation = true;
        this._rotateValue(0);
        Animated.timing(this.rotateValue, {
            toValue: 1,
            duration: 1000,
            easing: Easing.out(Easing.ease),
        }).start(() => {
            if (this.show) {
                this._startAnimation();
            }else {
                this.didAnimation = false;
            }
        });
    };

    render() {
        const {show = false, image = null} = this.props;
        this.show = show;
        if (show && !this.didAnimation) {
            this._startAnimation();
        }
        return (
            <Modal animationType = {'none'}
                transparent = {true}
                visible = {show}>
                <View style = {styles.loadingView}>
                    <View style = {styles.loading}>
                        <Animated.Image style = {{
                            width: 40,
                            height: 40,
                            transform: [
                                {
                                    rotateZ: this.rotateValue.interpolate({
                                        inputRange: [0,1],
                                        outputRange: ['0deg', '360deg'],
                                    }),
                                },
                            ],
                        }}
                            source = {image || require('../images/loading.png')}
                        />
                    </View>
                </View>
            </Modal>
        );
    }
}


const styles = StyleSheet.create({
    loadingView: {
        flex: 1,
        backgroundColor: '#00000033',
        alignItems: 'center',
        justifyContent: 'center',
    },
    loading: {
        width: 70,
        height: 70,
        alignItems: 'center',
        justifyContent: 'center',
        borderRadius: 5,
        backgroundColor: '#ffffffF2',
    },
});


================================================
FILE: app/components/whc-text.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    Text,
} from 'react-native';

export default WHCText = ({
    style,
    text,
    textColor = 'gary',
    fontSize = 14,
}) => {
    return (
        <View style = {style}>
            <Text style = {{color: textColor, fontSize: fontSize}}>{text}</Text>
        </View>
    );
};


================================================
FILE: app/components/whc-toast.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    StyleSheet,
    Animated,
    Easing,
    Modal,
    Text,
} from 'react-native';

export default class WHCToast extends Component {
    constructor(props) {
        super(props);
        this.state = {
            opacity: new Animated.Value(0),
        };
    }

    componentWillUnmount() {
        this.timer && clearTimeout(this.timer)
    }

    _setOpacity = (value) => {
        this.setState((state) => {
            state.opacity.setValue(value);
            return state;
        });
    };

    _startAnimation = () => {
        this.did_end_show = false;
        Animated.timing(this.state.opacity, {
            toValue: 1,
            duration: 200,
            easing: Easing.out(Easing.linear),
        }).start(() => {
            const {duration} = this.props;
            this.timer = setTimeout(() => {
                this._setOpacity(1);
                Animated.timing(this.state.opacity, {
                    toValue: 0,
                    duration: 200,
                    easing: Easing.out(Easing.linear),
                }).start(() => {
                    this._setOpacity(0);
                    const {onHide = null} = this.props;
                    if (onHide) {
                        onHide && onHide();
                    }else {
                        this.modal.visible = false;
                    }
                });
            }, duration || 2500);
        });
    };

    render() {
        const {message = null} = this.props;
        let visible = message !== null && message !== '';
        visible && this._startAnimation();
        return (
            <Modal
                ref = {(ref) => {this.modal = ref}}
                transparent = {true}
                visible = {visible}>
                <View style = {styles.toast}>
                    <Animated.View style = {[styles.message, {opacity: this.state.opacity,}]}>
                        <Text style = {styles.text}>
                            {message}
                        </Text>
                    </Animated.View>
                </View>
            </Modal>
        );
    }
}


const styles = StyleSheet.create({
    toast: {
        flex: 1,
        backgroundColor: 'transparent',
        alignItems: 'center',
        justifyContent: 'center',
    },
    message: {
        alignItems: 'center',
        justifyContent: 'center',
        padding: 20,
        backgroundColor: '#000000B2',
        borderRadius: 5,
    },
    text: {
        color: 'white',
        fontSize: 14,
    },
});


================================================
FILE: app/constants/action-type.js
================================================
/**
 * 退出登录
 * @type {string}
 */
export const DID_LOGOUT = 'DID_LOGOUT';
/**
 * 登录
 * @type {string}
 */
export const DID_LOGIN = 'DID_LOGIN';

================================================
FILE: app/constants/app-constant.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

/**
 * 修改类型
 */
export const ModifyType = {
    email: 0,
    mobile: 1,
    password: 2,
};

/**
 * 收藏类型
 */
export const CollectType = {
    my_collect: 0,
    collect_set: 1,
};



================================================
FILE: app/constants/color.js
================================================

/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

export const theme = '#CC6766';
export const black = '#333333';
export const line = '#f1f1f1';
export const gray = '#cccccc';


================================================
FILE: app/constants/screen.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import {
    Dimensions
} from 'react-native';

export const width = Dimensions.get('window').width;
export const height = Dimensions.get('window').height;


================================================
FILE: app/containers/navigation.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {View, Text} from 'react-native';
import {StackNavigator} from 'react-navigation';
import Launch from '../pages/launch/launch';
import Tabbar from './tabbar';
import Blank from '../pages/blank/blank';
import Webv from '../pages/webview/webv';
import Set from '../pages/my/set/set';
import Modify from '../pages/my/set/modity/modify'
import Feedback from '../pages/my/feedback/feedback';
import Collect from '../pages/community/collect/collect';

import WeekHot from '../pages/community/week/week-hot';
import OfflineActivity from '../pages/community/activity/offline-activity';
import MyLike from '../pages/my/like/my-like';
import DidRead from '../pages/my/read/did-read';
import SpecialColumn from '../pages/community/column/special-column';

import Login from '../pages/my/login/login';
import Register from '../pages/my/login/register';
import Forget from '../pages/my/login/forget';
import User from '../pages/my/user/user';

const AppNavigation  = StackNavigator({
    Launch: {
        screen: Launch,
    },
    Tabbar: {
        screen: Tabbar,
    },
    Blank: {
        screen: Blank,
    },
    Webv: {
        screen: Webv,
    },
    Set: {
        screen: Set,
    },
    Modify: {
        screen: Modify,
    },
    Feedback: {
        screen: Feedback,
    },
    Collect: {
        screen: Collect,
    },
    WeekHot: {
        screen: WeekHot,
    },
    OfflineActivity: {
        screen: OfflineActivity,
    },
    MyLike: {
        screen: MyLike,
    },
    DidRead: {
        screen: DidRead,
    },
    SpecialColumn: {
        screen: SpecialColumn,
    },
    Login: {
        screen: Login,
    },
    Register: {
        screen: Register,
    },
    Forget: {
        screen: Forget,
    },
    User: {
        screen: User,
    },
},{
    initialRouteName: 'Launch', // 默认显示界面
    navigationOptions: {  // 屏幕导航的默认选项, 也可以在组件内用 static navigationOptions 设置(会覆盖此处的设置)
        headerBackTitle: null,  // 左上角返回键文字
        headerStyle: {
            backgroundColor: '#fff',
        },
        headerTitleStyle: {
            color: '#333',
            alignSelf : 'center',
        },
        cardStack: {
            gesturesEnabled: true,
        },
        headerRight: (<View/>),
    },
    mode: 'card',  // 页面切换模式, 左右是card(相当于iOS中的push效果), 上下是modal(相当于iOS中的modal效果)
    headerMode: 'screen', // 导航栏的显示模式, screen: 有渐变透明效果, float: 无透明效果, none: 隐藏导航栏
    onTransitionStart: ()=>{ console.log('导航栏切换开始'); },  // 回调
    onTransitionEnd: ()=>{ console.log('导航栏切换结束'); }  // 回调

});

export default AppNavigation;


================================================
FILE: app/containers/tabbar.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {TabNavigator} from 'react-navigation';
import {
    Image,
    Platform,
    View,
} from 'react-native';

import Home from '../pages/home/home';
import Community from '../pages/community/community';
import My from '../pages/my/my';

import * as color from '../constants/color';

export default Tabbar = TabNavigator({
    Home: {
        screen: Home,
        navigationOptions: {
            title: '首页',
            headerLeft: (<View/>),
            tabBarLabel: '首页',
            tabBarIcon: ({tintColor}) => {
                return(<Image
                    resizeMode = 'contain'
                    source = {require('../images/home_normal_icon.png')}
                    style = {{
                        width: 20,
                        height: 20,
                        tintColor: tintColor,
                    }}/>
            )},
        },
    },
    Community: {
        screen: Community,
        navigationOptions: {
            title: '社区',
            headerLeft: (<View/>),
            tabBarLabel: '社区',
            tabBarIcon: ({tintColor}) => {
                return (<Image
                    source = {require('../images/community_normal_icon.png')}
                    style = {{
                        width: 20,
                        height: 20,
                        tintColor: tintColor,
                    }}/>
            )},
        },
    },
    My: {
        screen: My,
        navigationOptions: {
            title: '我的',
            headerLeft: (<View/>),
            tabBarLabel: '我的',
            tabBarIcon: ({tintColor}) => {
                return (<Image
                    source = {require('../images/my_normal_icon.png')}
                    style = {{
                        width: 25,
                        height: 25,
                        tintColor: tintColor,
                    }}/>
            )},
        },
    }}, {
    tabBarPosition: 'bottom',
    lazy: true,
    initialRouteName: 'Home',
    swipeEnabled: false,
    animationEnabled: false,
    tabBarOptions: {
        showIcon: true,
        style: {
            height: 50,
            backgroundColor: '#ffffff',
            zIndex: 0,
            position: 'relative',
        },
        labelStyle: {
            fontSize: 11,
            paddingVertical: 0,
            marginTop: (Platform.OS === 'android' || (Platform.OS === 'ios' && Platform.Version < 10)) ? 0 : 15,
        },
        iconStyle: {
            marginTop: -2,
        },
        tabStyle: {
            backgroundColor: 'white',
        },
        activeBackgroundColor: '#fff',
        activeTintColor: color.theme,
        inactiveBackgroundColor:'white',
        inactiveTintColor: color.black,
    },
});



================================================
FILE: app/pages/blank/blank.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React, {Component} from 'react';
import {
    View,
    Text,
    StyleSheet,
} from 'react-native';

import * as color from '../../constants/color';

class Blank extends Component {
    static navigationOptions = {
        title: '开发中'
    };

    constructor(props) {
        super(props);
        this.state = {};
    }

    render () {
        return (
            <View style = {styles.view}>
                <Text style = {styles.text}>{'功能还在开发,敬请期待'}</Text>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
        justifyContent: 'center',
        alignItems: 'center'
    },
    text: {
        fontSize: 20,
        fontWeight: 'bold',
        color: color.theme,
    },
});

export default Blank;


================================================
FILE: app/pages/community/activity/offline-activity.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import BaseList from '../../../base/base-list';
import Api from '../../../api/api';

export default class OfflineActivity extends BaseList {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this._startRequest();
    }

    _startRequest = () => {
        this.loading(true);
        Api.get({api: 'offine_activity/'}, (json) => {
            if (json.code !== 0) {
                this.toast(json.message);
            }else {
                this.reloadData(json.data.list);
            }
        });
    };

    render() {
        return super.render();
    }
}


================================================
FILE: app/pages/community/collect/collect-cell.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    View,
    StyleSheet,
    Image,
    Text,
    TouchableHighlight,
} from 'react-native';

import WHCLine from '../../../components/whc-line';
import Api from '../../../api/api';

CollectCell = ({
    item,
    onClick,
}) => {
    return (
        [
            <View style = {styles.view}>
                <TouchableHighlight onPress = {() => {
                    if (onClick !== void 0) {
                        onClick(item);
                    }
                }} underlayColor = {'transparent'}>
                    <View style = {styles.content_view}>
                        <Image style = {styles.image}
                                source = {{uri: Api.main_url + item.logoUrl}}/>
                        <View style = {styles.mid_content}>
                            <Text style = {styles.title}>{item.title}</Text>
                            <Text style = {styles.detail}>{item.count + '篇 · ' + item.focusCount + '关注 · ' + item.author}</Text>
                        </View>
                        <Image style = {styles.arrow_img} source = {require('../../../images/right_arrow_icon.png')}/>
                    </View>
                </TouchableHighlight>
            </View>,
            <WHCLine/>
        ]
    );
};


const styles = StyleSheet.create({
    view: {
        flex: 1,
        backgroundColor: 'white',
        padding: 15,
    },
    content_view: {
        flexDirection: 'row',
        alignItems: 'center',
    },
    image: {
        width: 60,
        height: 60,
        borderRadius: 3,
    },
    mid_content: {
        paddingLeft: 20,
        flexGrow: 2,
        height: 60,
        justifyContent: 'space-between',
    },
    arrow_img: {
        width: 20,
        height: 20,
    }
});

export default CollectCell;


================================================
FILE: app/pages/community/collect/collect.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    View,
    StyleSheet,
    FlatList,
} from 'react-native';

import CollectCell from './collect-cell';
import Api from '../../../api/api';
import {CollectType} from '../../../constants/app-constant';
import Controller from '../../../base/controller';

class Collect extends Controller {

    constructor(props) {
        super(props);
        this.datas = [];
    }

    componentDidMount() {
        this._startRequest();
    }

    _startRequest = () => {
        this.loading();
        let api = '';
        const {type = CollectType.my_collect} = this.props.navigation.state.params;
        switch (type) {
            case CollectType.my_collect:
                api = 'my_collect/';
                break;
            case CollectType.collect_set:
                api = 'collect/';
                break;
            default:

        }
        Api.get({api: api}, (json) => {
            if (json.code !== 0) {
                this.toast(json.message);
            }else {
                this.datas = json.data.list;
                this.loading(false);
            }
        });
    };

    render() {
        return (
            <View style = {styles.view}>
                <FlatList style = {styles.list}
                          data = {this.datas}
                          renderItem = {({item, index}) => (
                              <CollectCell
                                  key = {index}
                                  item = {item}
                                  onClick = {(item) => {
                                      this.push('Webv', {linkUrl: item.linkUrl, title: item.title});
                                  }}/>
                          )}/>
                {super.render()}
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    list: {
        flex: 1,
    },
});

export default Collect;


================================================
FILE: app/pages/community/column/special-column.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    FlatList,
    StyleSheet,
    View,
} from 'react-native';

import HomeCell from '../../home/home-cell';
import api from '../../../api/api';
import Constroller from '../../../base/controller';

export default class SpecialColumn extends Constroller {

    constructor(props) {
        super(props);
        this.datas = [];
    }

    componentDidMount() {
        this._startRequest();
    }

    _startRequest = () => {
        this.loading();
        api.get({
            api: 'special_column/'
        }, (json) => {
            if (json.code === 0) {
                this.datas = json.data.list;
                this.loading(false);
            }else {
                this.toast(json.message);
            }
        });
    };

    _clickItem = (item) => {
        this.push('Webv', {linkUrl: item.linkUrl, title: item.title});
    };

    render() {
        return (
            <View style = {styles.view}>
                <FlatList
                    style = {styles.list}
                    data = {this.datas}
                    renderItem = {({item,index}) => (
                        <HomeCell
                            key = {index}
                            itemInfo = {item}
                            click = {() => {this._clickItem(item);}}
                        />
                    )}
                />
                {super.render()}
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    list: {
        flex: 1,
    },
});


================================================
FILE: app/pages/community/community-cell.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    StyleSheet,
    Text,
    Image,
    TouchableHighlight,
} from 'react-native';
import Api from '../../api/api';

import * as color from '../../constants/color';

class CommunityCell extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    render() {
        const {title, loveNum,image, time, organizeName, key} = this.props.item;
        const click = this.props.click;
        if (image != null) {
            return (
                <TouchableHighlight onPress = {click} key = {key}>
                    <View style = {{flex: 1}}>
                        <View style = {styles.viewimage}>
                            <View style = {styles.view}>
                                <Text style = {styles.title}>{title}</Text>
                                <Text style = {styles.info}>{loveNum + '人喜欢 · ' + organizeName + ' · ' + time}</Text>
                            </View>
                            <Image style = {styles.img} source = {{uri: Api.main_url + image}}/>
                        </View>
                        <View style = {styles.bottomLine}/>
                    </View>
                </TouchableHighlight>
            );
        }
        return (
            <TouchableHighlight onPress = {click}>
                <View style = {{flex: 1}}>
                    <View style = {styles.view}>
                        <Text style = {styles.title}>{title}</Text>
                        <Text style = {styles.info}>{loveNum + '人喜欢 · ' + organizeName + ' · ' + time}</Text>
                    </View>
                    <View style = {styles.bottomLine}/>
                </View>
            </TouchableHighlight>
        );
    }
}

const styles = StyleSheet.create({
    viewimage: {
        flex: 1,
        flexDirection: 'row',
        backgroundColor: 'white',
    },
    view: {
        flex: 1,
        padding: 20,
        backgroundColor: 'white',
    },
    title: {
        fontSize: 14,
        color: color.black,
    },
    info: {
        marginTop: 15,
        color: 'gray',
        fontSize: 12,
    },
    bottomLine: {
        backgroundColor: '#f1f1f1',
        height: 0.5,
    },
    img: {
        marginTop: 20,
        marginRight: 20,
        width: 50,
        height: 50,
    },
});

export default CommunityCell;


================================================
FILE: app/pages/community/community-section.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    StyleSheet,
    Image,
    Text,
} from 'react-native';

import * as color from '../../constants/color';

class CommunitySection extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    render() {
        let {image, title, markImage, markTitle} = this.props;
        return (
            <View style = {styles.view}>
                <Image style = {styles.img} source = {image}/>
                <Text style = {styles.title}>{title}</Text>
                <Image style = {styles.img} source = {markImage}/>
                <Text style = {styles.markTitle}>{markTitle}</Text>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
        paddingTop: 10,
        paddingBottom: 10,
        paddingLeft: 20,
        paddingRight: 20,
        flexDirection: 'row',
        alignItems: 'center',
        backgroundColor: 'white',
    },
    img: {
        width: 20,
        height: 20,
    },
    title: {
        marginLeft: 15,
        fontSize: 14,
        color: color.black,
        flexGrow: 2,
    },
    markTitle: {
        marginLeft: 15,
        fontSize: 14,
        color: color.gary,
    },

});

export default CommunitySection;


================================================
FILE: app/pages/community/community.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    View,
    Text,
    StyleSheet,
    Image,
    TouchableHighlight,
    FlatList,
    RefreshControl,
} from 'react-native';

import WHCBanner from '../../components/whc-banner';
import WHCGridView from '../../components/whc-grid-view';
import * as color from '../../constants/color';
import CommunitySection from './community-section';
import CommunityCell from './community-cell';
import Api from '../../api/api';
import Webv from '../webview/webv';
import {CollectType} from '../../constants/app-constant';
import Controller from '../../base/controller';

class Community extends Controller {

    static navigationOptions = (options) => {
        Controller.navigationOptions(options);
        options.headerLeft = (<View/>);
        return options;
    }

    constructor(props) {
        super(props);
        this.grid_menu = [
            {title: '本周最热',image: require('../../images/community_hot_icon.png')},
            {title: '收藏集', image: require('../../images/community_collect_icon.png')},
            {title: '线下活动', image: require('../../images/community_active_icon.png')},
            {title: '专栏', image: require('../../images/community_column_icon.png')},
        ];
    }

    componentDidMount() {
        this._startRequest();
    }

    _onRefresh = (e) => {
        this._startRequest();
    };

    _startRequest = () => {
        this.loading();
        Api.get({
            api: 'community'
        }, (json) => {
            this.datas = [];
            if (json.code === 0) {
                this.datas.push(json.data.banner);
                this.datas.push(this.grid_menu);
                this.datas.push({});
                this.datas = this.datas.concat(json.data.hot_article);
                setTimeout(() => {
                    this.loading(false);
                }, 1000);
            }else {
                this.toast(json.message);
            }
        });
    };

    _clickTopItem = (index, item = null) => {
        switch(index){
            case 0: { /// 本周最热
                this.push('WeekHot', {title: '本周最热'});
            }
            break;
            case 1:  { /// 我的收藏
                this.push('Collect', {title: '收藏集', type: CollectType.collect_set});
            }
            break;
            case 2: { /// 线下活动
                this.push('OfflineActivity', {title: '线下活动'});
            }
            break;
            case 3: {/// 专栏
                this.push('SpecialColumn', {title: '专栏'});
            }
            break;
            default: {
                this.push('Webv', {title: item.title, linkUrl: item.linkUrl});
            }
        }
    };

    _cell = ({item, index}) => {
        switch (index) {
            case 0: {
                return (
                    <WHCBanner
                        style = {styles.banner}
                        urls = {(() => {
                            let urls = [];
                            item.forEach((value) => {
                                urls.push(Api.main_url + value.image_url);
                            });
                            return urls;
                        })()}
                        onPress = {(e, index) => {
                            this.push('Webv',{title: '百度一下', linkUrl: item[index].link_url});
                        }}
                    />
                );
            }
            case 1: {
                return (
                    <WHCGridView
                        style = {styles.grid}
                        column = {4}
                        data = {item}
                        renderItem = {(item, index) => (
                            <TouchableHighlight
                                key = {index}
                                onPress = {() => {this._clickTopItem(index)}}
                                underlayColor = {'transparent'}>
                                <View style = {styles.item}>
                                    <Image style = {styles.itemImage} source = {item.image}/>
                                    <Text style = {styles.itemText}>{item.title}</Text>
                                </View>
                            </TouchableHighlight>
                        )}
                    />
                );
            }
            case 2: {
                return (
                    <View style = {{backgroundColor: '#F4F6F9', paddingTop: 20, paddingBottom: 0.5}}>
                        <CommunitySection
                            image = {require('../../images/community_hot_section_icon.png')}
                            title = {'热门文章'}
                            markImage = {require('../../images/community_set_icon.png')}
                            markTitle = {'定制热门'}
                        />
                    </View>
                );
            }
            default:{
                return (
                    <CommunityCell item = {item} click = {() => {
                        this._clickTopItem(4,item)
                    }}/>
                );
            }
        }
    };

    render() {
        const {loading} = this.state;
        return (
            <View style = {{flex: 1}}>
                <FlatList
                    style = {styles.list}
                    data = {this.datas}
                    renderItem = {this._cell}
                    refreshControl = {(
                        <RefreshControl
                            title = 'Loading'
                            onRefresh = {this._onRefresh}
                            refreshing = {loading}
                            colors = {['#ffaa66cc', '#ff00ddff', '#ffffbb33', '#ffff4444']}
                        />
                    )}
                />
                {super.render()}
            </View>
        );
    }
}

const styles = StyleSheet.create({
    banner: {
        height: 150,
    },
    list: {
        flex: 1,
    },
    grid: {
        flex: 1,
        padding: 20,
        backgroundColor: 'white',
    },
    item: {
        alignItems: 'center',
        justifyContent: 'center',
        flexGrow: 1,
        width: 80,
    },
    itemText: {
        color: color.black,
        fontSize: 14,
        textAlign: 'center',
        marginTop: 15,
    },
    itemImage: {
        width: 30,
        height: 30,
    },
});

export default Community;


================================================
FILE: app/pages/community/week/week-hot.js
================================================

/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import BaseList from '../../../base/base-list';
import Api from '../../../api/api';

export default class WeekHot extends BaseList {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this._startRequest();
    }

    _startRequest = () => {
        this.loading();
        Api.get({api: 'week_hot/'}, (json) => {
            if (json.code !== 0) {
                this.toast(json.message);
            }else {
                this.reloadData(json.data.list);
            }
        });
    };

    render() {
        return super.render();
    }
}


================================================
FILE: app/pages/home/home-cell.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    Image,
    Text,
    StyleSheet,
    TouchableHighlight,
} from 'react-native';

import * as color from '../../constants/color';
import WHCImageButton from '../../components/whc-image-button';
import Api from '../../api/api';

class HomeCell extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    _clickCollection = (e) => {
        Alert.alert('点击收藏');
    };

    _clickMsg = (e) => {
        Alert.alert('点击阅读消息');
    };

    render() {
        const item = this.props.itemInfo;
        const click = this.props.click;
        return (
            <TouchableHighlight onPress = {click}>
                <View style = {styles.item}>
                    <View style = {styles.topsegv}/>
                    <View style = {styles.topv}>
                        <Image style = {styles.userImg}
                            source = {{uri: Api.main_url + item.userIcon}}
                        />
                        <Text style = {styles.author}>{item.author}</Text>
                        <Text style ={styles.date}>发布日期: {item.date}</Text>
                    </View>
                    <View style = {styles.bottomv}>
                        <View style = {styles.bottomleft}>
                            <Text style = {styles.title} numberOfLines = {2}>{item.title}</Text>
                            <Text style = {styles.content} numberOfLines = {2}>{item.detail}</Text>
                        </View>
                        <Image style = {styles.logoImg}
                            source = {{uri: Api.main_url + item.logoUrl}}
                        />
                    </View>
                    <View style = {styles.bottombar}>
                        <WHCImageButton
                            style = {styles.bottomButton}
                            imageSource = {require('../../images/collection_icon.png')}
                            text = {item.collectionCount}
                            imageStyle = {styles.collectionImg}
                            textStyle = {styles.bottomButtonText}
                            underlayColor = 'transparent'
                            onPress = {this._clickCollection}
                        />

                        <WHCImageButton
                            style = {styles.bottomButton}
                            imageSource = {require('../../images/msg_icon.png')}
                            text = {item.msgCount}
                            imageStyle = {styles.msgImg}
                            textStyle = {styles.bottomButtonText}
                            underlayColor = 'transparent'
                            onPress = {this._clickMsg}
                        />
                    </View>
                </View>
            </TouchableHighlight>
        );
    }
}

const styles = StyleSheet.create({
    topsegv: {
        backgroundColor: '#F4F6F9',
        height: 15,
    },
    topv: {
        flexDirection: 'row',
        marginTop: 25,
        alignItems: 'center',
    },
    bottomv: {
        flexDirection: 'row',
        paddingTop: 20,
        paddingRight: 20,
        height: 110,
    },
    bottomleft: {
        flexDirection: 'column',
        paddingLeft: 20,
        paddingRight: 10,
        flexShrink: 1,
        height: 90,
    },
    author: {
        marginLeft: 8,
    },
    logoImg: {
        height: 90,
        width: 90,
        borderRadius: 3,
        flexShrink: 0,

    },
    date: {
        textAlign: 'right',
        flexGrow: 1,
        marginRight: 20,
        color: '#8D9DA0',
    },
    item: {
        paddingTop: 0,
        paddingBottom: 10,
        backgroundColor: '#fff',
    },
    title: {
        fontSize: 17,
        color: color.black,
        fontWeight: 'bold',
    },
    content: {
        marginTop: 8,
        fontSize: 14,
        color: '#647079',
        flex: 1,

    },
    userImg: {
        height: 30,
        width: 30,
        marginLeft: 20,
        borderRadius: 15,
    },
    bottomButton: {
        flexDirection: 'row',
        alignItems: 'center',
    },
    bottomButtonText: {
        color: '#94A2B0',
        fontSize: 12,
        marginLeft: 5,
    },
    bottombar: {
        flexDirection: 'row',
        marginTop: 10,
        paddingLeft: 20,
        paddingRight: 20,
        alignItems: 'center',
    },
    msgImg: {
        width: 13,
        height: 13,
        marginLeft: 20,
    },
    collectionImg: {
        width: 16,
        height: 16,
    },
});

export default HomeCell;


================================================
FILE: app/pages/home/home.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
  View,
  StyleSheet,
  FlatList,
  RefreshControl,
  Text,
 }from 'react-native';

import HomeCell from './home-cell';
import Api from '../../api/api';
import Controller from '../../base/controller';

export default class Home extends Controller {

    constructor(props) {
        super(props);
        this.data_list = [];
        this.page = 1;
    }

    componentDidMount() {
        this._request();
    }

    _request = () => {
        this.loading();
        Api.get({
            api: 'home/',
            param: {
                page: this.page,
            }
        }, (json) => {
            if (this.page === 1) {
                this.data_list = [];
            }
            if (json.code === 0) {
                this.data_list = this.data_list.concat(json.data.list);
            }else {
                this.toast(json.message);
                this.data_list = [];
            }
            setTimeout(() => {
                this.loading(false);
            }, 2000);
        })
    };

    _onDownPullRefresh = (e) => {
        this.page = 1;
        this._request();
    };

    _onUpPullRefresh = (e) => {
        const {distanceFromEnd = 1} = e;
        if (distanceFromEnd < 0) {
            this.page += 1;
            this._request();
        }
    };

    _loadMoreItem = () => {
        return (
            <View style = {styles.footerLoad}>
                <Text>加载更多...</Text>
            </View>
        );
    };

    _clickItem = (item) => {
        this.push('Webv',{linkUrl: item.linkUrl, title: item.title});
    };

    render() {
        const {loading} = this.state;
        return (
            <View style = {{flex: 1}}>
                <FlatList
                    ListFooterComponent = {this._loadMoreItem}
                    refreshControl = {(
                        <RefreshControl
                            title = 'Loading'
                            onRefresh = {this._onDownPullRefresh}
                            refreshing = {loading}
                            colors = {['#ffaa66cc', '#ff00ddff', '#ffffbb33', '#ffff4444']}
                        />
                    )}
                    onEndReached = {this._onUpPullRefresh}
                    onEndReachedThreshold = {0}
                    style = {styles.list}
                    data = {this.data_list}
                    renderItem = {
                        ({item, index}) => (
                            <HomeCell key = {index} itemInfo = {item}
                                click = {() => {this._clickItem(item);}}
                            />
                        )
                    }>
                </FlatList>
                {super.render()}
            </View>
        );
    }
}

const styles = StyleSheet.create({
    list: {
        marginTop: 0,
    },
    footerLoad: {
        height: 40,
        justifyContent: 'center',
        alignItems: 'center',
    },
});



================================================
FILE: app/pages/launch/launch.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    StyleSheet,
    View,
    Animated, Easing,
} from 'react-native';

import * as color from '../../constants/color';
import Controller from '../../base/controller';

export default class Launch extends Controller {

    static navigationOptions = {
        header: null,
    };

    constructor(props) {
        super(props);
        this.state = {
            scale: new Animated.Value(1),
            opacity: new Animated.Value(1),
        };
    }

    componentDidMount() {
        const duration = 1500;
        Animated.parallel([
            Animated.timing(this.state.scale, {
                toValue: 2,
                duration: duration,
                easing: Easing.out(Easing.ease),
            }),
            Animated.timing(this.state.opacity, {
                toValue: 0,
                duration: duration,
                easing: Easing.out(Easing.ease),
            })
        ]).start(() => {
            this.setRootController('Tabbar');
        });

    }


    render() {
        const {scale, opacity} = this.state;
        return (
            <View style = {styles.view}>
                <Animated.Image style = {
                    {
                        flex: 1,
                        backgroundColor: color.theme,
                        opacity: opacity,
                        transform: [
                            {
                                scale: scale.interpolate({
                                    inputRange: [1, 2],
                                    outputRange: [1, 2.5],
                                })
                            }
                        ],
                    }
                }
                                source = {require('../../images/launch.png')}
                                resizeMode = 'contain'
                />
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: color.theme,
    },
});



================================================
FILE: app/pages/my/feedback/feedback.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    View,
    StyleSheet,
    TouchableHighlight,
    TextInput,
    Text,
} from 'react-native';

import * as color from '../../../constants/color';
import api from '../../../api/api';
import Controller from '../../../base/controller';

class Feedback extends Controller {

    constructor(props) {
        super(props);
        this.state = {
            loading: false,
            message: null
        };
        this._feedback = '';
    }

    _clickCommit = () => {
        if (this._feedback.length < 10) {
            this.toast('请最少输入10个字符');
            return;
        }
        this.loading();
        api.post({
            api: 'feedback/',
            param: {content: this._feedback},
        }, (json) => {
            this.toast(json.message);
        });

    };

    render() {
        return (
            <View style = {styles.view}>
                <TextInput style = {styles.input}
                    placeholder = {'请输入您的宝贵建议'}
                    underlineColorAndroid ='transparent'
                    onChangeText = {(text) => {this._feedback = text;}}
                    multiline = {true}/>
                    <TouchableHighlight style = {styles.commit}
                        onPress = {this._clickCommit}
                        underlayColor = {'transparent'}>
                        <Text style = {styles.text}>提 交</Text>
                    </TouchableHighlight>
                {super.render()}
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
        padding: 20,
    },
    input: {
        height: 100,
        backgroundColor: 'white',
    },
    text: {
        color: 'white',
        textAlign: 'center',
    },
    commit: {
        marginTop: 50,
        backgroundColor: color.theme,
        height: 44,
        borderRadius: 5,
        alignItems: 'center',
        justifyContent: 'center',
    },
});

export default Feedback;


================================================
FILE: app/pages/my/like/my-like.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import BaseList from '../../../base/base-list';
import Api from '../../../api/api';

export default class MyLike extends BaseList {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this._startRequest();
    }

    _startRequest = () => {
        this.loading(true);
        Api.get({api: 'my_like/'}, (json) => {
            if (json.code != 0) {
                this.toast(json.message);
            }else {
                this.reloadData(json.data.list);
            }
        });
    };

    render() {
        return super.render();
    }
}


================================================
FILE: app/pages/my/login/forget.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import React from 'react';
import {
    View,
    StyleSheet,
    ScrollView,
} from 'react-native';

import WHCButton from '../../../components/whc-button';
import * as color from '../../../constants/color';
import ModityInputItem from '../set/modity/modity-input-item';
import tool from '../../../components/tool';
import api from '../../../api/api';
import Controller from '../../../base/controller';

export default class Forget extends Controller {

    constructor(props) {
        super(props);
        this._username = '';
        this._email = '';
    }

    _commit = () => {
        if (this._username.length === 0) {
            this.toast('用户名不能为空');
            return;
        }
        if (this._email.length === 0) {
            this.toast('邮件地址不能为空');
            return;
        }
        if (!tool.isemail(this._email)) {
            this.toast('请输入正确的邮件地址');
            return;
        }
        this.loading();
        api.post({
            api: 'forget_password/',
            param: {
                username: this._username,
                email: this._email
            }
        }, (json) => {
            if (json.code === 0) {
                this.toast('您的密码:' + json.password);
                setTimeout(() => {
                    this.pop();
                }, 2000);
            }else {
                this.toast(json.message);
            }
        });
    };


    render() {
        return (
            <View style = {styles.view}>
                <ScrollView style = {{flex: 1}}>
                    <ModityInputItem style = {styles.input} key = {0} hint = {'请输入用户名'} onChangeText = {(text) => {this._username = text;}}/>
                    <ModityInputItem style = {styles.input} key = {1} hint = {'请输入邮件地址'} onChangeText = {(text) => {this._email = text;}}/>
                    <WHCButton style = {styles.commitBtn}
                               text = {'提交'}
                               key = {3}
                               textColor = {'white'}
                               onClick = {this._commit}/>
                </ScrollView>
                {super.render()}
            </View>
        );
    }
}


const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    input: {
        height: 44,
    },
    commitBtn: {
        marginTop: 50,
        marginLeft: 20,
        marginRight: 20,
        height: 44,
        borderRadius: 3,
        backgroundColor: color.theme,
    },
});


================================================
FILE: app/pages/my/login/login.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import React from 'react';
import {
    View,
    StyleSheet,
    ScrollView,
} from 'react-native';

import WHCButton from '../../../components/whc-button';
import * as color from '../../../constants/color';
import ModityInputItem from '../set/modity/modity-input-item';
import WHCText from '../../../components/whc-text';
import Storage from '../../../components/storage';
import Api from '../../../api/api';
import account from '../../../api/account';
import Controller from '../../../base/controller';
import { connect } from 'react-redux';
import {did_login} from "../../../actions/login-action";

class Login extends Controller {

    static navigationOptions = (options) => {
        options.headerRight = (<WHCButton style = {styles.rightItem}
                                          text = {'注册'}
                                          textColor = {color.theme}
                                          onClick = {() => {
                                              const {gotoRegisterBlock = null} = options.navigation;
                                              gotoRegisterBlock && gotoRegisterBlock();
                                          }}/>);
        Controller.navigationOptions(options);
        return options;
    }

    constructor(props) {
        super(props);
        this.state = {
            login: {},
        };
        this.props.navigation.gotoRegisterBlock = this._gotoRegister;
    }

    /**
     * 注册状态回调
     */
    _registerStateBlock = (isok) => {
        if (isok) {
            Storage.value('login', (login) => {
                this._setlogin(login);
            });
        }
    };

    _goLogin = () => {
        const user_name = this.user_name || '';
        const psw       = this.psw || '';
        if (user_name.length === 0) {
            this.toast('请输入用户名');
            return;
        }
        if (psw.length < 6 || psw.length > 20) {
            this.toast('密码为6-20位');
            return;
        }
        this.loading();
        Api.post({
            api: 'login/',
            param: {
                username: user_name,
                password: psw
            }
        }, (json) => {
            if (json.code !== 0) {
                this.toast(json.message);
            }else {
                account.user_info = json;
                this.loading(false);
                Storage.set('login', {
                    username: user_name,
                    password: psw
                }, () => {
                    this.props.dispatch(did_login(json));
                    this.pop();
                });
            }
        });
    };

    _gotoForgetPsw = () => {
        this.push('Forget', {title: '忘记密码'});
    };

    _gotoRegister = () => {
        this.push('Register', {title: '注册', block: this._registerStateBlock});
    };

    _setlogin = (login) => {
        this.user_name = login.username;
        this.psw = login.password;
        this.setState((state) => {
            state.login = login;
            return state;
        });
    };

    render() {
        return (
            <View style = {styles.view}>
                <ScrollView style = {{flex: 1 , backgroundColor: 'white'}}>
                    <View key = {0} style = {styles.topView}>
                        <WHCText style = {styles.logoText}
                                 text = {'React'}
                                 textColor = {'white'}
                                 fontSize = {20}/>
                    </View>
                    <View key = {1} style = {styles.bottomView}>
                        <ModityInputItem style = {styles.input}
                                         hint = {'请输入用户名'}
                                         key = {5}
                                         value = {this.state.login.username || ''}
                                         onChangeText = {(text) => {this.user_name = text}}/>
                        <ModityInputItem style = {styles.input}
                                         hint = {'请输入密码'}
                                         key = {6}
                                         value = {this.state.login.password || ''}
                                         ispasswrod = {true}
                                         onChangeText = {(text) => {this.psw = text}}/>
                    </View>
                    <WHCButton style = {styles.loginBtn}
                               text = {'登录'}
                               key = {2}
                               textColor = {'white'}
                               onClick = {this._goLogin}/>
                    <View style = {styles.forgetView}
                          key = {3}>
                        <WHCButton style = {styles.forgetBtn}
                                   text = {'忘记密码'}
                                   textColor = {color.theme}
                                   onClick = {this._gotoForgetPsw}/>
                    </View>
                </ScrollView>
                {super.render()}
            </View>
        );
    }
}


const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    rightItem: {
        width: 60,
        height: 30,
    },
    topView: {
        height: 180,
        justifyContent: 'center',
        alignItems: 'center',
    },
    logoText: {
        height: 70,
        width: 70,
        backgroundColor: color.theme,
        alignItems: 'center',
        justifyContent: 'center',
    },
    bottomView: {
        marginTop: 0,
    },
    input: {
        height: 44,
    },
    loginBtn: {
        marginTop: 50,
        marginLeft: 20,
        marginRight: 20,
        height: 44,
        borderRadius: 3,
        backgroundColor: color.theme,
    },
    forgetView: {
        alignItems: 'flex-end',
        padding: 20,
    },
    forgetBtn: {
        height: 30,
        width: 60,
    },
});


function select(store){
    return {};
}

export default connect(select)(Login);

================================================
FILE: app/pages/my/login/register.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import React from 'react';
import {
    View,
    StyleSheet,
    ScrollView,
} from 'react-native';

import WHCButton from '../../../components/whc-button';
import * as color from '../../../constants/color';
import ModityInputItem from '../set/modity/modity-input-item';
import Api from '../../../api/api';
import Tool from '../../../components/tool';
import Storage from '../../../components/storage';
import Controller from '../../../base/controller';

export default class Register extends Controller {

    constructor(props) {
        super(props);
    }

    _goRegister = () => {
        const user_name = this.user_name || '';
        const tel       = this.tel || '';
        const email     = this.email || '';
        const psw       = this.psw || '';
        const repsw     = this.repsw || '';
        if (user_name.length === 0) {
            this.toast('请输入用户名');
            return;
        }
        if (tel.length === 0) {
            this.toast('请输入手机号码');
            return;
        }
        if (!Tool.istel(tel)) {
            this.toast('请输入正确手机号格式');
            return;
        }
        if (email.length === 0) {
            this.toast('请输入电子邮箱');
            return;
        }
        if (!Tool.isemail(email)) {
            this.toast('请输入正确的电子邮箱格式');
            return;
        }
        if (psw.length < 6 || psw.length > 20) {
            this.toast('密码为6-20位');
            return;
        }
        if (psw !== repsw) {
            this.toast('两次密码输入不一致');
            return;
        }
        this.loading();
        Api.post({
            api: 'register/',
            param: {
                username: user_name,
                password: psw,
                mobile: tel,
                email: email,
            }
        }, (json) => {
            if (json.code !== 0) {
                this.toast(json.message);
            }else {
                this.loading(false);
                Storage.set('login', {
                    username: user_name,
                    password: psw
                }, () => {
                    const {block} = this.props.navigation.state.params;
                    block && block(true);
                    this.pop();
                });
            }
        });
    };


    render() {
        return (
            <View style = {styles.view}>
                <ScrollView style = {{flex: 1}}>
                    <ModityInputItem style = {styles.input} key = {0} hint = {'请输入用户名'} onChangeText = {(text) => {this.user_name = text}}/>
                    <ModityInputItem style = {styles.input} key = {1} hint = {'请输入手机号'} onChangeText = {(text) => {this.tel = text}}/>
                    <ModityInputItem style = {styles.input} key = {2} hint = {'请输入邮件地址'} onChangeText = {(text) => {this.email = text}}/>
                    <ModityInputItem style = {styles.input} key = {3} hint = {'请输入密码'} ispasswrod = {true} onChangeText = {(text) => {this.psw = text}}/>
                    <ModityInputItem style = {styles.input} key = {4} hint = {'请再次输入密码'} ispasswrod = {true} onChangeText = {(text) => {this.repsw = text}}/>
                    <WHCButton key = {5} style = {styles.registerBtn}
                               text = {'提交'}
                               textColor = {'white'}
                               onClick = {this._goRegister}/>
                </ScrollView>
                {super.render()}
            </View>
        );
    }
}


const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    input: {
        height: 44,
    },
    registerBtn: {
        marginTop: 50,
        marginLeft: 20,
        marginRight: 20,
        height: 44,
        borderRadius: 3,
        backgroundColor: color.theme,
    },
});


================================================
FILE: app/pages/my/my-header.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React, {Component} from 'react';
import {
    StyleSheet,
    View,
    Text,
    Image,
    TouchableHighlight,
} from 'react-native';

import * as color from '../../constants/color';
import Api from '../../api/api';

class MyHeader extends Component {
    constructor(props) {
        super(props);
        this.state = {};
    }

    render() {
        const {click, info} = this.props;
        let image = require('../../images/default_icon.png');
        if (info !== void 0 && info.image) {
            image = {uri: Api.main_url + info.image};
        }
        const user_name = info.username || '游客';
        const detail = info.detail || '暂未登录';
        return (
            <TouchableHighlight onPress = {click}>
                <View style = {styles.header}>
                    <Image style = {styles.userImg} source = {image}/>
                    <View style = {styles.userNameView}>
                        <Text style = {styles.titleText} numberOfLines = {1}>{user_name}</Text>
                        <Text style = {styles.detailText} numberOfLines = {1}>{detail}</Text>
                    </View>
                    <Image style = {styles.arrowImg} source = {require('../../images/right_arrow_icon.png')}/>
                </View>
            </TouchableHighlight>
        );
    }
}

const styles = StyleSheet.create({
    header: {
        flex: 1,
        flexDirection: 'row',
        padding: 20,
        alignItems: 'center',
        backgroundColor: 'white',

    },
    userImg: {
        width: 70,
        height: 70,
        borderRadius: 35,
    },
    userNameView: {
        marginLeft: 15,
        flexDirection: 'column',
        flexGrow: 1,
        height: 50,
    },
    titleText: {
        fontSize: 20,
        fontWeight: 'bold',
        color: color.black,
        flexGrow: 1,
    },
    detailText: {
        fontSize: 14,
        color: 'gray',
    },
    arrowImg: {
        width: 18,
        height: 18,
        marginLeft: 15,
    },
});

export default MyHeader;


================================================
FILE: app/pages/my/my-item.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React  from 'react';
import {
    View,
    StyleSheet,
    Image,
    Text,
    Switch,
    TouchableHighlight,
} from 'react-native';

import PropTypes from 'prop-types';
import WHCLine from '../../components/whc-line';
import * as color from '../../constants/color';

const propTypes = {
    click: PropTypes.func,
    img: PropTypes.object,
    title: PropTypes.string,
    value: PropTypes.string,
    isSwitch: PropTypes.bool,
};

const MyItem = ({img, title, value, click,isSwitch}) => {
    return (
        <TouchableHighlight onPress = {click} underlayColor = {'transparent'}>
            <View>
                <View style = {styles.item}>
                    <Image style = {styles.markImg} source = {img}/>
                    <Text style = {styles.titleText}>{title}</Text>
                    {isSwitch ? <Switch/> : <Text style = {styles.valueText}>{value}</Text>}
                </View>
                <WHCLine/>
            </View>
        </TouchableHighlight>
    );
};

MyItem.prototype = propTypes;

MyItem.defaultProps = {
    click() {},
    title: '',
    value: '',
    isSwitch: false,
    img: require('../../images/home_normal_icon.png')
};

const styles = StyleSheet.create({
    item: {
        backgroundColor: 'white',
        height: 50,
        flexDirection: 'row',
        alignItems: 'center',
        padding: 20,
    },
    markImg: {
        width: 20,
        height: 20,
    },
    titleText: {
        marginLeft: 20,
        flexGrow: 1,
        fontSize: 17,
        color: color.black,
    },
    valueText: {
        fontSize: 14,
        color: 'gray',
    },
});

export default MyItem;


================================================
FILE: app/pages/my/my.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    View,
    ScrollView,
    StyleSheet,
} from 'react-native';
import { connect } from 'react-redux';

import MyHeader from './my-header';
import WHCLine from '../../components/whc-line';
import MyItem from './my-item';
import Api from '../../api/api';
import Storage from '../../components/storage';
import Tool from '../../components/tool';
import account from '../../api/account';
import {CollectType} from '../../constants/app-constant';
import Controller from '../../base/controller';
import {did_login} from "../../actions/login-action";

class My extends Controller {

    constructor(props) {
        super(props);
        this.userInfo = {};
    }

    componentDidMount() {
        this._autoLogin();

    }

    shouldComponentUpdate(nextProps, nextState) {
        this.userInfo = nextProps.userInfo;
        return true;
    }

    _clickItem = (view, param) => {
        if (view) {
            if (account.did_login) {
                this.push(view, param);
            }else {
                this.push('Login', {title: '登录'});
            }
        }
    };

    _startRequest = () => {
        if (!account.did_login) {
            this._autoLogin();
        }
    };

    _autoLogin = () => {
        Storage.value('login', (login) => {
            if (login && Tool.count(login) === 2) {
                this.loading();
                Api.post({
                    api: 'login/',
                    param: login,
                }, (json) => {
                    account.user_info = json;
                    this.props.dispatch(did_login(json));
                    this.loading(false);
                });
            }
        });
    };

    render() {
        const {userInfo}  = this;
        const {lovenum = null, collectnum = null, readnum = null} = userInfo;
        const love_num    = lovenum ? lovenum + '篇' : '';
        const collect_num = collectnum ? collectnum + '个' : '';
        const read_num    = readnum ? readnum + '篇' : '';

        return (
            <View style = {styles.view}>
                <ScrollView style = {styles.scrollView}>
                    <MyHeader style = {styles.header}
                              info = {userInfo}
                              click = {() => {
                                  this._clickItem('User', {title: '个人信息', user_info: userInfo});
                              }}/>
                    <WHCLine/>
                    <View style = {styles.section1}>
                        <MyItem img = {require('../../images/my_love_icon.png')}
                                title = {'我喜欢的'}
                                value = {love_num}
                                click = {() => {
                                    this._clickItem('MyLike', {title: '我喜欢的'});
                                }}
                        />
                        <MyItem img = {require('../../images/my_collect_icon.png')}
                                title = {'我的收藏集'}
                                value = {collect_num}
                                click = {() => {
                                    this._clickItem('Collect', {title: '我的收藏集', type: CollectType.my_collect});
                                }}
                        />
                        <MyItem img = {require('../../images/my_read_icon.png')}
                                title = {'阅读过的文章'}
                                value = {read_num}
                                click = {() => {
                                    this._clickItem('DidRead', {title: '阅读过的文章'});
                                }}
                        />
                    </View>

                    <View style = {styles.section2}>
                        <MyItem img = {require('../../images/my_suggest_icon.png')}
                                title = {'意见反馈'}
                                click = {() => {
                                    this._clickItem('Feedback', {title: '意见反馈'});
                                }}
                        />
                        <MyItem img = {require('../../images/my_set_icon.png')}
                                title = {'设置'}
                                click = {() => {
                                    this._clickItem('Set', {title: '设置', user_info: userInfo});
                                }}
                        />
                    </View>
                </ScrollView>
                {super.render()}
            </View>
        )
    }
};

const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    scrollView: {
        flex: 1,
        backgroundColor: '#F4F6F9',
        paddingTop: 15,
        paddingBottom: 15,
    },
    header: {
        flex: 1,
    },
    section1: {
        marginTop: 15,
        backgroundColor: 'white',
    },
    section2: {
        marginTop: 15,
        backgroundColor: 'white',
    },
});

function select(store){
    return {
        isLogin: store.loginState.isLogin,
        userInfo: store.loginState.userInfo,
    }
}


export default connect(select)(My);



================================================
FILE: app/pages/my/read/did-read.js
================================================

/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import BaseList from '../../../base/base-list';
import Api from '../../../api/api';

export default class DidRead extends BaseList {
    constructor(props) {
        super(props);
    }

    componentDidMount() {
        this._startRequest();
    }

    _startRequest = () => {
        this.loading(true);
        Api.get({api: 'did_read/'}, (json) => {
            if (json.code !== 0) {
                this.toast(json.message);
            }else {
                this.reloadData(json.data.list);
            }
        });
    };

    render() {
        return super.render();
    }
}


================================================
FILE: app/pages/my/set/modity/modify.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import React from 'react';
import {
    View,
    StyleSheet,
    Text,
    TouchableHighlight,
} from 'react-native';

import {ModifyType} from '../../../../constants/app-constant';
import ModityInputItem from './modity-input-item';
import * as color from '../../../../constants/color';
import tool from '../../../../components/tool';
import storage from '../../../../components/storage';
import account from '../../../../api/account';
import Api from '../../../../api/api';
import Controller from '../../../../base/controller';

class Modity extends Controller {

    constructor(props) {
        super(props);

        this._mobile = '';
        this._email = '';
        this._new_psw = '';
        this._current_psw = '';
        this._renew_psw = '';
    }

    _clickCommit = () => {
        let param = {username: account.user_info.username,};
        let api = '';
        const {type} = this.props.navigation.state.params;
        switch (type) {
            case ModifyType.mobile:
                if (this._mobile.length === 0 || !tool.istel(this._mobile)) {
                    this.toast('手机号格式不对');
                    return;
                }
                api = 'modify_mobile/';
                param.mobile = this._mobile;
                break;
            case ModifyType.email:
                if (this._email.length === 0 || !tool.isemail(this._email)) {
                    this.toast('邮件格式不对');
                    return;
                }
                api = 'modify_email/';
                param.email = this._email;
                break;
            case ModifyType.password:
                if (this._current_psw.length === 0) {
                    this.toast('当前密码不能为空');
                    return;
                }
                if (this._new_psw.length < 6 || this._new_psw.length > 20) {
                    this.toast('密码范围6-20字符');
                    return;
                }
                if (this._new_psw !== this._renew_psw) {
                    this.toast('两次新密码输入不一致');
                    return;
                }
                storage.value('login', (login) => {

                });
                api = 'modity_psw/';
                param.password = this._current_psw;
                param.newpassword = this._new_psw;
                break;
            default:
                this.toast('修改类型不存在');
                return;

        }
        this.loading();
        Api.post({
            api: api,
            param: param,
        }, (json) => {
            if (json.code === 0) {
                this.toast('修改成功');
                setTimeout(() => {
                    this.pop();
                }, 2000);
            }else {
                this.toast(json.message);
            }
        });
    };

    render() {
        const {params} = this.props.navigation.state;
        let input_items = [];
        switch (params.type) {
            case ModifyType.mobile: {
                input_items.push(<ModityInputItem hint = {'请输入新手机号'} onChangeText = {(text) => {this._mobile = text;}}/>);
                break;
            }
            case ModifyType.email: {
                input_items.push(<ModityInputItem hint = {'请输入新邮箱'} onChangeText = {(text) => {this._email = text;}}/>);
                break;
            }
            case ModifyType.password: {
                input_items.push(<ModityInputItem hint = {'请输入旧密码'} ispasswrod = {true} onChangeText = {(text) => {this._current_psw = text;}}/>);
                input_items.push(<ModityInputItem hint = {'请输入新密码'} ispasswrod = {true} onChangeText = {(text) => {this._new_psw = text;}}/>);
                input_items.push(<ModityInputItem hint = {'请重复输入新密码'} ispasswrod = {true} onChangeText = {(text) => {this._renew_psw = text;}}/>);
                break;
            }
        }
        return (
            <View style = {styles.view}>
                {input_items}
                <TouchableHighlight style = {styles.commit}
                    onPress = {this._clickCommit}>
                    <Text style = {styles.text}>提 交</Text>
                </TouchableHighlight>
                {super.render()}
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
        paddingTop: 20,
    },
    text: {
        color: 'white',
        textAlign: 'center',
    },
    commit: {
        marginTop: 50,
        marginLeft: 20,
        marginRight: 20,
        backgroundColor: color.theme,
        height: 44,
        borderRadius: 5,
        alignItems: 'center',
        justifyContent: 'center',
    },
});

export default Modity;


================================================
FILE: app/pages/my/set/modity/modity-input-item.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React , {Component} from 'react';
import {
    View,
    StyleSheet,
    TextInput,
} from 'react-native';

import WHCLine from '../../../../components/whc-line';

ModityInputItem = ({
hint,
ispasswrod,
fontSize,
value,
onChangeText,
}) => {
    return (
        [<View style = {styles.view}>
            <TextInput placeholder = {hint}
             underlineColorAndroid ='transparent'
                      defaultValue = {value || ''}
                          fontSize = {fontSize || 14}
                   secureTextEntry = {ispasswrod || false}
                      onChangeText = {onChangeText}/>
        </View>,
        <WHCLine/>]
    );
};

const styles = StyleSheet.create({
    view: {
        padding: 15,
        backgroundColor: 'white',
    },
});

export default ModityInputItem;


================================================
FILE: app/pages/my/set/set-item.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import React, {Component} from 'react';
import {
    View,
    Text,
    StyleSheet,
    TouchableHighlight,
} from 'react-native';


SetItem = ({
title,
value,
onClick,
}) => {
    return (
        <TouchableHighlight onPress = {onClick}>
            <View style = {styles.view}>
                <Text style = {styles.title}>{title}</Text>
                <Text style = {styles.value}>{value}</Text>
            </View>
        </TouchableHighlight>
    )
};

const styles = StyleSheet.create({
    view: {
        paddingTop: 15,
        paddingBottom: 15,
        paddingLeft: 15,
        paddingRight: 15,
        flexDirection: 'row',
        backgroundColor: 'white',
    },
    title: {
        textAlign: 'left',
        flexGrow: 1,
    },
    value: {
        textAlign: 'right',
        flexGrow: 1,
    },
});

export default SetItem;


================================================
FILE: app/pages/my/set/set.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    View,
    StyleSheet,
    ScrollView,
} from 'react-native';

import { connect } from 'react-redux';
import SetItem from './set-item';
import WHCLine from '../../../components/whc-line';
import {ModifyType} from '../../../constants/app-constant';
import * as color from '../../../constants/color';
import WHCButton from '../../../components/whc-button';
import account from '../../../api/account';
import Controller from '../../../base/controller';
import {did_logout} from '../../../actions/login-action';

class Set extends Controller {

    constructor(props) {
        super(props);
    }

    _gotoModityUI = (title, type) => {
        this.push('Modify', {title: title, type: type});
    };

    _exitLogin = () => {
        account.exit_login();
        this.props.dispatch(did_logout());
        this.pop();
    };

    render() {
        const {user_info} = this.props.navigation.state.params;
        return (
            <View style = {styles.v}>
                <ScrollView>
                    <SetItem title = {'邮箱'}
                        value = {user_info.email}
                        onClick = {() => {
                            this._gotoModityUI('修改邮箱', ModifyType.email);
                        }}/>
                    <WHCLine/>
                    <SetItem title = {'手机号'}
                         value = {user_info.mobile}
                         onClick = {() => {
                             this._gotoModityUI('修改手机号', ModifyType.mobile);
                         }}/>
                    <WHCLine/>
                    <SetItem title = {'修改账户密码'}
                             onClick = {() => {
                                 this._gotoModityUI('修改密码', ModifyType.password);
                             }}/>
                    <WHCLine/>
                    <WHCButton style = {styles.exit}
                               text = {'退出登录'}
                               textColor = {'white'}
                               onClick = {this._exitLogin}/>
                </ScrollView>
            </View>
        );
    }
}


const styles = StyleSheet.create({
    v: {
        flex: 1,
    },
    exit: {
        marginTop: 50,
        marginLeft: 20,
        marginRight: 20,
        height: 44,
        borderRadius: 3,
        backgroundColor: color.theme,
    },
});

function select(store){
    return {};
}


export default connect(select)(Set);



================================================
FILE: app/pages/my/user/user.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import React from 'react';
import {
    View,
    StyleSheet,
    ScrollView,
} from 'react-native';
import SetItem from '../set/set-item';
import WHCLine from '../../../components/whc-line';
import Controller from '../../../base/controller';

export default class User extends Controller {

    constructor(props) {
        super(props);
    }

    render() {
        const {user_info} = this.props.navigation.state.params;
        return (
            <View style = {styles.v}>
                <ScrollView>
                    <SetItem title = {'用户名'}
                        value = {user_info.username}
                    />
                    <WHCLine/>
                    <SetItem title = {'邮箱'}
                        value = {user_info.email}
                    />
                    <WHCLine/>
                    <SetItem title = {'手机号'}
                         value = {user_info.mobile}
                    />
                    <WHCLine/>
                </ScrollView>
            </View>
        );
    }
}


const styles = StyleSheet.create({
    v: {
        flex: 1,
    },
});


================================================
FILE: app/pages/webview/webv.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */


import React from 'react';
import {
    View,
    WebView,
    StyleSheet,
    BackHandler,
} from 'react-native';

import Controller from '../../base/controller';

class Webv extends Controller {

    constructor(props) {
        super(props);
        this.canGoBack = false;
    }

    componentDidMount () {
        BackHandler.addEventListener('hardwareBackPress', this._androidGoBack);
    }

    canBack () {
        return !this._androidGoBack();
    }

    _androidGoBack = () => {
        if (this.canGoBack) {
            this.webview.goBack();
            return true;
        }
        return false;
    };

    _onNavigationStateChange = (navState) => {
        const {title = ''} = navState;
        this.setTitle(title);
        this.canGoBack = navState.canGoBack;
    };

    render() {
        const { params } = this.props.navigation.state;
        return (
            <View style = {styles.view}>
                <WebView
                    ref = {(ref) => {this.webview = ref}}
                    style = {styles.web}
                    onNavigationStateChange = {this._onNavigationStateChange}
                    source = {{uri: params.linkUrl}}/>
            </View>
        );
    }
}

const styles = StyleSheet.create({
    view: {
        flex: 1,
    },
    web: {
        flex: 1,
    }
});

export default Webv;


================================================
FILE: app/reducers/index.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import { combineReducers } from 'redux';
import loginState from './login';

const rootReducer = combineReducers({
    loginState
});

export default rootReducer;


================================================
FILE: app/reducers/login.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import * as types from '../constants/action-type';

const initState = {
    isLogin: false,
    userInfo: {},
};

export default function loginState(state=initState, action) {
    switch (action.type) {
        case types.DID_LOGIN:
            return {
                ...state,
                isLogin: true,
                userInfo: action.userInfo,
            };
        case types.DID_LOGOUT:
            return {
                ...state,
                isLogin: false,
                userInfo: {},
            };
        default:
            return state;
    }
}


================================================
FILE: app/store/configure-stroe.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import rootReducer from '../reducers/index';

const createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(createStore);

export default function configureStore(initialState) {
    return createStoreWithMiddleware(rootReducer, initialState);
}


================================================
FILE: app.json
================================================
{
  "name": "whcapp",
  "displayName": "whcapp"
}


================================================
FILE: index.js
================================================
/**
 *
 * Copyright 2017-present whcapp
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 * https://github.com/netyouli/whcapp
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

import { AppRegistry } from 'react-native';
import App from './app/App';

AppRegistry.registerComponent('whcapp', () => App);


================================================
FILE: ios/whcapp/AppDelegate.h
================================================
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#import <UIKit/UIKit.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic, strong) UIWindow *window;

@end


================================================
FILE: ios/whcapp/AppDelegate.m
================================================
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation;
  
  jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];

  RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                      moduleName:@"whcapp"
                                               initialProperties:nil
                                                   launchOptions:launchOptions];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1];

  self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
  UIViewController *rootViewController = [UIViewController new];
  rootView.backgroundColor = [[UIColor alloc] initWithRed:230.0 / 255.0 green:80.0 / 255.0 blue:88.0 / 255.0 alpha:1];
  rootViewController.view = rootView;
  self.window.rootViewController = rootViewController;
  [self.window makeKeyAndVisible];
  return YES;
}

@end


================================================
FILE: ios/whcapp/Base.lproj/LaunchScreen.xib
================================================
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13529" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES">
    <device id="retina4_7" orientation="portrait">
        <adaptation id="fullscreen"/>
    </device>
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13527"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <objects>
        <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
        <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
        <view contentMode="scaleToFill" id="iN0-l3-epB">
            <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
            <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
            <subviews>
                <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="launch" translatesAutoresizingMaskIntoConstraints="NO" id="Q0v-cQ-x6h">
                    <rect key="frame" x="0.0" y="0.0" width="480" height="480"/>
                </imageView>
            </subviews>
            <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
            <constraints>
                <constraint firstItem="Q0v-cQ-x6h" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="top" id="I8F-ke-sve"/>
                <constraint firstAttribute="bottom" secondItem="Q0v-cQ-x6h" secondAttribute="bottom" id="VfF-jj-Oy5"/>
                <constraint firstItem="Q0v-cQ-x6h" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" id="eRm-qc-2dF"/>
                <constraint firstAttribute="trailing" secondItem="Q0v-cQ-x6h" secondAttribute="trailing" id="rzg-rP-dE4"/>
            </constraints>
            <nil key="simulatedStatusBarMetrics"/>
            <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
            <point key="canvasLocation" x="-91" y="4"/>
        </view>
    </objects>
    <resources>
        <image name="launch" width="617" height="1098"/>
    </resources>
</document>


================================================
FILE: ios/whcapp/Images.xcassets/AppIcon.appiconset/Contents.json
================================================
{
  "images" : [
    {
      "size" : "20x20",
      "idiom" : "iphone",
      "filename" : "Icon-Notification@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "20x20",
      "idiom" : "iphone",
      "filename" : "Icon-Notification@3x.png",
      "scale" : "3x"
    },
    {
      "size" : "29x29",
      "idiom" : "iphone",
      "filename" : "Icon-Small@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "29x29",
      "idiom" : "iphone",
      "filename" : "Icon-Small@3x.png",
      "scale" : "3x"
    },
    {
      "size" : "40x40",
      "idiom" : "iphone",
      "filename" : "Icon-Small-40@2x.png",
      "scale" : "2x"
    },
    {
      "size" : "40x40",
      "idiom" : "iphone",
      "filename" : "Icon-Small-40@3x.png",
      "scale" : "3x"
    },
    {
      "size" : "60x60",
      "idiom" : "iphone",
      "filename" : "Icon-Small-40@3x-1.png",
      "scale" : "2x"
    },
    {
      "size" : "60x60",
      "idiom" : "iphone",
      "filename" : "Icon-60@3x.png",
      "scale" : "3x"
    },
    {
      "idiom" : "ios-marketing",
      "size" : "1024x1024",
      "scale" : "1x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: ios/whcapp/Images.xcassets/Contents.json
================================================
{
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: ios/whcapp/Images.xcassets/launch.imageset/Contents.json
================================================
{
  "images" : [
    {
      "idiom" : "universal",
      "scale" : "1x"
    },
    {
      "idiom" : "universal",
      "filename" : "launch.png",
      "scale" : "2x"
    },
    {
      "idiom" : "universal",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: ios/whcapp/Images.xcassets/loading.imageset/Contents.json
================================================
{
  "images" : [
    {
      "idiom" : "universal",
      "scale" : "1x"
    },
    {
      "idiom" : "universal",
      "filename" : "loading.png",
      "scale" : "2x"
    },
    {
      "idiom" : "universal",
      "scale" : "3x"
    }
  ],
  "info" : {
    "version" : 1,
    "author" : "xcode"
  }
}

================================================
FILE: ios/whcapp/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleDisplayName</key>
	<string>whc</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsArbitraryLoads</key>
		<true/>
	</dict>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string></string>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
	</array>
	<key>UIViewControllerBasedStatusBarAppearance</key>
	<false/>
</dict>
</plist>


================================================
FILE: ios/whcapp/main.m
================================================
/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#import <UIKit/UIKit.h>

#import "AppDelegate.h"

int main(int argc, char * argv[]) {
  @autoreleasepool {
    return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
  }
}


================================================
FILE: ios/whcapp-tvOS/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIRequiredDeviceCapabilities</key>
	<array>
		<string>armv7</string>
	</array>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UIViewControllerBasedStatusBarAppearance</key>
	<false/>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string></string>
	<key>NSAppTransportSecurity</key>
	<!--See http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ -->
	<dict>
		<key>NSExceptionDomains</key>
		<dict>
			<key>localhost</key>
			<dict>
				<key>NSExceptionAllowsInsecureHTTPLoads</key>
				<true/>
			</dict>
		</dict>
	</dict>
</dict>
</plist>


================================================
FILE: ios/whcapp-tvOSTests/Info.plist
================================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>en</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>$(PRODUCT_NAME)</string>
	<key>CFBundlePackageType</key>
	<string>BNDL</string>
	<key>CFBundleShortVersionString</key>
	<string>1.0</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>1</string>
</dict>
</plist>


================================================
FILE: ios/whcapp.xcodeproj/project.pbxproj
================================================
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
		00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
		00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
		00C302E81ABCBA2D00DB3ED1 /* libRCTImage.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302C01ABCB91800DB3ED1 /* libRCTImage.a */; };
		00C302E91ABCBA2D00DB3ED1 /* libRCTNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302DC1ABCB9D200DB3ED1 /* libRCTNetwork.a */; };
		00C302EA1ABCBA2D00DB3ED1 /* libRCTVibration.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302E41ABCB9EE00DB3ED1 /* libRCTVibration.a */; };
		00E356F31AD99517003FC87E /* whcappTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* whcappTests.m */; };
		133E29F31AD74F7200F7D852 /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 78C398B91ACF4ADC00677621 /* libRCTLinking.a */; };
		139105C61AF99C1200B5F7CC /* libRCTSettings.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139105C11AF99BAD00B5F7CC /* libRCTSettings.a */; };
		139FDEF61B0652A700C62182 /* libRCTWebSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 139FDEF41B06529B00C62182 /* libRCTWebSocket.a */; };
		13B07FBC1A68108700A75B9A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
		13B07FBD1A68108700A75B9A /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB11A68108700A75B9A /* LaunchScreen.xib */; };
		13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
		13B07FC11A68108700A75B9A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
		140ED2AC1D01E1AD002B40FF /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
		146834051AC3E58100842450 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 146834041AC3E56700842450 /* libReact.a */; };
		2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB01A68108700A75B9A /* AppDelegate.m */; };
		2D02E4BD1E0B4A84006451C7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
		2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 13B07FB71A68108700A75B9A /* main.m */; };
		2D02E4C21E0B4AEC006451C7 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157351DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
		2D02E4C31E0B4AEC006451C7 /* libRCTImage-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E841DF850E9000B6D8A /* libRCTImage-tvOS.a */; };
		2D02E4C41E0B4AEC006451C7 /* libRCTLinking-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E881DF850E9000B6D8A /* libRCTLinking-tvOS.a */; };
		2D02E4C51E0B4AEC006451C7 /* libRCTNetwork-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E8C1DF850E9000B6D8A /* libRCTNetwork-tvOS.a */; };
		2D02E4C61E0B4AEC006451C7 /* libRCTSettings-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E901DF850E9000B6D8A /* libRCTSettings-tvOS.a */; };
		2D02E4C71E0B4AEC006451C7 /* libRCTText-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E941DF850E9000B6D8A /* libRCTText-tvOS.a */; };
		2D02E4C81E0B4AEC006451C7 /* libRCTWebSocket-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3E991DF850E9000B6D8A /* libRCTWebSocket-tvOS.a */; };
		2D02E4C91E0B4AEC006451C7 /* libReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DAD3EA31DF850E9000B6D8A /* libReact.a */; };
		2DCD954D1E0B4F2C00145EB5 /* whcappTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 00E356F21AD99517003FC87E /* whcappTests.m */; };
		5E9157361DD0AC6A00FF2AA8 /* libRCTAnimation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5E9157331DD0AC6500FF2AA8 /* libRCTAnimation.a */; };
		832341BD1AAA6AB300B99B32 /* libRCTText.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 832341B51AAA6A8300B99B32 /* libRCTText.a */; };
		ADBDB9381DFEBF1600ED6528 /* libRCTBlob.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ADBDB9271DFEBF0700ED6528 /* libRCTBlob.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
		00C302AB1ABCB8CE00DB3ED1 /* PBXContainerItemProxy */ = {
			isa = PBXContainerItemProxy;
			containerPortal = 00C302A71ABCB8CE00DB3ED1 /* RCTActionSheet.xcodeproj */;
			proxyType = 2;
	
Download .txt
gitextract_rvuho2zj/

├── .babelrc
├── .buckconfig
├── .flowconfig
├── .gitattributes
├── .gitignore
├── .tern-project
├── .watchmanconfig
├── LICENSE
├── README.md
├── __tests__/
│   └── App.js
├── android/
│   ├── app/
│   │   ├── BUCK
│   │   ├── app-release.apk
│   │   ├── build.gradle
│   │   ├── proguard-rules.pro
│   │   └── src/
│   │       └── main/
│   │           ├── AndroidManifest.xml
│   │           ├── java/
│   │           │   └── com/
│   │           │       └── whcapp/
│   │           │           ├── MainActivity.java
│   │           │           └── MainApplication.java
│   │           └── res/
│   │               ├── values/
│   │               │   ├── dimens.xml
│   │               │   ├── strings.xml
│   │               │   └── styles.xml
│   │               ├── values-v21/
│   │               │   └── styles.xml
│   │               └── values-w820dp/
│   │                   └── dimens.xml
│   ├── build.gradle
│   ├── gradle/
│   │   └── wrapper/
│   │       ├── gradle-wrapper.jar
│   │       └── gradle-wrapper.properties
│   ├── gradle.properties
│   ├── gradlew
│   ├── gradlew.bat
│   ├── keystores/
│   │   ├── BUCK
│   │   └── debug.keystore.properties
│   └── settings.gradle
├── app/
│   ├── App.js
│   ├── actions/
│   │   └── login-action.js
│   ├── api/
│   │   ├── account.js
│   │   └── api.js
│   ├── base/
│   │   ├── base-list.js
│   │   └── controller.js
│   ├── components/
│   │   ├── storage.js
│   │   ├── tool.js
│   │   ├── whc-banner.js
│   │   ├── whc-button.js
│   │   ├── whc-grid-view.js
│   │   ├── whc-image-button.js
│   │   ├── whc-line.js
│   │   ├── whc-loading.js
│   │   ├── whc-text.js
│   │   └── whc-toast.js
│   ├── constants/
│   │   ├── action-type.js
│   │   ├── app-constant.js
│   │   ├── color.js
│   │   └── screen.js
│   ├── containers/
│   │   ├── navigation.js
│   │   └── tabbar.js
│   ├── pages/
│   │   ├── blank/
│   │   │   └── blank.js
│   │   ├── community/
│   │   │   ├── activity/
│   │   │   │   └── offline-activity.js
│   │   │   ├── collect/
│   │   │   │   ├── collect-cell.js
│   │   │   │   └── collect.js
│   │   │   ├── column/
│   │   │   │   └── special-column.js
│   │   │   ├── community-cell.js
│   │   │   ├── community-section.js
│   │   │   ├── community.js
│   │   │   └── week/
│   │   │       └── week-hot.js
│   │   ├── home/
│   │   │   ├── home-cell.js
│   │   │   └── home.js
│   │   ├── launch/
│   │   │   └── launch.js
│   │   ├── my/
│   │   │   ├── feedback/
│   │   │   │   └── feedback.js
│   │   │   ├── like/
│   │   │   │   └── my-like.js
│   │   │   ├── login/
│   │   │   │   ├── forget.js
│   │   │   │   ├── login.js
│   │   │   │   └── register.js
│   │   │   ├── my-header.js
│   │   │   ├── my-item.js
│   │   │   ├── my.js
│   │   │   ├── read/
│   │   │   │   └── did-read.js
│   │   │   ├── set/
│   │   │   │   ├── modity/
│   │   │   │   │   ├── modify.js
│   │   │   │   │   └── modity-input-item.js
│   │   │   │   ├── set-item.js
│   │   │   │   └── set.js
│   │   │   └── user/
│   │   │       └── user.js
│   │   └── webview/
│   │       └── webv.js
│   ├── reducers/
│   │   ├── index.js
│   │   └── login.js
│   └── store/
│       └── configure-stroe.js
├── app.json
├── index.js
├── ios/
│   ├── whcapp/
│   │   ├── AppDelegate.h
│   │   ├── AppDelegate.m
│   │   ├── Base.lproj/
│   │   │   └── LaunchScreen.xib
│   │   ├── Images.xcassets/
│   │   │   ├── AppIcon.appiconset/
│   │   │   │   └── Contents.json
│   │   │   ├── Contents.json
│   │   │   ├── launch.imageset/
│   │   │   │   └── Contents.json
│   │   │   └── loading.imageset/
│   │   │       └── Contents.json
│   │   ├── Info.plist
│   │   └── main.m
│   ├── whcapp-tvOS/
│   │   └── Info.plist
│   ├── whcapp-tvOSTests/
│   │   └── Info.plist
│   ├── whcapp.xcodeproj/
│   │   ├── project.pbxproj
│   │   └── xcshareddata/
│   │       └── xcschemes/
│   │           ├── whcapp-tvOS.xcscheme
│   │           └── whcapp.xcscheme
│   └── whcappTests/
│       ├── Info.plist
│       └── whcappTests.m
├── package.json
└── release_ios/
    ├── main.jsbundle
    └── main.jsbundle.meta
Download .txt
SYMBOL INDEX (146 symbols across 43 files)

FILE: android/app/src/main/java/com/whcapp/MainActivity.java
  class MainActivity (line 5) | public class MainActivity extends ReactActivity {
    method getMainComponentName (line 11) | @Override

FILE: android/app/src/main/java/com/whcapp/MainApplication.java
  class MainApplication (line 14) | public class MainApplication extends Application implements ReactApplica...
    method getUseDeveloperSupport (line 17) | @Override
    method getPackages (line 22) | @Override
    method getJSMainModuleName (line 29) | @Override
    method getReactNativeHost (line 35) | @Override
    method onCreate (line 40) | @Override

FILE: app/App.js
  class App (line 29) | class App extends Component {
    method render (line 31) | render() {

FILE: app/actions/login-action.js
  function did_login (line 22) | function did_login(userInfo = {}) {
  function did_logout (line 29) | function did_logout() {

FILE: app/api/account.js
  class Account (line 22) | class Account {
    method exit_login (line 31) | static exit_login() {

FILE: app/api/api.js
  class Api (line 22) | class Api {
    method get (line 28) | static get({api, param, headers}, block) {
    method post (line 40) | static post({api, param, headers}, block) {
    method request (line 52) | static request({api = null,

FILE: app/base/base-list.js
  class BaseList (line 31) | class BaseList extends Controller {
    method constructor (line 33) | constructor(props) {
    method render (line 49) | render() {

FILE: app/base/controller.js
  class Controller (line 35) | class Controller extends Component {
    method constructor (line 91) | constructor(props) {
    method canBack (line 108) | canBack() {
    method render (line 247) | render() {

FILE: app/components/storage.js
  class Storage (line 23) | class Storage {
    method value (line 30) | static value(key, block) {
    method set (line 45) | static set(key, value, block) {
    method remove (line 60) | static remove(key, block) {

FILE: app/components/tool.js
  class Tool (line 20) | class Tool {
    method istel (line 24) | static istel(tel) {
    method isemail (line 35) | static isemail(email) {
    method count (line 46) | static count(object) {

FILE: app/components/whc-banner.js
  class WHCBannerIndicater (line 32) | class WHCBannerIndicater extends Component {
    method constructor (line 33) | constructor(props) {
    method render (line 46) | render() {
  class WHCBanner (line 65) | class WHCBanner extends Component {
    method constructor (line 66) | constructor(props) {
    method componentDidMount (line 73) | componentDidMount() {
    method componentWillUnmount (line 80) | componentWillUnmount() {
    method render (line 151) | render() {

FILE: app/components/whc-grid-view.js
  method renderItem (line 93) | renderItem(){}

FILE: app/components/whc-image-button.js
  class WHCImageButton (line 28) | class WHCImageButton extends Component {
    method constructor (line 29) | constructor(props) {
    method render (line 34) | render() {

FILE: app/components/whc-line.js
  class WHCLine (line 28) | class WHCLine extends Component {
    method constructor (line 29) | constructor(props) {
    method render (line 34) | render() {

FILE: app/components/whc-loading.js
  class WHCLoading (line 30) | class WHCLoading extends Component {
    method constructor (line 31) | constructor(props) {
    method componentWillUnmount (line 38) | componentWillUnmount() {
    method render (line 62) | render() {

FILE: app/components/whc-toast.js
  class WHCToast (line 30) | class WHCToast extends Component {
    method constructor (line 31) | constructor(props) {
    method componentWillUnmount (line 38) | componentWillUnmount() {
    method render (line 76) | render() {

FILE: app/constants/action-type.js
  constant DID_LOGOUT (line 5) | const DID_LOGOUT = 'DID_LOGOUT';
  constant DID_LOGIN (line 10) | const DID_LOGIN = 'DID_LOGIN';

FILE: app/pages/blank/blank.js
  class Blank (line 29) | class Blank extends Component {
    method constructor (line 34) | constructor(props) {
    method render (line 39) | render () {

FILE: app/pages/community/activity/offline-activity.js
  class OfflineActivity (line 23) | class OfflineActivity extends BaseList {
    method constructor (line 24) | constructor(props) {
    method componentDidMount (line 28) | componentDidMount() {
    method render (line 43) | render() {

FILE: app/pages/community/collect/collect.js
  class Collect (line 32) | class Collect extends Controller {
    method constructor (line 34) | constructor(props) {
    method componentDidMount (line 39) | componentDidMount() {
    method render (line 67) | render() {

FILE: app/pages/community/column/special-column.js
  class SpecialColumn (line 31) | class SpecialColumn extends Constroller {
    method constructor (line 33) | constructor(props) {
    method componentDidMount (line 38) | componentDidMount() {
    method render (line 60) | render() {

FILE: app/pages/community/community-cell.js
  class CommunityCell (line 32) | class CommunityCell extends Component {
    method constructor (line 33) | constructor(props) {
    method render (line 38) | render() {

FILE: app/pages/community/community-section.js
  class CommunitySection (line 30) | class CommunitySection extends Component {
    method constructor (line 31) | constructor(props) {
    method render (line 36) | render() {

FILE: app/pages/community/community.js
  class Community (line 41) | class Community extends Controller {
    method constructor (line 49) | constructor(props) {
    method componentDidMount (line 59) | componentDidMount() {
    method render (line 172) | render() {

FILE: app/pages/community/week/week-hot.js
  class WeekHot (line 23) | class WeekHot extends BaseList {
    method constructor (line 24) | constructor(props) {
    method componentDidMount (line 28) | componentDidMount() {
    method render (line 43) | render() {

FILE: app/pages/home/home-cell.js
  class HomeCell (line 33) | class HomeCell extends Component {
    method constructor (line 34) | constructor(props) {
    method render (line 47) | render() {

FILE: app/pages/home/home.js
  class Home (line 33) | class Home extends Controller {
    method constructor (line 35) | constructor(props) {
    method componentDidMount (line 41) | componentDidMount() {
    method render (line 93) | render() {

FILE: app/pages/launch/launch.js
  class Launch (line 30) | class Launch extends Controller {
    method constructor (line 36) | constructor(props) {
    method componentDidMount (line 44) | componentDidMount() {
    method render (line 64) | render() {

FILE: app/pages/my/feedback/feedback.js
  class Feedback (line 33) | class Feedback extends Controller {
    method constructor (line 35) | constructor(props) {
    method render (line 59) | render() {

FILE: app/pages/my/like/my-like.js
  class MyLike (line 22) | class MyLike extends BaseList {
    method constructor (line 23) | constructor(props) {
    method componentDidMount (line 27) | componentDidMount() {
    method render (line 42) | render() {

FILE: app/pages/my/login/forget.js
  class Forget (line 33) | class Forget extends Controller {
    method constructor (line 35) | constructor(props) {
    method render (line 74) | render() {

FILE: app/pages/my/login/login.js
  class Login (line 37) | class Login extends Controller {
    method constructor (line 51) | constructor(props) {
    method render (line 122) | render() {
  function select (line 210) | function select(store){

FILE: app/pages/my/login/register.js
  class Register (line 34) | class Register extends Controller {
    method constructor (line 36) | constructor(props) {
    method render (line 101) | render() {

FILE: app/pages/my/my-header.js
  class MyHeader (line 32) | class MyHeader extends Component {
    method constructor (line 33) | constructor(props) {
    method render (line 38) | render() {

FILE: app/pages/my/my-item.js
  method click (line 60) | click() {}

FILE: app/pages/my/my.js
  class My (line 39) | class My extends Controller {
    method constructor (line 41) | constructor(props) {
    method componentDidMount (line 46) | componentDidMount() {
    method shouldComponentUpdate (line 51) | shouldComponentUpdate(nextProps, nextState) {
    method render (line 88) | render() {
  function select (line 172) | function select(store){

FILE: app/pages/my/read/did-read.js
  class DidRead (line 23) | class DidRead extends BaseList {
    method constructor (line 24) | constructor(props) {
    method componentDidMount (line 28) | componentDidMount() {
    method render (line 43) | render() {

FILE: app/pages/my/set/modity/modify.js
  class Modity (line 36) | class Modity extends Controller {
    method constructor (line 38) | constructor(props) {
    method render (line 110) | render() {

FILE: app/pages/my/set/set.js
  class Set (line 37) | class Set extends Controller {
    method constructor (line 39) | constructor(props) {
    method render (line 53) | render() {
  function select (line 100) | function select(store){

FILE: app/pages/my/user/user.js
  class User (line 30) | class User extends Controller {
    method constructor (line 32) | constructor(props) {
    method render (line 36) | render() {

FILE: app/pages/webview/webv.js
  class Webv (line 31) | class Webv extends Controller {
    method constructor (line 33) | constructor(props) {
    method componentDidMount (line 38) | componentDidMount () {
    method canBack (line 42) | canBack () {
    method render (line 60) | render() {

FILE: app/reducers/login.js
  function loginState (line 27) | function loginState(state=initState, action) {

FILE: app/store/configure-stroe.js
  function configureStore (line 26) | function configureStore(initialState) {
Condensed preview — 104 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,055K chars).
[
  {
    "path": ".babelrc",
    "chars": 34,
    "preview": "{\n  \"presets\": [\"react-native\"]\n}\n"
  },
  {
    "path": ".buckconfig",
    "chars": 114,
    "preview": "\n[android]\n  target = Google Inc.:Google APIs:23\n\n[maven_repositories]\n  central = https://repo1.maven.org/maven2\n"
  },
  {
    "path": ".flowconfig",
    "chars": 1445,
    "preview": "[ignore]\n; We fork some components by platform\n.*/*[.]android.js\n\n; Ignore \"BUCK\" generated dirs\n<PROJECT_ROOT>/\\.buckd/"
  },
  {
    "path": ".gitattributes",
    "chars": 16,
    "preview": "*.pbxproj -text\n"
  },
  {
    "path": ".gitignore",
    "chars": 763,
    "preview": "# OSX\n#\n.DS_Store\n\n# Xcode\n#\nbuild/\n*.pbxuser\n!default.pbxuser\n*.mode1v3\n!default.mode1v3\n*.mode2v3\n!default.mode2v3\n*.p"
  },
  {
    "path": ".tern-project",
    "chars": 314,
    "preview": "{\n  \"ecmaVersion\": 6,\n  \"libs\": [\n    \"browser\"\n  ],\n  \"loadEagerly\": [\n    \"**/*.js\",\n    \"**/*.png\",\n    \"**/*.jpg\",\n "
  },
  {
    "path": ".watchmanconfig",
    "chars": 2,
    "preview": "{}"
  },
  {
    "path": "LICENSE",
    "chars": 11358,
    "preview": "                                 Apache License\n                           Version 2.0, January 2004\n                   "
  },
  {
    "path": "README.md",
    "chars": 1522,
    "preview": "# react-native whcapp\n\n[![License Apache2.0](https://img.shields.io/hexpm/l/plug.svg)](https://raw.githubusercontent.com"
  },
  {
    "path": "__tests__/App.js",
    "chars": 267,
    "preview": "import 'react-native';\nimport React from 'react';\nimport App from '../App';\n\n// Note: test renderer must be required aft"
  },
  {
    "path": "android/app/BUCK",
    "chars": 1570,
    "preview": "# To learn about Buck see [Docs](https://buckbuild.com/).\n# To run your application with Buck:\n# - install Buck\n# - `npm"
  },
  {
    "path": "android/app/build.gradle",
    "chars": 6213,
    "preview": "apply plugin: \"com.android.application\"\n\nimport com.android.build.OutputFile\n\n/**\n * The react.gradle file registers a t"
  },
  {
    "path": "android/app/proguard-rules.pro",
    "chars": 2682,
    "preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in /u"
  },
  {
    "path": "android/app/src/main/AndroidManifest.xml",
    "chars": 1491,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n    package="
  },
  {
    "path": "android/app/src/main/java/com/whcapp/MainActivity.java",
    "chars": 357,
    "preview": "package com.whcapp;\n\nimport com.facebook.react.ReactActivity;\n\npublic class MainActivity extends ReactActivity {\n\n    /*"
  },
  {
    "path": "android/app/src/main/java/com/whcapp/MainApplication.java",
    "chars": 1042,
    "preview": "package com.whcapp;\n\nimport android.app.Application;\n\nimport com.facebook.react.ReactApplication;\nimport com.facebook.re"
  },
  {
    "path": "android/app/src/main/res/values/dimens.xml",
    "chars": 253,
    "preview": "<resources>\n    <!-- Default screen margins, per the Android Design guidelines. -->\n    <dimen name=\"activity_horizontal"
  },
  {
    "path": "android/app/src/main/res/values/strings.xml",
    "chars": 131,
    "preview": "<resources>\n    <string name=\"app_name\">whc</string>\n    <string name=\"title_activity_launch\">LaunchActivity</string>\n</"
  },
  {
    "path": "android/app/src/main/res/values/styles.xml",
    "chars": 435,
    "preview": "<resources>\n\n    <!-- Base application theme. -->\n    <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.NoActionBar\">"
  },
  {
    "path": "android/app/src/main/res/values-v21/styles.xml",
    "chars": 24,
    "preview": "<resources></resources>\n"
  },
  {
    "path": "android/app/src/main/res/values-w820dp/dimens.xml",
    "chars": 358,
    "preview": "<resources>\n    <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n         (such as s"
  },
  {
    "path": "android/build.gradle",
    "chars": 642,
    "preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n    r"
  },
  {
    "path": "android/gradle/wrapper/gradle-wrapper.properties",
    "chars": 203,
    "preview": "distributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_HOME\nzipStorePath=wrapper/dist"
  },
  {
    "path": "android/gradle.properties",
    "chars": 857,
    "preview": "## Project-wide Gradle settings.\n#\n# For more details on how to configure your build environment visit\n# http://www.grad"
  },
  {
    "path": "android/gradlew",
    "chars": 5080,
    "preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n##  Gradle start "
  },
  {
    "path": "android/gradlew.bat",
    "chars": 2404,
    "preview": "@if \"%DEBUG%\" == \"\" @echo off\r\n@rem ##########################################################################\r\n@rem\r\n@r"
  },
  {
    "path": "android/keystores/BUCK",
    "chars": 152,
    "preview": "keystore(\n    name = \"debug\",\n    properties = \"debug.keystore.properties\",\n    store = \"debug.keystore\",\n    visibility"
  },
  {
    "path": "android/keystores/debug.keystore.properties",
    "chars": 105,
    "preview": "key.store=debug.keystore\nkey.alias=androiddebugkey\nkey.store.password=android\nkey.alias.password=android\n"
  },
  {
    "path": "android/settings.gradle",
    "chars": 44,
    "preview": "rootProject.name = 'whcapp'\n\ninclude ':app'\n"
  },
  {
    "path": "app/App.js",
    "chars": 1032,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/actions/login-action.js",
    "chars": 913,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/api/account.js",
    "chars": 982,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/api/api.js",
    "chars": 3172,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/base/base-list.js",
    "chars": 1916,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/base/controller.js",
    "chars": 7371,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/storage.js",
    "chars": 1611,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/tool.js",
    "chars": 1449,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-banner.js",
    "chars": 6694,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-button.js",
    "chars": 1262,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-grid-view.js",
    "chars": 3182,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-image-button.js",
    "chars": 1420,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-line.js",
    "chars": 1153,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-loading.js",
    "chars": 3107,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-text.js",
    "chars": 985,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/components/whc-toast.js",
    "chars": 3230,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/constants/action-type.js",
    "chars": 143,
    "preview": "/**\n * 退出登录\n * @type {string}\n */\nexport const DID_LOGOUT = 'DID_LOGOUT';\n/**\n * 登录\n * @type {string}\n */\nexport const D"
  },
  {
    "path": "app/constants/app-constant.js",
    "chars": 822,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/constants/color.js",
    "chars": 767,
    "preview": "\n/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you ma"
  },
  {
    "path": "app/constants/screen.js",
    "chars": 796,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/containers/navigation.js",
    "chars": 3214,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/containers/tabbar.js",
    "chars": 3398,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/blank/blank.js",
    "chars": 1410,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/activity/offline-activity.js",
    "chars": 1243,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/collect/collect-cell.js",
    "chars": 2451,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/collect/collect.js",
    "chars": 2580,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/column/special-column.js",
    "chars": 2202,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/community-cell.js",
    "chars": 3021,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/community-section.js",
    "chars": 1941,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/community.js",
    "chars": 7024,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/community/week/week-hot.js",
    "chars": 1224,
    "preview": "\n/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you ma"
  },
  {
    "path": "app/pages/home/home-cell.js",
    "chars": 5239,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/home/home.js",
    "chars": 3619,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/launch/launch.js",
    "chars": 2718,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/feedback/feedback.js",
    "chars": 2614,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/like/my-like.js",
    "chars": 1224,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/login/forget.js",
    "chars": 3099,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/login/login.js",
    "chars": 6606,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/login/register.js",
    "chars": 4374,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/my-header.js",
    "chars": 2663,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/my-item.js",
    "chars": 2286,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/my.js",
    "chars": 5741,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/read/did-read.js",
    "chars": 1228,
    "preview": "\n/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you ma"
  },
  {
    "path": "app/pages/my/set/modity/modify.js",
    "chars": 5269,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/set/modity/modity-input-item.js",
    "chars": 1446,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/set/set-item.js",
    "chars": 1486,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/set/set.js",
    "chars": 3073,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/my/user/user.js",
    "chars": 1743,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/pages/webview/webv.js",
    "chars": 1987,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/reducers/index.js",
    "chars": 802,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/reducers/login.js",
    "chars": 1215,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app/store/configure-stroe.js",
    "chars": 987,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "app.json",
    "chars": 50,
    "preview": "{\n  \"name\": \"whcapp\",\n  \"displayName\": \"whcapp\"\n}\n"
  },
  {
    "path": "index.js",
    "chars": 766,
    "preview": "/**\n *\n * Copyright 2017-present whcapp\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may"
  },
  {
    "path": "ios/whcapp/AppDelegate.h",
    "chars": 451,
    "preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the B"
  },
  {
    "path": "ios/whcapp/AppDelegate.m",
    "chars": 1502,
    "preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the B"
  },
  {
    "path": "ios/whcapp/Base.lproj/LaunchScreen.xib",
    "chars": 2467,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<document type=\"com.apple.InterfaceBuilder3.CocoaTouch.XIB\" version=\"3.0\" toolsVe"
  },
  {
    "path": "ios/whcapp/Images.xcassets/AppIcon.appiconset/Contents.json",
    "chars": 1190,
    "preview": "{\n  \"images\" : [\n    {\n      \"size\" : \"20x20\",\n      \"idiom\" : \"iphone\",\n      \"filename\" : \"Icon-Notification@2x.png\",\n"
  },
  {
    "path": "ios/whcapp/Images.xcassets/Contents.json",
    "chars": 62,
    "preview": "{\n  \"info\" : {\n    \"version\" : 1,\n    \"author\" : \"xcode\"\n  }\n}"
  },
  {
    "path": "ios/whcapp/Images.xcassets/launch.imageset/Contents.json",
    "chars": 303,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n     "
  },
  {
    "path": "ios/whcapp/Images.xcassets/loading.imageset/Contents.json",
    "chars": 304,
    "preview": "{\n  \"images\" : [\n    {\n      \"idiom\" : \"universal\",\n      \"scale\" : \"1x\"\n    },\n    {\n      \"idiom\" : \"universal\",\n     "
  },
  {
    "path": "ios/whcapp/Info.plist",
    "chars": 1412,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ios/whcapp/main.m",
    "chars": 510,
    "preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the B"
  },
  {
    "path": "ios/whcapp-tvOS/Info.plist",
    "chars": 1611,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ios/whcapp-tvOSTests/Info.plist",
    "chars": 765,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ios/whcapp.xcodeproj/project.pbxproj",
    "chars": 57720,
    "preview": "// !$*UTF8*$!\n{\n\tarchiveVersion = 1;\n\tclasses = {\n\t};\n\tobjectVersion = 46;\n\tobjects = {\n\n/* Begin PBXBuildFile section *"
  },
  {
    "path": "ios/whcapp.xcodeproj/xcshareddata/xcschemes/whcapp-tvOS.xcscheme",
    "chars": 4968,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0820\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "ios/whcapp.xcodeproj/xcshareddata/xcschemes/whcapp.xcscheme",
    "chars": 4943,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Scheme\n   LastUpgradeVersion = \"0620\"\n   version = \"1.3\">\n   <BuildAction\n      "
  },
  {
    "path": "ios/whcappTests/Info.plist",
    "chars": 765,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/P"
  },
  {
    "path": "ios/whcappTests/whcappTests.m",
    "chars": 2059,
    "preview": "/**\n * Copyright (c) 2015-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the B"
  },
  {
    "path": "package.json",
    "chars": 578,
    "preview": "{\n\t\"name\": \"whcapp\",\n\t\"version\": \"0.0.1\",\n\t\"private\": true,\n\t\"scripts\": {\n\t\t\"start\": \"node node_modules/react-native/loc"
  },
  {
    "path": "release_ios/main.jsbundle",
    "chars": 767578,
    "preview": "!function(e){e.__DEV__=!1,e.__BUNDLE_START_TIME__=e.nativePerformanceNow?e.nativePerformanceNow():Date.now()}(\"undefined"
  }
]

// ... and 3 more files (download for full content)

About this extraction

This page contains the full source code of the netyouli/react-native-whcapp GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 104 files (997.1 KB), approximately 300.0k tokens, and a symbol index with 146 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!