Skip to content
This repository was archived by the owner on Mar 26, 2022. It is now read-only.

Commit 8b84221

Browse files
authored
Merge pull request #86 from CECS-478-AuRave/androidDeploy
Deployment Ready App
2 parents 9199293 + 7844d7e commit 8b84221

File tree

31 files changed

+4802
-51589
lines changed

31 files changed

+4802
-51589
lines changed

client/secureChatIonic/app/pages/all-conversations/all-conversations.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<button menuToggle>
1111
<ion-icon name="menu"></ion-icon>
1212
</button>
13-
<ion-title>Messages</ion-title>
13+
<ion-title class="animated fadeIn">Messages</ion-title>
1414
</ion-navbar>
1515
</ion-header>
1616

@@ -22,13 +22,13 @@
2222

2323
<!-- If no Messages found -->
2424
<div *ngIf="!hasConversations()">
25-
<h2 class="centerText">No Conversations Found!</h2>
26-
<h6 class="centerText">Add some friends using the side menu</h6>
25+
<h2 class="centerText animated fadeIn">No Conversations Found!</h2>
26+
<h6 class="centerText animated fadeInLeft">Add some friends using the side menu</h6>
2727
</div>
2828

2929
<!-- If we have messages -->
3030
<div *ngIf="hasConversations()">
31-
<button ion-item class="messageItem" *ngFor="let conversation of convoList" (click)="convoClick(conversation)">
31+
<button ion-item class="messageItem animated fadeInUp" *ngFor="let conversation of convoList" (click)="convoClick(conversation)">
3232
<!-- Our user name -->
3333
<h3 class="messageUser">{{getConvoMembers(conversation)}}</h3>
3434
<!-- Our message text -->
@@ -40,6 +40,6 @@ <h3 class="messageUser">{{getConvoMembers(conversation)}}</h3>
4040
</ion-content>
4141

4242
<!-- Add friend fab -->
43-
<ion-fab class="plusFab" (click)="goToNewConversation()">
43+
<ion-fab class="plusFab animated fadeInRight" (click)="goToNewConversation()">
4444
<button ion-fab color="primary"><ion-icon name="add"></ion-icon></button>
4545
</ion-fab>

