-
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
40,663 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Java Gradle CircleCI 2.0 configuration file | ||
# | ||
# Check https://circleci.com/docs/2.0/language-java/ for more details | ||
# | ||
version: 2 | ||
jobs: | ||
build: | ||
docker: | ||
# specify the version you desire here | ||
- image: circleci/openjdk:8-jdk | ||
|
||
# Specify service dependencies here if necessary | ||
# CircleCI maintains a library of pre-built images | ||
# documented at https://circleci.com/docs/2.0/circleci-images/ | ||
# - image: circleci/postgres:9.4 | ||
|
||
working_directory: ~/repo | ||
|
||
environment: | ||
# Customize the JVM maximum heap limit | ||
JVM_OPTS: -Xmx3200m | ||
TERM: dumb | ||
|
||
steps: | ||
- checkout | ||
|
||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "build.gradle" }} | ||
# fallback to using the latest cache if no exact match is found | ||
- v1-dependencies- | ||
|
||
- run: gradle dependencies | ||
|
||
- save_cache: | ||
paths: | ||
- ~/.gradle | ||
key: v1-dependencies-{{ checksum "build.gradle" }} | ||
|
||
# run tests! | ||
- run: gradle test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40,152 changes: 40,151 additions & 1 deletion
40,152
erxeslibrary/src/main/graphql/com.erxes.io/opens/schema.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
erxeslibrary/src/main/java/com/newmedia/erxeslibrary/connection/WidgetBotRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
package com.newmedia.erxeslibrary.connection; | ||
|
||
import android.content.Context; | ||
import android.text.TextUtils; | ||
import android.util.Log; | ||
|
||
import com.apollographql.apollo.api.Response; | ||
import com.apollographql.apollo.rx3.Rx3Apollo; | ||
import com.erxes.io.opens.WidgetBotRequestMutation; | ||
import com.erxes.io.opens.WidgetsInsertMessageMutation; | ||
import com.erxes.io.opens.type.AttachmentInput; | ||
import com.newmedia.erxeslibrary.configuration.Config; | ||
import com.newmedia.erxeslibrary.configuration.ErxesRequest; | ||
import com.newmedia.erxeslibrary.model.ConversationMessage; | ||
import com.newmedia.erxeslibrary.utils.ReturntypeUtil; | ||
|
||
import java.util.List; | ||
|
||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; | ||
import io.reactivex.rxjava3.core.Observer; | ||
import io.reactivex.rxjava3.disposables.Disposable; | ||
import io.reactivex.rxjava3.schedulers.Schedulers; | ||
|
||
public class WidgetBotRequest { | ||
final static String TAG = "widgetBotRequest"; | ||
private final ErxesRequest erxesRequest; | ||
private final Config config; | ||
private final Context context; | ||
|
||
public WidgetBotRequest(ErxesRequest erxesRequest, Context context) { | ||
this.erxesRequest = erxesRequest; | ||
this.context = context; | ||
config = Config.getInstance(context); | ||
} | ||
|
||
public void run(String mContent, String type,String payload) { | ||
if (TextUtils.isEmpty(mContent) ) { | ||
mContent = "This message has an attachment"; | ||
} | ||
WidgetBotRequestMutation.Builder temp = WidgetBotRequestMutation.builder() | ||
.integrationId(config.integrationId) | ||
.customerId(config.customerId) | ||
.message(mContent) | ||
.conversationId(config.conversationId) | ||
.payload(payload) | ||
.type(type); | ||
|
||
String finalMContent = mContent; | ||
Rx3Apollo.from(erxesRequest.apolloClient | ||
.mutate(temp.build())) | ||
.subscribeOn(Schedulers.io()) | ||
.observeOn(AndroidSchedulers.mainThread()) | ||
.subscribe(new Observer<Response<WidgetBotRequestMutation.Data>>() { | ||
@Override | ||
public void onSubscribe(Disposable d) { | ||
|
||
} | ||
|
||
@Override | ||
public void onNext(Response<WidgetBotRequestMutation.Data> response) { | ||
if (response.hasErrors()) { | ||
erxesRequest.notefyAll(ReturntypeUtil.SERVERERROR, config.conversationId, response.getErrors().get(0).getMessage(),null); | ||
} else { | ||
if (response.getData() != null) { | ||
Log.d("fuck"," xx "+response.getData().widgetBotRequest().toString()); | ||
erxesRequest.notefyAll(ReturntypeUtil.GETBOTINITIALMESSAGE, config.conversationId, null, response.getData().widgetBotRequest()); | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public void onError(Throwable e) { | ||
e.printStackTrace(); | ||
erxesRequest.notefyAll(ReturntypeUtil.CONNECTIONFAILED, null, e.getMessage(),null); | ||
|
||
} | ||
|
||
@Override | ||
public void onComplete() { | ||
|
||
} | ||
}); | ||
} | ||
|
||
} |
Oops, something went wrong.