1 00:00:00,450 --> 00:00:03,120 ‫Speaker: Hi. Before we continue to do 2 00:00:03,120 --> 00:00:05,490 ‫reverse engineering curve this application, 3 00:00:05,490 --> 00:00:08,640 ‫I just wanted to explain all of these codes to you. 4 00:00:08,640 --> 00:00:11,040 ‫So if you're not an Android developer, 5 00:00:11,040 --> 00:00:14,730 ‫you get to see what we are doing in this codes. 6 00:00:14,730 --> 00:00:16,740 ‫Of course, in real reverse engineering 7 00:00:16,740 --> 00:00:18,390 ‫or real penetration testing, 8 00:00:18,390 --> 00:00:20,350 ‫you won't get to see the codes 9 00:00:21,450 --> 00:00:24,780 ‫at this context this clearly. 10 00:00:24,780 --> 00:00:26,520 ‫But since this is a test 11 00:00:26,520 --> 00:00:28,950 ‫and since you are learning how to do it, 12 00:00:28,950 --> 00:00:31,560 ‫then I believe it would be a good idea 13 00:00:31,560 --> 00:00:35,220 ‫to learn about all of this stuff before we continue. 14 00:00:35,220 --> 00:00:37,410 ‫So if you are already an Android developer 15 00:00:37,410 --> 00:00:40,410 ‫then you're more than welcome to skip this lecture. 16 00:00:40,410 --> 00:00:43,170 ‫So I'm gonna start with Android manifest. 17 00:00:43,170 --> 00:00:46,200 ‫As you can see, we have this main launcher tag 18 00:00:46,200 --> 00:00:48,870 ‫which indicates the activity 19 00:00:48,870 --> 00:00:53,370 ‫that needs to be shown first when application is launched. 20 00:00:53,370 --> 00:00:57,030 ‫So signup activity is actually the first activity 21 00:00:57,030 --> 00:00:58,650 ‫that we see. 22 00:00:58,650 --> 00:01:01,800 ‫So over here in the signup activity, 23 00:01:01,800 --> 00:01:06,210 ‫we see some methods like on create and the other methods. 24 00:01:06,210 --> 00:01:08,610 ‫There are a couple of edit texts, email texts, 25 00:01:08,610 --> 00:01:09,510 ‫and password texts, 26 00:01:09,510 --> 00:01:11,622 ‫Of course, these are the texts 27 00:01:11,622 --> 00:01:12,810 ‫that we are getting input from, 28 00:01:12,810 --> 00:01:16,890 ‫and we have this fire base authentication object. 29 00:01:16,890 --> 00:01:20,160 ‫So let me go over here to this buttons. 30 00:01:20,160 --> 00:01:23,910 ‫As you can see, we have signing clicked and sign up clicked. 31 00:01:23,910 --> 00:01:26,610 ‫So these are for signing the user up 32 00:01:26,610 --> 00:01:28,135 ‫and registering, 33 00:01:28,135 --> 00:01:32,040 ‫signing and registering and logging in the user. 34 00:01:32,040 --> 00:01:36,000 ‫And we are using this fire base authentication object 35 00:01:36,000 --> 00:01:39,300 ‫in order to create user with email and password. 36 00:01:39,300 --> 00:01:42,660 ‫So this is the power of fire base SD case case. 37 00:01:42,660 --> 00:01:44,580 ‫As you can see, it's very clear. 38 00:01:44,580 --> 00:01:48,270 ‫You all need just type, create user with email and password 39 00:01:48,270 --> 00:01:51,960 ‫and you get the email and password from the email text 40 00:01:51,960 --> 00:01:54,840 ‫and password text as usual. 41 00:01:54,840 --> 00:01:57,210 ‫And if it's a successful operation, 42 00:01:57,210 --> 00:01:59,220 ‫it will give you a call back like this, 43 00:01:59,220 --> 00:02:01,500 ‫you get to do what you want to do. 44 00:02:01,500 --> 00:02:05,850 ‫And over here we do an intent to Feedactivity 45 00:02:05,850 --> 00:02:08,580 ‫once we register the user. 46 00:02:08,580 --> 00:02:12,420 ‫And actually it gets to see the tweets, 47 00:02:12,420 --> 00:02:15,330 ‫previous to it that are held, 48 00:02:15,330 --> 00:02:19,200 ‫that are actually written by other users. 49 00:02:19,200 --> 00:02:22,410 ‫So sign and click does exactly the same thing 50 00:02:22,410 --> 00:02:25,020 ‫only it's just logs the user in 51 00:02:25,020 --> 00:02:27,450 ‫rather than registering the user up. 52 00:02:27,450 --> 00:02:30,540 ‫So over here we still do the same thing 53 00:02:30,540 --> 00:02:34,290 ‫with just having an intent to the feed activity. 54 00:02:34,290 --> 00:02:36,540 ‫And over here you see a coding block, 55 00:02:36,540 --> 00:02:40,140 ‫which starts with controlling the fire based user. 56 00:02:40,140 --> 00:02:44,100 ‫So if the user is already signed in before, 57 00:02:44,100 --> 00:02:45,630 ‫if it's not null, 58 00:02:45,630 --> 00:02:48,540 ‫null means void now means new. 59 00:02:48,540 --> 00:02:51,660 ‫And if it's not null if it's over there, 60 00:02:51,660 --> 00:02:53,580 ‫then we're going to do an intent. 61 00:02:53,580 --> 00:02:58,580 ‫We won't have to show the sign in or sign up activity 62 00:02:59,250 --> 00:03:03,273 ‫to the user at all if they're already logged in before. 63 00:03:04,200 --> 00:03:07,290 ‫So let me go back to your feed activity over here. 64 00:03:07,290 --> 00:03:09,887 ‫As you can see, we have couple of array lists 65 00:03:09,887 --> 00:03:13,620 ‫of strengths and we store the user email 66 00:03:13,620 --> 00:03:16,780 ‫from Firebase and user tweet from Fire Base 67 00:03:17,797 --> 00:03:18,630 ‫in this array list. 68 00:03:18,630 --> 00:03:20,820 ‫And also we have our recycler adapter 69 00:03:20,820 --> 00:03:22,800 ‫which we will talk about later. 70 00:03:22,800 --> 00:03:27,120 ‫We have the menu, options menu functions over here. 71 00:03:27,120 --> 00:03:31,500 ‫So we get to say what happens when we click 72 00:03:31,500 --> 00:03:34,800 ‫each one of these buttons over here. 73 00:03:34,800 --> 00:03:39,210 ‫Okay, and remember we created that menu under resources 74 00:03:39,210 --> 00:03:40,710 ‫under menu folder, 75 00:03:40,710 --> 00:03:45,120 ‫so we actually connect that menu to our activity 76 00:03:45,120 --> 00:03:47,340 ‫using this methods. 77 00:03:47,340 --> 00:03:49,440 ‫So if we click on a tweet, 78 00:03:49,440 --> 00:03:53,160 ‫then we are going to do as if we click on signup, 79 00:03:53,160 --> 00:03:54,720 ‫then we are going to do this. 80 00:03:54,720 --> 00:03:56,280 ‫So if we click on a tweet, 81 00:03:56,280 --> 00:03:58,620 ‫we are going to go for tweet activity 82 00:03:58,620 --> 00:04:00,450 ‫every click on signup, 83 00:04:00,450 --> 00:04:04,140 ‫we are going to go back to signup activity. 84 00:04:04,140 --> 00:04:08,190 ‫Okay? So under onCreate, we don't do much, 85 00:04:08,190 --> 00:04:11,370 ‫we only do the setup thing like getting the data 86 00:04:11,370 --> 00:04:12,990 ‫from the fire store. 87 00:04:12,990 --> 00:04:16,770 ‫So I have written all of this actually codes 88 00:04:16,770 --> 00:04:19,590 ‫under a separate method like this, 89 00:04:19,590 --> 00:04:22,230 ‫since it's a little bit long. 90 00:04:22,230 --> 00:04:26,940 ‫And as you can see, we're getting the collection tweets, 91 00:04:26,940 --> 00:04:29,910 ‫we are reading from collection tweets. 92 00:04:29,910 --> 00:04:32,370 ‫We can have multiple collections over here 93 00:04:32,370 --> 00:04:36,150 ‫like tweets, user, I don't know, address 94 00:04:36,150 --> 00:04:37,800 ‫whatever you can think of. 95 00:04:37,800 --> 00:04:39,510 ‫Since this is a test application, 96 00:04:39,510 --> 00:04:43,560 ‫we only have one collection and we are reading it. 97 00:04:43,560 --> 00:04:47,070 ‫So we are getting the data from tweets 98 00:04:47,070 --> 00:04:49,830 ‫in this coding block in this method, 99 00:04:49,830 --> 00:04:53,220 ‫and we are sorting them by the date. 100 00:04:53,220 --> 00:04:56,970 ‫And over here, we are getting everything and storing them 101 00:04:56,970 --> 00:05:00,059 ‫inside of these two array lists. 102 00:05:00,059 --> 00:05:05,059 ‫Okay? And over here, we are actually using those array lists 103 00:05:05,460 --> 00:05:08,070 ‫in order to create an adapter. 104 00:05:08,070 --> 00:05:12,030 ‫So adapter actually connects this data source 105 00:05:12,030 --> 00:05:14,940 ‫with the recycler view itself. 106 00:05:14,940 --> 00:05:17,970 ‫So if you look at the activity feed XML, 107 00:05:17,970 --> 00:05:20,040 ‫you will only see a recycler view, 108 00:05:20,040 --> 00:05:21,870 ‫you won't see anything else, 109 00:05:21,870 --> 00:05:26,520 ‫because we are going, we are using Recycler Row XML 110 00:05:26,520 --> 00:05:27,720 ‫over her, 111 00:05:27,720 --> 00:05:31,620 ‫and since we are using our tweet recycler adapter, 112 00:05:31,620 --> 00:05:36,420 ‫we can connect our recycler row with the recycler view 113 00:05:36,420 --> 00:05:39,450 ‫and also with the feed activity data. 114 00:05:39,450 --> 00:05:43,380 ‫So that's what Tweet recycler adapter does. 115 00:05:43,380 --> 00:05:45,300 ‫So adapter is very important. 116 00:05:45,300 --> 00:05:48,270 ‫It's holding everything together. 117 00:05:48,270 --> 00:05:52,230 ‫So as you can see, it's using some class 118 00:05:52,230 --> 00:05:54,690 ‫called RecyclerView.Adapter, 119 00:05:54,690 --> 00:05:58,020 ‫it actually has its own class. 120 00:05:58,020 --> 00:06:01,080 ‫And over here we create a constructor 121 00:06:01,080 --> 00:06:05,610 ‫to specify the data that we are going to need. 122 00:06:05,610 --> 00:06:09,428 ‫And over here, we are actually connecting 123 00:06:09,428 --> 00:06:14,428 ‫the recycler row views with like text view or edit texts. 124 00:06:15,840 --> 00:06:17,910 ‫So we have two text views over here, 125 00:06:17,910 --> 00:06:21,690 ‫User tweet text and user email text. 126 00:06:21,690 --> 00:06:26,280 ‫And after that, we are just connecting everything together 127 00:06:26,280 --> 00:06:29,250 ‫under this tweet recycler adapter. 128 00:06:29,250 --> 00:06:33,150 ‫Now, since we are using this tweet recycler adapter, 129 00:06:33,150 --> 00:06:38,150 ‫we are actually able to connect our feed activity data 130 00:06:39,060 --> 00:06:41,880 ‫with the recycler review that we are seeing. 131 00:06:41,880 --> 00:06:44,460 ‫So this may sound a little bit complicated 132 00:06:44,460 --> 00:06:46,530 ‫if you're not an Android developer 133 00:06:46,530 --> 00:06:48,657 ‫but believe me, it's not. 134 00:06:48,657 --> 00:06:51,196 ‫If you learn about Android development it should be 135 00:06:51,196 --> 00:06:54,120 ‫an easy thing to do for you 136 00:06:54,120 --> 00:06:59,120 ‫after actually spending at least a couple of months in it. 137 00:06:59,400 --> 00:07:02,100 ‫And over here in the tweet activity, 138 00:07:02,100 --> 00:07:03,600 ‫you'll see tweet button click, 139 00:07:03,600 --> 00:07:07,200 ‫and of course we are uploading every data 140 00:07:07,200 --> 00:07:09,840 ‫to the fire store in this case. 141 00:07:09,840 --> 00:07:12,270 ‫And then like we store the date, 142 00:07:12,270 --> 00:07:15,810 ‫we store the user email at Tweet itself over here. 143 00:07:15,810 --> 00:07:19,260 ‫And then if it says success, if it's a successful operation, 144 00:07:19,260 --> 00:07:21,720 ‫then we go back to feed activity 145 00:07:21,720 --> 00:07:24,540 ‫to display this data to gather this information 146 00:07:24,540 --> 00:07:27,690 ‫from fire store and display it to the user. 147 00:07:27,690 --> 00:07:31,020 ‫So that's what we are doing in this code. 148 00:07:31,020 --> 00:07:33,600 ‫Of course, you don't need to understand everything 149 00:07:33,600 --> 00:07:34,860 ‫at this point, 150 00:07:34,860 --> 00:07:38,970 ‫but we are going to reverse engineer it in the next lecture, 151 00:07:38,970 --> 00:07:41,250 ‫so maybe it would give you a good idea 152 00:07:41,250 --> 00:07:42,483 ‫about what we are doing.