Giter Club home page Giter Club logo

wordpress-android's Introduction

WordPress for Android

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. Install npm using Node Version Manager(nvm), as described in step one from the Block Editor Quickstart guide
  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. Recommended: The CI uses JDK11 to build the app and run the tests. Some tests won't pass on the JDK embedded in Android Studio (JDK8). You might want to set JAVA_HOME and JDK location in Android Studio to JDK11.
  7. Go to Tools → AVD Manager and create an emulated device.
  8. 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.
  • While loading/building the app in Android Studio ignore the prompt to update the gradle plugin version as that will probably introduce build errors. On the other hand, feel free to update if you are planning to work on ensuring the compatibility of the newer version.

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 "Website URL", "Redirect URLs", and "Javascript Origins" fields are required but not used for the 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 [email protected], you will only be able to login with [email protected]. Using another account like [email protected] 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 assembleWordPressVanillaDebug                        # assemble the debug .apk
$ ./gradlew installWordPressVanillaDebug                         # install the debug .apk if you have an
                                                                 # emulator or an Android device connected
$ ./gradlew :WordPress:testWordPressVanillaDebugUnitTest         # assemble, install and run unit tests
$ ./gradlew :WordPress:connectedWordPressVanillaDebugAndroidTest # 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.

wordpress-android's People

Contributors

0nko avatar aforcier avatar ajeshrpai avatar alisoftware avatar antonis avatar ashiagr avatar daniloercoli avatar develric avatar hypest avatar irfano avatar jd-alexander avatar khaykov avatar kwonye avatar loremattei avatar malinajirka avatar maxme avatar mzorz avatar nbradbury avatar oguzkocer avatar ovitrif avatar paraskp7 avatar planarvoid avatar ravishanker avatar renanferrari avatar renanlukas avatar roundhill avatar theck13 avatar thomashorta avatar tonyr59h avatar zwarm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-android's Issues

Passcode/PIN lock

We need to find a way to set a PIN or passphrase lock for the entire app that effectively locking in any sensitive information. (See the DropBox app for a nice implementation of it).

It's a much requested feature from our users.

java.lang.IllegalStateException: sender id not set on constructor

java.lang.IllegalStateException: sender id not set on constructor
at com.google.android.gcm.GCMBaseIntentService.getSenderIds(GCMBaseIntentService.java:125)
at com.google.android.gcm.GCMBaseIntentService.onHandleIntent(GCMBaseIntentService.java:237)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:60)

Uploading arbitrary files

Wordpress allows uploading arbitrary files if correctly configured.
If the android app allowed that too, one could upload gpx tracks and have them visualized by the gp2graphics plugin for wordpress!
Add another item in the media choose dialog that lets users choose a file with a file manager (if installed).

JSONUtil NPE

java.lang.NullPointerException
at org.wordpress.android.util.JSONUtil.queryJSON(JSONUtil.java:51)
at org.wordpress.android.models.Note.buildReply(Note.java:132)
at org.wordpress.android.ui.notifications.NoteCommentFragment$3.onReply(NoteCommentFragment.java:249)
at org.wordpress.android.ui.notifications.ReplyField$1.onClick(ReplyField.java:62)
at android.view.View.performClick(View.java:3652)
at android.view.View$PerformClick.run(View.java:14354)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4512)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
at dalvik.system.NativeStart.main(Native Method)

Fetch new notifications when a push is received

When a push notification is received we currently don't update the local data which results in a delay if the user opens the app via the notification.

Let's update the notifications in the background when we receive the push.

FollowRow NPE

java.lang.NullPointerException
at org.wordpress.android.ui.notifications.FollowRow.isSiteId(FollowRow.java:136)
at org.wordpress.android.ui.notifications.FollowListener$FollowResponseHandler.onResponse(FollowListener.java:39)
at org.wordpress.android.ui.notifications.FollowListener$FollowResponseHandler.onResponse(FollowListener.java:27)
at com.wordpress.rest.RestRequest.deliverResponse(RestRequest.java:60)
at com.wordpress.rest.RestRequest.deliverResponse(RestRequest.java:17)
at com.android.volley.ExecutorDelivery$ResponseDeliveryRunnable.run(ExecutorDelivery.java:99)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:138)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)

"View Site" feature error when the site has Adobe Flash items in it.

Few users has reported the issue where the "View Site" feature doesn't work on their sites.
Error message: "Web Page Not Available message - The Web page at file:///android_asset/webkit/ might be temporarily down ...".

Seems that this is a common issue for those apps that use native webView to access web-pages.

Use image resize dimensions in blog's options

The 'Default Image width' selector uses a bunch of predefined dimensions in it. I think it should show the predefined dimensions the user has set on the blog options.
Something like this:

  • Original size
  • Max (actual dimensions read from options)
  • Medium (actual dimensions read from options)
  • Small (actual dimensions read from options)
  • Custom (Maybe?)

Unusable slider for image size in the editor

