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

Errors #10

Merged
merged 21 commits into from
Apr 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
ecdc085
mapping the correct config
castaway2000 Mar 23, 2016
3c3ae09
v2.3.27 added imoji stickers (send and show as an image attachments)
roma-sck Dec 27, 2016
fe42ea9
v2.3.28 fixed sticker send/show in chat screen
roma-sck Dec 28, 2016
60f217a
fixed some bugs after QA tests
roman-fomenko Jan 6, 2017
5cd6099
v2.3.29 fixed bug with neverending progress loading on chats screen
roman-fomenko Jan 6, 2017
6712c93
fixed neverending load after reopen chat screen from profile activity
roman-fomenko Jan 6, 2017
fa2a2af
v2.3.30 added progress bar while sticker loading
roman-fomenko Jan 10, 2017
52f36cc
v2.4.31 added online/offline status indicators for users in NearBy an…
roman-fomenko Jan 13, 2017
406a47c
v2.4.32 fixed deactivation of msg send button (after canceled file/ph…
roman-fomenko Jan 17, 2017
91b93cb
v2.4.32 added online/offline status indicator to userIcon on ChatActi…
roman-fomenko Jan 27, 2017
12c01f7
fixes for online/offline user status after QA tests
roman-fomenko Jan 30, 2017
e3cd88a
crashlytics updated
volnyansky Feb 1, 2017
920fbf0
Merge branch 'master' of https://github.com/castaway2000/PawPadsDev i…
castaway2000 Feb 1, 2017
32f93c1
Added giphy and emoji upload
volnyansky Feb 20, 2017
60cb4d7
2.5.1 Fixed select photos from google photos
volnyansky Feb 21, 2017
dbb0d3c
FIxed: chat activity does not show last sticker when opened from push
volnyansky Feb 22, 2017
3bdd639
Fixed: send button hidden when long message entered .
volnyansky Feb 27, 2017
f4068ca
Merge branch 'master' of https://github.com/castaway2000/PawPadsDev i…
castaway2000 Feb 28, 2017
3094036
applied patch to UDID error
castaway2000 Apr 14, 2017
49ceb2a
removed keys for opensourcing
castaway2000 Apr 14, 2017
6d255da
Merge branch 'master' into errors
castaway2000 Apr 14, 2017
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
48 changes: 48 additions & 0 deletions .idea/misc.xml

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

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

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

7 changes: 0 additions & 7 deletions AndroidStudioProjects/PawPads/.gitignore

This file was deleted.

17 changes: 12 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ android {
minSdkVersion 15

targetSdkVersion 23
versionCode 25
versionCode 33

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

Expand Down Expand Up @@ -71,21 +71,28 @@ dependencies {
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-beta2'
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:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
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.5@aar') {
compile('com.crashlytics.sdk.android:crashlytics:2.6.6@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'

}
7 changes: 6 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
android:name=".ui.chat.ChatActivity"
android:label="Chat"
android:parentActivityName=".ui.home.MainActivity"
android:launchMode="singleInstance"
android:screenOrientation="portrait">
<meta-data
android:name="android.support.PARENT_ACTIVITY"
Expand Down Expand Up @@ -173,6 +172,12 @@
<meta-data
android:name="io.fabric.ApiKey"
android:value="71b41297088b136c5894241c6ffdecec047779a6" />
<activity
android:windowSoftInputMode="adjustNothing"
android:name="io.imoji.sdk.editor.ImojiEditorActivity"
android:theme="@style/Theme.AppCompat.NoActionBar"></activity>


</application>

</manifest>
1 change: 1 addition & 0 deletions app/src/main/java/saberapplications/pawpads/C.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ public class C {
public static final String USER_DATA_CHANGED = "user_data_changed";
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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import com.twitter.sdk.android.core.TwitterAuthConfig;
import com.twitter.sdk.android.core.TwitterCore;

import java.util.UUID;

import io.fabric.sdk.android.Fabric;
import io.imoji.sdk.ImojiSDK;
import saberapplications.pawpads.views.FontManager;


Expand All @@ -36,6 +39,8 @@ public void onCreate() {

FacebookSdk.sdkInitialize(getApplicationContext());
AppEventsLogger.activateApp(this);

ImojiSDK.getInstance().setCredentials(UUID.fromString(Util.IMOJI_SDK_CLIENT_ID), Util.IMOJI_SDK_API_TOKEN);
}

@Override
Expand Down
96 changes: 96 additions & 0 deletions app/src/main/java/saberapplications/pawpads/UserStatusHelper.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package saberapplications.pawpads;

import android.util.Log;

import com.quickblox.users.model.QBUser;

import java.util.HashMap;
import java.util.Map;

/**
* Created by Roman Fomenko on 13.01.17.
*/

public class UserStatusHelper {
private static final long OFFLINE_TIME = 600000; // 10 min
private static final long AWAY_TIME = 300000; // 5 min
private static final int USER_OFFLINE = 1;
private static final int USER_AWAY = 2;
public static final int USER_ONLINE = 3;
private static Map<Integer, Integer> mStatusUserList = new HashMap<>();
private static Map<Integer, Long> mStatusByNewMessageChangedTimeList = new HashMap<>();

public static int getUserStatus(QBUser user) {
int userStatusByLastRequest = getUserStatusByLastRequestTime(user);
if( !mStatusUserList.containsKey(user.getId())) {
Log.d("UserStatusHelper", user.getId() + " " + userStatusByLastRequest);
mStatusUserList.put(user.getId(), userStatusByLastRequest);
mStatusByNewMessageChangedTimeList.put(user.getId(), 0L);
return userStatusByLastRequest;
} else {
int existStatus = mStatusUserList.get(user.getId());
long lastChangedStatusTime = mStatusByNewMessageChangedTimeList.get(user.getId());
long currentTime = System.currentTimeMillis();
long userLastRequestAtTime = user.getLastRequestAt().getTime();
if(lastChangedStatusTime == 0L ||
(currentTime - lastChangedStatusTime) > (currentTime - userLastRequestAtTime)) {
Log.d("UserStatusHelper", "lastChangedStatusTime is 0 or was a long time ago");
mStatusUserList.put(user.getId(), userStatusByLastRequest);
return userStatusByLastRequest;
} else {
if (existStatus >= userStatusByLastRequest) {
Log.d("UserStatusHelper", user.getId() + " exist-" + existStatus);
return getCheckedExistStatus(user);
} else {
mStatusUserList.put(user.getId(), userStatusByLastRequest);
Log.d("UserStatusHelper", user.getId() + " byreq-" + userStatusByLastRequest);
return userStatusByLastRequest;
}
}
}
}

private static int getUserStatusByLastRequestTime(QBUser user) {
long currentTime = System.currentTimeMillis();
long userLastRequestAtTime = user.getLastRequestAt().getTime();
Log.d("UserStatusHelper", "getLastRequestAt = " + user.getLastRequestAt().getTime() +
" currentTime = " + currentTime +
" userLastRequestAtTime = " + (currentTime - userLastRequestAtTime));

if ((currentTime - userLastRequestAtTime) > OFFLINE_TIME) {
// user is offline now
return USER_OFFLINE;
} else if ((currentTime - userLastRequestAtTime) > AWAY_TIME) {
// user is away now
return USER_AWAY;
} else {
// else online
return USER_ONLINE;
}
}

private static int getCheckedExistStatus(QBUser user) {
int checkedStatus;
long lastChangedStatusTime = mStatusByNewMessageChangedTimeList.get(user.getId());
long currentTime = System.currentTimeMillis();

if ((currentTime - lastChangedStatusTime) > OFFLINE_TIME) {
// user is offline now
checkedStatus = USER_OFFLINE;
} else if ((currentTime - lastChangedStatusTime) > AWAY_TIME) {
// user is away now
checkedStatus = USER_AWAY;
} else {
// else online
checkedStatus = USER_ONLINE;
}
mStatusUserList.put(user.getId(), checkedStatus);
return checkedStatus;
}

public static void setUserStatusByNewMessage(int userId) {
Log.d("UserStatusHelper", " new status for user " + userId);
mStatusUserList.put(userId, USER_ONLINE);
mStatusByNewMessageChangedTimeList.put(userId, System.currentTimeMillis());
}
}
17 changes: 13 additions & 4 deletions app/src/main/java/saberapplications/pawpads/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,15 @@ public class Util {
public static final String QB_AUTH_SECRET = "PUT YOURS HERE";
public static final String QB_ACCOUNT_KEY = "PUT YOURS HERE";

//quickblox ID
public static final String QB_APPID = "PUT YOURS HERE";
public static final String QB_AUTH_KEY = "PUT YOURS HERE";
public static final String QB_AUTH_SECRET = "PUT YOURS HERE";
public static final String QB_ACCOUNT_KEY = "PUT YOURS HERE";

public static final String STICKERS_API_KEY = "PUT YOURS HERE";
public static final String STICKERS_API_KEY = "PUT YOUR IMOJI KEY HERE";
public static final String IMOJI_SDK_CLIENT_ID = "PUT YOUR IMOJI CLIENT ID HERE";
public static final String IMOJI_SDK_API_TOKEN = "PUT YOUR IMOJI API TOKEN HERE";

public static String ACCURACY;
public static int RANGE;
Expand All @@ -62,7 +69,7 @@ public static void onError(List<String> errors, Context context) {
for (String error : errors) {
msg = msg + error + "\n";
}
showAlert(context,msg);
showAlert(context, msg);
}

public static void onError(Exception e, Context context) {
Expand All @@ -72,8 +79,10 @@ public static void onError(Exception e, Context context) {

public static void onError(QBResponseException e, Context context) {
Crashlytics.getInstance().logException(e);
showAlert(context,e.getLocalizedMessage());

String message = e.getLocalizedMessage();
if(!message.contains("Subscription with such UDID already exists")){
showAlert(context, e.getLocalizedMessage());
}
}
public static void onError(String error, Context context) {
showAlert(context,error);
Expand Down
16 changes: 12 additions & 4 deletions app/src/main/java/saberapplications/pawpads/ui/BaseActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

import saberapplications.pawpads.C;
import saberapplications.pawpads.R;
import saberapplications.pawpads.UserStatusHelper;
import saberapplications.pawpads.Util;
import saberapplications.pawpads.service.UserLocationService;
import saberapplications.pawpads.ui.chat.ChatActivity;
Expand Down Expand Up @@ -72,8 +73,15 @@ public void chatCreated(QBPrivateChat qbPrivateChat, final boolean createdLocall
if (!createdLocally) {
qbPrivateChat.addMessageListener(new QBMessageListener<QBPrivateChat>() {
@Override
public void processMessage(QBPrivateChat qbPrivateChat, final QBChatMessage qbChatMessage) {
onChatMessage(qbPrivateChat, qbChatMessage);
public void processMessage(final QBPrivateChat qbPrivateChat, final QBChatMessage qbChatMessage) {
BaseActivity.this.runOnUiThread(new Runnable() {
@Override
public void run() {
onChatMessage(qbPrivateChat, qbChatMessage);
UserStatusHelper.setUserStatusByNewMessage(qbChatMessage.getSenderId());
}
});

}

@Override
Expand Down Expand Up @@ -338,7 +346,7 @@ public boolean isLoggedIn() {
}

public void onChatMessage(QBPrivateChat qbPrivateChat, final QBChatMessage qbChatMessage) {
if (Util.IM_ALERT == true) {
if (Util.IM_ALERT) {
new AlertDialog.Builder(BaseActivity.this)
.setTitle(R.string.new_chat_message)
.setMessage(qbChatMessage.getBody())
Expand All @@ -347,7 +355,7 @@ public void onChatMessage(QBPrivateChat qbPrivateChat, final QBChatMessage qbCha
public void onClick(DialogInterface dialog, int which) {
Intent intent = new Intent(BaseActivity.this, ChatActivity.class);
intent.putExtra(ChatActivity.DIALOG_ID, qbChatMessage.getDialogId().toString());
intent.putExtra(ChatActivity.RECIPIENT_ID, qbChatMessage.getSenderId().toString());
intent.putExtra(ChatActivity.RECIPIENT_ID, qbChatMessage.getSenderId());
startActivity(intent);
}
})
Expand Down
Loading