Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build issues #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Notification/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
firebase-debug.log*
firebase-debug.*.log*

# Firebase cache
.firebase/
Expand Down
6 changes: 6 additions & 0 deletions Notification/database.rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": {
".read": "now < 1644258600000", // 2022-2-8
".write": "now < 1644258600000", // 2022-2-8
}
}
2 changes: 1 addition & 1 deletion Notification/firebase.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"database": {
"rules": "rules.json"
"rules": "database.rules.json"
}
}
1,595 changes: 815 additions & 780 deletions Notification/functions/package-lock.json

Large diffs are not rendered by default.

11 changes: 6 additions & 5 deletions Notification/functions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,22 @@
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"serve": "firebase emulators:start --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "8"
"node": "16"
},
"main": "index.js",
"dependencies": {
"firebase-admin": "^8.0.0",
"firebase-functions": "^3.1.0"
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.14.1"
},
"devDependencies": {
"firebase-functions-test": "^0.1.6"
"firebase-functions-test": "^0.2.0"
},
"private": true
}
7 changes: 0 additions & 7 deletions Notification/rules.json

This file was deleted.

2 changes: 2 additions & 0 deletions WhatsApp/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
/build
/captures
.externalNativeBuild
.cxx
local.properties
1 change: 1 addition & 0 deletions WhatsApp/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions WhatsApp/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions WhatsApp/.idea/encodings.xml

This file was deleted.

11 changes: 8 additions & 3 deletions WhatsApp/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions WhatsApp/.idea/inspectionProfiles/Project_Default.xml

This file was deleted.

9 changes: 8 additions & 1 deletion WhatsApp/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 0 additions & 12 deletions WhatsApp/.idea/runConfigurations.xml

This file was deleted.

51 changes: 28 additions & 23 deletions WhatsApp/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}

android {
compileSdkVersion 29
buildToolsVersion "29.0.0"
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.github.markpairdha.whatsapp"
minSdkVersion 19
targetSdkVersion 29
minSdk 30
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -18,24 +20,27 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation platform('com.google.firebase:firebase-bom:29.0.3')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-database'
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-storage'
implementation 'com.google.firebase:firebase-messaging'
implementation 'com.firebaseui:firebase-ui-database:8.0.0'
implementation 'de.hdodenhof:circleimageview:3.1.0'
api 'com.theartofdev.edmodo:android-image-cropper:2.8.+'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.DocumentsContract;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
Expand All @@ -24,9 +24,7 @@
import android.widget.TextView;
import android.widget.Toast;

import com.google.android.gms.auth.api.signin.internal.Storage;
import com.google.android.gms.tasks.Continuation;
import com.google.android.gms.tasks.OnCanceledListener;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.OnFailureListener;
import com.google.android.gms.tasks.Task;
Expand Down Expand Up @@ -87,15 +85,16 @@ protected void onCreate(Bundle savedInstanceState)

mAuth = FirebaseAuth.getInstance();
messageSenderID = mAuth.getCurrentUser().getUid();
RootRef = FirebaseDatabase.getInstance().getReference();
// TODO: Add your own Database instance here
RootRef = FirebaseDatabase.getInstance("Add your own instance here").getReference();


messageReceiverID = getIntent().getExtras().get("visit_user_id").toString();
messageReceiverName = getIntent().getExtras().get("visit_user_name").toString();
messageReceiverImage = getIntent().getExtras().get("visit_image").toString();


IntializeControllers();
InitializeControllers();


userName.setText(messageReceiverName);
Expand Down Expand Up @@ -153,7 +152,8 @@ public void onClick(DialogInterface dialogInterface, int i) {
});
}

