Rename column uploadkey
This commit is contained in:
@@ -26,7 +26,7 @@ extension SQLiteDatabase {
|
|||||||
if version == 1 {
|
if version == 1 {
|
||||||
transaction("""
|
transaction("""
|
||||||
ALTER TABLE rec ADD COLUMN subtitle TEXT;
|
ALTER TABLE rec ADD COLUMN subtitle TEXT;
|
||||||
ALTER TABLE rec ADD COLUMN sharekey TEXT;
|
ALTER TABLE rec ADD COLUMN uploadkey TEXT;
|
||||||
""")
|
""")
|
||||||
}
|
}
|
||||||
try run(sql: "PRAGMA user_version = 2;")
|
try run(sql: "PRAGMA user_version = 2;")
|
||||||
@@ -298,12 +298,12 @@ extension CreateTable {
|
|||||||
title TEXT,
|
title TEXT,
|
||||||
subtitle TEXT,
|
subtitle TEXT,
|
||||||
notes TEXT,
|
notes TEXT,
|
||||||
sharekey TEXT
|
uploadkey TEXT
|
||||||
);
|
);
|
||||||
"""}
|
"""}
|
||||||
}
|
}
|
||||||
|
|
||||||
let readRecordingSelect = "id, start, stop, appid, title, subtitle, notes, sharekey"
|
let readRecordingSelect = "id, start, stop, appid, title, subtitle, notes, uploadkey"
|
||||||
struct Recording {
|
struct Recording {
|
||||||
let id: sqlite3_int64
|
let id: sqlite3_int64
|
||||||
let start: Timestamp
|
let start: Timestamp
|
||||||
@@ -312,7 +312,7 @@ struct Recording {
|
|||||||
var title: String? = nil
|
var title: String? = nil
|
||||||
var subtitle: String? = nil
|
var subtitle: String? = nil
|
||||||
var notes: String? = nil
|
var notes: String? = nil
|
||||||
var sharekey: String? = nil
|
var uploadkey: String? = nil
|
||||||
}
|
}
|
||||||
typealias AppBundleInfo = (bundleId: String, name: String?, author: String?)
|
typealias AppBundleInfo = (bundleId: String, name: String?, author: String?)
|
||||||
|
|
||||||
@@ -341,9 +341,9 @@ extension SQLiteDatabase {
|
|||||||
|
|
||||||
/// Update given recording by replacing `title`, `appid`, and `notes` with new values.
|
/// Update given recording by replacing `title`, `appid`, and `notes` with new values.
|
||||||
func recordingUpdate(_ r: Recording) {
|
func recordingUpdate(_ r: Recording) {
|
||||||
try? run(sql: "UPDATE rec SET appid = ?, title = ?, subtitle = ?, notes = ?, sharekey = ? WHERE id = ? LIMIT 1;",
|
try? run(sql: "UPDATE rec SET appid = ?, title = ?, subtitle = ?, notes = ?, uploadkey = ? WHERE id = ? LIMIT 1;",
|
||||||
bind: [BindTextOrNil(r.appId), BindTextOrNil(r.title), BindTextOrNil(r.subtitle),
|
bind: [BindTextOrNil(r.appId), BindTextOrNil(r.title), BindTextOrNil(r.subtitle),
|
||||||
BindTextOrNil(r.notes), BindTextOrNil(r.sharekey), BindInt64(r.id)]) { stmt -> Void in
|
BindTextOrNil(r.notes), BindTextOrNil(r.uploadkey), BindInt64(r.id)]) { stmt -> Void in
|
||||||
sqlite3_step(stmt)
|
sqlite3_step(stmt)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,7 +369,7 @@ extension SQLiteDatabase {
|
|||||||
title: col_text(stmt, 4),
|
title: col_text(stmt, 4),
|
||||||
subtitle: col_text(stmt, 5),
|
subtitle: col_text(stmt, 5),
|
||||||
notes: col_text(stmt, 6),
|
notes: col_text(stmt, 6),
|
||||||
sharekey: col_text(stmt, 7))
|
uploadkey: col_text(stmt, 7))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `WHERE stop IS NULL`
|
/// `WHERE stop IS NULL`
|
||||||
|
|||||||
@@ -38,6 +38,6 @@ extension Recording {
|
|||||||
} }
|
} }
|
||||||
var duration: Timestamp? { get { stop == nil ? nil : stop! - start } }
|
var duration: Timestamp? { get { stop == nil ? nil : stop! - start } }
|
||||||
var isLongTerm: Bool { (duration ?? 0) > Timestamp.hours(1) }
|
var isLongTerm: Bool { (duration ?? 0) > Timestamp.hours(1) }
|
||||||
var isShared: Bool { sharekey?.count ?? 0 > 0}
|
var isShared: Bool { uploadkey?.count ?? 0 > 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class VCShareRecording : UIViewController {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// update db, mark record as shared
|
// update db, mark record as shared
|
||||||
rec.sharekey = json["key"] as? String ?? "_"
|
rec.uploadkey = json["key"] as? String ?? "_"
|
||||||
self?.record = rec // in case view is still open
|
self?.record = rec // in case view is still open
|
||||||
RecordingsDB.update(rec) // rec cause self may not be available
|
RecordingsDB.update(rec) // rec cause self may not be available
|
||||||
self?.sendButton.tintColor = .gray
|
self?.sendButton.tintColor = .gray
|
||||||
|
|||||||
Reference in New Issue
Block a user