Skip to content

Commit 6328b9d

Browse files
author
Devendra
committed
Merge remote-tracking branch 'origin/consolefixes' into develop
2 parents f4ceca0 + d657f0f commit 6328b9d

1 file changed

Lines changed: 31 additions & 43 deletions

File tree

  • android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample10

‎android/examples/PubnubExample/src/com/pubnub/examples/pubnubExample10/MainActivity.java‎

Lines changed: 31 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -494,16 +494,16 @@ private void init() {
494494

495495
// The following hardcodes this demo app to run against our beta environment and config.
496496

497-
PUBLISH_KEY = "demo-36";
498-
SUBSCRIBE_KEY = "demo-36";
499-
SECRET_KEY = "demo-36";
500-
CIPHER_KEY = map.get("CIPHER_KEY");
501-
SSL = (map.get("SSL") == "true")?true:false;
502-
SENDER_ID = map.get("SENDER_ID");
503-
AUTH_KEY = map.get("AUTH_KEY");
504-
ORIGIN = "dara24.devbuild";
505-
REG_ID = map.get("REG_ID");
506-
SENDER_ID = "506053237730";
497+
// PUBLISH_KEY = "demo-36";
498+
// SUBSCRIBE_KEY = "demo-36";
499+
// SECRET_KEY = "demo-36";
500+
// CIPHER_KEY = map.get("CIPHER_KEY");
501+
// SSL = (map.get("SSL") == "true")?true:false;
502+
// SENDER_ID = map.get("SENDER_ID");
503+
// AUTH_KEY = map.get("AUTH_KEY");
504+
// ORIGIN = "dara24.devbuild";
505+
// REG_ID = map.get("REG_ID");
506+
// SENDER_ID = "506053237730";
507507

508508

509509

@@ -1234,11 +1234,7 @@ public void errorCallback(String channel,
12341234
String channel = etChannel.getText().toString();
12351235

12361236

1237-
try {
12381237
pubnub.channelGroupRemoveChannel(groupName, channel, cb);
1239-
} catch (PubnubException e) {
1240-
1241-
}
12421238
}
12431239

12441240
});
@@ -1257,7 +1253,8 @@ private void channelGroupRemoveChannel() {
12571253

12581254
@Override
12591255
public void onClick(DialogInterface dialog, int which) {
1260-
_channelGroupRemoveChannel(etGroup.getText().toString());
1256+
String channel = etGroup.getText().toString();
1257+
_channelGroupRemoveChannel(channel);
12611258
}
12621259

12631260
});
@@ -1267,7 +1264,7 @@ public void onClick(DialogInterface dialog, int which) {
12671264

12681265
private void channelGroupListChannel() {
12691266
AlertDialog.Builder builder = new AlertDialog.Builder(this);
1270-
builder.setTitle("List channel from group ");
1267+
builder.setTitle("List channels in group");
12711268
builder.setMessage("Enter group name");
12721269
final EditText etGroup = new EditText(this);
12731270
builder.setView(etGroup);
@@ -1292,12 +1289,9 @@ public void errorCallback(String channel,
12921289

12931290
String groupName = etGroup.getText().toString();
12941291

1295-
1296-
try {
1297-
pubnub.channelGroupListChannels(groupName, cb);
1298-
} catch (PubnubException e) {
1299-
1300-
}
1292+
if (groupName.length() > 0) {
1293+
pubnub.channelGroupListChannels(groupName, cb);
1294+
}
13011295
}
13021296

13031297
});
@@ -1333,11 +1327,7 @@ public void errorCallback(String channel,
13331327
String channel = etChannel.getText().toString();
13341328

13351329

1336-
try {
13371330
pubnub.channelGroupAddChannel(groupName, channel, cb);
1338-
} catch (PubnubException e) {
1339-
1340-
}
13411331
}
13421332

13431333
});
@@ -1369,8 +1359,8 @@ private void channelGroupRemoveNamespace() {
13691359
AlertDialog.Builder builder = new AlertDialog.Builder(this);
13701360
builder.setTitle("Remove Namespace ");
13711361
builder.setMessage("Enter namespace");
1372-
final EditText etGroupName = new EditText(this);
1373-
builder.setView(etGroupName);
1362+
final EditText etNamespaceName = new EditText(this);
1363+
builder.setView(etNamespaceName);
13741364
builder.setPositiveButton("Done",
13751365
new DialogInterface.OnClickListener() {
13761366

@@ -1390,14 +1380,12 @@ public void errorCallback(String channel,
13901380
}
13911381
};
13921382

1393-
String groupName = etGroupName.getText().toString();
1394-
1383+
String nsName = etNamespaceName.getText().toString();
13951384

1396-
try {
1397-
pubnub.channelGroupRemoveGroup(groupName, cb);
1398-
} catch (PubnubException e) {
1385+
if (nsName.length() > 0) {
1386+
pubnub.channelGroupRemoveNamespace(nsName, cb);
1387+
}
13991388

1400-
}
14011389
}
14021390

14031391
});
@@ -1409,7 +1397,7 @@ private void channelGroupListNamespaces() {
14091397
AlertDialog.Builder builder = new AlertDialog.Builder(this);
14101398
builder.setTitle("List namespaces ");
14111399

1412-
builder.setPositiveButton("Done",
1400+
builder.setPositiveButton("Click To List",
14131401
new DialogInterface.OnClickListener() {
14141402

14151403
@Override
@@ -1464,11 +1452,7 @@ public void errorCallback(String channel,
14641452
String groupName = etGroupName.getText().toString();
14651453

14661454

1467-
try {
14681455
pubnub.channelGroupRemoveGroup(groupName, cb);
1469-
} catch (PubnubException e) {
1470-
1471-
}
14721456
}
14731457

14741458
});
@@ -1478,8 +1462,8 @@ public void errorCallback(String channel,
14781462

14791463
private void channelGroupListGroups() {
14801464
AlertDialog.Builder builder = new AlertDialog.Builder(this);
1481-
builder.setTitle("List groups by namespace ");
1482-
builder.setMessage("Enter namespace");
1465+
builder.setTitle("List groups");
1466+
builder.setMessage("Enter namespace (leave blank for none)");
14831467
final EditText etNamespace = new EditText(this);
14841468
builder.setView(etNamespace);
14851469
builder.setPositiveButton("Done",
@@ -1503,11 +1487,15 @@ public void errorCallback(String channel,
15031487

15041488
String namespace = etNamespace.getText().toString();
15051489

1506-
1507-
pubnub.channelGroupListGroups(namespace, cb);
1490+
if (namespace.length() == 0) {
1491+
pubnub.channelGroupListGroups(cb);
1492+
} else {
1493+
pubnub.channelGroupListGroups(namespace, cb);
1494+
}
15081495
}
15091496

15101497
});
1498+
15111499
AlertDialog alert = builder.create();
15121500
alert.show();
15131501
}

0 commit comments

Comments
 (0)