Skip to content

Commit 2b04e50

Browse files
author
Devendra
committed
adding support for adding platform specifc user agent header. also fixing indents
1 parent e7be17c commit 2b04e50

246 files changed

Lines changed: 9505 additions & 9225 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

android/3.3_and_older/PubnubAndroidTest/3.1/AndroidManifest.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
android:versionCode="1"
55
android:versionName="1.0">
66
<uses-sdk android:minSdkVersion="9" />
7-
8-
<uses-permission android:name="android.permission.INTERNET" />
9-
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
7+
8+
<uses-permission android:name="android.permission.INTERNET" />
9+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
1010

1111
<application android:icon="@drawable/icon" android:label="@string/app_name">
1212
<activity android:name=".PubnubTestActivity"
Lines changed: 65 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3-
android:layout_width="fill_parent"
4-
android:layout_height="fill_parent"
5-
android:orientation="vertical" >
6-
<EditText
7-
android:id="@+id/editText1"
8-
android:layout_width="fill_parent"
9-
android:layout_height="wrap_content" />
10-
<Button
11-
android:id="@+id/publishBtn"
12-
android:layout_width="fill_parent"
13-
android:layout_height="wrap_content"
14-
android:text="Publish" />
15-
<TableLayout
16-
android:layout_width="wrap_content"
17-
android:layout_height="wrap_content"
18-
android:layout_span="2"
19-
android:stretchColumns="*" >
20-
<TableRow>
21-
<Button
22-
android:id="@+id/unsubscribeBtn"
23-
android:layout_width="wrap_content"
24-
android:layout_height="wrap_content"
25-
android:text="Unsubscribe" />
26-
<Button
27-
android:id="@+id/subscribeBtn"
28-
android:layout_width="wrap_content"
29-
android:layout_height="wrap_content"
30-
android:text="Subscribe" />
31-
</TableRow>
32-
</TableLayout>
33-
<TableLayout
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"
36-
android:layout_span="2"
37-
android:stretchColumns="*" >
38-
<TableRow>
39-
<Button
40-
android:id="@+id/historyBtn"
41-
android:layout_width="wrap_content"
42-
android:layout_height="wrap_content"
43-
android:text="History" />
44-
<Button
45-
android:id="@+id/uuidBtn"
46-
android:layout_width="wrap_content"
47-
android:layout_height="wrap_content"
48-
android:text="UUID" />
49-
<Button
50-
android:id="@+id/timeBtn"
51-
android:layout_width="wrap_content"
52-
android:layout_height="wrap_content"
53-
android:text="Time" />
54-
</TableRow>
55-
</TableLayout>
56-
<Button
57-
android:id="@+id/button1"
58-
android:layout_width="match_parent"
59-
android:layout_height="wrap_content"
60-
android:onClick="allMessageClick"
61-
android:text="All Message Publish" />
62-
<Button
63-
android:id="@+id/button2"
64-
android:layout_width="match_parent"
65-
android:layout_height="wrap_content"
66-
android:onClick="runUnitTest"
67-
android:text="Run Unit-Test" />
3+
android:layout_width="fill_parent"
4+
android:layout_height="fill_parent"
5+
android:orientation="vertical" >
6+
<EditText
7+
android:id="@+id/editText1"
8+
android:layout_width="fill_parent"
9+
android:layout_height="wrap_content" />
10+
<Button
11+
android:id="@+id/publishBtn"
12+
android:layout_width="fill_parent"
13+
android:layout_height="wrap_content"
14+
android:text="Publish" />
15+
<TableLayout
16+
android:layout_width="wrap_content"
17+
android:layout_height="wrap_content"
18+
android:layout_span="2"
19+
android:stretchColumns="*" >
20+
<TableRow>
21+
<Button
22+
android:id="@+id/unsubscribeBtn"
23+
android:layout_width="wrap_content"
24+
android:layout_height="wrap_content"
25+
android:text="Unsubscribe" />
26+
<Button
27+
android:id="@+id/subscribeBtn"
28+
android:layout_width="wrap_content"
29+
android:layout_height="wrap_content"
30+
android:text="Subscribe" />
31+
</TableRow>
32+
</TableLayout>
33+
<TableLayout
34+
android:layout_width="wrap_content"
35+
android:layout_height="wrap_content"
36+
android:layout_span="2"
37+
android:stretchColumns="*" >
38+
<TableRow>
39+
<Button
40+
android:id="@+id/historyBtn"
41+
android:layout_width="wrap_content"
42+
android:layout_height="wrap_content"
43+
android:text="History" />
44+
<Button
45+
android:id="@+id/uuidBtn"
46+
android:layout_width="wrap_content"
47+
android:layout_height="wrap_content"
48+
android:text="UUID" />
49+
<Button
50+
android:id="@+id/timeBtn"
51+
android:layout_width="wrap_content"
52+
android:layout_height="wrap_content"
53+
android:text="Time" />
54+
</TableRow>
55+
</TableLayout>
56+
<Button
57+
android:id="@+id/button1"
58+
android:layout_width="match_parent"
59+
android:layout_height="wrap_content"
60+
android:onClick="allMessageClick"
61+
android:text="All Message Publish" />
62+
<Button
63+
android:id="@+id/button2"
64+
android:layout_width="match_parent"
65+
android:layout_height="wrap_content"
66+
android:onClick="runUnitTest"
67+
android:text="Run Unit-Test" />
6868
</LinearLayout>

