Skip to content

Commit

Permalink
Merge pull request #16 from castaway2000/update
Browse files Browse the repository at this point in the history
LGTM
  • Loading branch information
castaway2000 authored Aug 13, 2017
2 parents 83dd707 + fc453fe commit f30f26b
Show file tree
Hide file tree
Showing 149 changed files with 7,092 additions and 318 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
/captures
/.idea
*.iml
/app/src/main/java/saberapplications/pawpads/Util.java
48 changes: 0 additions & 48 deletions .idea/misc.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
git MIT License

Copyright (c) 2016 Adam Szablya

Expand Down
Binary file removed app/app-release.apk
Binary file not shown.
65 changes: 40 additions & 25 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,34 @@ repositories {

}
android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
signingConfigs {
config {
keyAlias 'debug_key'
keyPassword 'RHe4bFgysjU'
storeFile file('../pawpads_debug.jks')
storePassword 'RHe4bFgysjU'
/*
Certificate fingerprints:
MD5: CD:A2:FB:81:0A:16:E6:41:B7:EF:4A:D4:6C:E6:DC:8E
SHA1: 27:51:F6:17:6F:A8:86:EC:73:46:B6:58:D8:F8:73:84:ED:AF:F6:47
SHA256: 63:F9:79:84:56:9E:B8:C5:44:68:3A:CD:69:D8:46:71:50:34:66:B3:A7:6A:8A:D3:68:5E:C5:19:4E:3F:6D:8A
Signature algorithm name: SHA256withRSA
Version: 3
FB hash: J1H2F2+ohuxzRrZY2PhzhO2v9kc=
*/
}
}

compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
applicationId "saberapplications.pawpads"
minSdkVersion 15

targetSdkVersion 23
versionCode 33
versionCode 40

versionName "2.5.2"
versionName "2.6.0"
// Enabling multidex support.
multiDexEnabled true