client/secureChatIonic/app/pages/all-conversations/all-conversations.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ export class AllConversationsPage {
6767

6868
this.pollingRequest = poll.subscribe(function(success) {
6969

70-
//Dont do anything on no changes
71-
if(success.status == 304) return;
72-
73-
7470
//Success!
7571
self.messageGetSuccess(success);
7672
}, function(error) {
@@ -138,7 +134,7 @@ export class AllConversationsPage {
138134
let userId = JSON.parse(localStorage.getItem(AppSettings.shushItemName))._id;
139135

140136
//Filter our convo
141-
convo = this.appMessaging.filterConvoMessages(convo);
137+
convo = this.appMessaging.filterConvoMessages(convo, false);
142138

143139
//Get the last message sender, since it is filter we can assume the zero index
144140
let lastMessage = convo.messages[convo.messages.length - 1].message[0];

client/secureChatIonic/app/pages/auth-login/auth-login.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<button menuToggle>
1010
<ion-icon name="menu"></ion-icon>
1111
</button>
12-
<ion-title>Login</ion-title>
12+
<ion-title class="animated fadeIn">Login</ion-title>
1313
</ion-navbar>
1414
</ion-header>
1515

@@ -20,7 +20,7 @@
2020
<h3 class="centerText loginHeader">Shush uses Facebook to help you discretely connect and talk to your friends.</h3>
2121

2222
<!-- Facebook login button -->
23-
<div class="centerText" (click)='login()'>
23+
<div class="centerText animated fadeInUp" (click)='login()'>
2424
<img class="fbLogin" src="build/images/facebookLoginButton.png">
2525
</div>
2626
</ion-content>

client/secureChatIonic/app/pages/conversation/conversation.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ion-header>
88

99
<ion-navbar>
10-
<ion-title class="navTitle">
10+
<ion-title class="navTitle animated fadeIn">
1111
{{convoTitle}}
1212
</ion-title>
1313
<!-- Show a loading symbol when decrypting -->
@@ -21,14 +21,15 @@
2121

2222
<!-- Ngfor our messages -->
2323
<!-- We are assuming a filtered convo -->
24-
<ion-card *ngFor="let convoMessage of convo.messages; let i = index;" [ngClass]="{'sender': !convoMessage.message[0].isUser, 'user': convoMessage.message[0].isUser}">
24+
<ion-card *ngFor="let convoMessage of convo.messages; let i = index;"
25+
[ngClass]="{}">
2526
<!--
2627
For media messages if supported
2728
<img src="img/nin-live.png" />
2829
-->
2930

3031
<!-- User who sent the item -->
31-
<ion-item>
32+
<ion-item class="animated fadeIn">
3233
<ion-avatar item-left>
3334
<img src="https://{{convoMessage.message[0].from.profilePhotoURL}}">
3435
</ion-avatar>

client/secureChatIonic/app/pages/conversation/conversation.ts

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class ConversationPage {
5656
//Get the conversation passed from the last page
5757
let passedConvo = this.navParams.get('conversation');
5858
//Filter the conversations
59-
this.convo = this.appMessaging.filterConvoMessages(passedConvo);
59+
this.convo = this.appMessaging.filterConvoMessages(passedConvo, false);
6060
//Start Decypting the messages
6161
this.decryptConvo();
6262

@@ -96,34 +96,22 @@ export class ConversationPage {
9696
this.pollingRequest = poll.subscribe(function(success) {
9797
//Success!
9898

99-
//Stop loading
100-
self.appNotify.stopLoading().then(function() {
99+
//Add our messages/Get our conversation
100+
self.appMessaging.conversations = success;
101101

102-
//Dont do anything on no changes
103-
if(success.status == 304) return;
104-
105-
//Add our messages/Get our conversation
106-
self.appMessaging.conversations = success;
107-
108-
//Update our conversations
109-
self.updateConversation();
110-
});
102+
//Update our conversations
103+
self.updateConversation();
111104
}, function(error) {
112105
//Error!
113-
114-
//Stop Loading
115-
self.appNotify.stopLoading().then(function() {
116-
//Pass to Error Handler
117-
self.appNotify.handleError(error, [{
118-
status: 404,
119-
callback: function() {
120-
//Pop back to the All conversations view
121-
122-
self.navCtrl.pop();
123-
}
124-
}]);
125-
});
126-
106+
//Pass to Error Handler
107+
self.appNotify.handleError(error, [{
108+
status: 404,
109+
callback: function() {
110+
//Pop back to the All conversations view
111+
112+
self.navCtrl.pop();
113+
}
114+
}]);
127115
}, function() {
128116
//Completed
129117
})
@@ -134,10 +122,10 @@ export class ConversationPage {
134122

135123
//Find and update our current conversation
136124
for (let i = 0; i < this.appMessaging.conversations.length; ++i) {
137-
if (this.convoId == this.appMessaging.conversations[i]._id) {
125+
if (this.convoId == this.appMessaging.conversations[i].conversationID) {
138126

139127
//Update/Filter the conversations
140-
this.convo = this.appMessaging.filterConvoMessages(this.appMessaging.conversations[i]);
128+
this.convo = this.appMessaging.filterConvoMessages(this.appMessaging.conversations[i], this.convo);
141129
//Start Decypting the messages
142130
this.decryptConvo();
143131

@@ -191,6 +179,25 @@ export class ConversationPage {
191179
let decryptRequest = new Observable(function(decrytReturn) {
192180
for(let i = 0; i < self.convo.messages.length; i++) {
193181
//Decrypt the message
182+
//Check if we have already decrypted
183+
if(self.convo.messages[i].message[0].decryptedMessage) {
184+
//Add to the decrypt cache
185+
decryptCache.push(i);
186+
187+
//Check if we should unsubscribe
188+
if(decryptCache.length == self.convo.messages.length) {
189+
//Reset everything
190+
self.decryptingObservable.unsubscribe();
191+
self.decryptingObservable = false;
192+
decryptCache = [];
193+
}
194+
195+
//Update the UI
196+
setTimeout(function() {
197+
self.changeDetector.detectChanges();
198+
}, 250);
199+
}
200+
194201
//The identifier will be the index of the convo messages message
195202
self.appCrypto.decryptMessage(self.convo.messages[i].message[0].message.messageText,
196203
self.convo.messages[i].message[0].message.messageHmac,
@@ -215,6 +222,15 @@ export class ConversationPage {
215222
setTimeout(function() {
216223
self.changeDetector.detectChanges();
217224
}, 250);
225+
}, function(error) {
226+
if(self.decryptingObservable) self.decryptingObservable.unsubscribe();
227+
self.decryptingObservable = false;
228+
decryptCache = [];
229+
230+
self.appNotify.showToast('Could not decrypt messages. You should ask other group members to store the conversation, or delete it.');
231+
232+
//Go back to the all conversations page
233+
self.navCtrl.pop();
218234
});
219235
}
220236
});
@@ -309,7 +325,7 @@ export class ConversationPage {
309325

310326
//Set our convo to the the filtered success result
311327
//Update/Filter the conversations
312-
self.convo = self.appMessaging.filterConvoMessages(success);
328+
self.convo = self.appMessaging.filterConvoMessages(success, self.convo);
313329
//Start Decypting the messages
314330
self.decryptConvo();
315331

client/secureChatIonic/app/pages/friends-list/friends-list.html

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<button menuToggle>
1111
<ion-icon name="menu"></ion-icon>
1212
</button>
13-
<ion-title>Friends</ion-title>
13+
<ion-title class="animated fadeIn">Friends</ion-title>
1414
</ion-navbar>
1515
</ion-header>
1616

@@ -25,12 +25,29 @@ <h6 class="centerText">Add them with the "+" button in the corner!</h6>
2525
</ion-card-content>
2626
</ion-card>
2727

28+
<!-- Ngfor our pending friends -->
29+
<div *ngIf="pendingFriends && pendingFriends.length > 0">
30+
<h2 class="friendTitle centerText">Pending Friends</h2>
31+
<ion-card *ngFor="let pendingFriend of pendingFriends; let i = index;" (click)="goToUser(pendingFriend)">
32+
33+
<!-- User name and picture -->
34+
<ion-item class="animated fadeIn">
35+
<ion-avatar item-left>
36+
<img src="https://{{pendingFriend.profilePhotoURL}}">
37+
</ion-avatar>
38+
<h2>{{pendingFriend.name}}</h2>
39+
</ion-item>
40+
41+
</ion-card>
42+
</div>
43+
2844
<!-- Ngfor our friends -->
2945
<div *ngIf="friends && friends.length > 0">
46+
<h2 class="friendTitle centerText">Friends</h2>
3047
<ion-card *ngFor="let friend of friends; let i = index;" (click)="goToUser(friend)">
3148

3249
<!-- User name and picture -->
33-
<ion-item>
50+
<ion-item class="animated fadeIn">
3451
<ion-avatar item-left>
3552
<img src="https://{{friend.profilePhotoURL}}">
3653
</ion-avatar>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.friendTitle {
2+
margin-top: 10px;
3+
margin-bottom: 5px;
4+
}

client/secureChatIonic/app/pages/friends-list/friends-list.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ export class FriendsListPage {
2323

2424
friends: any;
2525

26+
pendingFriends: any;
27+
2628
constructor(private changeDetector: ChangeDetectorRef, private navCtrl: NavController, private appNotify: AppNotify, private appUsers: AppUsers) {
2729

2830
//Initialize friends
2931
this.friends = [];
32+
this.pendingFriends = [];
3033
}
3134

3235
//Call function every time the view loads
@@ -51,7 +54,10 @@ export class FriendsListPage {
5154
self.appNotify.stopLoading().then(function() {
5255

5356
//Save our friends
54-
self.friends = success;
57+
self.friends = success.friends;
58+
59+
//Save our pending friends
60+
self.pendingFriends = success.pendingFriends;
5561

5662
//Update the UI
5763
self.changeDetector.detectChanges();

client/secureChatIonic/app/pages/malicious-key/malicious-key.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<ion-header>
22
<ion-toolbar>
3-
<ion-title>
3+
<ion-title class="animated tada">
44
Warning!
55
</ion-title>
66
<ion-buttons start>
@@ -15,9 +15,9 @@
1515

1616
<ion-content padding>
1717

18-
<h1 class="maliciousKeyTitle">A public key from the server has changed!</h1>
18+
<h1 class="maliciousKeyTitle animated flash">A public key from the server has changed!</h1>
1919

20-
<div class="maliciousKeyText">
20+
<div class="maliciousKeyText animated fadeIn">
2121
The public key we received from the server has changed. This means, either you friend has gotten a new device, or re-installed the application, or someone may have compromised the server and is trying to intercept your messages. We <b>HIGHLY</b> suggest you contact your friend, through another medium, and compare public keys from their "My profile tab" on their device, and their public profile on you're device. The public key of you're friend will be saved to this device from now on. You may have to restart this application.
2222
</div>
2323
</ion-content>

client/secureChatIonic/app/pages/new-conversation/new-conversation.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ion-header>
88

99
<ion-navbar>
10-
<ion-title>New Conversation</ion-title>
10+
<ion-title class="aniamted fadeIn">New Conversation</ion-title>
1111
</ion-navbar>
1212

1313
</ion-header>
@@ -22,10 +22,10 @@
2222
<ion-item *ngFor="let friend of friends | NgForTextFilter:searchQuery">
2323
<!-- Check Box for the item -->
2424
<ion-checkbox color="dark" (click)="editConvoFriends(friend)" checked="{{convoFriends.includes(friend._id)}}"></ion-checkbox>
25-
<ion-avatar item-left>
25+
<ion-avatar item-left class="animated fadeIn">
2626
<img src="https://{{friend.profilePhotoURL}}">
2727
</ion-avatar>
28-
<ion-label>{{friend.name}}</ion-label>
28+
<ion-label class="animated fadeIn">{{friend.name}}</ion-label>
2929
</ion-item>
3030
</ion-list>
3131

0 commit comments

Comments
 (0)