Skip to content

Commit 28fc0dd

Browse files
committed
add restore mechanism to screencontroller
1 parent f1c1821 commit 28fc0dd

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

ApphudSDK.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'ApphudSDK'
3-
s.version = '0.6.2'
3+
s.version = '0.6.3'
44
s.summary = 'Track and control iOS auto-renewable subscriptions.'
55

66
s.description = 'Track, control and analyze iOS auto-renewable subscriptions with Apphud.'

Source/ApphudInternal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import AdSupport
1111
import StoreKit
1212

13-
let sdk_version = "0.6.2"
13+
let sdk_version = "0.6.3"
1414

1515
final class ApphudInternal {
1616

Source/ApphudScreenController.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,16 @@ class ApphudScreenController: UIViewController{
318318
(self.navigationController ?? self).dismiss(animated: true, completion: nil)
319319
}
320320

321+
private func restoreTapped(){
322+
self.loadingIndicator.startAnimating()
323+
Apphud.restoreSubscriptions { subscriptions in
324+
self.loadingIndicator.stopAnimating()
325+
if subscriptions?.first?.isActive() ?? false {
326+
self.dismiss()
327+
}
328+
}
329+
}
330+
321331
private func openURL(url: URL?){
322332
guard let url = url else {
323333
return
@@ -356,6 +366,9 @@ extension ApphudScreenController : WKNavigationDelegate {
356366
case "link":
357367
self.openURL(url: navigationAction.request.url)
358368
return false
369+
case "restore":
370+
self.restoreTapped()
371+
return false
359372
default:
360373
break
361374
}

apphud/AppDelegate.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
1818

1919
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
2020

21-
let APPHUD_API_KEY = "YOUR_API_KEY"
21+
Apphud.enableDebugLogs()
22+
let APPHUD_API_KEY = "app_kAJSnePQqvAAXuHHJMpH1D7u3jeD34"
23+
ApphudHttpClient.shared.domain_url_string = "https://api.bitcolio.com"
24+
2225
Apphud.start(apiKey: APPHUD_API_KEY)
2326

2427
registerForNotifications()

0 commit comments

Comments
 (0)