Skip to content

Commit

Permalink
Merge pull request #105 from WezSieTato/feature/pola-button
Browse files Browse the repository at this point in the history
Guzik Pola przekierowywuje do about zamiast friends
  • Loading branch information
WezSieTato authored Aug 26, 2020
2 parents 424db07 + eebfa1e commit 95c0ad5
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 4 deletions.
1 change: 1 addition & 0 deletions BuyPolish/Pola/Manager/Analytics/AnalyticsEventName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ enum AnalyticsEventName: String {
case reportFinished = "report_finished"
case menuItemOpened = "menu_item_opened"
case donateOpened = "donate_opened"
case aboutPola = "about_pola"
case polasFriends = "polas_friends"
}
5 changes: 5 additions & 0 deletions BuyPolish/Pola/Manager/Analytics/AnalyticsHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ final class AnalyticsHelper {
parameters: AnalitycsPolasFriendsParameters(device_id: UIDevice.current.deviceId))
}

class func aboutPolaOpened() {
logEvent(name: .aboutPola,
parameters: AnalitycsPolasFriendsParameters(device_id: UIDevice.current.deviceId))
}

private class func reportParameters(barcode: String?) -> AnalyticsReportParameters {
return AnalyticsReportParameters(code: barcode ?? "No Code",
device_id: UIDevice.current.deviceId)
Expand Down
2 changes: 2 additions & 0 deletions BuyPolish/Pola/SupportingFiles/pl.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"created rich salary work places" = "prowadzi badania i rozwój w Polsce";
"producing in PL" = "produkuje w Polsce";
"This is Pola's friend" = "To jest przyjaciel Poli";
"look at Pola's friends" = "ZOBACZ PRZYJACIÓŁ POLI";
"Loading..." = "Pobieranie danych...";
"Sending..." = "Wysyłanie...";
"Report sent" = "Raport wysłany";
Expand Down Expand Up @@ -67,6 +68,7 @@
"Accessibility.Close" = "Zamknij";
"Accessibility.CardHint" = "Otwórz lub zamknij poprzez kliknięcie";
"Accessibility.Report.AddPhoto" = "Dodaj zdjęcie";
"Accessibility.Logo" = "Strona główna";
"CaptureVideo.Timer.Seconds" = "sek.";
"CaptureVideo.Start" = "START";
"CaptureVideo.Sending" = "Wysyłanie zdjęć";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ final class ScanResultView: UIView {
}
}

let polasFriendsButton = UIButton(type: .custom)
let reportProblemButton = UIButton(type: .custom)
let reportInfoLabel = UILabel()
let separatorView = UIView()
Expand Down Expand Up @@ -52,6 +53,17 @@ final class ScanResultView: UIView {
mainProgressView.sizeToFit()
addSubview(mainProgressView)

polasFriendsButton.setTitle(R.string.localizable.lookAtPolaSFriends(), for: .normal)
polasFriendsButton.titleLabel?.font = Theme.buttonFont
polasFriendsButton.layer.borderColor = Theme.actionColor.cgColor
polasFriendsButton.layer.borderWidth = 1
polasFriendsButton.setTitleColor(Theme.actionColor, for: .normal)
polasFriendsButton.setTitleColor(Theme.clearColor, for: .highlighted)
polasFriendsButton.setBackgroundImage(UIImage.image(color: UIColor.clear), for: .normal)
polasFriendsButton.setBackgroundImage(UIImage.image(color: Theme.actionColor), for: .highlighted)
polasFriendsButton.sizeToFit()
addSubview(polasFriendsButton)

reportProblemButton.titleLabel?.font = Theme.buttonFont
reportProblemButton.sizeToFit()
addSubview(reportProblemButton)
Expand Down Expand Up @@ -125,11 +137,20 @@ final class ScanResultView: UIView {
rect.origin.y = reportProblemButton.frame.minY - verticalPadding - rect.height
reportInfoLabel.frame = rect

if !polasFriendsButton.isHidden {
rect = polasFriendsButton.frame
rect.size = CGSize(width: widthWithPadding, height: buttonHeight)
rect.origin.x = horizontalPadding
rect.origin.y = reportInfoLabel.frame.minY - verticalPadding - rect.height
polasFriendsButton.frame = rect
}

rect = separatorView.frame
rect.size.width = bounds.width
rect.size.height = 1
rect.origin.x = 0
rect.origin.y = reportInfoLabel.frame.minY - 15 - rect.height
let viewUnderSeparator = polasFriendsButton.isHidden ? reportInfoLabel : polasFriendsButton
rect.origin.y = viewUnderSeparator.frame.minY - 15 - rect.height
separatorView.frame = rect

rect = scrollViewForContentView.frame
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ final class ScanResultViewController: UIViewController {
super.viewDidLoad()

castedView.reportProblemButton.addTarget(self, action: #selector(reportProblemTapped), for: .touchUpInside)
castedView.polasFriendsButton.addTarget(self, action: #selector(polasFriendsButtonTapped), for: .touchUpInside)

downloadScanResult()
}
Expand Down Expand Up @@ -115,6 +116,16 @@ final class ScanResultViewController: UIViewController {
argument: ReportProblemReason.product(productId, barcode))!
present(vc, animated: true, completion: nil)
}

@objc
func polasFriendsButtonTapped() {
AnalyticsHelper.polasFriendsOpened()
let vc = AboutWebViewController(url: "https://www.pola-app.pl/m/friends",
title: R.string.localizable.polaSFriends())
vc.addCloseButton()
let nvc = UINavigationController(rootViewController: vc)
present(nvc, animated: true, completion: nil)
}
}

extension ScanResultViewController: CardStackViewControllerCard {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class ScanCodeView: UIView {

addSubview(dimView)

logoButton.accessibilityLabel = R.string.localizable.accessibilityPolaFriends()
logoButton.accessibilityLabel = R.string.localizable.accessibilityLogo()
logoButton.setImage(R.image.logoIcon(), for: .normal)
logoButton.sizeToFit()
addSubview(logoButton)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ final class ScanCodeViewController: UIViewController {

@objc
func tapLogoButton() {
AnalyticsHelper.polasFriendsOpened()
let vc = AboutWebViewController(url: "https://www.pola-app.pl/m/friends",
AnalyticsHelper.aboutPolaOpened()
let vc = AboutWebViewController(url: "https://www.pola-app.pl/m/about",
title: R.string.localizable.polaSFriends())
vc.addCloseButton()
let nvc = UINavigationController(rootViewController: vc)
Expand Down
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.

0 comments on commit 95c0ad5

Please sign in to comment.