private void IntializeControllers() {
@SuppressLint("RestrictedApi")
private void InitializeControllers() {
ChatToolBar = (Toolbar) findViewById(R.id.chat_toolbar);
setSupportActionBar(ChatToolBar);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
PrivateChatsView = inflater.inflate(R.layout.fragment_chats, container, false);

mAuth = FirebaseAuth.getInstance();

currentUserID = mAuth.getCurrentUser().getUid();
ChatsRef = FirebaseDatabase.getInstance().getReference().child("Contacts").child(currentUserID);
UsersRef = FirebaseDatabase.getInstance().getReference().child("Users");
// TODO: Add your own Firebase Database instance here
ChatsRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Contacts").child(currentUserID);
UsersRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Users");

chatsList = (RecyclerView) PrivateChatsView.findViewById(R.id.chats_list);
chatsList.setLayoutManager(new LinearLayoutManager(getContext()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container,
mAuth = FirebaseAuth.getInstance();
currentUserID = mAuth.getCurrentUser().getUid();


ContacsRef = FirebaseDatabase.getInstance().getReference().child("Contacts").child(currentUserID);
UsersRef = FirebaseDatabase.getInstance().getReference().child("Users");
// TODO: Add your own Firebase Database Instance here
ContacsRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Contacts").child(currentUserID);
UsersRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Users");


return ContactsView;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_find_friends);

UsersRef = FirebaseDatabase.getInstance().getReference().child("Users");
// TODO: Add your own Firebase Database instance here
UsersRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Users");

FindFriendsRecyclerList = (RecyclerView) findViewById(R.id.find_friends_toolbar);
FindFriendsRecyclerList.setLayoutManager(new LinearLayoutManager(this));
Expand All @@ -55,9 +56,9 @@ protected void onStart() {
.setQuery(UsersRef, Contacts.class)
.build();
FirebaseRecyclerAdapter<Contacts, FindFriendViewHolder> adapter =
new FirebaseRecyclerAdapter<Contacts, FindFriendViewHolder>() {
new FirebaseRecyclerAdapter<Contacts, FindFriendViewHolder>(options) {
@Override
protected void onBindViewHolder(@NonNull FindFriendViewHolder holder, final int position, @NonNull Contacts model) {
protected void onBindViewHolder(@NonNull final FindFriendViewHolder holder, int position, @NonNull Contacts model) {

holder.userName.setText(model.getName());
holder.userStatus.setText(model.getStatus());
Expand All @@ -67,7 +68,7 @@ protected void onBindViewHolder(@NonNull FindFriendViewHolder holder, final int
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String visit_user_id = getRef(position).getKey();
String visit_user_id = getRef(holder.getBindingAdapterPosition()).getKey();

Intent profileIntent = new Intent(FindFriendsActivity.this, ProfileActivity.class);
profileIntent.putExtra("visit_user_id", visit_user_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ protected void onCreate(Bundle savedInstanceState)

mAuth = FirebaseAuth.getInstance();
currentUserID = mAuth.getCurrentUser().getUid();
UsersRef = FirebaseDatabase.getInstance().getReference().child("Users");
GroupNameRef = FirebaseDatabase.getInstance().getReference().child("Groups").child(currentUserName);
// TODO: Add your own Firebase Database instance here
UsersRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Users");
GroupNameRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Groups").child(currentUserName);

InitializeFields();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa

groupFragmentView = inflater.inflate(R.layout.fragment_groups, container, false);

GroupRef = FirebaseDatabase.getInstance().getReference().child("Groups");
// TODO: Add your own Firebase Database instance here
GroupRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Groups");

InitializeFields();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
import com.google.firebase.auth.FirebaseUser;
import com.google.firebase.database.DatabaseReference;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.InstanceIdResult;
import com.google.firebase.messaging.FirebaseMessaging;


public class LoginActivity extends AppCompatActivity {
Expand All @@ -40,7 +39,8 @@ protected void onCreate(Bundle savedInstanceState)
setContentView(R.layout.activity_login);

mAuth = FirebaseAuth.getInstance();
UsersRef = FirebaseDatabase.getInstance().getReference().child("Users");
// TODO: Add your own Firebase Database instance here
UsersRef = FirebaseDatabase.getInstance("Add your instance here").getReference().child("Users");

InitializeFields();

Expand Down Expand Up @@ -99,7 +99,7 @@ public void onComplete(@NonNull Task<AuthResult> task) {
if(task.isSuccessful())
{
String currentUserId = mAuth.getCurrentUser().getUid();
String deviceToken = FirebaseInstanceId.getInstance().getInstanceId().toString();
String deviceToken = FirebaseMessaging.getInstance().getToken().toString();
UsersRef.child(currentUserId).child("device_Token").setValue(deviceToken).addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
Expand Down
Loading