Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Twitter (iOS) CDV 2.0 Compliance

  • Loading branch information...
commit 8d1ea688db4bdc6220b43fc92e492d8b76550736 1 parent b4c386f
@RandyMcMillan RandyMcMillan authored
Showing with 5,898 additions and 51 deletions.
  1. +3 −7 iOS/Twitter/{native/ios → }/TwitterPlugin.h
  2. +2 −7 iOS/Twitter/{native/ios → }/TwitterPlugin.m
  3. +9 −0 iOS/Twitter/example/www/index.html
  4. 0  iOS/Twitter/{www → example/www2.0}/TwitterPlugin.js
  5. +47 −0 iOS/Twitter/example/www2.0/config.xml
  6. +5,240 −0 iOS/Twitter/example/www2.0/cordova-2.0.0.js
  7. +100 −0 iOS/Twitter/example/www2.0/css/index.css
  8. +155 −0 iOS/Twitter/example/www2.0/demo.js
  9. BIN  iOS/Twitter/example/www2.0/img/cordova.png
  10. +68 −0 iOS/Twitter/example/www2.0/index.html
  11. +24 −0 iOS/Twitter/example/www2.0/js/index.js
  12. BIN  iOS/Twitter/example/www2.0/ninja-lolcat.gif
  13. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_128.png
  14. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_16.png
  15. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_24.png
  16. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_256.png
  17. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_32.png
  18. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_48.png
  19. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_512.png
  20. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_64.png
  21. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_36.png
  22. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_48.png
  23. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_72.png
  24. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_96.png
  25. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_bb_80.png
  26. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_114.png
  27. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_144.png
  28. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_57.png
  29. BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_72.png
  30. BIN  iOS/Twitter/example/www2.0/res/screen/android_hdpi_landscape.png
  31. BIN  iOS/Twitter/example/www2.0/res/screen/android_hdpi_portrait.png
  32. BIN  iOS/Twitter/example/www2.0/res/screen/android_ldpi_landscape.png
  33. BIN  iOS/Twitter/example/www2.0/res/screen/android_ldpi_portrait.png
  34. BIN  iOS/Twitter/example/www2.0/res/screen/android_mdpi_landscape.png
  35. BIN  iOS/Twitter/example/www2.0/res/screen/android_mdpi_portrait.png
  36. BIN  iOS/Twitter/example/www2.0/res/screen/android_xhdpi_landscape.png
  37. BIN  iOS/Twitter/example/www2.0/res/screen/android_xhdpi_portrait.png
  38. BIN  iOS/Twitter/example/www2.0/res/screen/blackberry_transparent_300.png
  39. BIN  iOS/Twitter/example/www2.0/res/screen/blackberry_transparent_400.png
  40. BIN  iOS/Twitter/example/www2.0/res/screen/ipad_landscape.png
  41. BIN  iOS/Twitter/example/www2.0/res/screen/ipad_portrait.png
  42. BIN  iOS/Twitter/example/www2.0/res/screen/ipad_retina_landscape.png
  43. BIN  iOS/Twitter/example/www2.0/res/screen/ipad_retina_portrait.png
  44. BIN  iOS/Twitter/example/www2.0/res/screen/iphone_landscape.png
  45. BIN  iOS/Twitter/example/www2.0/res/screen/iphone_portrait.png
  46. BIN  iOS/Twitter/example/www2.0/res/screen/iphone_retina_landscape.png
  47. BIN  iOS/Twitter/example/www2.0/res/screen/iphone_retina_portrait.png
  48. BIN  iOS/Twitter/example/www2.0/res/screen/windows_phone_portrait.jpg
  49. +50 −0 iOS/Twitter/example/www2.0/spec.html
  50. +11 −0 iOS/Twitter/example/www2.0/spec/helper.js
  51. +49 −0 iOS/Twitter/example/www2.0/spec/index.js
  52. +0 −22 iOS/Twitter/install
  53. +140 −0 iOS/Twitter/js/TwitterPlugin.js
  54. +0 −15 iOS/Twitter/package.json