Expand All @@ -44,6 +62,9 @@ android {
// debug {
// debuggable true
// }
debug {
signingConfig signingConfigs.config
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
Expand All @@ -58,41 +79,35 @@ android {
}

dependencies {


compile('com.twitter.sdk.android:twitter-core:2.0.0@aar') {
transitive = true;
}

compile 'com.google.android.gms:play-services-ads:9.6.1'
compile 'com.twitter.sdk.android:twitter:3.0.0'
compile 'com.quickblox:quickblox-android-sdk-core:2.6.1'
compile 'com.quickblox:quickblox-android-sdk-chat:2.6.1'
compile 'com.quickblox:quickblox-android-sdk-messages:2.6.1'
compile 'com.quickblox:quickblox-android-sdk-location:2.6.1'
compile 'com.quickblox:quickblox-android-sdk-content:2.6.1'
compile 'com.quickblox:quickblox-android-sdk-customobjects:2.6.1'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta5'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:gridlayout-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.google.android.gms:play-services-ads:11.0.0'
compile 'com.google.android.gms:play-services-plus:11.0.0'
compile 'com.google.android.gms:play-services-identity:11.0.0'
compile 'com.google.android.gms:play-services-gcm:11.0.0'
compile 'com.google.android.gms:play-services-location:11.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.google.android.gms:play-services-identity:9.6.1'
compile 'com.google.android.gms:play-services-gcm:9.6.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.makeramen:roundedimageview:2.2.1'
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@aar') {
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
compile ('io.imoji.sdk:imoji-sdk-ui:+@aar') {
transitive=true
compile('io.imoji.sdk:imoji-sdk-ui:+@aar') {
transitive = true
}

compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'

compile 'com.github.bumptech.glide:glide:3.7.0'

compile 'org.greenrobot:eventbus:3.0.0'
}
29 changes: 29 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,35 @@
android:label="@string/About"
android:screenOrientation="portrait" />

<activity
android:name=".ui.chat.CreateChatActivity"
android:screenOrientation="portrait"/>

<activity
android:name=".ui.search.SearchActivity"
android:screenOrientation="portrait"/>

<activity
android:name=".ui.friends.FriendsActivity"
android:label="@string/friends"
android:screenOrientation="portrait"/>

<activity
android:name=".ui.chat.ChatGroupActivity"
android:label="ChatGroup"
android:parentActivityName=".ui.home.MainActivity"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".ui.home.MainActivity" />
</activity>

<activity
android:name=".ui.GroupEditActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
</activity>

<receiver
android:name=".GcmBroadcastReceiver"
android:exported="true"
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/saberapplications/pawpads/C.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ public class C {
public static final String UPDATE_CHAT = "update_chat";
public static final long LOCATION_PUSH_INTERVAL = 120000;
public static final String CHAT_MSG_STICKER_PROPERTY = "STICKER";
public static final String CREATED_CHANNELS_COUNT = "CREATED_CHANNELS_COUNT";
public static final String FRIEND_OUT_INVITES_LIST = "FRIEND_OUT_INVITES_LIST";
public static final String FRIEND_ACCEPTED_LIST = "FRIEND_ACCEPTED_LIST";
public static final String LATITUDE="latitude";
public static final String LONGITUDE="longitude";
public static final long DAY = 24 * 3600;
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ private void sendNotificationChat(final Intent intent) {

String msg = extras.getString("message");
String userId = extras.getString("user_id");
int currentUserId = PreferenceManager.getDefaultSharedPreferences(this).getInt(C.QB_USERID, 0);
try {
if (userId != null && currentUserId == Integer.parseInt(userId)) return;
} catch (Exception e) {
e.printStackTrace();
}
//Check blocked users
boolean isBlocked = false;
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
import com.quickblox.core.QBSettings;
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.twitter.sdk.android.core.TwitterCore;
import com.twitter.sdk.android.core.Twitter;

import java.util.UUID;

Expand All @@ -32,11 +31,9 @@ public void onCreate() {
QBSettings.getInstance().setAccountKey(Util.QB_ACCOUNT_KEY);
FontManager.init(getAssets());
// StickersManager.initialize(Util.STICKERS_API_KEY, this);
TwitterAuthConfig authConfig =
new TwitterAuthConfig("Consumer Key (API Key)", "Consumer Secret (API Secret)");
Fabric.with(this, new Crashlytics(), new TwitterCore(authConfig));


Fabric.with(this, new Crashlytics());
Twitter.initialize(this);
FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public static int getUserStatus(QBUser user) {
}

private static int getUserStatusByLastRequestTime(QBUser user) {
if(user.getLastRequestAt() == null) return USER_OFFLINE;
long currentTime = System.currentTimeMillis();
long userLastRequestAtTime = user.getLastRequestAt().getTime();
Log.d("UserStatusHelper", "getLastRequestAt = " + user.getLastRequestAt().getTime() +
Expand Down
77 changes: 70 additions & 7 deletions app/src/main/java/saberapplications/pawpads/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
import com.quickblox.core.exception.QBResponseException;
import com.quickblox.users.model.QBUser;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
* Created by blaze on 9/7/2015.
Expand Down Expand Up @@ -80,20 +82,27 @@ public static void onError(Exception e, Context context) {
public static void onError(QBResponseException e, Context context) {
Crashlytics.getInstance().logException(e);
String message = e.getLocalizedMessage();
if(!message.contains("Subscription with such UDID already exists")){
if(message.contains("Subscription with such UDID already exists")) return;
if (e.getLocalizedMessage().contains("timeout")){
showAlert(context,context.getString(R.string.error_timeout));
}else {
showAlert(context, e.getLocalizedMessage());
}
}
public static void onError(String error, Context context) {
showAlert(context,error);
}

private static void showAlert(Context context,String message){
new AlertDialog.Builder(context,R.style.AppAlertDialogTheme)
.setMessage(message)
.setTitle("Error")
.setPositiveButton("OK", null)
.show();
public static void showAlert(Context context,String message){
try {
new AlertDialog.Builder(context, R.style.AppAlertDialogTheme)
.setMessage(message)
.setTitle("Error")
.setPositiveButton("OK", null)
.show();
} catch (Exception e) {
e.printStackTrace();
}
}

public static boolean isEmailValid(CharSequence email) {
Expand Down Expand Up @@ -133,4 +142,58 @@ public static String getUserName(QBUser user) {

return user.getFullName()!=null ? user.getFullName() : user.getLogin();
}

public static int getCreatedChannelsCount() {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance());
return defaultSharedPreferences.getInt(C.CREATED_CHANNELS_COUNT, 0);
}

public static void setCreatedChannelsCount(int channelsCount) {
if(channelsCount < 0) channelsCount = 0;
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance()).edit();
editor.putInt(C.CREATED_CHANNELS_COUNT, channelsCount);
editor.apply();
}

public static Set<String> getFriendOutInvitesList() {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance());
return defaultSharedPreferences.getStringSet(C.FRIEND_OUT_INVITES_LIST, new HashSet<String>());
}

public static void addFriendOutInviteToList(int userId) {
Set<String> outInvites = getFriendOutInvitesList();
outInvites.add(String.valueOf(userId));
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance()).edit();
editor.putStringSet(C.FRIEND_OUT_INVITES_LIST, outInvites);
editor.apply();
}


public static Set<String> getFriendAcceptedList() {
SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance());
return defaultSharedPreferences.getStringSet(C.FRIEND_ACCEPTED_LIST, new HashSet<String>());
}

public static void addFriendAcceptedList(int userId) {
Set<String> outInvites = getFriendAcceptedList();
outInvites.add(String.valueOf(userId));
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance()).edit();
editor.putStringSet(C.FRIEND_ACCEPTED_LIST, outInvites);
editor.apply();
}
public static void removeFriendAcceptedList(int userId) {
Set<String> outInvites = getFriendAcceptedList();
outInvites.remove(String.valueOf(userId));
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance()).edit();
editor.putStringSet(C.FRIEND_ACCEPTED_LIST, outInvites);
editor.apply();
}

public static void removeFriendOutInviteFromList(int userId) {
Set<String> outInvites = getFriendOutInvitesList();
outInvites.remove(String.valueOf(userId));
SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(PawPadsApplication.getInstance()).edit();
editor.putStringSet(C.FRIEND_OUT_INVITES_LIST, outInvites);
editor.apply();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package saberapplications.pawpads.events;

import com.quickblox.users.model.QBUser;

/**
* Created by Stanislav Volnjanskij on 6/15/17.
*/

public class FriendRemovedEvent {

QBUser user;

public FriendRemovedEvent(QBUser user) {
this.user = user;
}

public QBUser getUser() {
return user;
}
}
Loading

0 comments on commit f30f26b

Please sign in to comment.