shabados / mobile

Android and iOS app for searching, navigating, and presenting the Shabad OS database.
MIT License
11 stars 11 forks source link

Implement read-only bookmarks #124

Closed Harjot1Singh closed 3 years ago

Harjot1Singh commented 3 years ago

These are bookmarks that are preexisting in the database.

Parent issue #22.

Acceptance Criteria

Bonus

@bhajneet's todo:

bhajneet commented 3 years ago

image

bhajneet commented 3 years ago

@Harjot1Singh we don't have bani IDs. It would be useful as different gutkae have different names for these banis. For ease of use we should use the names the users are already used to based on their school of thought. So I would have preferred something like:

{
  "1": [
    {
      "collection": "ਨਿਤਨੇਮ",
      "bookmarks": {
        "ਜਪੁ ਜੀ ਸਾਹਿਬ": [
          {
            "header": "ਜਪੁ ਜੀ ਸਾਹਿਬ"
          },
          {
            "start_line": "0NVY",
            "end_line": "9WAL"
          }
        ]
        "ਜਾਪੁ ਸਾਹਿਬ",
        "ਤ੍ਵ ਪ੍ਰਸਾਦਿ ਸਵਯੇ (ਸ੍ਰਾਵਗ ਸੁਧ)",
        "ਤ੍ਵ ਪ੍ਰਸਾਦਿ ਸਵਯੇ",
        "ਤ੍ਵਪ੍ਰਸਾਦਿ ਸਵਯੇ"
        }
      }
    }
  ],
}

Note you can create your own bookmarks this way, we are not reliant on database which is the base for multiple projects. We can also add headers and such in our custom json. It would also be nice to be able to name the same bani different ways based on school of thought. Idea: we can also use unicode names and transliterate to the localization language. Idea 2: we'll need to start specifying source of start/end lines, so we need to include a field to choose source ID.

Given no Bani IDs, I've done it using banis.json's "name_english" field for now:

{
  "1": [
    {
      "name": "Nitnem",
      "name_english": [
        "Jap Ji Sahib",
        "Jaap Sahib",
        "Tav Prasad Savaiye (Sravag Sudh)",
        "Benti Chaupai Sahib",
        "Anand Sahib",
        "Rehras Sahib",
        "Ardaas",
        "Sohila Sahib"
      ]
    }
  ],
  "2": [
    {
      "name": "Sundar Gutka",
      "name_english": [
        "Jap Ji Sahib",
        "Jaap Sahib",
        "Tav Prasad Savaiye (Sravag Sudh)",
        "Benti Chaupai Sahib",
        "Anand Sahib",
        "Shabad Hazare",
        "Barah Maha",
        "Shabad Hazare Patshahi 10",
        "Tav Prasad Savaiye (Deenan Ki)",
        "Rehras Sahib",
        "Ardaas",
        "Aarti",
        "Sohila Sahib",
        "Bavan Akhri",
        "Sukhmani Sahib",
        "Asa Ki Var",
        "Oankaar",
        "Sidh Gosht",
        "Lavan (Anand Karaj)",
        "Chandi Di Var",
        "Sri Guru Granth Sahib Paath Bhog (Ragmala)"
      ]
    }
  ]
}

This collections.json is missing a few from sundar gutka which are available in our database, but not populated in our db's banis.json file. I think being able to add these as custom in mobile repo would be easier than adding them to the database project.

Harjot1Singh commented 3 years ago

@bhajneet We definitely do have bani IDs, but currently, they're just in the order of the JSON file e.g. Japji Sahib = 1 etc. v5 will move to immutable Bani IDs.

AkalUstat commented 3 years ago

quick question: is the list data (shabads AND banis) just going to be ids or more like what @bhajneet is suggesting

Harjot1Singh commented 3 years ago

Design what seems most sensible as an input and just assume we can hook in the data however we'd like after. You don;t have to deal with data fetching yourself etc, so you can assume the latter