as mentionned here ​http://androiddevel.wordpress.com/2012/01/23/heres-whats-on-the-list-for-2-0-5/#comment-7908
As the default image size currently doesn't work (it always uploads pictures à 500px), we have to change the size of the uploaded media in the text editor, by taping on the picture.
There's a slider for that purpose.
The slider is not really precise if you're not a kid with tiny fingers. A spinner or even a text field would be really better.
Even if i have a big screen (4.3"), it takes at least 30 seconds before i can make my picture 960px wide (it always fall on 940px, or 970px when i remove my finger), whereas it would take like 2 seconds with a spinner or a text field.

NPE in CategoryNode

@maxme any thoughts on this one?

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.wordpress.android/org.wordpress.android.ui.posts.SelectCategoriesActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.wordpress.android.models.CategoryNode.createCategoryTreeFromDB(CategoryNode.java:84)
at org.wordpress.android.ui.posts.SelectCategoriesActivity.populateOrFetchCategories(SelectCategoriesActivity.java:99)
at org.wordpress.android.ui.posts.SelectCategoriesActivity.onCreate(SelectCategoriesActivity.java:75)
at android.app.Activity.performCreate(Activity.java:5133)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
... 11 more

ViewPostFragment does not resolve relative urls (patch added)

In my blog, I use relative URLs. This is the case for image URLs and for anchors leading into my blog. I use it anywhere, where I can, so my blog will work after a global domain change, too.
But the Client is not able to resolve them. Images are missing and links are opened with ​file://.. instead of ​http://blog/ ..
I'll add an image of my post view before my patch, a screenshot after my patch and the patch itself, that resolves the problem.

Patch is here: http://android.trac.wordpress.org/ticket/257

Tag-like strings need to be filtered when creating a new category.

Fringe case (probably)
A user can type something that looks like a tag <foo>bar</baz> and the app will show it as such but WordPress actually filteres the <foo> and </baz>. The category is actually bar.
It might be easiest if the app fetched the canonical category from the site vs trying to filter edge cases like this client side.

Post can loose a category if its not in the category list when categories are added.

Another edge case most likely.

Add a new category to a post via the web admin.
In the app, refresh the post list.
Edit the post. Notice the category you added via the admin is included in the posts categories.
Tap the + button to add a new category.
Without refreshing the category list, tap the back button.
Since the new category did not exist in the apps copy of the category list it was removed from the post.

If you let the category list refresh before returning to the post editor the category will be retained.

Featured image assigned to multiple posts?

Unconfirmed user report:

I noticed that setting the featured image in the app will sometimes set it for multiple posts... I notice it more when I have multiple posts pending or if I update a post to add an image.

Post editor shows html entities in categories.

The categories section of the post editor will show code for html entities (but correctly displays double-byte characters).
Example: Pride & Prejudice shows up as Pride &amp; Prejudice

Formatting bar lingers after dismissing keyboard

On the post editor, tap to edit content.
Dismiss the keyboard. Notice that the formatting bar is not visible.
Scroll down a little bit.
Now the formatting bar is back.

Tapping the buttons inserts markup where the cursor last appeared in the content view.

Posts containing umlats are incorrectly parsed.

As reported by a memember:
"because it cuts posts with "Umlaut" like äüö and so on at their first appearance and drops the rest even in the editor..."
Confirmed using the same characters on a test blog. Only the content in the post preceding the ä umlat character was displayed both in the preview and in the editor.

Notifications NPE

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.wordpress.android/org.wordpress.android.ui.notifications.NotificationsActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.wordpress.android.ui.notifications.SingleLineListFragment.onActivityCreated(SingleLineListFragment.java:48)
at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1468)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:931)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1070)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1861)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:547)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133)
at android.app.Activity.performStart(Activity.java:4475)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
... 11 more

zh_TW shows up as zh_CN

My Android system locale is Traditional Chinese (正體中文), but Wordpress app displays Simplified Chinese (简体中文).

Simplified Chinese has simplified characters based on Traditional Chinese, but thet are not the same.

For example:
"Post" in Simplified Chinese is "博文", in Traditional Chinese it is "文章"
"Page" in Simplified Chinese is "页面", in Traditional Chinese it is "頁面"

Refreshing posts after discarding changes still prompts you about unsaved changes.

On the Nexus 7.
Steps to reproduce:

  • In the post detail panel, tap to edit a post.
  • Make a change (or not) and hit the back button to return to the post list.
  • Choose "Discard" when prompted to save your changes.
  • Back on the post list, tap to refresh the list.

You're prompted that you have local changes, even though you just discarded them.

Trapped on the configure blog screen.

When adding a self hosted blog on a spotty wifi connection you can get trapped on the "Attempting to configure blog" screen for a long period of time. It might make sense to make this dismissable and let the user reattempt to add the blog with a better connection, or another time, than be stuck waiting for the call to timeout/finish.

NotificationsActivity Crash

Just one report of this so far:

java.lang.RuntimeException: Unable to start activity ComponentInfo{org.wordpress.android/org.wordpress.android.ui.notifications.NotificationsActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
at android.app.ActivityThread.access$600(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at org.wordpress.android.ui.notifications.NotificationsListFragment$NotesAdapter.addAll(NotificationsListFragment.java:143)
at org.wordpress.android.ui.notifications.NotificationsActivity.onCreate(NotificationsActivity.java:79)
at android.app.Activity.performCreate(Activity.java:5104)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
... 11 more

Problem with article source code

I'm using the source code view in my blog when writing new articles. The problem is that the WordPress Android app does have such a mode. So when I write new articles or edit older articles it adds line breaks "
" etc. automatically when saving the article. Please add a "source only" edit mode to the app which does not automatically add HTML tags.

Exchange Vectors with ArrayLists

I found some Vectors used in the code, where ArrayLists should be enough (iterating inside of a method in example).
Vectors are synchronized and therefor coming with some overhead compared to ArrayLists. So use ArrayLists, where no concurrent access to the List is needed (what is in most cases the case).
An example: ViewPosts.getRecentPostsTask.onPostExecute(). Vectors are created and used there only. Why do you need it to be synchronized?

Reader NPE

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:278)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.NullPointerException
at org.wordpress.android.ui.reader.ReaderImplFragment$loadReaderTask.doInBackground(ReaderImplFragment.java:221)
at org.wordpress.android.ui.reader.ReaderImplFragment$loadReaderTask.doInBackground(ReaderImplFragment.java:181)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 5 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.