Commit a06cbf10 authored by Aubrey Colter's avatar Aubrey Colter Committed by Gerrit Review System

Replacing the twitter4j jar required some minor code tweaks:

Removing all of the synchronization (and thus the unnecessary variables myTwitter and myUserId)
Search is no longer anonymous in twitter4j, so I only create one instance of twitter and use it in Search as well.
Fixing a few of the blocks that broke because of method signatures that changed.
CheckAuthorized() (checkAccessCode())
Follow()
StopFollowing()
RequestFollowers()
Added the @UsesLibraries annotation that was missing in the broken code. Code is fixed, ready to publish.
Fixed the formatting to be compatible with app-inventor style.
Removed the volatile keyword on the variables because it is no longer necessary.
Moved the setOAuth back into the try block at Jose's suggestion.
Added catch (IllegalStateException) block. Andrew and I determined this should return true because the user is valid, twitter4j does not allow the OAuth to be set again.
Updated documentation to reflect changes in code.
Change-Id: Ibaa8564ac0a154992340c8fef2e6c3e84a0ff042
parent 8ef1932d
......@@ -72,7 +72,7 @@
<pathelement location="lib/keyczar/keyczar-0.66-080111-java-1.6.jar" />
<pathelement location="lib/objectify-3.0/objectify-3.0.jar" />
<pathelement location="lib/tablelayout/TableLayout-jdk1.5-2007-04-21.jar" />
<pathelement location="lib/twitter/twitter4j-2.0.10-SNAPSHOT.jar" />
<pathelement location="lib/twitter/twitter4j-core-android-2.2.6.jar" />
<fileset dir="buildserver/lib" includes="**/*.jar"/>
<!-- gwt libs -->
<pathelement location="lib/gwt/2.3.0/gwt-dev.jar"/>
......
......@@ -128,7 +128,7 @@
</copy>
<copy toFile="${classes.files.dir}/YailGenerator.jar" file="${local.build.dir}/YailGenerator.jar" />
<copy toFile="${classes.files.dir}/kawa.jar" file="${lib.dir}/kawa/kawa-1.11-modified.jar" />
<copy toFile="${classes.files.dir}/twitter4j.jar" file="${lib.dir}/twitter/twitter4j-2.0.10-SNAPSHOT.jar" />
<copy toFile="${classes.files.dir}/twitter4j.jar" file="${lib.dir}/twitter/twitter4j-core-android-2.2.6.jar" />
<copy toFile="${classes.files.dir}/fusiontables.jar" file="${lib.dir}/fusiontables/fusiontables.jar" />
<copy toFile="${classes.files.dir}/google-api-client-beta.jar" file="${lib.dir}/oauth/google-api-client-1.10.3-beta.jar" />
<copy toFile="${classes.files.dir}/google-http-client-beta.jar" file="${lib.dir}/oauth/google-http-client-1.10.3-beta.jar" />
......
......@@ -118,7 +118,7 @@
<pathelement location="${public.build.dir}/CommonConstants.jar" />
<pathelement location="${lib.dir}/android/2.2/android.jar" />
<pathelement location="${lib.dir}/kawa/kawa-1.11-modified.jar" />
<pathelement location="${lib.dir}/twitter/twitter4j-2.0.10-SNAPSHOT.jar" />
<pathelement location="${lib.dir}/twitter/twitter4j-core-android-2.2.6.jar" />
<pathelement location="${lib.dir}/fusiontables/fusiontables.jar" />
<pathelement location="${lib.dir}/oauth/google-api-client-1.10.3-beta.jar" />
<pathelement location="${lib.dir}/oauth/google-api-client-android2-1.10.3-beta.jar" />
......@@ -212,7 +212,7 @@
<pathelement location="${lib.dir}/android/2.2/android.jar" />
<pathelement location="${lib.dir}/guava/guava-11.0.1.jar" />
<pathelement location="${lib.dir}/kawa/kawa-1.11-modified.jar" />
<pathelement location="${lib.dir}/twitter/twitter4j-2.0.10-SNAPSHOT.jar" />
<pathelement location="${lib.dir}/twitter/twitter4j-core-android-2.2.6.jar" />
<pathelement location="${lib.dir}/fusiontables/fusiontables.jar" />
<pathelement location="${lib.dir}/oauth/google-api-client-1.10.3-beta.jar" />
<pathelement location="${lib.dir}/oauth/google-api-client-android2-1.10.3-beta.jar" />
......
......@@ -944,17 +944,11 @@
This component allows users to interact with Twitter.
</p>
<p>
This non-visible component enables communication with Twitter. Methods are included
to enable searching (
<code>
SearchTwitter
</code>
) and logging in to Twitter
(
This non-visible component enables communication with Twitter. Once a user has logged in (
<code>
Authorize
</code>
). Once a user has logged in and the login has been
) and the login has been
confirmed successful by the
<code>
IsAuthorized
......@@ -963,6 +957,13 @@
following methods:
</p>
<ul>
<li>
Search Twitter for tweets or labels (
<code>
SearchTwitter
</code>
).
</li>
<li>
Set the status of the logged-in user (
<code>
......@@ -1007,7 +1008,7 @@
).
</li>
<li>
Get the most recent messages of followed users
Get the most recent messages in the user's timeline.
(
<code>
RequestFriendTimeline
......@@ -1024,8 +1025,8 @@
</li>
</ul>
<p>
In general, you invoke one of these methods and the result will bcome available
when the corresponding recipt event is signalled. For example, if you call
In general, you invoke one of these methods and the result will become available
when the corresponding receipt event is signaled. For example, if you call
<code>
RequestFollowers
</code>
......@@ -1034,10 +1035,9 @@
FollowersReceived
</code>
event will
be signalled when the list of followers is available. This might take time, because
the request is going over the web; the result might even never become available,
for example, if your device is not connected to the web or the Twitter web site is
down.
be signaled when the list of followers is available. This might take time, because
the request is going over the web; the result might even never become available if,
for example, your device is not connected to the web or the Twitter web site is down.
</p>
<p>
Login is handled using the OAuth protocol, as required by the Twitter API (
......@@ -1050,19 +1050,12 @@
<code>
Authorize
</code>
. This causes a Twitter login page to
be presented that will allow the user to login with their username and password if
necessary, and then return appropriate credentials to the Twitter component in the
. This loads a Twitter login page that will allow the user to login with their username and password, and then return appropriate credentials to the Twitter component in the
app. Once the Twitter component has the credentials the
<code>
IsAuthorized
</code>
event is raised to let the app know that it can proceed with Twitter API calls. The
only Twitter component method that does not require the user to be authenticated is
<code>
SearchTwitter
</code>
. An app retains Twitter credentials across invocations,
event is raised to let the app know that it can proceed with Twitter API calls. An app retains Twitter credentials across invocations,
so it may not be necessary for the user to login each time he or she uses the app.
Reinstalling an app will clear the credentials, as will calling the
<code>
......@@ -1085,7 +1078,7 @@
Important:
</b>
Most of the operation of the OAuth protocol is hidden inside the
Twitter component and you do not need to understand how it works in order to use
Twitter component and you do not need to understand how it works to use
the component. However, it is necessary for anyone building an app with the Twitter
component to supply a
<i>
......@@ -1320,7 +1313,7 @@
<code>
RequestMentions
</code>
has
have
been retrieved.
</dd>
<dt>
......@@ -1367,11 +1360,7 @@
</dt>
<dd>
Removes authorization from this running app instance. A user will have to
login again to use any Twitter method other than
<code>
SearchTwitter
</code>
.
login again to use any Twitter method.
</dd>
<dt>
<code>
......@@ -1412,7 +1401,7 @@
</dt>
<dd>
Retrieves the 20 most recent messages in your timeline. Returns a list of
tuples (sub-lists), where each tuple contains username and status message.
tuples (sub-lists), where each tuple contains a username and status message.
</dd>
<dt>
<code>
......@@ -1420,7 +1409,7 @@
</code>
</dt>
<dd>
Retrieves the most mentions of the user.
Retrieves the most recent mentions of the user.
</dd>
<dt>
<code>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment