Alessio Verardo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # H3LP Code review # General Remark Of course, we don't expect you to change all of your code (some parts of the review can be subjective), what’s important is that you understand why better alternatives may exist. Please ask us if you have any question about the code review, whether it is by writing a comment below or by sending us an email. Important : if you try to fix these, don't break your app. We prefer that the app works even if you don't manage to fix anything. It may be too hard to rework some of the issues below. ## Code structure The package structure is well organized. However, it should be nice to split the view and the model in different packages. Several times, you define `goToActivity` functions in different activities. Maybe you could investigate if there is a better way of doing this. Otherwise, you seem to use a large amount of Kotlin functionnalities which is a really good thing. ## Code style *Globally, your code style is consistent. In some files however we saw some variations: single line comments had no space (i.e. you did `//comment` instead of `// comment`), no spaces around a `==`... We suggest you use the automatic code reformatting from Android Studio before commiting code.* More generally, some activities are not commented and others are, you should really comment every activity with their goals. # By file *Only files for which we have a comment are referenced here.* ## Package `h3lp` ### `AwaitHelpActivity` - `setupLocation` documentation refers to an invalid method. - See comment on `FirstAidActivity` for the functions at the end of the class. - Missing comments on some functions (`foundHelperPerson`, `showHelperPerson`) ### `FirstAidActivity` - We propose to refactor the activity in the following way: - Create a map, mapping the button id to an intent going to the Activity it refers to. - Having a single function goToActivity(v:View) that uses `v.id` to launch the correct activity. - this way, we avoid the code duplication you have at the moment. ### `GoogleAPIHelper` - `downloadURL` missing @return comment. - (`displayWalkingPath`, line 51) We detect some inconsistency here. Refers to the comment on `JSONParserInterface`. We encourage you to return `null` value from the JSON parser if an error happen. To handle the `null` value, instead of `path.let` you can use `path?.let` and in the function you can use `it` instead of `path`. - `parseTask` missing @return and @param comments and return type should be changed to `T?`. ### `HelpParameterActivity` ### `LocalEmergencyCaller` - `getPhoneNumberFromCountry` the reader is not closed properly `csvReader.close()`. ### `MainPageActivity` - See comment on `FirstAidActivity` for the functions at the end of the class. - Missing comments on the `MainPageButton`. ### MapsFragment - `showMap`: since the hashmap place is a `HashMap<String, String>`, the returned value cannot be `null` and therefore the two last conditions on the first if are not needed. ### `MedicalCardActivity` - `createBirthField`, `createHeightField`, `createWeightField`, `createBloodField`, `createGenderField`, `createHelpField`: the content of these methods could be directly replaced in the onCreate() function (keep their comments though) since they are called once and contains only one line on code. - The two `loadTo` methods don't have comments. - Missing @return comment for `checkField` and `checkPolicy` functions. - Missing comments for `getStringFromId` and `getIntFromId` ### `MySkillsActivity` - `getBooleanFromSwitch`, `toggleSwitch` missing comments. - Remove the annotation after having upgraded the SDK version ### `NearbyUtilitiesActivity` - Missing comments `setRequestedButton` and `setupLocation` ## Package `h3lp.database` ### `EmergencyInfoRepository` - @param for `database` is missing. ### `Repositories` - It might be better to wrap everything in an `object` instea of having "global variable". ### `Database` - The signature of the `addListener method should change (according to the comments we will make in the `FireDatabase` class). ### `Databases` - @return missing for the return type of databaseOf method. ### `FireDatabase` - In the JavaDoc comment of the get method, should have Long instead of Int. Missing comment for the returned value. - The comments of the overidden functions should not be rewritten in sub-classes/interface implementation. - Missing description for the `path` parameter of the class. - To be consistent with the `get` function, it would be nice to also the `reified` keyword instead of explicitly asking the type as a parameter of the function, since the class.java can be obtained from the `T` type (using `T::class.java`). - In the same function, for the `onCancelled` case, you should write the error in the log (using `Log.e(...)`) instead of printing a message in the console. - ### `MockDatabase` - This class should be in the test package as it is not used during the normal runtime of the application. - The method `addListener` will change according to the comments made above. ## Package `h3lp.dataclasses` ### `HelperSkills` - No comments for the different values of the data class. ### `MedicalInformation` - No comment for the different values of the data class. - You should upgrade the API version of your app instead of having `RequiresAPI(...)` annotation. - The `MIN_WEIGHT` cannot be set to 20 if the birthdate can be today. However, for legal purposes (ask us in the next meeting for more information), it should be preferred to limit the age of the app user. - Small typo in the `BloodType` enum, `Unkown` should be replaced by `Unknown`. ## Package `h3lp.firstaid` - Instead of having 4 different activities with the same structure/same code and different content, you could have only one activity which takes a parameter [(more info)](https://stackoverflow.com/questions/2405120/how-to-start-an-intent-by-passing-some-parameters-to-it) and adapt the content depending on the parameter. This avoid code duplication and is better practice. ## Package `h3lp.locationmanager` ### `GeneralLocationManager` - The way you did the get/set property is fine. However, for more concise notation, see [properties documentation](https://kotlinlang.org/docs/properties.html#getters-and-setters) of Kotlin. - Minor issue but it could be nice to change the name of the last function from `setSystemManager` to `setDefaultSystemManager`. ### `LocationManagerInterface` - Missing comment for return value ### `SystemLocationAdapter` - No need to comment the function again since it is an overidden function and the comment is the same. ## Package `h3lp.notification` ### `NotificationService` - `createNotificationChannel`, you can upgrade the SDK version of Android to avoid this if. - In `sendOpenActivityNotification`, you can use `reified` keyword instead of explicitly giving the type as parameter. - `buildBasicNotification`, minor typos in the @return of the function. ## Package `h3lp.presentation` ### `PresIrrelevantActivity` - One improvment could be to change the color of the button when we agree to the terms of use. - Missing comment for `addClickableText` ### `SwipeListener` - Missing comments in the companion object. ## Package `h3lp.signin` ### `GoogleSignInAdapter` - No need to comment again for overidden functions. ### `SignIn` - You can use properties as suggested before. If you don't want to, you should comment the set function. ### `SignInActivity` - As said in the general remark, storing context is a bad practice [(see this)](https://stackoverflow.com/questions/37709918/warning-do-not-place-android-context-classes-in-static-fields-this-is-a-memory). Therefore, the context should be removed from the companion object. - Missing comment for the functions `checkToSAndLaunchIfNotAcceptedElseMain` - If `signInClient` is not used elsewhere, should be private, otherwise you should comment what it represents. ### `SignInInterface` - Really nice abstraction - Missing @return comment for `isSignedIn`. ## Package `h3lp.storage` ### `LocalStorage` - `pull` should not throw a `NullPointerException`. You should throw a more explicit Error (e.g. `UserNotAuthenticatedException`) that will be catched later on. - Same remark as earlier for the `context` object stored in the instance of the class. - Missing @param comment for `parseOnlinePrefs`. - Extract one function containing the db object creation, that will throw a more meaningful error if the user is not logged in. - The comments (@param, @return) are missing in this class for almost all the methods :). - These methods need to be implemented asynchronously since disk I/O are slow operation that should not be blocking and to be consistent with what you did for the online database. - `getObjectOrDefault` and `setObject` should use `reified` keyword instead of explicit class type. ### `Storages` - Same remark as earlier for the `context` object stored in the instance of the class. - `storageOf` missing @return comment. - Missing comment for class parameter. ## Package `h3lp.util` ### `AedLocations` - The value `AED_LOCATIONS_LAUSANNE` should be wrapped in an object. Also, the aed locations should be store in the online database and retrieve when the application needs it and eventually cached locally (since the location is unlikely to be changed too often). ### `GDurationJSONParser` ### `JSONParserInterface` - `parseResult` should return `T?` instead of `T` otherwise you have no way of knowing if there was an error during the parsing. # Tests Your tests look very good, congratulations for that. # Conclusion Your code is very good overall, you have nice abstractions and lots of efforts put in. The documentation and maning are mostly clear and understable, the codestyle is mostly consistent. The app design is very cool. Keep up the good work!

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully