Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the certificate with the new PDF + new AppIcon #15

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AttestationCovid.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = H3J4BA637A;
INFOPLIST_FILE = AttestationCovid/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand All @@ -526,7 +526,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = H3J4BA637A;
INFOPLIST_FILE = AttestationCovid/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
Expand Down
120 changes: 60 additions & 60 deletions AttestationCovid/Assets.xcassets/AppIcon.appiconset/Contents.json
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,122 +1,122 @@
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "1x"
"idiom" : "iphone",
"scale" : "1x",
"size" : "29x29"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "[email protected]",
"scale" : "3x"
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "20x20"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "20x20"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "29x29"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "29x29"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "40x40"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "40x40"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "1x"
"idiom" : "ipad",
"scale" : "1x",
"size" : "76x76"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "76x76"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "[email protected]",
"scale" : "2x"
"idiom" : "ipad",
"scale" : "2x",
"size" : "83.5x83.5"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "[email protected]",
"scale" : "1x"
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions AttestationCovid/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "LaunchScreen.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 21 additions & 19 deletions AttestationCovid/Certificate/CertificateDocumentBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,43 +28,45 @@ struct CertificateDocumentBuilder {
let mainPage = document.page(at: 0)
let pageWidth = mainPage?.bounds(for: .mediaBox).width ?? 600

mainPage?.addAnnotation(makeTextAnnotation(text: attestation.displayName, x: 123, y: 686, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.birthdate, x: 123, y: 661, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.birthplace, x: 92, y: 638, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.fullAddress, x: 134, y: 613, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.displayName, x: 115, y: 698, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.birthdate, x: 115, y: 675, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.birthplace, x: 295, y: 675, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.fullAddress, x: 130, y: 653, width: .fittingPage(pageWidth)))

if attestation.motives.contains(.pro) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 74, y: 527))
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 577))
}
if attestation.motives.contains(.shop) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 74, y: 478))
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 532))
}
if attestation.motives.contains(.health) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 74, y: 436))
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 477))
}
if attestation.motives.contains(.family) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 74, y: 400))
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 435))
}
if attestation.motives.contains(.disabledPeopleTransport) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 395))
}
if attestation.motives.contains(.brief) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 74, y: 345))
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 355))
}
if attestation.motives.contains(.administrative) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 74, y: 298))
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 295))
}
if attestation.motives.contains(.tig) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 74, y: 260))
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 254))
}
if attestation.motives.contains(.school) {
mainPage?.addAnnotation(makeCheckmarkAnnotation(x: 80, y: 210))
}

mainPage?.addAnnotation(makeTextAnnotation(text: attestation.city, x: 111, y: 226, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.formattedDate, x: 92, y: 200, width: .width(80)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.formattedHour, x: 198, y: 201, width: .width(20)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.formattedMinute, x: 218, y: 201, width: .width(20)))

let qrImage = try CertificateQRCodeBuilder.build(from: attestation, creationDate: creationDate)
mainPage?.addAnnotation(makeImageAnnotation(image: qrImage, x: pageWidth - 170, y: 157, width: 100, height: 100))
makeCreationDateAnnotations(creationDate: creationDate).forEach { mainPage?.addAnnotation($0) }
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.city, x: 106, y: 175, width: .fittingPage(pageWidth)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.formattedDate, x: 92, y: 153, width: .width(80)))
mainPage?.addAnnotation(makeTextAnnotation(text: attestation.formattedTime, x: 255, y: 153, width: .width(80)))

let qrPage = PDFPage()
let qrImage = try CertificateQRCodeBuilder.build(from: attestation, creationDate: creationDate)
let qrPageHeight = qrPage.bounds(for: .mediaBox).height
qrPage.addAnnotation(makeImageAnnotation(image: qrImage, x: 50, y: qrPageHeight - 350, width: 300, height: 300))
document.insert(qrPage, at: 1)
Expand Down
20 changes: 20 additions & 0 deletions AttestationCovid/Form/FormViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,16 @@ final class FormViewController: UITableViewController {
}
}
return cell
case (.motives, FormSection.MotivesContent.disabledPeopleTransport.rawValue):
let cell = self.checkCell(tableView, indexPath: indexPath)
cell.configure(content: NSLocalizedString("motive.disabledPeopleTransport", comment: ""), selected: attestation.motives.contains(.disabledPeopleTransport)) { [weak self] value in
if value {
self?.attestation.motives.insert(.disabledPeopleTransport)
} else {
self?.attestation.motives.remove(.disabledPeopleTransport)
}
}
return cell
case (.motives, FormSection.MotivesContent.brief.rawValue):
let cell = self.checkCell(tableView, indexPath: indexPath)
cell.configure(content: NSLocalizedString("motive.brief", comment: ""), selected: attestation.motives.contains(.brief)) { [weak self] value in
Expand Down Expand Up @@ -180,6 +190,16 @@ final class FormViewController: UITableViewController {
}
}
return cell
case (.motives, FormSection.MotivesContent.school.rawValue):
let cell = self.checkCell(tableView, indexPath: indexPath)
cell.configure(content: NSLocalizedString("motive.school", comment: ""), selected: attestation.motives.contains(.school)) { [weak self] value in
if value {
self?.attestation.motives.insert(.school)
} else {
self?.attestation.motives.remove(.school)
}
}
return cell

// DATE section
case (.date, FormSection.DateContent.date.rawValue):
Expand Down
2 changes: 2 additions & 0 deletions AttestationCovid/Form/FormViewModels.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ enum FormSection: Int, CaseIterable {
case shop
case health
case family
case disabledPeopleTransport
case brief
case administrative
case tig
case school
}

enum DateContent: Int, CaseIterable {
Expand Down
14 changes: 11 additions & 3 deletions AttestationCovid/Models/Certificate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,23 @@ struct Certificate: Codable {
static let shop = Motive(rawValue: 1 << 1)
static let health = Motive(rawValue: 1 << 2)
static let family = Motive(rawValue: 1 << 3)
static let brief = Motive(rawValue: 1 << 4)
static let administrative = Motive(rawValue: 1 << 5)
static let tig = Motive(rawValue: 1 << 6)
static let disabledPeopleTransport = Motive(rawValue: 1 << 4)
static let brief = Motive(rawValue: 1 << 5)
static let administrative = Motive(rawValue: 1 << 6)
static let tig = Motive(rawValue: 1 << 7)
static let school = Motive(rawValue: 1 << 8)

var displayableValue: String {
var values: [String] = []
if contains(.pro) { values.append("travail") }
if contains(.shop) { values.append("courses") }
if contains(.health) { values.append("sante") }
if contains(.family) { values.append("famille") }
if contains(.disabledPeopleTransport) { values.append("déplacement des personnes en situtation de handicap") }
if contains(.brief) { values.append("sport") }
if contains(.administrative) { values.append("judiciaire") }
if contains(.tig) { values.append("missions") }
if contains(.school) { values.append("école") }

return values.joined(separator: "-")
}
Expand All @@ -68,6 +72,10 @@ struct Certificate: Codable {
var formattedDate: String {
return DateFormatter.date.string(from: date)
}

var formattedTime: String {
return DateFormatter.time.string(from: date)
}

var formattedHour: String {
return DateFormatter.hour.string(from: date)
Expand Down
Binary file modified AttestationCovid/certificate.pdf
Binary file not shown.
Loading