Updates to add more ads and fix ad types.
This commit is contained in:
parent
ad850d2be6
commit
ad2d932842
17 changed files with 552 additions and 59 deletions
|
|
@ -48,6 +48,29 @@ const createAdFreeEntitlementTableSql = '''
|
|||
)
|
||||
''';
|
||||
|
||||
/// A single-row table (`id` is always `1`) holding the earliest-known
|
||||
/// moment this app was ever used — see `AppState.firstUsedAt` and
|
||||
/// `DatabaseService.getOrCreateFirstUsedAt`. Synced like
|
||||
/// `ad_free_entitlement`, for the same reason: without it, reinstalling
|
||||
/// would reset the new-user ad grace period every time.
|
||||
const createAppUsageTableSql = '''
|
||||
CREATE TABLE app_usage (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 1),
|
||||
first_used_at INTEGER NOT NULL
|
||||
)
|
||||
''';
|
||||
|
||||
/// Unlike every other merge statement here, this keeps whichever row has
|
||||
/// the *smaller* `first_used_at` — merging in a device that's had the app
|
||||
/// longer can only push "first use" earlier, never later.
|
||||
const mergeAppUsageSql = '''
|
||||
INSERT OR REPLACE INTO main.app_usage (id, first_used_at)
|
||||
SELECT r.id, r.first_used_at
|
||||
FROM remote_db.app_usage r
|
||||
LEFT JOIN main.app_usage l ON l.id = r.id
|
||||
WHERE l.id IS NULL OR r.first_used_at < l.first_used_at
|
||||
''';
|
||||
|
||||
/// Selects fuel entries whose receipt photo still needs uploading to
|
||||
/// Drive. Deliberately requires `receipt_drive_file_id IS NULL`, not just
|
||||
/// "has a local path": once a row is uploaded, its local copy may still be
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue