WordPress-Android

适用于Android的WordPress。(WordPress for Android.)

Github星跟蹤圖

Android 版 WordPress

如果您只是想安装WordPress for Android,您可以找到 它在 Google Play 上。如果您是想要贡献的开发人员,请继续阅读。

构建说明

  1. 确保您安装了 JDK 8 Android Studio 标准设置可以工作。
  2. 克隆此GitHub存储库。
  3. 将 gradle.properties-example 复制到 gradle.properties 。
  4. 在Android Studio中,从本地存储库以 Gradle项目打开项目(这将自动生成 local.properties 与SDK位置)。
  5. 确保您在AVD Manager( Tools→Android→AVD Manager )中设置了仿真设备。
  6. 运行。

注意:

  • 要使用WordPress.com功能(登录到WordPress.com,访问Reader和Stats等),您需要一个WordPress.com OAuth2 ID和密码。请阅读 OAuth2身份验证部分。

安装后,您现在可以从命令行构建,安装和测试项目:

$ ./gradlew assembleVanillaDebug                        # assemble the debug .apk
$ ./gradlew installVanillaDebug                         # install the debug .apk if you have an
                                                        # emulator or an Android device connected
$ ./gradlew :WordPress:testVanillaDebugUnitTest         # assemble, install and run unit tests
$ ./gradlew :WordPress:connectedVanillaDebugAndroidTest # assemble, install and run Android tests

目录结构

.
├── libs                    # dependencies used to build debug variants
├── tools                   # script collection
├── gradle.properties       # properties imported by the build script
├── WordPress
│   |-- build.gradle        # main build script
│   └── src
│       ├── androidTest     # Android test assets, resources and code
│       ├── test            # Unit tests
│       ├── main
│       │   ├── assets      # main project assets
│       │   ├── java        # main project java code
│       │   └── res         # main project resources
│       ├── debug           # debug variant
│       └── wasabi          # wasabi variant specific resources and manifest

OAuth2身份验证

为了使用WordPress.com功能,您需要一个客户端ID和 一个客户端密钥。这些细节将用于验证您的身份 应用程序并验证正在进行的API调用是否有效。您可以 用您的现有应用程序创建应用程序或查看详细信息 我们的 WordPress.com应用程序管理器

在创建应用程序时,您应该选择“Native client” 应用类型。应用程序管理器目前需要一个“重定向URL”, 但这不适用于移动应用程序。只需使用“ https://localhost ”。

应用程序管理器中创建应用程序后,您会 需要编辑 ./gradle.properties 文件并更改 WP.OAUTH.APP_ID 和 WP.OAUTH.APP_SECRET 字段。然后你可以编译和 在设备或模拟器上运行应用程序,并尝试使用WordPress.com登录 帐户。

详细了解 OAuth2 WordPress.com REST端点

Google配置

Google登录只能通过官方应用。 贡献者可以毫无问题地构建和运行该应用,但Google登录始终会失败。 Google登录需要包含客户端和服务器信息的配置文件 无法公开分享。更多的文档和指南可以在上找到 Google Identity Platform网站

我们如何工作

您可以详细了解我们采用的代码风格指南,以及 我们如何在我们的仓库中组织分支机构 贡献指南

需要帮助建立或破解?

在我们的 Slack 频道上打招呼: #mobile 。

常见问题

  • 问:由于 PermGen space 错误,我无法构建/测试/打包项目。
  • 答:用项目在项目根目录下创建一个 gradle.properties 文件 以下内容: org.gradle.jvmargs = -XX:MaxPermSize参数=1024米

许可证

Android的WordPress是一个开源项目 GNU通用公共许可证版本2 。注意:代码 在 libs/目录中来自外部库,可能 由与GPLv2兼容的其他许可证覆盖。

概覽

名稱與所有者wordpress-mobile/WordPress-Android
主編程語言Kotlin
編程語言Java (語言數: 8)
平台Android
許可證GNU General Public License v2.0
發布數1062
最新版本名稱24.7-rc-3 (發布於 )
第一版名稱1.4.0 (發布於 )
創建於2013-04-08 20:52:40
推送於2024-04-27 01:38:20
最后一次提交
星數2.9k
關注者數207
派生數1.3k
提交數83.4k
已啟用問題?
問題數8618
打開的問題數1056
拉請求數10580
打開的拉請求數37
關閉的拉請求數1408
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?

