Skip to content

Commit

Permalink
Merge pull request #25 from DevlessTeam/dev
Browse files Browse the repository at this point in the history
Dev Merger After @nayram pull request
  • Loading branch information
charlesagyemang authored Jan 24, 2018
2 parents 7926d96 + 36a3760 commit 3b5b79f
Show file tree
Hide file tree
Showing 14 changed files with 358 additions and 38 deletions.
8 changes: 8 additions & 0 deletions .idea/markdown-exported-files.xml

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

6 changes: 5 additions & 1 deletion .idea/misc.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@
import android.os.Bundle;
import android.util.Log;

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

import androidsdk.devless.io.devless.interfaces.DeleteResponse;
import androidsdk.devless.io.devless.interfaces.EditDataResponse;
import androidsdk.devless.io.devless.interfaces.GetDataResponse;
import androidsdk.devless.io.devless.interfaces.LoginResponse;
import androidsdk.devless.io.devless.interfaces.PostDataResponse;
import androidsdk.devless.io.devless.interfaces.SearchResponse;
import androidsdk.devless.io.devless.interfaces.SignUpResponse;
import androidsdk.devless.io.devless.main.Devless;
import androidsdk.devless.io.devless.messages.ErrorMessage;
import androidsdk.devless.io.devless.messages.Payload;
import androidsdk.devless.io.devless.messages.ResponsePayload;


