Skip to content

Commit

Permalink
Outdated protection. (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
yspreen authored May 16, 2021
1 parent 08357c2 commit b7bad2d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 81 deletions.
3 changes: 0 additions & 3 deletions DGCAWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
CEA6D6F8261F8D2900715333 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = CEA6D6F6261F8D2900715333 /* LaunchScreen.storyboard */; };
CEA6D703261F8D2900715333 /* DGCAWalletTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA6D702261F8D2900715333 /* DGCAWalletTests.swift */; };
CEA6D70E261F8D2900715333 /* DGCAWalletUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA6D70D261F8D2900715333 /* DGCAWalletUITests.swift */; };
CEA6E561264058B50066DC8E /* UIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA6E560264058B50066DC8E /* UIViewController.swift */; };
CEC7FEDF264C5A41005561BA /* context.jsonc in Resources */ = {isa = PBXBuildFile; fileRef = CEC7FEDE264C5A41005561BA /* context.jsonc */; };
CED2726026398683003D47A9 /* UIFont.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED2725F26398683003D47A9 /* UIFont.swift */; };
CED949CA263B50CE00883558 /* List.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED949C9263B50CE00883558 /* List.swift */; };
Expand Down Expand Up @@ -164,7 +163,6 @@
children = (
CED2725F26398683003D47A9 /* UIFont.swift */,
CE8096D8263B07BB00A65AD6 /* UIColor.swift */,
CEA6E560264058B50066DC8E /* UIViewController.swift */,
);
path = Extensions;
sourceTree = "<group>";
Expand Down Expand Up @@ -472,7 +470,6 @@
CE56BC07264068110044FD3F /* GatewayConnection.swift in Sources */,
CEA6D6F0261F8D2700715333 /* Scan.swift in Sources */,
CE13CF23262DDF810070C80E /* RoundedButton.swift in Sources */,
CEA6E561264058B50066DC8E /* UIViewController.swift in Sources */,
CEA6D6EC261F8D2700715333 /* AppDelegate.swift in Sources */,
CE891305263581D900CB92AF /* Home.swift in Sources */,
CEA15563262F6DAB0024B7AC /* CertViewerDelegate.swift in Sources */,
Expand Down
78 changes: 0 additions & 78 deletions DGCAWallet/Extensions/UIViewController.swift

This file was deleted.

6 changes: 6 additions & 0 deletions DGCAWallet/Services/GatewayConnection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import Foundation
import Alamofire
import SwiftDGC
import SwiftyJSON
import UIKit

struct GatewayConnection: ContextConnection {
public static func claim(cert: HCert, with tan: String?, completion: ((Bool, String?) -> Void)?) {
Expand Down Expand Up @@ -95,6 +96,11 @@ struct GatewayConnection: ContextConnection {
let json = JSON(parseJSONC: string)
LocalData.sharedInstance.config.merge(other: json)
LocalData.sharedInstance.save()
if LocalData.sharedInstance.versionedConfig["outdated"].bool == true {
(
UIApplication.shared.windows[0].rootViewController as? UINavigationController
)?.popToRootViewController(animated: false)
}
}
}
static var config: JSON {
Expand Down
4 changes: 4 additions & 0 deletions DGCAWallet/ViewControllers/Home.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ class HomeVC: UIViewController {
}

func checkId() {
if LocalData.sharedInstance.versionedConfig["outdated"].bool == true {
showAlert(title: l10n("info.outdated"), subtitle: l10n("info.outdated.body"))
return
}
SecureBackground.checkId { [weak self] in
if $0 {
self?.performSegue(withIdentifier: "list", sender: self)
Expand Down

0 comments on commit b7bad2d

Please sign in to comment.