Skip to content

Commit f8b7360

Browse files
Show donation in onboarding flow
1 parent c81e2d1 commit f8b7360

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

ChatSecureCore/Classes/View Controllers/OTRInviteViewController.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,13 @@ - (void)setShareButtons:(NSArray<BButton *> *)shareButtons
196196

197197
- (void)skipPressed:(id)sender
198198
{
199-
[self dismissViewControllerAnimated:YES completion:nil];
199+
if (OTRBranding.allowsDonation) {
200+
PurchaseViewController *purchaseVC = [PurchaseViewController fromBundle];
201+
[self.navigationController setNavigationBarHidden:YES animated:YES];
202+
[self.navigationController pushViewController:purchaseVC animated:YES];
203+
} else {
204+
[self dismissViewControllerAnimated:YES completion:nil];
205+
}
200206
}
201207

202208
- (void)shareSMSPressed:(id)sender

ChatSecureCore/Classes/View Controllers/OTRLogListViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import LumberjackConsole
3838
#if DEBUG
3939
debugPrint("Enabling os_log logger...")
4040
DDLog.add(DDOSLogger.sharedInstance)
41-
DDLogVerbose("os_log logger enabled.")
41+
debugPrint("os_log logger enabled.")
4242
#endif
4343

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

5454
let consoleLogger = PTEConsoleLogger()
5555
DDLog.add(consoleLogger)
5656
self.consoleLogger = consoleLogger
57-
DDLogVerbose("Console logger enabled.")
57+
debugPrint("Console logger enabled.")
5858
} else {
5959
self.fileLogger = nil
6060
self.consoleLogger = nil
@@ -86,7 +86,7 @@ import LumberjackConsole
8686
do {
8787
try FileManager.default.removeItem(atPath: logsDirectory)
8888
} catch {
89-
DDLogError("Error deleting log files! \(error)")
89+
debugPrint("Error deleting log files! \(error)")
9090
}
9191
}
9292
setupLogging()

ChatSecureCore/Classes/View Controllers/Previews/OTRInviteViewController_Previews.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@
1010
import SwiftUI
1111

1212
/// Unfortunately Xcode cannot seem to create Previews with our current build configuration
13+
/// seems related to using `MACH_O_TYPE=staticlib` for our frameworks
14+
/// https://twitter.com/_andersha/status/1405925636565262341
1315
@available(iOS 13.0, *)
1416
struct OTRInviteViewController_Previews: PreviewProvider {
1517
static var previews: some View {
1618
Group {
1719
UIViewControllerPreview {
18-
OTRInviteViewController(account: OTRAccount(username: "[email protected]", accountType: .jabber)!)
20+
OTRInviteViewController(account: OTRXMPPAccount(username: "[email protected]", accountType: .jabber)!)
1921
}
20-
.previewDevice("iPhone 11 Pro Max")
22+
.previewDevice("iPhone 12 Pro Max")
2123
.previewLayout(.sizeThatFits)
2224
}
2325
}

ChatSecureCore/Classes/View Controllers/PurchaseViewController.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,17 @@ import OTRAssets
1414
import Kvitto
1515

1616
extension PurchaseViewController {
17-
@objc public class func show(from viewController: UIViewController) {
17+
@objc public class func fromBundle() -> Self {
1818
let assets = OTRAssets.resourcesBundle
1919
let storyboard = UIStoryboard(name: "Purchase", bundle: assets)
20-
guard let vc = storyboard.instantiateInitialViewController() else { return }
20+
guard let vc = storyboard.instantiateInitialViewController() as? Self else {
21+
fatalError("Could not create PurchaseViewController from storyboard!")
22+
}
23+
return vc
24+
}
25+
26+
@objc public class func show(from viewController: UIViewController) {
27+
let vc = fromBundle()
2128
vc.modalPresentationStyle = .formSheet
2229
let nav = UINavigationController(rootViewController: vc)
2330
nav.isNavigationBarHidden = true
@@ -36,6 +43,7 @@ extension Bundle {
3643
}
3744
}
3845

46+
@objc
3947
public class PurchaseViewController: UIViewController {
4048
@IBOutlet weak var bigMoneyButton: UIButton!
4149
@IBOutlet weak var smallMoneyButton: UIButton!

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ However, developing and supporting this project is hard work and costs real mone
2121

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

2725
## Localization
2826

0 commit comments

Comments
 (0)