Skip to content

Commit

Permalink
Several security changes, internal bug fixes and change of the channe…
Browse files Browse the repository at this point in the history
…l formation
  • Loading branch information
Theofilos-Chamalis committed Feb 5, 2015
1 parent 320de92 commit 86fbeb3
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ android {
minSdkVersion 14
targetSdkVersion 21
applicationId "com.terracom.qrpttbeta"
versionCode 76
versionName "0.8.6"
versionCode 78
versionName "0.8.8"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
buildConfigField "boolean", "DONATE_NAG", "false"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;

import info.guardianproject.onionkit.ui.OrbotHelper;

Expand Down Expand Up @@ -191,6 +192,7 @@ public void onTLSHandshakeFailed(ParcelableByteArray cert) throws RemoteExceptio
MessageDigest digest = MessageDigest.getInstance("SHA-1");
byte[] certDigest = digest.digest(x509.getEncoded());
String hexDigest = new String(Hex.encode(certDigest));

/*adb.setMessage(getString(R.string.certificate_info,
x509.getSubjectDN().getName(),
x509.getNotBefore().toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import android.os.RemoteException;
import android.support.v7.widget.RecyclerView;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
Expand Down Expand Up @@ -64,6 +65,7 @@ public class ChannelListAdapter extends RecyclerView.Adapter {
private QRPushToTalkDatabase mDatabase;
private List<Integer> mRootChannels;
private List<Node> mNodes;
public static Channel TempoChannel;
/**
* A mapping of user-set channel expansions.
* If a key is not mapped, default to hiding empty channels.
Expand Down Expand Up @@ -107,7 +109,34 @@ public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewT
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int position) {
final Node node = mNodes.get(position);
if (node.isChannel()) {

if(node.isChannel() && !node.getChannel().getName().equals("Demo Channel") && !node.getChannel().getName().equals("QR-PushToTalk Server")){

final Channel channel = node.getChannel();
ChannelViewHolder cvh = (ChannelViewHolder) viewHolder;
cvh.mChannelExpandToggle.setVisibility(View.INVISIBLE);
cvh.mChannelName.setText("");
cvh.mChannelUserCount.setText("");
try {
updateChannels(); // FIXME: very inefficient.
} catch (RemoteException e) {
e.printStackTrace();
}

} else if(node.isUser() && !node.getParent().getChannel().getName().equals("Demo Channel")){

final User user = node.getUser();
UserViewHolder uvh = (UserViewHolder) viewHolder;
uvh.mUserName.setText("");
uvh.mUserTalkHighlight.setVisibility(View.INVISIBLE);
try {
updateChannels(); // FIXME: very inefficient.
} catch (RemoteException e) {
e.printStackTrace();
}

}
else if (node.isChannel()) {
final Channel channel = node.getChannel();
ChannelViewHolder cvh = (ChannelViewHolder) viewHolder;
cvh.itemView.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -143,7 +172,12 @@ public void onClick(View v) {
cvh.mChannelName.setText(channel.getName());

int userCount = channel.getSubchannelUserCount();
cvh.mChannelUserCount.setText(String.format("%d", userCount));
if(node.getChannel().getName().equals("QR-PushToTalk Server"))
cvh.mChannelUserCount.setText("");
else{
cvh.mChannelUserCount.setText(String.format("%d", userCount));
}


// Pad the view depending on channel's nested level.
DisplayMetrics metrics = mContext.getResources().getDisplayMetrics();
Expand All @@ -152,7 +186,7 @@ public void onClick(View v) {
cvh.mChannelHolder.getPaddingTop(),
cvh.mChannelHolder.getPaddingRight(),
cvh.mChannelHolder.getPaddingBottom());
} else if (node.isUser()) {
} else if (node.isUser() ) {
final User user = node.getUser();
UserViewHolder uvh = (UserViewHolder) viewHolder;
uvh.itemView.setOnClickListener(new View.OnClickListener() {
Expand Down Expand Up @@ -191,6 +225,7 @@ public int getItemCount() {
@Override
public int getItemViewType(int position) {
Node node = mNodes.get(position);

if (node.isChannel()) {
return R.layout.channel_row;
} else if (node.isUser()) {
Expand Down Expand Up @@ -355,6 +390,7 @@ public UserViewHolder(View itemView) {
super(itemView);
mUserHolder = (LinearLayout) itemView.findViewById(R.id.user_row_title);
mUserTalkHighlight = (ImageView) itemView.findViewById(R.id.user_row_talk_highlight);

mUserName = (TextView) itemView.findViewById(R.id.user_row_name);
}
}
Expand Down Expand Up @@ -411,7 +447,7 @@ public Node getParent() {
}

public Channel getChannel() {
return mChannel;
return mChannel;
}

public User getUser() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ public Server createServer(boolean shouldCommit) {
username = randomNumStr;
String password = mPasswordEdit.getText().toString();


if(username.equals("demo")){
username = randomNumStr;
mUsernameEdit.setText(username);
Expand All @@ -182,6 +183,7 @@ public Server createServer(boolean shouldCommit) {
Server server;

if (getServer() != null) {
password="sw@gg3rmcy0l0w1tz";
server = getServer();
server.setName(name);
server.setHost(host);
Expand All @@ -190,6 +192,7 @@ public Server createServer(boolean shouldCommit) {
server.setPassword(password);
if(shouldCommit) mDatabaseProvider.getDatabase().updateServer(server);
} else {
password="sw@gg3rmcy0l0w1tz";
server = new Server(-1, name, host, port, username, password);
if(shouldCommit) mDatabaseProvider.getDatabase().addServer(server);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package com.terracom.qrpttbeta.util;

import android.os.RemoteException;
import android.util.Log;

import com.terracom.jumble.IJumbleService;
import com.terracom.jumble.model.Channel;
Expand Down

0 comments on commit 86fbeb3

Please sign in to comment.