WordPress for Android

CircleCI

If you're just looking to install WordPress for Android, you can find
it on Google Play. If you're a developer wanting to contribute, read on.

Build Instructions

  1. Make sure you've installed Android Studio.
  2. git clone git@github.com:wordpress-mobile/WordPress-Android.git in the folder of your preference.
  3. cd WordPress-Android to enter the working directory.
  4. cp gradle.properties-example gradle.properties to set up the sample app credentials file.
  5. In Android Studio, open the project from the local repository. This will auto-generate local.properties with the SDK location.
  6. Go to Tools → AVD Manager and create an emulated device.
  7. Run.

Notes:

  • To use WordPress.com features (login to WordPress.com, access Reader and Stats, etc) you need a WordPress.com OAuth2 ID and secret. Please read the OAuth2 Authentication section.

OAuth2 Authentication

In order to use WordPress.com functions you will need a client ID and
a client secret key. These details will be used to authenticate your
application and verify that the API calls being made are valid. You can
create an application or view details for your existing applications with
our WordPress.com applications manager.

When creating your application, you should select "Native client" for the
application type. The applications manager currently requires a "redirect URL",
but this isn't used for mobile apps. Just use "https://localhost".

Once you've created your application in the applications manager, you'll
need to edit the ./gradle.properties file and change the
wp.oauth.app_id and wp.oauth.app_secret fields. Then you can compile and
run the app on a device or an emulator and try to login with a WordPress.com
account. Note that authenticating to WordPress.com via Google is not supported
in development builds of the app, only in the official release.

Note that credentials created with our WordPress.com applications manager
allow login only and not signup. New accounts must be created using the official app
or on the web. Login is restricted to the WordPress.com
account with which the credentials were created. In other words, if the credentials
were created with foo@email.com, you will only be able to login with foo@email.com.
Using another account like bar@email.com will cause the Client cannot use "password" grant_type error.

For security reasons, some account-related actions aren't supported for development
builds when using a WordPress.com account with 2-factor authentication enabled.

Read more about OAuth2 and the WordPress.com REST endpoint.

Build and Test

To build, install, and test the project from the command line:

$ ./gradlew assembleVanillaDebug                        # assemble the debug .apk
$ ./gradlew installVanillaDebug                         # install the debug .apk if you have an
                                                        # emulator or an Android device connected
$ ./gradlew :WordPress:testVanillaDebugUnitTest         # assemble, install and run unit tests
$ ./gradlew :WordPress:connectedVanillaDebugAndroidTest # assemble, install and run Android tests

Directory structure

.
├── libs                    # dependencies used to build debug variants
├── tools                   # script collection
├── gradle.properties       # properties imported by the build script
├── WordPress
│, -- build.gradle        # main build script
│   └── src
│       ├── androidTest     # Android test assets, resources and code
│       ├── test            # Unit tests
│       ├── main
│       │   ├── assets      # main project assets
│       │   ├── java        # main project java code
│       │   └── res         # main project resources
│       ├── debug           # debug variant
│       └── wasabi          # wasabi variant specific resources and manifest

Google Configuration

Google Sign-In is only available for WordPress.com accounts through the official app.
Contributors can build and run the app without issue, but Google Sign-In will always fail.
Google Sign-In requires configuration files which contain client and server information
that can't be shared publicly. More documentation and guides can be found on the
Google Identity Platform website.

Contributing

Read our Contributing Guide to learn about reporting issues, contributing code, and more ways to contribute.

Security

If you happen to find a security vulnerability, we would appreciate you letting us know at https://hackerone.com/automattic and allowing us to respond before disclosing the issue publicly.

Getting in Touch

If you have questions or just want to say hi, join the WordPress Slack and drop a message on the #mobile channel.

Documentation

Please read the docs for more.

Resources

License

WordPress for Android is an Open Source project covered by the
GNU General Public License version 2. Note: code
in the libs/ directory comes from external libraries, which might
be covered by a different license compatible with the GPLv2.

去到頂部