forked from paulkokos/discountFinderAndroid
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Conflicts: # app/src/test/java/eu/jnksoftware/discountfinderandroid/ui/customer/ViewStoreTest.java
- Loading branch information
Showing
100 changed files
with
3,133 additions
and
1,372 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<resources> | ||
<!-- | ||
TODO: Before you run your application, you need a Google Maps API key. | ||
To get one, follow this link, follow the directions and press "Create" at the end: | ||
https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=5B:D5:F9:3B:6F:DF:0C:84:E5:12:D4:C4:87:6C:A2:62:E9:DA:94:79%3Beu.jnksoftware.discountfinderandroid | ||
You can also add your credentials to an existing key, using these values: | ||
Package name: | ||
5B:D5:F9:3B:6F:DF:0C:84:E5:12:D4:C4:87:6C:A2:62:E9:DA:94:79 | ||
SHA-1 certificate fingerprint: | ||
5B:D5:F9:3B:6F:DF:0C:84:E5:12:D4:C4:87:6C:A2:62:E9:DA:94:79 | ||
Alternatively, follow the directions here: | ||
https://developers.google.com/maps/documentation/android/start#get-key | ||
Once you have your key (it starts with "AIza"), replace the "google_maps_key" | ||
string in this file. | ||
--> | ||
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">AIzaSyCnjNNPviOid3FOGAlKCZcjzD8IGrNX_B0</string> | ||
</resources> |
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
20 changes: 0 additions & 20 deletions
20
app/src/main/java/eu/jnksoftware/discountfinderandroid/Apis/DiscountsApiInterface.java
This file was deleted.
Oops, something went wrong.
100 changes: 100 additions & 0 deletions
100
app/src/main/java/eu/jnksoftware/discountfinderandroid/Apis/HttpCall.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,100 @@ | ||
package eu.jnksoftware.discountfinderandroid.Apis; | ||
|
||
import android.widget.Toast; | ||
|
||
import com.google.gson.Gson; | ||
|
||
import eu.jnksoftware.discountfinderandroid.Utilities.ManageSharePrefs; | ||
import eu.jnksoftware.discountfinderandroid.models.Location; | ||
import eu.jnksoftware.discountfinderandroid.models.token.FcmToken; | ||
import eu.jnksoftware.discountfinderandroid.models.token.User; | ||
import eu.jnksoftware.discountfinderandroid.services.IuserService; | ||
import retrofit2.Call; | ||
import retrofit2.Callback; | ||
import retrofit2.Response; | ||
|
||
/** | ||
* Created by makis on 21/12/2017. | ||
*/ | ||
|
||
public class HttpCall { | ||
private IuserService iuserService; | ||
|
||
public HttpCall() { | ||
iuserService = ApiUtils.getUserService(); | ||
} | ||
|
||
public int setFcmToken(FcmToken token, String auth){ | ||
final int[] statusCode = new int[1]; | ||
Call<Void> call =iuserService.registerFcmToken(token, auth); | ||
call.enqueue(new Callback<Void>() { | ||
|
||
@Override | ||
public void onResponse(retrofit2.Call<Void> call, Response<Void> response) { | ||
statusCode[0] =response.code(); | ||
} | ||
|
||
@Override | ||
public void onFailure(retrofit2.Call<Void> call, Throwable t) { | ||
} | ||
|
||
}); | ||
return statusCode[0]; | ||
} | ||
|
||
public int setUserLocation(Location location, String auth){ | ||
final int[] statuscode = new int[1]; | ||
; | ||
Call<Void> call =iuserService.setUserLocation(location, auth); | ||
call.enqueue(new Callback<Void>() { | ||
|
||
@Override | ||
public void onResponse(retrofit2.Call<Void> call, Response<Void> response) { | ||
|
||
|
||
do { | ||
statuscode[0] = response.code(); | ||
try { | ||
Thread.sleep(3000); | ||
} catch (InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
}while (statuscode[0] ==0); | ||
} | ||
|
||
|
||
@Override | ||
public void onFailure(retrofit2.Call<Void> call, Throwable t) { | ||
} | ||
|
||
}); | ||
return statuscode[0]; | ||
} | ||
|
||
public void refreshToken(){ | ||
String refresh_token=" "; | ||
User tempUser= ManageSharePrefs.readUser(""); | ||
if (tempUser!=null){ | ||
refresh_token=tempUser.getRefreshToken(); | ||
} | ||
Call<User> call =iuserService.refreshAccessToken(refresh_token); | ||
call.enqueue(new Callback<User>() { | ||
|
||
@Override | ||
public void onResponse(retrofit2.Call<User> call, Response<User> response) { | ||
int statusCode =response.code(); | ||
if (response.isSuccessful()){ | ||
User user=response.body(); | ||
ManageSharePrefs.writeUser(user); | ||
} | ||
} | ||
|
||
@Override | ||
public void onFailure(retrofit2.Call<User> call, Throwable t) { | ||
} | ||
|
||
}); | ||
|
||
} | ||
|
||
} |
21 changes: 0 additions & 21 deletions
21
app/src/main/java/eu/jnksoftware/discountfinderandroid/Apis/RestClient.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.