android/3.3_and_older/PubnubAndroidTest/3.1/src/com/fbt/Pubnub.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
/**
3333
* PubNub 3.1 Real-time Push Cloud API
34-
*
34+
*
3535
* @author Stephen Blum
3636
* @package pubnub
3737
*/
@@ -43,7 +43,7 @@ public class Pubnub {
4343
private String CIPHER_KEY = "";
4444
private boolean SSL = false;
4545
private class ChannelStatus {
46-
String channel;
46+
String channel;
4747
boolean connected, first;
4848
}
4949
private List<ChannelStatus> subscriptions;
@@ -52,7 +52,7 @@ private class ChannelStatus {
5252
* PubNub 3.1 with Cipher Key
5353
*
5454
* Prepare PubNub State.
55-
*
55+
*
5656
* @param String Publish Key.
5757
* @param String Subscribe Key.
5858
* @param String Secret Key.
@@ -180,7 +180,7 @@ public JSONArray publish( HashMap<String, Object> args ) {
180180

181181
String channel = (String) args.get("channel");
182182
Object message= args.get("message");
183-
183+
184184
if(message instanceof JSONObject) {
185185
JSONObject obj=(JSONObject)message;
186186
if(this.CIPHER_KEY.length() > 0){
@@ -411,7 +411,7 @@ private void _subscribe( HashMap<String, Object> args ) {
411411
if (!it.first) {
412412
it.first = true;
413413
callback.connectCallback(channel);
414-
414+
415415
break;
416416
}
417417
}
@@ -449,7 +449,7 @@ private void _subscribe( HashMap<String, Object> args ) {
449449
String msgs=messages.getString(0);
450450
if(this.CIPHER_KEY.length() > 0) {
451451
PubnubCrypto pc = new PubnubCrypto(this.CIPHER_KEY);
452-
msgs=pc.decrypt(msgs);
452+
msgs=pc.decrypt(msgs);
453453
}
454454
if(callback !=null)
455455
callback.subscribeCallback(channel,msgs);
@@ -578,15 +578,15 @@ private JSONArray _request(List<String> url_components) {
578578
e.printStackTrace();
579579
JSONArray jsono = new JSONArray();
580580
try {
581-
jsono.put(0);
582-
jsono.put("Failed UTF-8 Encoding URL."); }
581+
jsono.put(0);
582+
jsono.put("Failed UTF-8 Encoding URL."); }
583583
catch (Exception jsone) {}
584584
return jsono;
585585
}
586586
}
587587

588588
try {
589-
589+
590590
PubnubHttpRequest request = new PubnubHttpRequest(url.toString());
591591
FutureTask<String> task = new FutureTask<String>(request);
592592
Thread t = new Thread(task);
@@ -597,7 +597,7 @@ private JSONArray _request(List<String> url_components) {
597597
JSONArray jsono = new JSONArray();
598598

599599
try {
600-
jsono.put(0);
600+
jsono.put(0);
601601
jsono.put("Request failed due to missing Internet connection.");
602602
} catch (Exception jsone) {
603603
}
@@ -612,8 +612,8 @@ private JSONArray _request(List<String> url_components) {
612612
JSONArray jsono = new JSONArray();
613613

614614
try {
615-
jsono.put(0);
616-
jsono.put("Failed JSONP HTTP Request."); }
615+
jsono.put(0);
616+
jsono.put("Failed JSONP HTTP Request."); }
617617
catch (Exception jsone) {}
618618

619619
System.out.println(e.getMessage());
@@ -627,8 +627,8 @@ private JSONArray _request(List<String> url_components) {
627627
JSONArray jsono = new JSONArray();
628628

629629
try {
630-
jsono.put(0);
631-
jsono.put("Failed JSON Parsing."); }
630+
jsono.put(0);
631+
jsono.put("Failed JSON Parsing."); }
632632
catch (Exception jsone) {}
633633

634634
System.out.println(e.getMessage());
@@ -690,7 +690,7 @@ public String call() throws Exception {
690690
}
691691

692692
private String _encodeToUTF8(String s) throws UnsupportedEncodingException {
693-
String enc = URLEncoder.encode(s, "UTF-8").replace("+", "%20");
694-
return enc;
693+
String enc = URLEncoder.encode(s, "UTF-8").replace("+", "%20");
694+
return enc;
695695
}
696696
}

0 commit comments

Comments
 (0)