[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WordPress.com Notifications in Android #3

Merged
merged 184 commits into from
Jun 7, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
184 commits
Select commit Hold shift + click to select a range
803eeda
Merge branch 'master' of http://android.git.wordpress.org
Apr 11, 2013
bd817d5
WPActionBarActivity refactor managing menu state
Apr 10, 2013
9c5d322
Ignoring local.properties file
Apr 8, 2013
32c410c
Adding REST notifications configuration
Apr 9, 2013
8f21de3
Configuring notifications
Apr 10, 2013
8ad11a3
Adding notifications menu item
Apr 10, 2013
894f0eb
Add library reference to wordpress-rest-android while notifications u…
Apr 10, 2013
4e4f8b9
Displaying an initial list of notes pulled straight from the REST api
Apr 11, 2013
e806171
Added method to query note json by keypath
Apr 11, 2013
dcc1f07
Configuring note row layout
Apr 11, 2013
31cce52
Dispaying gravatars in notification list
Apr 11, 2013
efccc0b
Adding global WP.com account. Refs #496
roundhill Apr 12, 2013
7a035f4
Adding basic GCM Service Class for testing
roundhill Apr 12, 2013
00720c6
Moving activity restore code to PostsActivity
Apr 12, 2013
f7fec3a
Adding refresh menu bar item to NotificationsActivity
Apr 12, 2013
36208ea
Additional support for global WP.com account. If credentials are chan…
roundhill Apr 12, 2013
a1c0e78
Adding more note accessors
Apr 12, 2013
cb1cbc5
Adding notifications request methods
Apr 12, 2013
e50876f
Attempting to implement endless scrolling
Apr 12, 2013
9b3424e
Using .getNotification() since .build() is unavailable on 2.3.3
Apr 12, 2013
9231237
Fixing register/unregister DataSetObserver for wrapped adapters
Apr 12, 2013
c14fdce
Initial endless scrolling of notes
Apr 12, 2013
577d406
Moving config.properties.sample so it doesn't fail building
Apr 12, 2013
bda9bd8
Preparing notification detail fragment and note selection
Apr 12, 2013
5eefc0b
Notification Settings
roundhill Apr 18, 2013
27dc56b
Merge remote-tracking branch 'origin/master' into notifications
Apr 22, 2013
16ddbe4
Notifications: Fixed device registration. Moved WPCom token registrat…
roundhill Apr 22, 2013
0923327
Open a NotificationsDetailFragment with a note id to fetch
Apr 13, 2013
3f38d93
Intercept menu bar home button click and pop note detail
Apr 13, 2013
9e31678
Notify of invalid JSON query
Apr 13, 2013
ad027e4
async-http-client automatically posts back to the calling thread, run…
Apr 15, 2013
651e68a
Activity now displays correct fragment for specific notes
Apr 16, 2013
082bcbb
method for retrieving the comment text
Apr 17, 2013
e418798
Registering note detail fragments for use with specific notes
Apr 17, 2013
6049162
layout for NotificationCommentDetail fragment
Apr 17, 2013
73ca6ae
Custom class for reply text field
Apr 17, 2013
3de8cd9
Removing static from NotesAdapter class
Apr 17, 2013
a6c621f
refactored queryJSON operations
Apr 18, 2013
280687e
Implementing notification replies
Apr 19, 2013
e0d3e51
Fleshing out the note detail view
Apr 22, 2013
6507e41
Refactoring parts of the detail views for re-use
Apr 25, 2013
e6ea29f
ignoring .jdbrc for debugging
Apr 25, 2013
dbf5613
Notifications: Make use of note_id to pass along to NotificationsActi…
roundhill Apr 26, 2013
aa2463b
Merge branch 'notifications' of https://github.com/wordpress-mobile/W…
roundhill Apr 26, 2013
6964889
Switch EditPostActivity to use renamed StringUtils class
roundhill Apr 27, 2013
a03a25d
Fleshing out detail views to include headers and images
Apr 26, 2013
645424b
Tapping notification header opens url in browser
Apr 29, 2013
d972a52
Set the notification intent to be the main and launcher activity so t…
roundhill Apr 29, 2013
bf5cb42
Merge branch 'notifications' of https://github.com/wordpress-mobile/W…
roundhill Apr 29, 2013
9976190
More robust queryJSON method
Apr 29, 2013
1d5f440
Prepare FollowRow getters and setters
Apr 29, 2013
b69a3ba
Set following data from note
Apr 29, 2013
38886dc
Hide icon in header view if not clickable
Apr 29, 2013
59fd6c1
Adding follow/unfollow api methods
Apr 30, 2013
93cac58
Adding ability to follow/unfollow people on comment view
Apr 30, 2013
e936244
Adding background color to notifications layout
Apr 30, 2013
69613b1
Supporting two-column notifications layout
Apr 30, 2013
62ad4ac
Adding note icons and unread indicator to notes list.
roundhill Apr 30, 2013
2a72e34
Merge branch 'notifications' of https://github.com/wordpress-mobile/W…
roundhill Apr 30, 2013
2de06cf
Adding follow/unfollow to SingleLineListFragment
Apr 30, 2013
16027eb
Fix gravatar image id
May 1, 2013
76fa763
Improve notifications layout
May 1, 2013
eecef88
Switching back to LinearLayout
May 1, 2013
fa46968
Setting selection state when opening a note
May 1, 2013
1f344f8
Use global wordpress.com account credentials for notifications
May 1, 2013
9810a11
Mark notes as read and update last seen time
May 1, 2013
8d6ea69
Making BitmapResponseHandler it's own public static class
May 1, 2013
26c348d
Fixing out of bounds index
May 1, 2013
6a0ee9d
Stop animating refresh indicator when token request is done
May 1, 2013
cc3b7b7
Refresh all blog content when refreshing the posts list. Fixes #519.
roundhill May 1, 2013
c223b2e
Moving JSON querying to JSONUtil class to make it reusable
May 1, 2013
4a14e17
Some more manifest cleanup.
roundhill May 1, 2013
940269a
Replacying Note.queryJSON with JSONUtil
May 1, 2013
27a9922
Improving UI feedback for comment replying
May 2, 2013
c44b244
Unregister for GCM when the user signs out from WP.com
roundhill May 2, 2013
a02dd2f
Merge branch 'notifications' of https://github.com/wordpress-mobile/W…
roundhill May 2, 2013
eaa65e3
Global Oauth authentication implemented
May 2, 2013
5341a5a
Access Settings using a different activity animation. Also changed se…
roundhill May 2, 2013
27d04a5
Merge branch 'notifications' of https://github.com/wordpress-mobile/W…
roundhill May 2, 2013
9177954
Use commit instead of apply
May 2, 2013
d0aeaf7
Get access token after wpcom login
May 2, 2013
456539f
Converted the Reader to use the global wpcom credentials. Also fixed …
roundhill May 3, 2013
8edbca9
Abort should check for a null handler
May 2, 2013
13b1f63
Additional support for images and smilies
May 3, 2013
accb848
Merge branch 'master' into notifications
May 3, 2013
ffc054e
Remove autolink form comment TextView
May 3, 2013
eda924d
Sync blog options after app install as well as each startup.
roundhill May 3, 2013
0707b85
Updating version number.
roundhill May 3, 2013
7d1eb06
Adding emoji support for ICS
May 3, 2013
37c6a12
Only apply custom WPQuoteSpan to ICS and newer
May 3, 2013
e51d138
Bail if an XMLRPCException is encountered when refreshing blog content.
roundhill May 3, 2013
47378bc
Made follow rows tappable to load the blog url in the browser, if a u…
roundhill May 3, 2013
988cb94
Set reply EditText to capitalize sentences. Also moved follow row lis…
roundhill May 3, 2013
13a3a98
Using WP Blue for emoji and blockquote
May 3, 2013
dcfffde
Working on Reply feedback interface
May 4, 2013
bd7ed7b
Reply feedback
May 4, 2013
5c29c10
Disable animation effects for pre Jelly Bean
May 4, 2013
6b35420
Make sure we have a valid video file before proceeding with the upload.
roundhill May 6, 2013
61291e2
Restores local change prompt when refreshing.
roundhill May 6, 2013
dcb0761
Updated Korean strings.
roundhill May 6, 2013
87bf436
Don't load a new PostsActivity instance when tapping on a failed uplo…
roundhill May 6, 2013
c988a68
Set same activity flags when post upload notification is updated with…
roundhill May 6, 2013
95ce402
A few wee string updates.
roundhill May 6, 2013
4744ad3
Wrapping Bitmap creating in error handler
May 6, 2013
eb52b42
Note DetailHeader now handles Url's
May 6, 2013
9cf37a9
FollowRow sets up it's own listener
May 6, 2013
62e355b
Merge remote-tracking branch 'origin/master' into notifications
May 6, 2013
d8d25d1
Show the keyboard when the user is replying to a comment or is return…
roundhill May 6, 2013
d9d2fc6
Adding support for moderating comments from the notifications comment…
roundhill May 10, 2013
c3284a7
Percent escape the iconURL, fixes issue where 'Mystery Man' avatar wa…
roundhill May 10, 2013
40e7457
Built out the big badge view. It will animate in the badge once it is…
roundhill May 10, 2013
a66036b
Use PendingIntent.FLAG_CANCEL_CURRENT to fix bogus intent extras from…
roundhill May 13, 2013
74d2fab
Fixed curly quotes around comment reply text.
roundhill May 13, 2013
ac0eb54
Use unicode encodings in Emoticons.java. Fixes broken emoticons.
roundhill May 13, 2013
00bc0a9
Fixes menu drawer from not updating after adding/removing blogs in se…
roundhill May 13, 2013
5767697
Removing blue background from menu panel on devices with menu key >= …
roundhill May 13, 2013
857f883
Adding null check in bitmap creation.
roundhill May 13, 2013
acc7460
Removing the remaining settings menu item code.
roundhill May 13, 2013
fd85b44
Fix for notifications not registering on devices less than Android 4.0
roundhill May 13, 2013
0906b6e
Updating version number.
roundhill May 13, 2013
5e55553
Unregister the device from .COM backend
May 14, 2013
c5b7577
Call getPushNotificationSettings in the device registration callback
May 14, 2013
21c02ec
Sets the User-Agent header to be sent with each REST request. Stats, …
May 14, 2013
805c959
Account is removed in PreferencesActivity
May 14, 2013
20f1a2b
Log errors in case of failures when loading notes from the server
May 14, 2013
6787330
Settings Screen: Check that "blogTitle" is not an empty string.
May 15, 2013
dd518b5
Handle errors, and log them, for most of the REST API calls
May 17, 2013
c0c0f85
Layout and style tweaks for notifications
roundhill May 17, 2013
ff36222
Merge branch 'notifications' of https://github.com/wordpress-mobile/W…
roundhill May 17, 2013
9e220c3
Merge branch 'master' of https://github.com/wordpress-mobile/WordPres…
roundhill May 17, 2013
55faf8e
Adding 'hamburger' menu button that is now recommended in the Android…
roundhill May 20, 2013
8aadbb9
Adding Volley jar
May 20, 2013
0723c2c
Tweaking list layouts to match up with 16dp/8dp grid from android des…
roundhill May 20, 2013
d65dbfa
Eighteen is not nearly as cool as sixteen.
roundhill May 20, 2013
a771d7b
Show a generic error message when something went wrong on following a…
May 21, 2013
2b5092e
Replacing old CWAC image cache and thumbnail with Volley caching and …
roundhill May 21, 2013
fb83d5e
Merge branch 'notifications' of https://github.com/wordpress-mobile/W…
roundhill May 21, 2013
a0bfab2
Don't show moderation buttons if the user can't moderate the comment.…
roundhill May 21, 2013
229f5e4
Fixes #456. Props aagam94
roundhill May 21, 2013
ca80358
Replacing hard coded yes/no strings.
roundhill May 21, 2013
257fe4e
Added footer view support for single line notes list. Also matched up…
roundhill May 22, 2013
2b6b4ee
The 16dp margins weren't jiving well with the content. Switching back…
roundhill May 22, 2013
df4afd8
Tint the follow button to match the color of other buttons in the view.
roundhill May 22, 2013
f616ad8
Ensure refresh button animates on first run of notifications activity.
roundhill May 22, 2013
e053dc6
Tweaks for inbox style notifications.
roundhill May 22, 2013
2a10cfc
Refactoring to use REST client that uses Volley
May 22, 2013
46d09a1
Using the new volley api with the rest client
May 23, 2013
4762a6b
make sure urls are absolute
May 23, 2013
1c2d303
Removing all uses of async-http library and moved to Volley
May 23, 2013
b11f1e7
Fixed an issue where the error message string was not correctly build…
May 23, 2013
f2be62e
Remove first item from 'before' notes request so we don't get dupes. …
roundhill May 23, 2013
3d2b10b
Don't show error message if we couldn't load a note from a notificati…
roundhill May 23, 2013
d54e0e7
Internationalize the notifications title.
roundhill May 23, 2013
442c0c9
Updating multiple notification icon to not have layers.
roundhill May 23, 2013
1a95028
Adding menu option to sign out. It will clear all wpcom credentials, …
roundhill May 23, 2013
8c46356
Moar icons.
roundhill May 23, 2013
0dfcffe
Caching latest notifications
May 24, 2013
0b52be1
Null check before setting visibility of progress footer view
roundhill May 24, 2013
a72dca5
Fixed reauthenticating to a site from outside of the regular auth flo…
roundhill May 24, 2013
fb86ef5
Cleaning up the manifest file
roundhill May 24, 2013
21e86db
A few ic_drawer icons were in the wrong folder. Added a listener to f…
roundhill May 24, 2013
ccfb52c
removing GCM register call from AccountSetupActivity, as it caused tw…
roundhill May 27, 2013
b16093c
Don't request more notifications if there are no more available.
roundhill May 27, 2013
6671d9c
Improvements to sign out process.
roundhill May 27, 2013
71f419d
Null check when setting comment badge
roundhill May 27, 2013
3fafb2c
Adding more error catching code
May 28, 2013
a71d6c5
Added menu icon for gingerbread and lower devices. Fixed capitalizati…
roundhill May 28, 2013
1d6abb0
Upgrading wordpress-android-rest library
May 29, 2013
fe96b43
New loading and failure images for comments
May 30, 2013
4c77b77
Tweaking remote failed image
May 30, 2013
7345872
Using a NetworkImageView in reply row template
May 31, 2013
a529c3c
ReplyField disables button when content is empty and enables when con…
May 31, 2013
740cbfe
Check if Activity still exists before modifying views
May 31, 2013
8b96355
Set a new "retry-policy" on REST requests with timeout of 20secs. Thi…
Jun 3, 2013
58668ba
Set the default number of retries for POST rest requests to 0. Also c…
Jun 3, 2013
92f156c
Use constants to define the number of retries and make them public, s…
Jun 3, 2013
c371941
Scale images horizontally if too large for TextView
Jun 4, 2013
d2cbcd5
Improved comment reply error handling in notifications
Jun 4, 2013
b2c8586
Updating translations.
roundhill Jun 5, 2013
f494668
Fix force close when signing out of WordPress.com and then tapping a …
roundhill Jun 5, 2013
f28975f
Don't set the drawer indicator if we're on an xlarge device in landsc…
roundhill Jun 5, 2013
a589de3
Using a custom script to build Config.java to include app tokens
Jun 6, 2013
5aa089b
Moving Config.java generation to stand alone task
Jun 6, 2013
97d943d
Removed unused 'fromNotification' extra as it was loading notificatio…
roundhill Jun 7, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Using a custom script to build Config.java to include app tokens
  • Loading branch information
Robert Collins committed Jun 6, 2013
commit a589de3011cdf431978a37de2bddc79affac1307
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
/gen
local.properties
res/raw/config.properties
.jdbrc
.jdbrc
src/org/wordpress/android/Config.java
6 changes: 0 additions & 6 deletions config.properties.sample

This file was deleted.

11 changes: 11 additions & 0 deletions custom_rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<project default="package">
<property file="local.properties"/>
<property file="project.properties"/>
<!-- Create a config class with values for this build -->
<target name="-pre-build">
<exec executable="./wpconfig">
<arg value="${source.absolute.dir}/org/wordpress/android/Config.java" />
</exec>
</target>

</project>
23 changes: 3 additions & 20 deletions src/org/wordpress/android/WordPress.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.net.URI;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import android.app.Application;
import android.content.Context;
Expand Down Expand Up @@ -43,6 +42,7 @@
import org.wordpress.android.ui.WPActionBarActivity;
import org.wordpress.android.util.BitmapLruCache;
import org.wordpress.android.util.WPRestClient;
import org.wordpress.android.Config;

public class WordPress extends Application {

Expand All @@ -63,7 +63,6 @@ public class WordPress extends Application {
public static boolean postsShouldRefresh;
public static boolean shouldRestoreSelectedActivity;
public static WPRestClient restClient;
public static Properties config;
public static RequestQueue requestQueue;
public static ImageLoader imageLoader;
public static JSONObject latestNotes;
Expand All @@ -72,7 +71,6 @@ public class WordPress extends Application {

@Override
public void onCreate() {
loadProperties();
versionName = getVersionName();
wpDB = new WordPressDB(this);

Expand Down Expand Up @@ -103,7 +101,7 @@ public static void registerForCloudMessaging(Context ctx) {
GCMRegistrar.checkDevice(ctx);
GCMRegistrar.checkManifest(ctx);
token = GCMRegistrar.getRegistrationId(ctx);
String gcmId = WordPress.config.getProperty("gcm.id").toString();
String gcmId = Config.GCM_ID;
if (gcmId != null && token.equals("")) {
GCMRegistrar.register(ctx, gcmId);
} else {
Expand Down Expand Up @@ -278,19 +276,6 @@ public static Blog setCurrentBlog(int id) {

return currentBlog;
}
/**
* Load res/raw/config.properties into a Properties object
*/
private void loadProperties(){
config = new Properties();
InputStream stream = getResources().openRawResource(R.raw.config);
try {
config.load(stream);
} catch(java.io.IOException error){
config = null;
Log.e(TAG, "Could not load config.properties", error);
}
}
/**
* Restores notifications from cached file
*/
Expand Down Expand Up @@ -425,9 +410,7 @@ public void requestAccessToken(final WPRestClient.Request request){
final SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(WordPress.this);
String username = settings.getString(WPCOM_USERNAME_PREFERENCE, null);
String password = WordPressDB.decryptPassword(settings.getString(WPCOM_PASSWORD_PREFERENCE, null));
Oauth oauth = new Oauth(config.getProperty(APP_ID_PROPERTY),
config.getProperty(APP_SECRET_PROPERTY),
config.getProperty(APP_REDIRECT_PROPERTY));
Oauth oauth = new Oauth(Config.OAUTH_APP_ID, Config.OAUTH_APP_SECRET, Config.OAUTH_REDIRECT_URI);
// make oauth volley request
Request oauthRequest = oauth.makeRequest(username, password,
new Oauth.Listener(){
Expand Down
2 changes: 1 addition & 1 deletion src/org/wordpress/android/WordPressDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public class WordPressDB {

private SQLiteDatabase db;

protected static final String PASSWORD_SECRET = "nottherealpasscode";
protected static final String PASSWORD_SECRET = Config.DB_SECRET;

public String defaultBlog = "";

Expand Down
27 changes: 27 additions & 0 deletions wpconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env ruby

require 'erb'

constants = {}

File.open('local.properties', 'r') do |f|
f.each_line do |line|
if line.index '='
name, value = line.split '=', 2
key = name.split '.'
constants[key[1..-1].join('_').upcase.strip] = value.strip if key[0] == 'wp'
end
end
end

File.open(ARGV[0], 'w') do |f|
f.puts ERB.new(<<-JAVA).result binding
package org.wordpress.android;

class Config {
<% constants.each do |name, value| %>
protected static final String <%=name%>="<%=value%>";
<% end %>
}
JAVA
end