Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions database.rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@
".write": false,
".read": "auth != null"
},
"appInfo": {
// written only by the backend (admin SDK); readable before login so
// the app can show the update prompt on the login screen too
".write": false,
".read": true,
"$platform": {
"releases": {
// the app range-queries the releases it is missing
".indexOn": ["versionCode"]
}
}
},
"projects": {
".write": false,
".read": "
Expand Down
48 changes: 48 additions & 0 deletions functions/definition/appInfo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/toggle-corp/typesync/refs/tags/v1.0.0/schema.local.json

FbAppInfoRelease:
model: alias
docs: Release notes for a single app version on a platform.
type:
type: object
fields:
version:
type: string
versionCode:
docs: Sortable number of the version used for range queries. Eg. 3.0.10 -> 3000010
type: int
Comment on lines +11 to +13

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need versionCode? To order and identify which version comes before another without linking?

updates:
docs: What's new in this version (markdown).
optional: true
type: string
incompatibleChanges:
docs: What won't work on older versions after this release (markdown).
optional: true
type: string
supportedFeatures:
docs: Features (AppFeatureEnum values) supported by this version. When set, it overrides the list bundled in the app.
optional: true
type:
type: list
elementType: string
Comment on lines +22 to +27

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the app override or is this the features supported by the backend.
We need both but I don't see both of them being defined.


FbAppInfo:
model: alias
# path: v2/appInfo/{platform}
docs: Represents version information of the mobile app for a platform (ios/android).
type:
type: object
fields:
latestVersion:
docs: Latest version available on the store.
optional: true
type: string
minSupportedVersion:
docs: Installed versions below this must update.
type: string
releases:
docs: Release notes up to the latest version, keyed by version with "." replaced by "_". Eg. 3_0_10
optional: true
type:
type: map
valueType: FbAppInfoRelease
6 changes: 6 additions & 0 deletions functions/definition/project/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ FbProjectUpdateInput:
type: int
progress:
type: int
requiredFeatures:
docs: Features (AppFeatureEnum values) a client must support to open this. Unknown values must be treated as unsupported.
optional: true
type:
type: list
elementType: string

FbProjectCreateOnlyInput:
model: alias
Expand Down
6 changes: 6 additions & 0 deletions functions/definition/tutorial/common.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ FbBaseTutorial:
tutorialDraftId:
type: string
deprecated: true
requiredFeatures:
docs: Features (AppFeatureEnum values) a client must support to open this. Unknown values must be treated as unsupported.
optional: true
type:
type: list
elementType: string
screens:
type:
type: list
Expand Down
59 changes: 59 additions & 0 deletions functions/generated/pyfirebase/pyfirebase_mapswipe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,57 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
super().__setattr__(name, value)


class FbAppInfoRelease(TypesyncModel):
"""Release notes for a single app version on a platform."""

version: str
versionCode: int
"""Sortable number of the version used for range queries. Eg. 3.0.10 -> 3000010"""
updates: str | TypesyncUndefined | None = UNDEFINED
"""What's new in this version (markdown)."""
incompatibleChanges: str | TypesyncUndefined | None = UNDEFINED
"""What won't work on older versions after this release (markdown)."""
supportedFeatures: list[str] | TypesyncUndefined | None = UNDEFINED
"""Features (AppFeatureEnum values) supported by this version. When set, it overrides the list bundled in the app."""

class Config:
use_enum_values = False
extra = "forbid"

@typing.override
def __setattr__(self, name: str, value: typing.Any) -> None:
if name == "updates" and value is None:
raise ValueError("'updates' field cannot be set to None")
if name == "incompatibleChanges" and value is None:
raise ValueError("'incompatibleChanges' field cannot be set to None")
if name == "supportedFeatures" and value is None:
raise ValueError("'supportedFeatures' field cannot be set to None")
super().__setattr__(name, value)


class FbAppInfo(TypesyncModel):
"""Represents version information of the mobile app for a platform (ios/android)."""

latestVersion: str | TypesyncUndefined | None = UNDEFINED
"""Latest version available on the store."""
minSupportedVersion: str
"""Installed versions below this must update."""
releases: dict[str, FbAppInfoRelease] | TypesyncUndefined | None = UNDEFINED
"""Release notes up to the latest version, keyed by version with "." replaced by "_". Eg. 3_0_10"""

class Config:
use_enum_values = False
extra = "forbid"

@typing.override
def __setattr__(self, name: str, value: typing.Any) -> None:
if name == "latestVersion" and value is None:
raise ValueError("'latestVersion' field cannot be set to None")
if name == "releases" and value is None:
raise ValueError("'releases' field cannot be set to None")
super().__setattr__(name, value)


class FbOrganisation(TypesyncModel):
"""Represents the requesting organisation."""

Expand Down Expand Up @@ -176,6 +227,8 @@ class FbProjectUpdateInput(TypesyncModel):
maxTasksPerUser: int | TypesyncUndefined | None = UNDEFINED
contributorCount: int
progress: int
requiredFeatures: list[str] | TypesyncUndefined | None = UNDEFINED
"""Features (AppFeatureEnum values) a client must support to open this. Unknown values must be treated as unsupported."""

class Config:
use_enum_values = False
Expand All @@ -195,6 +248,8 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
raise ValueError("'teamId' field cannot be set to None")
if name == "maxTasksPerUser" and value is None:
raise ValueError("'maxTasksPerUser' field cannot be set to None")
if name == "requiredFeatures" and value is None:
raise ValueError("'requiredFeatures' field cannot be set to None")
super().__setattr__(name, value)


Expand Down Expand Up @@ -892,6 +947,8 @@ class FbBaseTutorial(TypesyncModel):
projectTopicKey: typing.Annotated[str, pydantic.Field(deprecated=True)]
status: typing.Literal["tutorial"]
tutorialDraftId: typing.Annotated[str, pydantic.Field(deprecated=True)]
requiredFeatures: list[str] | TypesyncUndefined | None = UNDEFINED
"""Features (AppFeatureEnum values) a client must support to open this. Unknown values must be treated as unsupported."""
screens: list[FbScreen] | TypesyncUndefined | None = UNDEFINED

class Config:
Expand All @@ -908,6 +965,8 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
raise ValueError("'informationPages' field cannot be set to None")
if name == "lookFor" and value is None:
raise ValueError("'lookFor' field cannot be set to None")
if name == "requiredFeatures" and value is None:
raise ValueError("'requiredFeatures' field cannot be set to None")
if name == "screens" and value is None:
raise ValueError("'screens' field cannot be set to None")
super().__setattr__(name, value)
Expand Down
Loading