public class MainActivity extends AppCompatActivity {
Expand All @@ -17,6 +31,192 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

//Create a shared preference like this
SharedPreferences sp = getSharedPreferences(getPackageName(), Context.MODE_PRIVATE);

//Now go ahead and set devless up
String appUrl = "http://buildgallery.herokuapp.com"; // remember no slash after the com just the absolute URL
String devlessToken = "41b1f8b6dd4823f63f8eeed626bfafa8"; //this is my token

//This is how to create a devless instance
//Devless devless = new Devless(this, appUrl, devlessToken);

/*
setUpDevlessUserToken Right under the instance and pass in the
name of your shared preference variable. Im my case I called my shared preference *sp*
*/
//devless.addUserToken(sp);

//Log.e("token", devless.getDevlessUserToken());


//Log.e("==repo==", devless.getDevlessUserToken());


// Sign Up
/*
devless.signUpWithEmailAndPassword("[email protected]", "password", sp, new SignUpResponse() {
@Override
public void onSignUpSuccess(Payload payload) {
Log.e("==Success==", payload.toString());
}
@Override
public void onSignUpFailed(ErrorMessage errorMessage) {
Log.e("==Failure==", errorMessage.toString());
}
});
*/




// devless.loginWithEmailAndPassword("[email protected]", "password", sp, new LoginResponse() {
// @Override
// public void onLogInSuccess(ResponsePayload response) {
// Log.e("==Passed==", response.toString());
// }
//
// @Override
// public void onLogInFailed(ErrorMessage errorMessage) {
// Log.e("==Failure==", errorMessage.toString());
// }
// });


//
// devless.getData("gitmo", "test_table", new GetDataResponse() {
// @Override
// public void onSuccess(ResponsePayload response) {
// Log.e("Success", response.toString());
// }
//
// @Override
// public void onFailed(ErrorMessage errorMessage) {
// Log.e("Failure", errorMessage.toString());
// }
//
// @Override
// public void userNotAuthenticated(ErrorMessage message) {
// Log.e("UserNotAuth", message.toString());
// }
//
// @Override
// public void fullRequestResponse(ResponsePayload response) {
// Log.e("Full", response.toString());
// }
// });







//Post Data
// Map<String, Object> data = new HashMap<String, Object>();
// data.put("name", "koobi");
//
// devless.postData("plans", "test_table", data, new PostDataResponse() {
// @Override
// public void onSuccess(ResponsePayload response) {
// Log.e("success", response.toString());
// }
//
// @Override
// public void onFailed(ErrorMessage errorMessage) {
// Log.e("Failed", errorMessage.toString());
// }
//
// @Override
// public void userNotAuthenticated(ErrorMessage message) {
// Log.e("UnAuth", message.toString());
// }
//
// @Override
// public void fullPostDataResponse(ResponsePayload response) {
// Log.e("FullPostdata", response.toString());
// }
// });


/* get data
devless.getData("plans", "test_table", new GetDataResponse() {
@Override
public void onSuccess(ResponsePayload response) {
Log.e("success", response.toString());
}
@Override
public void onFailed(ErrorMessage errorMessage) {
Log.e("Failed", errorMessage.toString());
}
@Override
public void userNotAuthenticated(ErrorMessage message) {
Log.e("UnAuth", message.toString());
}
@Override
public void fullRequestResponse(ResponsePayload response) {
Log.e("FullPostData", response.toString());
}
});
*/


/*
Map<String, Object> change = new HashMap<>();
change.put("name", "kulee");
devless.edit("plans", "test_table", change, "1", new EditDataResponse() {
@Override
public void onSuccess(ResponsePayload response) {
Log.e("success", response.toString());
}
@Override
public void onFailed(ErrorMessage errorMessage) {
Log.e("Failed", errorMessage.toString());
}
@Override
public void userNotAuthenticated(ErrorMessage message) {
Log.e("UnAuth", message.toString());
}
@Override
public void fullEditDataResponse(ResponsePayload response) {
Log.e("FullPostData", response.toString());
}
});
*/

/* Delete Message
devless.delete("plans", "test_table", "1", new DeleteResponse() {
@Override
public void onSuccess(ResponsePayload response) {
Log.e("success", response.toString());
}
@Override
public void onFailed(ErrorMessage errorMessage) {
Log.e("Failed", errorMessage.toString());
}
@Override
public void userNotAuthenticated(ErrorMessage message) {
Log.e("UnAuth", message.toString());
}
@Override
public void fullDeleteResponse(ResponsePayload response) {
Log.e("FullPostData", response.toString());
}
});
*/



}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ public interface DeleteResponse {
void onSuccess(ResponsePayload response);
void onFailed(ErrorMessage errorMessage);
void userNotAuthenticated(ErrorMessage message);
void fullDeleteResponse (ResponsePayload response);

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ public interface EditDataResponse {
void onSuccess(ResponsePayload response);
void onFailed(ErrorMessage errorMessage);
void userNotAuthenticated(ErrorMessage message);
void fullEditDataResponse(ResponsePayload response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public interface GetDataResponse {
void onSuccess(ResponsePayload response);
void onFailed(ErrorMessage errorMessage);
void userNotAuthenticated(ErrorMessage message);
void fullRequestResponse (ResponsePayload response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
public interface LoginResponse {
void onLogInSuccess(ResponsePayload response);
void onLogInFailed(ErrorMessage errorMessage);

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@

public interface LogoutResponse {
void onLogOutSuccess(ResponsePayload response);
void fullLogoutResponse(ResponsePayload response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ public interface PostDataResponse {
void onSuccess(ResponsePayload response);
void onFailed(ErrorMessage errorMessage);
void userNotAuthenticated(ErrorMessage message);
void fullPostDataResponse(ResponsePayload response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
public interface RequestResponse {
void onSuccess(ResponsePayload response);
void userNotAuthenticated(ErrorMessage message);
// void fullRequestResponse(ResponsePayload response);
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
public interface SearchResponse {
void onSuccess(ResponsePayload response);
void userNotAuthenticated(ErrorMessage errorMessage);
void fullSearchResponse(ResponsePayload responsePayload);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import androidsdk.devless.io.devless.messages.ErrorMessage;
import androidsdk.devless.io.devless.messages.Payload;
import androidsdk.devless.io.devless.messages.ResponsePayload;

/**
* Created by pianoafrik on 6/8/17.
Expand All @@ -10,4 +11,5 @@
public interface SignUpResponse {
void onSignUpSuccess(Payload payload);
void onSignUpFailed(ErrorMessage errorMessage);

}
Loading

0 comments on commit 3b5b79f

Please sign in to comment.