Skip to content

Commit

Permalink
Show donation in onboarding flow
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Aug 7, 2021
1 parent c81e2d1 commit f8b7360
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,13 @@ - (void)setShareButtons:(NSArray<BButton *> *)shareButtons

- (void)skipPressed:(id)sender
{
[self dismissViewControllerAnimated:YES completion:nil];
if (OTRBranding.allowsDonation) {
PurchaseViewController *purchaseVC = [PurchaseViewController fromBundle];
[self.navigationController setNavigationBarHidden:YES animated:YES];
[self.navigationController pushViewController:purchaseVC animated:YES];
} else {
[self dismissViewControllerAnimated:YES completion:nil];
}
}

- (void)shareSMSPressed:(id)sender
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import LumberjackConsole
#if DEBUG
debugPrint("Enabling os_log logger...")
DDLog.add(DDOSLogger.sharedInstance)
DDLogVerbose("os_log logger enabled.")
debugPrint("os_log logger enabled.")
#endif

// allow file-based debug logging if user has enabled it
Expand All @@ -49,12 +49,12 @@ import LumberjackConsole
fileLogger.doNotReuseLogFiles = true
DDLog.add(fileLogger)
self.fileLogger = fileLogger
DDLogVerbose("File logger enabled.")
debugPrint("File logger enabled.")

let consoleLogger = PTEConsoleLogger()
DDLog.add(consoleLogger)
self.consoleLogger = consoleLogger
DDLogVerbose("Console logger enabled.")
debugPrint("Console logger enabled.")
} else {
self.fileLogger = nil
self.consoleLogger = nil
Expand Down Expand Up @@ -86,7 +86,7 @@ import LumberjackConsole
do {
try FileManager.default.removeItem(atPath: logsDirectory)
} catch {
DDLogError("Error deleting log files! \(error)")
debugPrint("Error deleting log files! \(error)")
}
}
setupLogging()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
import SwiftUI

/// Unfortunately Xcode cannot seem to create Previews with our current build configuration
/// seems related to using `MACH_O_TYPE=staticlib` for our frameworks
/// https://twitter.com/_andersha/status/1405925636565262341
@available(iOS 13.0, *)
struct OTRInviteViewController_Previews: PreviewProvider {
static var previews: some View {
Group {
UIViewControllerPreview {
OTRInviteViewController(account: OTRAccount(username: "[email protected]", accountType: .jabber)!)
OTRInviteViewController(account: OTRXMPPAccount(username: "[email protected]", accountType: .jabber)!)
}
.previewDevice("iPhone 11 Pro Max")
.previewDevice("iPhone 12 Pro Max")
.previewLayout(.sizeThatFits)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,17 @@ import OTRAssets
import Kvitto

extension PurchaseViewController {
@objc public class func show(from viewController: UIViewController) {
@objc public class func fromBundle() -> Self {
let assets = OTRAssets.resourcesBundle
let storyboard = UIStoryboard(name: "Purchase", bundle: assets)
guard let vc = storyboard.instantiateInitialViewController() else { return }
guard let vc = storyboard.instantiateInitialViewController() as? Self else {
fatalError("Could not create PurchaseViewController from storyboard!")
}
return vc
}

@objc public class func show(from viewController: UIViewController) {
let vc = fromBundle()
vc.modalPresentationStyle = .formSheet
let nav = UINavigationController(rootViewController: vc)
nav.isNavigationBarHidden = true
Expand All @@ -36,6 +43,7 @@ extension Bundle {
}
}

@objc
public class PurchaseViewController: UIViewController {
@IBOutlet weak var bigMoneyButton: UIButton!
@IBOutlet weak var smallMoneyButton: UIButton!
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ However, developing and supporting this project is hard work and costs real mone

* [GitHub Sponsors](https://github.com/sponsors/chrisballinger)
* [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=F9SM36SQY5EN8)
* [Bitcoin](bitcoin:bc1qrpswdcrga6w74sm08wy9mult6jp7zt5vjtx0zx?message=ChatSecure%20Donations) `bc1qrpswdcrga6w74sm08wy9mult6jp7zt5vjtx0zx`


## Localization

Expand Down

0 comments on commit f8b7360

Please sign in to comment.