patch
This commit is contained in:
parent
43a9d477a9
commit
eef02dcca1
@ -120,6 +120,40 @@
|
|||||||
"Email не подтверждён. Подтвердите, чтобы активировать дополнительные проверки." : {
|
"Email не подтверждён. Подтвердите, чтобы активировать дополнительные проверки." : {
|
||||||
"comment" : "Описание необходимости подтверждения email"
|
"comment" : "Описание необходимости подтверждения email"
|
||||||
},
|
},
|
||||||
|
"ForceUpdate.Message" : {
|
||||||
|
"comment" : "Force update alert message",
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "This version is no longer supported. Please update the app."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ru" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Эта версия приложения устарела и больше не поддерживается. Пожалуйста, обновите приложение."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ForceUpdate.Title" : {
|
||||||
|
"comment" : "Force update alert title",
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Update required"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ru" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Требуется обновление"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Fun Fest" : {
|
"Fun Fest" : {
|
||||||
"comment" : "Fun Fest",
|
"comment" : "Fun Fest",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@ -149,6 +183,12 @@
|
|||||||
},
|
},
|
||||||
"Login must not end with 'bot' for non-bot accounts" : {
|
"Login must not end with 'bot' for non-bot accounts" : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"NeedUpdate.Message" : {
|
||||||
|
"comment" : "Need update alert message"
|
||||||
|
},
|
||||||
|
"NeedUpdate.Title" : {
|
||||||
|
"comment" : "Need update alert title"
|
||||||
},
|
},
|
||||||
"OK" : {
|
"OK" : {
|
||||||
"comment" : "Common OK\nProfile update alert button\nОбщий текст кнопки OK",
|
"comment" : "Common OK\nProfile update alert button\nОбщий текст кнопки OK",
|
||||||
@ -204,6 +244,40 @@
|
|||||||
},
|
},
|
||||||
"Qr" : {
|
"Qr" : {
|
||||||
|
|
||||||
|
},
|
||||||
|
"SoftUpdate.Message" : {
|
||||||
|
"comment" : "Soft update alert message",
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "A new version is available. Some features may stop working correctly soon."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ru" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Вышла новая версия приложения. Некоторые функции могут скоро работать некорректно."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"SoftUpdate.Title" : {
|
||||||
|
"comment" : "Soft update alert title",
|
||||||
|
"localizations" : {
|
||||||
|
"en" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Update available"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"ru" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "Доступно обновление"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Yobble" : {
|
"Yobble" : {
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@ -3,18 +3,40 @@ import UIKit
|
|||||||
|
|
||||||
struct AppUpdateNotice: Identifiable {
|
struct AppUpdateNotice: Identifiable {
|
||||||
enum Kind {
|
enum Kind {
|
||||||
|
case need
|
||||||
case force
|
case force
|
||||||
case soft
|
case soft
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = UUID()
|
let id = UUID()
|
||||||
let kind: Kind
|
let kind: Kind
|
||||||
let title: String
|
|
||||||
let message: String
|
|
||||||
let appStoreURL: URL
|
let appStoreURL: URL
|
||||||
|
|
||||||
|
var title: String {
|
||||||
|
switch kind {
|
||||||
|
case .need:
|
||||||
|
return NSLocalizedString("NeedUpdate.Title", comment: "Need update alert title")
|
||||||
|
case .force:
|
||||||
|
return NSLocalizedString("ForceUpdate.Title", comment: "Force update alert title")
|
||||||
|
case .soft:
|
||||||
|
return NSLocalizedString("SoftUpdate.Title", comment: "Soft update alert title")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var message: String {
|
||||||
|
switch kind {
|
||||||
|
case .need:
|
||||||
|
return NSLocalizedString("NeedUpdate.Message", comment: "Need update alert message")
|
||||||
|
case .force:
|
||||||
|
return NSLocalizedString("ForceUpdate.Message", comment: "Force update alert message")
|
||||||
|
case .soft:
|
||||||
|
return NSLocalizedString("SoftUpdate.Message", comment: "Soft update alert message")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class AppUpdateChecker: ObservableObject {
|
final class AppUpdateChecker: ObservableObject {
|
||||||
|
@Published private(set) var needUpdateNotice: AppUpdateNotice?
|
||||||
@Published private(set) var softUpdateNotice: AppUpdateNotice?
|
@Published private(set) var softUpdateNotice: AppUpdateNotice?
|
||||||
@Published private(set) var forceUpdateNotice: AppUpdateNotice?
|
@Published private(set) var forceUpdateNotice: AppUpdateNotice?
|
||||||
|
|
||||||
@ -90,22 +112,20 @@ final class AppUpdateChecker: ObservableObject {
|
|||||||
print("buildNumber", buildNumber)
|
print("buildNumber", buildNumber)
|
||||||
print("config", config.notSupportedBuild, config.minSupportedBuild, config.recommendedBuild)
|
print("config", config.notSupportedBuild, config.minSupportedBuild, config.recommendedBuild)
|
||||||
|
|
||||||
let requiresDoUpdate = buildNumber <= config.notSupportedBuild
|
let requiresNeedUpdate = buildNumber <= config.notSupportedBuild
|
||||||
if requiresDoUpdate, let info = config.forceUpdate {
|
if requiresNeedUpdate {
|
||||||
forceUpdateNotice = AppUpdateNotice(kind: .force, title: info.title, message: info.message, appStoreURL: appStoreURL)
|
needUpdateNotice = AppUpdateNotice(kind: .need, appStoreURL: appStoreURL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let requiresForcedUpdate = buildNumber < config.minSupportedBuild
|
let requiresForcedUpdate = buildNumber < config.minSupportedBuild
|
||||||
if requiresForcedUpdate, let info = config.forceUpdate {
|
if requiresForcedUpdate {
|
||||||
forceUpdateNotice = AppUpdateNotice(kind: .force, title: info.title, message: info.message, appStoreURL: appStoreURL)
|
forceUpdateNotice = AppUpdateNotice(kind: .force, appStoreURL: appStoreURL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let needsSoftUpdate = buildNumber < config.recommendedBuild
|
if buildNumber < config.recommendedBuild {
|
||||||
if needsSoftUpdate, let info = config.softUpdate {
|
softUpdateNotice = AppUpdateNotice(kind: .soft, appStoreURL: appStoreURL)
|
||||||
softUpdateNotice = AppUpdateNotice(kind: .soft, title: info.title, message: info.message, appStoreURL: appStoreURL)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,8 +155,6 @@ private struct RemoteBuildConfiguration: Decodable {
|
|||||||
case notSupportedBuild = "not_supported_build"
|
case notSupportedBuild = "not_supported_build"
|
||||||
case minSupportedBuild = "min_supported_build"
|
case minSupportedBuild = "min_supported_build"
|
||||||
case recommendedBuild = "recommended_build"
|
case recommendedBuild = "recommended_build"
|
||||||
case forceUpdate = "force_update"
|
|
||||||
case softUpdate = "soft_update"
|
|
||||||
case appStoreURL = "appstore_url"
|
case appStoreURL = "appstore_url"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,13 @@ struct yobbleApp: App {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
.overlay(alignment: .center) {
|
.overlay(alignment: .center) {
|
||||||
if let notice = updateChecker.forceUpdateNotice {
|
if let notice = updateChecker.needUpdateNotice {
|
||||||
|
ForceUpdateView(
|
||||||
|
title: notice.title,
|
||||||
|
message: notice.message,
|
||||||
|
onUpdate: { updateChecker.openAppStore() }
|
||||||
|
)
|
||||||
|
} else if let notice = updateChecker.forceUpdateNotice {
|
||||||
ForceUpdateView(
|
ForceUpdateView(
|
||||||
title: notice.title,
|
title: notice.title,
|
||||||
message: notice.message,
|
message: notice.message,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user