mirror of https://github.com/oxen-io/session-ios
parent
4983853dd0
commit
b371e627c4
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "signal-answer.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "signal-answer@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "signal-answer@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 21 KiB |
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
Binary file not shown.
After Width: | Height: | Size: 72 KiB |
@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "signal-video-splash.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "signal-video-splash@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "signal-video-splash@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
After Width: | Height: | Size: 43 KiB |
Binary file not shown.
After Width: | Height: | Size: 69 KiB |
@ -0,0 +1,11 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
extension UIDevice {
|
||||
var supportsCallKit: Bool {
|
||||
return ProcessInfo().isOperatingSystemAtLeast(OperatingSystemVersion(majorVersion: 10, minorVersion: 0, patchVersion: 0))
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class ExperienceUpgradeFinder: NSObject {
|
||||
public let TAG = "[ExperienceUpgradeFinder]"
|
||||
|
||||
// Keep these ordered by increasing uniqueId.
|
||||
private var allExperienceUpgrades: [ExperienceUpgrade] {
|
||||
var upgrades = [ExperienceUpgrade(uniqueId: "001",
|
||||
title: NSLocalizedString("UPGRADE_EXPERIENCE_VIDEO_TITLE", comment: "Header for upgrade experience"),
|
||||
body: NSLocalizedString("UPGRADE_EXPERIENCE_VIDEO_DESCRIPTION", comment: "Description of video calling to upgrading (existing) users"),
|
||||
image: #imageLiteral(resourceName: "introductory_splash_video_calling"))]
|
||||
|
||||
if UIDevice.current.supportsCallKit {
|
||||
upgrades.append(ExperienceUpgrade(uniqueId: "002",
|
||||
title: NSLocalizedString("UPGRADE_EXPERIENCE_CALLKIT_TITLE", comment: "Header for upgrade experience"),
|
||||
body: NSLocalizedString("UPGRADE_EXPERIENCE_CALLKIT_DESCRIPTION", comment: "Description of CallKit to upgrading (existing) users"),
|
||||
image: #imageLiteral(resourceName: "introductory_splash_callkit")))
|
||||
}
|
||||
|
||||
return upgrades
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Instance Methods
|
||||
|
||||
public func allUnseen(transaction: YapDatabaseReadTransaction) -> [ExperienceUpgrade] {
|
||||
return allExperienceUpgrades.filter { ExperienceUpgrade.fetch(withUniqueID: $0.uniqueId, transaction: transaction) == nil }
|
||||
}
|
||||
|
||||
public func markAllAsSeen(transaction: YapDatabaseReadWriteTransaction) {
|
||||
Logger.info("\(TAG) marking experience upgrades as seen")
|
||||
allExperienceUpgrades.forEach { $0.save(with: transaction) }
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
//
|
||||
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
class ExperienceUpgrade: TSYapDatabaseObject {
|
||||
let title: String
|
||||
let body: String
|
||||
let image: UIImage?
|
||||
var seenAt: Date?
|
||||
|
||||
required init(uniqueId: String, title: String, body: String, image: UIImage) {
|
||||
self.title = title
|
||||
self.body = body
|
||||
self.image = image
|
||||
super.init(uniqueId: uniqueId)
|
||||
}
|
||||
|
||||
override required init(uniqueId: String) {
|
||||
// This is the unfortunate seam between strict swift and fast-and-loose objc
|
||||
// we can't leave these properties nil, since we really "don't know" that the superclass
|
||||
// will assign them.
|
||||
self.title = "New Feature"
|
||||
self.body = "Bug fixes and performance improvements."
|
||||
self.image = nil
|
||||
super.init(uniqueId: uniqueId)
|
||||
}
|
||||
|
||||
required init!(coder: NSCoder!) {
|
||||
// This is the unfortunate seam between strict swift and fast-and-loose objc
|
||||
// we can't leave these properties nil, since we really "don't know" that the superclass
|
||||
// will assign them.
|
||||
self.title = "New Feature"
|
||||
self.body = "Bug fixes and performance improvements."
|
||||
self.image = nil
|
||||
super.init(coder: coder)
|
||||
}
|
||||
|
||||
required init(dictionary dictionaryValue: [AnyHashable : Any]!) throws {
|
||||
// This is the unfortunate seam between strict swift and fast-and-loose objc
|
||||
// we can't leave these properties nil, since we really "don't know" that the superclass
|
||||
// will assign them.
|
||||
self.title = "New Feature"
|
||||
self.body = "Bug fixes and performance improvements."
|
||||
self.image = nil
|
||||
try super.init(dictionary: dictionaryValue)
|
||||
}
|
||||
|
||||
override class func storageBehaviorForProperty(withKey propertyKey: String) -> MTLPropertyStorage {
|
||||
// These exist in a hardcoded set - no need to save them, plus it allows us to
|
||||
// update copy/image down the line if there was a typo and we want to re-expose
|
||||
// these models in a "change log" archive.
|
||||
if propertyKey == "title" || propertyKey == "body" || propertyKey == "image" {
|
||||
return MTLPropertyStorageNone
|
||||
} else if propertyKey == "uniqueId" || propertyKey == "seenAt" {
|
||||
return super.storageBehaviorForProperty(withKey: propertyKey)
|
||||
} else {
|
||||
// Being conservative here in case we rename a property.
|
||||
assertionFailure("unknown property \(propertyKey)")
|
||||
return super.storageBehaviorForProperty(withKey: propertyKey)
|
||||
}
|
||||
}
|
||||
|
||||
func markAsSeen(transaction: YapDatabaseReadWriteTransaction) {
|
||||
self.seenAt = Date()
|
||||
super.save(with: transaction)
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue