Skip to content

Commit

Permalink
ver 4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
alirezaashrafi committed Feb 16, 2018
1 parent b382ef3 commit 461fb40
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
16 changes: 16 additions & 0 deletions .idea/checkstyle-idea.xml

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

4 changes: 2 additions & 2 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
consumerProguardFiles 'proguard-rules.pro'
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 41
versionName "4.1.0"
versionCode 42
versionName "4.1.1"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
Expand Down
14 changes: 14 additions & 0 deletions library/src/main/java/com/ashrafi/webi/classes/WebService.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import com.ashrafi.webi.enums.Logs;
import com.ashrafi.webi.enums.Methods;

import org.json.JSONObject;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
Expand All @@ -33,6 +35,7 @@

final class WebService {

protected JSONObject jsonObject;
/*--* log tag *--*/
private final String TAG = this.getClass().getName();

Expand Down Expand Up @@ -100,6 +103,7 @@ final class WebService {
protected boolean is_headers_seted = false;
protected boolean is_gets_seted = false;
protected boolean is_ramCache_seted = false;
protected boolean is_jsonObject = false;
protected boolean is_xmlCache_seted = false;
protected boolean is_sqlCache_seted = false;
protected boolean is_workOffline_seted = false;
Expand All @@ -108,6 +112,7 @@ final class WebService {

//1
WebService(Context context, Webi webi, WebiEvents webiEvents) {
this.jsonObject = new JSONObject();
this.posts = new ArrayList<>();
this.headers = new ArrayList<>();
this.gets = new ArrayList<>();
Expand Down Expand Up @@ -282,6 +287,15 @@ public void data(String string) {
//6
protected void onExecute() {
/*--* start connection *--*/

if (is_jsonObject){
Posts posts = new Posts();
posts.setKey("api");
posts.setValue(jsonObject.toString());
this.posts.add(posts);
}


openHttpURLConnection();
/*--* start requesting to server *--*/

Expand Down
11 changes: 11 additions & 0 deletions library/src/main/java/com/ashrafi/webi/classes/Webi.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.ashrafi.webi.interfaces.OnXmlReceive;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.net.Authenticator;
Expand Down Expand Up @@ -72,6 +73,16 @@ public Webi from(String url) {
return this;
}


public Webi addJsonPost(Object key,Object value){
try {
webService.is_jsonObject = true;
webService.jsonObject.put(key.toString(),value.toString());
} catch (JSONException e) {
e.printStackTrace();
}
return this;
}
public Webi from(Object url) {
/** (webi library)
*
Expand Down

0 comments on commit 461fb40

Please sign in to comment.