View
10 iOS/Twitter/native/ios/TwitterPlugin.h → iOS/Twitter/TwitterPlugin.h
@@ -5,14 +5,10 @@
// Created by Antonelli Brian on 10/13/11.
//
-#import <Foundation/Foundation.h>
-#import <Twitter/Twitter.h>
-#import <Accounts/Accounts.h>
-#ifdef CORDOVA_FRAMEWORK
+ #import <Foundation/Foundation.h>
+ #import <Twitter/Twitter.h>
+ #import <Accounts/Accounts.h>
#import <Cordova/CDVPlugin.h>
-#else
- #import "CDVPlugin.h"
-#endif
@interface TwitterPlugin : CDVPlugin{
}
View
9 iOS/Twitter/native/ios/TwitterPlugin.m → iOS/Twitter/TwitterPlugin.m
@@ -5,14 +5,9 @@
// Created by Antonelli Brian on 10/13/11.
//
-#import "TwitterPlugin.h"
-#ifdef CORDOVA_FRAMEWORK
+ #import "TwitterPlugin.h"
#import <Cordova/JSONKit.h>
#import <Cordova/CDVAvailability.h>
-#else
- #import "JSONKit.h"
- #import "CDVAvailability.h"
-#endif
#define TWITTER_URL @"http://api.twitter.com/1/"
@@ -92,7 +87,7 @@ - (void) composeTweet:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)
else{
#if TARGET_IPHONE_SIMULATOR
- NSString *simWarning = @"Test TwitterPlugin on Real Hardware. Tested on Cordova 1.7.0";
+ NSString *simWarning = @"Test TwitterPlugin on Real Hardware. Tested on Cordova 2.0.0";
//EXC_BAD_ACCESS occurs on simulator unable to reproduce on real device
//running iOS 5.1 and Cordova 1.6.1
NSLog(@"%@",simWarning);
View
9 iOS/Twitter/example/www/index.html
@@ -10,9 +10,18 @@
<script type="text/javascript" charset="utf-8" src="cordova-1.7.0.js"></script>
<script type="text/javascript" charset="utf-8" src="TwitterPlugin.js"></script>
<script type="text/javascript" charset="utf-8" src="demo.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/index.css" />
+
</head>
<body onload="onBodyLoad()">
<h1>Hey, it's Twitter on PhoneGap!</h1>
+ <h1>Apache Cordova™</h1>
+ <div id="deviceready">
+ <p class="status pending blink">Connecting to Device</p>
+ <p class="status complete blink hide">Device is Ready</p>
+ </div>
+ </div>
+
<br />
<ol>
<li><a href="#" id="isAvailable">isAvailable</a></li>
View
0  iOS/Twitter/www/TwitterPlugin.js → iOS/Twitter/example/www2.0/TwitterPlugin.js
File renamed without changes
View
47 iOS/Twitter/example/www2.0/config.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns = "http://www.w3.org/ns/widgets"
+ xmlns:gap = "http://phonegap.com/ns/1.0"
+ id = "io.cordova.hello-cordova"
+ version = "2.0.0">
+ <name>Hello Cordova</name>
+
+ <description>
+ A sample Apache Cordova application that responds to the deviceready event.
+ </description>
+
+ <author href="http://cordova.io" email="callback-dev@incubator.apache.org">
+ Apache Cordova Team
+ </author>
+
+ <icon src="res/icon/cordova_512.png" width="512" height="512" />
+ <icon src="res/icon/cordova_android_96.png" width="96" height="96" gap:platform="android" />
+ <icon src="res/icon/cordova_bb_80.png" width="80" height="80" gap:platform="blackberry" />
+ <icon src="res/icon/cordova_ios_144.png" width="144" height="144" gap:platform="ios" />
+
+ <gap:splash src="res/screen/android_hdpi_landscape.png" width="800" height="480" gap:platform="android" />
+ <gap:splash src="res/screen/android_hdpi_portrait.png" width="480" height="800" gap:platform="android" />
+ <gap:splash src="res/screen/android_ldpi_landscape.png" width="320" height="200" gap:platform="android" />
+ <gap:splash src="res/screen/android_ldpi_portrait.png" width="200" height="320" gap:platform="android" />
+ <gap:splash src="res/screen/android_mdpi_landscape.png" width="480" height="320" gap:platform="android" />
+ <gap:splash src="res/screen/android_mdpi_portrait.png" width="320" height="480" gap:platform="android" />
+ <gap:splash src="res/screen/android_xhdpi_landscape.png" width="1280" height="720" gap:platform="android" />
+ <gap:splash src="res/screen/android_xhdpi_portrait.png" width="720" height="1280" gap:platform="android" />
+ <gap:splash src="res/screen/blackberry_transparent_300.png" width="300" height="300" gap:platform="blackberry" />
+ <gap:splash src="res/screen/blackberry_transparent_400.png" width="200" height="200" gap:platform="blackberry" />
+ <gap:splash src="res/screen/ipad_landscape.png" width="1024" height="748" gap:platform="ios" />
+ <gap:splash src="res/screen/ipad_portrait.png" width="768" height="1004" gap:platform="ios" />
+ <gap:splash src="res/screen/ipad_retina_landscape.png" width="2048" height="1496" gap:platform="ios" />
+ <gap:splash src="res/screen/ipad_retina_portrait.png" width="1536" height="2008" gap:platform="ios" />
+ <gap:splash src="res/screen/iphone_landscape.png" width="480" height="320" gap:platform="ios" />
+ <gap:splash src="res/screen/iphone_portrait.png" width="320" height="480" gap:platform="ios" />
+ <gap:splash src="res/screen/iphone_retina_landscape.png" width="960" height="640" gap:platform="ios" />
+ <gap:splash src="res/screen/iphone_retina_portrait.png" width="640" height="960" gap:platform="ios" />
+ <gap:splash src="res/screen/windows_phone_portrait.jpg" width="480" height="800" gap:platform="winphone" />
+
+ <feature name="http://api.phonegap.com/1.0/device" />
+
+ <preference name="phonegap-version" value="1.9.0" />
+ <preference name="orientation" value="default" />
+ <preference name="target-device" value="universal" />
+ <preference name="fullscreen" value="false" />
+</widget>
View
5,240 iOS/Twitter/example/www2.0/cordova-2.0.0.js
5,240 additions, 0 deletions not shown
View
100 iOS/Twitter/example/www2.0/css/index.css
@@ -0,0 +1,100 @@
+html,
+body {
+ height:100%;
+ font-size:12px;
+ width:100%;
+}
+
+html {
+ display:table;
+}
+
+body {
+ background-color:#A7A7A7;
+ background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+ background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+ background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%);
+ background-image:-webkit-gradient(
+ linear,
+ left top,
+ left bottom,
+ color-stop(0, #A7A7A7),
+ color-stop(0.51, #E4E4E4)
+ );
+ display:table-cell;
+ font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif;
+ text-transform:uppercase;
+ vertical-align:middle;
+}
+
+.app {
+ background-image:url(../img/cordova.png);
+ background-repeat:no-repeat;
+ margin:0px auto;
+ width:275px;
+}
+
+h1 {
+ font-size:2em;
+ font-weight:300;
+ margin:0px;
+ overflow:visible;
+ padding:0px;
+ text-align:center;
+}
+
+.status {
+ background-color:#333333;
+ border-radius:4px;
+ -webkit-border-radius:4px;
+ color:#FFFFFF;
+ font-size:1em;
+ margin:0px auto;
+ padding:2px 10px;
+ text-align:center;
+ width:100%;
+ max-width:175px;
+}
+
+.status.complete {
+ background-color:#4B946A;
+}
+
+.hide {
+ display:none;
+}
+
+@keyframes fade {
+ from { opacity: 1.0; }
+ 50% { opacity: 0.4; }
+ to { opacity: 1.0; }
+}
+
+@-webkit-keyframes fade {
+ from { opacity: 1.0; }
+ 50% { opacity: 0.4; }
+ to { opacity: 1.0; }
+}
+
+.blink {
+ animation:fade 3000ms infinite;
+ -webkit-animation:fade 3000ms infinite;
+}
+
+/* portrait */
+/* @media screen and (max-aspect-ratio: 1/1) */
+.app {
+ background-position:center top;
+ height:100px; /* adds enough room for text */
+ padding:180px 0px 0px 0px; /* background height - shadow offset */
+}
+
+/* lanscape (when wide enough) */
+@media screen and (min-aspect-ratio: 1/1) and (min-width:445px) {
+ .app {
+ background-position:left center;
+ height:140px; /* height + padding = background image size */
+ padding-left:170px; /* background width */
+ padding-top:60px; /* center the text */
+ }
+}
View
155 iOS/Twitter/example/www2.0/demo.js
@@ -0,0 +1,155 @@
+//function onBodyLoad(){
+// document.addEventListener("deviceready", onDeviceReady, false);
+//}
+
+//function onDeviceReady(){
+// console.log("onDeviceReady");
+
+
+// TwitterDemo.setup(); ///This is now called from index.js
+
+
+//}
+
+TwitterDemo = {
+ $:function(id){
+ return document.getElementById(id);
+ },
+
+ log:function(s){
+ TwitterDemo.$("log").innerHTML = s;
+ },
+
+ setup:function(){
+ var tests = ["isAvailable", "isSetup", "tweet1", "tweet2", "tweet3", "tweet4", "tweet5", "tweet6", "timeline", "mentions", "friendsIds", "usersLookup"];
+ for(var i=0, l=tests.length; i<l; i++){
+ this.$(tests[i]).onclick = this[tests[i]];
+ }
+ },
+
+ isAvailable:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.isTwitterAvailable(function(r){
+ TwitterDemo.log("twitter available? " + r);
+ });
+ },
+
+ isSetup:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.isTwitterSetup(function(r){
+ TwitterDemo.log("twitter configured? " + r);
+ });
+ },
+
+ tweet1:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.composeTweet(
+ function(s){ TwitterDemo.log("tweet success"); },
+ function(e){ TwitterDemo.log("tweet failure: " + e); },
+ "Text, Image, URL",
+ {
+ urlAttach:"http://m.youtube.com/#/watch?v=obx2VOtx0qU",
+ imageAttach:"http://i.ytimg.com/vi/obx2VOtx0qU/hqdefault.jpg?w=320&h=192&sigh=QD3HYoJj9dtiytpCSXhkaq1oG8M"
+ });
+ },
+
+
+ /*
+ //Original tweet1 example
+ tweet1:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.composeTweet(
+ function(s){ TwitterDemo.log("tweet success"); },
+ function(e){ TwitterDemo.log("tweet failure: " + e); },
+ "Text, Image, URL",
+ {
+ urlAttach:"https://github.com/brianantonelli",
+ imageAttach:"http://zomgdinosaurs.com/zomg.jpg"
+ });
+ },
+
+ */
+
+ tweet2:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.composeTweet(
+ function(s){ TwitterDemo.log("tweet success"); },
+ function(e){ TwitterDemo.log("tweet failure: " + e); },
+ "Text, Remote Image",
+ {
+ imageAttach:"http://zomgdinosaurs.com/zomg.jpg"
+ });
+ },
+
+ tweet6:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.composeTweet(
+ function(s){ TwitterDemo.log("tweet success"); },
+ function(e){ TwitterDemo.log("tweet failure: " + e); },
+ "Text, Local Image",
+ {
+ imageAttach:"www/ninja-lolcat.gif"
+ });
+ },
+
+ tweet3:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.composeTweet(
+ function(s){ TwitterDemo.log("tweet success"); },
+ function(e){ TwitterDemo.log("tweet failure: " + e); },
+ "Text, URL",
+ {
+ urlAttach:"https://github.com/brianantonelli"
+ });
+ },
+
+ tweet4:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.composeTweet(
+ function(s){ TwitterDemo.log("tweet success"); },
+ function(e){ TwitterDemo.log("tweet failure: " + e); },
+ "Text");
+ },
+
+ tweet5:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.composeTweet(
+ function(s){ TwitterDemo.log("tweet success"); },
+ function(e){ TwitterDemo.log("tweet failure: " + e); });
+ },
+
+ timeline:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.getPublicTimeline(
+ function(s){ TwitterDemo.log("timeline success: " + JSON.stringify(s)); },
+ function(e){ TwitterDemo.log("timeline failure: " + e); });
+ },
+
+ mentions:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.getMentions(
+ function(s){ TwitterDemo.log("mentions success: " + JSON.stringify(s)); },
+ function(e){ TwitterDemo.log("mentions failure: " + e); });
+ },
+
+ friendsIds:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.getTWRequest(
+ 'friends/ids.json',
+ {},
+ function(s){ TwitterDemo.log("friendsIds success: " + JSON.stringify(s)); },
+ function(e){ TwitterDemo.log("friendsIds failure: " + e); });
+ },
+
+ usersLookup:function(){
+ TwitterDemo.log("wait..");
+ window.plugins.twitter.getTWRequest(
+ 'users/lookup.json',
+ {user_id: '16141659,783214,6253282'},
+ function(s){ TwitterDemo.log("usersLookup success: " + JSON.stringify(s)); },
+ function(e){ TwitterDemo.log("usersLookup failure: " + e); },
+ {requestMethod: 'POST'});
+ }
+
+
+};
View
BIN  iOS/Twitter/example/www2.0/img/cordova.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
68 iOS/Twitter/example/www2.0/index.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html>
+<html>
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+-->
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta name = "format-detection" content = "telephone=no"/>
+ <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width;" />
+ <link rel="stylesheet" type="text/css" href="css/index.css" />
+ <title>Hello Cordova</title>
+ </head>
+ <body>
+ <div class="app">
+ <h1>Apache Cordova™</h1>
+ <div id="deviceready">
+ <p class="status pending blink">Connecting to Device</p>
+ <p class="status complete blink hide">Device is Ready</p>
+ </div>
+ </div>
+ <script type="text/javascript" src="cordova-2.0.0.js"></script>
+ <script type="text/javascript" src="js/index.js"></script>
+ <script type="text/javascript" charset="utf-8" src="TwitterPlugin.js"></script>
+ <script type="text/javascript" charset="utf-8" src="demo.js"></script>
+
+ <script type="text/javascript">
+ app.initialize();
+ </script>
+
+
+ <h1>Hey, it's Twitter on PhoneGap!</h1>
+ <br />
+ <ol>
+ <li><a href="#" id="isAvailable">isAvailable</a></li>
+ <li><a href="#" id="isSetup">isSetup</a></li>
+ <li><a href="#" id="tweet1">tweet (text, img, url)</a></li>
+ <li><a href="#" id="tweet2">tweet (text, remote img)</a></li>
+ <li><a href="#" id="tweet6">tweet (text, local img)</a></li>
+ <li><a href="#" id="tweet3">tweet (text, url)</a></li>
+ <li><a href="#" id="tweet4">tweet (text)</a></li>
+ <li><a href="#" id="tweet5">tweet (empty)</a></li>
+ <li><a href="#" id="timeline">timeline</a></li>
+ <li><a href="#" id="mentions">mentions</a></li>
+ <li><a href="#" id="friendsIds">friendsIds</a></li>
+ <li><a href="#" id="usersLookup">usersLookup</a></li>
+ </ol>
+ <div id="log" style="width:100%;height:200px;overflow:auto;background-color:#000;color:yellow;"></div>
+
+
+ </body>
+</html>
View
24 iOS/Twitter/example/www2.0/js/index.js
@@ -0,0 +1,24 @@
+var app = {
+initialize: function() {
+ this.bind();
+},
+bind: function() {
+ document.addEventListener('deviceready', this.deviceready, false);
+},
+deviceready: function() {
+ // note that this is an event handler so the scope is that of the event
+ // so we need to call app.report(), and not this.report()
+ app.report('deviceready');
+
+ TwitterDemo.setup();
+
+
+},
+report: function(id) {
+ console.log("report:" + id);
+ // hide the .pending <p> and show the .complete <p>
+ document.querySelector('#' + id + ' .pending').className += ' hide';
+ var completeElem = document.querySelector('#' + id + ' .complete');
+ completeElem.className = completeElem.className.split('hide').join('');
+}
+};
View
BIN  iOS/Twitter/example/www2.0/ninja-lolcat.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_128.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_24.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_256.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_32.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_512.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_64.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_36.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_48.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_android_96.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_bb_80.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_114.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_144.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_57.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/icon/cordova_ios_72.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_hdpi_landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_hdpi_portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_ldpi_landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_ldpi_portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_mdpi_landscape.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_mdpi_portrait.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_xhdpi_landscape.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/android_xhdpi_portrait.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/blackberry_transparent_300.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/blackberry_transparent_400.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/ipad_landscape.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/ipad_portrait.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/ipad_retina_landscape.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/ipad_retina_portrait.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/iphone_landscape.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/iphone_portrait.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/iphone_retina_landscape.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/iphone_retina_portrait.png
Diff not rendered
View
BIN  iOS/Twitter/example/www2.0/res/screen/windows_phone_portrait.jpg
Diff not rendered
View
50 iOS/Twitter/example/www2.0/spec.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>Jasmine Spec Runner</title>
+
+ <!-- jasmine source -->
+ <link rel="shortcut icon" type="image/png" href="spec/lib/jasmine-1.2.0/jasmine_favicon.png">
+ <link rel="stylesheet" type="text/css" href="spec/lib/jasmine-1.2.0/jasmine.css">
+ <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine.js"></script>
+ <script type="text/javascript" src="spec/lib/jasmine-1.2.0/jasmine-html.js"></script>
+
+ <!-- include source files here... -->
+ <script type="text/javascript" src="js/index.js"></script>
+
+ <!-- include spec files here... -->
+ <script type="text/javascript" src="spec/helper.js"></script>
+ <script type="text/javascript" src="spec/index.js"></script>
+
+ <script type="text/javascript">
+ (function() {
+ var jasmineEnv = jasmine.getEnv();
+ jasmineEnv.updateInterval = 1000;
+
+ var htmlReporter = new jasmine.HtmlReporter();
+
+ jasmineEnv.addReporter(htmlReporter);
+
+ jasmineEnv.specFilter = function(spec) {
+ return htmlReporter.specFilter(spec);
+ };
+
+ var currentWindowOnload = window.onload;
+
+ window.onload = function() {
+ if (currentWindowOnload) {
+ currentWindowOnload();
+ }
+ execJasmine();
+ };
+
+ function execJasmine() {
+ jasmineEnv.execute();
+ }
+ })();
+ </script>
+ </head>
+ <body>
+ <div id="stage" style="display:none;"></div>
+ </body>
+</html>
View
11 iOS/Twitter/example/www2.0/spec/helper.js
@@ -0,0 +1,11 @@
+afterEach(function() {
+ document.getElementById('stage').innerHTML = '';
+});
+
+var helper = {
+ trigger: function(obj, name) {
+ var e = document.createEvent('Event');
+ e.initEvent(name, true, true);
+ obj.dispatchEvent(e);
+ }
+};
View
49 iOS/Twitter/example/www2.0/spec/index.js
@@ -0,0 +1,49 @@
+describe('app', function() {
+ describe('initialize', function() {
+ it('should bind deviceready', function() {
+ runs(function() {
+ spyOn(app, 'deviceready');
+ app.initialize();
+ helper.trigger(window.document, 'deviceready');
+ });
+
+ waitsFor(function() {
+ return (app.deviceready.calls.length > 0);
+ }, 'deviceready should be called once', 500);
+
+ runs(function() {
+ expect(app.deviceready).toHaveBeenCalled();
+ });
+ });
+ });
+
+ describe('deviceready', function() {
+ it('should report that it fired', function() {
+ spyOn(app, 'report');
+ app.deviceready();
+ expect(app.report).toHaveBeenCalledWith('deviceready');
+ });
+ });
+
+ describe('report', function() {
+ beforeEach(function() {
+ var el = document.getElementById('stage');
+ el.innerHTML = ['<div id="deviceready">',
+ ' <p class="status pending">Pending</p>',
+ ' <p class="status complete hide">Complete</p>',
+ '</div>'].join('\n');
+ });
+
+ it('should show the completion state', function() {
+ app.report('deviceready');
+ var el = document.querySelector('#deviceready .complete:not(.hide)');
+ expect(el).toBeTruthy();
+ });
+
+ it('should hide the pending state', function() {
+ app.report('deviceready');
+ var el = document.querySelector('#deviceready .pending.hide');
+ expect(el).toBeTruthy();
+ });
+ });
+});
View
22 iOS/Twitter/install
@@ -1,22 +0,0 @@
-#!/usr/bin/env ruby
-
-def replace_in_file(filepath, regexp, *args, &block)
- content = File.read(filepath).gsub(regexp, *args, &block)
- File.open(filepath, 'wb') { |file| file.write(content) }
-end
-
-file = File.expand_path(ARGV[0])
-platform = ( File.extension(file) == ".plist" ? "ios" : "android" )
-
-if (platform == "ios")
- replace_in_file(file, /\s*<key>com.phonegap.twitter<\/key>\n/mi) do |match|
- ""
- end
- replace_in_file(file, /\s*<string>TwitterPlugin<\/string>\n/mi) do |match|
- ""
- end
- replace_in_file(file, /<key>Plugins<\/key>\n\s*<dict>/mi) do |match|
- "<key>Plugins</key>\n\t<dict>\n\t\t<key>com.phonegap.twitter</key>\n\t\t<string>TwitterPlugin</string>"
- end
-elsif (platform == "android")
-end
View
140 iOS/Twitter/js/TwitterPlugin.js
@@ -0,0 +1,140 @@
+/**
+ * @constructor
+ */
+var Twitter = function(){};
+/**
+ * Checks if the Twitter SDK is loaded
+ * @param {Function} response callback on result
+ * @param {Number} response.response is 1 for success, 0 for failure
+ * @example
+ * window.plugins.twitter.isTwitterAvailable(function (response) {
+ * console.log("twitter available? " + response);
+ * });
+ */
+Twitter.prototype.isTwitterAvailable = function(response){
+ cordova.exec(response, null, "TwitterPlugin", "isTwitterAvailable", []);
+};
+/**
+ * Checks if the Twitter SDK can send a tweet
+ * @param {Function} response callback on result
+ * @param {Number} response.response is 1 for success, 0 for failure
+ * @example
+ * window.plugins.twitter.isTwitterSetup(function (r) {
+ * console.log("twitter configured? " + r);
+ * });
+ */
+Twitter.prototype.isTwitterSetup = function(response){
+ cordova.exec(response, null, "TwitterPlugin", "isTwitterSetup", []);
+};
+/**
+ * Sends a Tweet to Twitter
+ * @param {Function} success callback
+ * @param {Function} failure callback
+ * @param {String} failure.error reason for failure
+ * @param {String} tweetText message to send to twitter
+ * @param {Object} options (optional)
+ * @param {String} options.urlAttach URL to embed in Tweet
+ * @param {String} options.imageAttach Image URL to embed in Tweet
+ * @param {Number} response.response - 1 on success, 0 on failure
+ * @example
+ * window.plugins.twitter.composeTweet(
+ * function () { console.log("tweet success"); },
+ * function (error) { console.log("tweet failure: " + error); },
+ * "Text, Image, URL",
+ * {
+ * urlAttach:"http://m.youtube.com/#/watch?v=obx2VOtx0qU",
+ * imageAttach:"http://i.ytimg.com/vi/obx2VOtx0qU/hqdefault.jpg?w=320&h=192&sigh=QD3HYoJj9dtiytpCSXhkaq1oG8M"
+ * }
+ * );
+ */
+Twitter.prototype.composeTweet = function(success, failure, tweetText, options){
+ options = options || {};
+ options.text = tweetText;
+ cordova.exec(success, failure, "TwitterPlugin", "composeTweet", [options]);
+};
+/**
+ * Gets Tweets from Twitter Timeline
+ * @param {Function} success callback
+ * @param {Object[]} success.response Tweet objects, see [Twitter Timeline Doc]
+ * @param {Function} failure callback
+ * @param {String} failure.error reason for failure
+ * @example
+ * window.plugins.twitter.getPublicTimeline(
+ * function (response) { console.log("timeline success: " + JSON.stringify(response)); },
+ * function (error) { console.log("timeline failure: " + error); }
+ * );
+ *
+ * [Twitter Timeline Doc]: https://dev.twitter.com/docs/api/1/get/statuses/public_timeline
+ */
+Twitter.prototype.getPublicTimeline = function(success, failure){
+ cordova.exec(success, failure, "TwitterPlugin", "getPublicTimeline", []);
+};
+/**
+ * Gets Tweets from Twitter Mentions
+ * @param {Function} success callback
+ * @param {Object[]} success.result Tweet objects, see [Twitter Mentions Doc]
+ * @param {Function} failure callback
+ * @param {String} failure.error reason for failure
+ * @example
+ * window.plugins.twitter.getMentions(
+ * function (response) { console.log("mentions success: " + JSON.stringify(response)); },
+ * function (error) { console.log("mentions failure: " + error); }
+ * );
+ *
+ * [Twitter Timeline Doc]: https://dev.twitter.com/docs/api/1/get/statuses/public_timeline
+ */
+Twitter.prototype.getMentions = function(success, failure){
+ cordova.exec(success, failure, "TwitterPlugin", "getMentions", []);
+};
+/**
+ * Gets Tweets from Twitter Mentions API
+ * @param {Function} success callback
+ * @param {String} success.response Twitter Username
+ * @param {Object[]} success.result Tweet objects, see [Twitter Mentions Doc]
+ * @param {Function} failure callback
+ * @param {String} failure.error reason for failure
+ *
+ * [Twitter Mentions Doc]: https://dev.twitter.com/docs/api/1/get/statuses/mentions
+ */
+Twitter.prototype.getTwitterUsername = function(success, failure) {
+ cordova.exec(success, failure, "TwitterPlugin", "getTwitterUsername", []);
+};
+/**
+ * Gets Tweets from Twitter Mentions API
+ * @param {String} url of [Twitter API Endpoint]
+ * @param {Object} params key-value map, matching [Twitter API Endpoint]
+ * @param {Function} success callback
+ * @param {Object[]} success.response objects returned from Twitter API (Tweets, Users,...)
+ * @param {Function} failure callback
+ * @param {String} failure.error reason for failure
+ * @param {Object} options (optional) other options for the HTTP request
+ * @param {String} options.requestMethod HTTP Request type, ex: "POST"
+ * @example
+ * window.plugins.twitter.getTWRequest(
+ * 'users/lookup.json',
+ * {user_id: '16141659,783214,6253282'},
+ * function (response) { console.log("usersLookup success: " + JSON.stringify(response)); },
+ * function (error) { console.log("usersLookup failure: " + error); },
+ * {requestMethod: 'POST'}
+ * );
+ *
+ * [Twitter API Endpoints]: https://dev.twitter.com/docs/api
+ */
+Twitter.prototype.getTWRequest = function(url, params, success, failure, options){
+ options = options || {};
+ options.url = url;
+ options.params = params;
+ cordova.exec(success, failure, "TwitterPlugin", "getTWRequest", [options]);
+};
+// Plug in to Cordova
+cordova.addConstructor(function() {
+
+ /* shim to work in 1.5 and 1.6 */
+ if (!window.Cordova) {
+ window.Cordova = cordova;
+ };
+
+
+ if(!window.plugins) window.plugins = {};
+ window.plugins.twitter = new Twitter();
+ });
View
15 iOS/Twitter/package.json
@@ -1,15 +0,0 @@
-{
- "author": "Brian Antonelli",
- "name": "com.phonegap.twitter",
- "description": "PhoneGap Twitter Plugin",
- "version": "0.0.1",
- "repository": {
- "type": "git",
- "url": "git://github.com/phonegap/phonegap-plugins.git"
- },
- "engines": {
- "phonegap": "1.2.0"
- },
- "dependencies": {},
- "development_dependencies": {}
-}
Please sign in to comment.
Something went wrong with that request. Please try again.