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
language: android | |
jdk: oraclejdk8 | |
sudo: false | |
android: | |
components: | |
- platform-tools | |
- tools | |
- build-tools-26.0.2 | |
- android-27 |
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
/* @method Permet l'ajout d'un document à la collection 'like' | |
* Reference path : /resources/{resourceId}/likes/{uniqueLikeId} | |
*/ | |
public void like() { | |
Map<String, Date> like = new HashMap<>(); | |
like.put("date", new Date()); | |
// mRef est la référence d'un collaborateur que l'on récupère via https://gist.github.com/RBonaventure/12283d6115d9960421470dde949acc41#file-firestore-fetch-data-java-L8 | |
mRef.collection(FirestoreCollections.LIKES).document(App.getGUID()) | |
.set(like).addOnCompleteListener(new OnCompleteListener<Void>() { |
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
// @see Firebase Performance | |
Traces.start(Traces.COLLABORATORS_TIME); | |
// Fetch collaborators list from Firestore | |
Collaborator.getAll(new OnCompleteListener<QuerySnapshot>() { | |
@Override | |
public void onComplete(@NonNull Task<QuerySnapshot> task) { | |
if(task.isSuccessful()) { | |
mCollaborators = task.getResult(); | |
CollaboratorsAdapter.this.notifyDataSetChanged(); |
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
service cloud.firestore { | |
match /databases/{database}/documents { | |
match /resources/{document=**} { | |
allow read; | |
} | |
match /locations/{document=**} { | |
allow read; | |
} | |
match /resources/{id}/likes/{document=**} { | |
allow read, write; |
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
/* | |
* Les deux traces et les URLs associées : | |
* A : ReactJS | |
* B : Plain HTML | |
*/ | |
private enum RenderingType { | |
REACT_JS(Traces.REACT_JS_TIME, "https://pot-pourri-android.firebaseapp.com/reactjs"), | |
PLAIN_HTML(Traces.PLAIN_HTML_TIME, "https://pot-pourri-android.firebaseapp.com/html"); | |
private String mTraceName; |
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
// Dans votre Activity#onCreate par exemple | |
mWebView.setWebViewClient(new WebViewClient() { | |
/* | |
* Le timer est démarré dès le chargement du contenu Web | |
*/ | |
@Override | |
public void onPageStarted(WebView view, String url, Bitmap favicon) { | |
super.onPageStarted(view, url, favicon); | |