Skip to content

Commit ee53a19

Browse files
author
Николай Капустин
committed
update master to 2.0.1
1 parent 5c57486 commit ee53a19

5 files changed

Lines changed: 35 additions & 12 deletions

File tree

GPBonusSDK.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Pod::Spec.new do |spec|
22
spec.name = "GPBonusSDK"
3-
spec.version = ENV['LIB_VERSION'] || "2.0.0"
3+
spec.version = ENV['LIB_VERSION'] || "2.0.1"
44
spec.summary = "GazpromBonus widget integration lib"
55
spec.homepage = "https://github.com/SetPartnerstv/ios-sdk"
66
spec.license = { :type => "MIT", :file => "LICENSE" }
77
spec.author = "SetPartnerstv"
8-
spec.platform = :ios, "11.0"
8+
spec.platform = :ios, "12.0"
99
spec.source = { :git => "https://github.com/SetPartnerstv/ios-sdk.git", :tag => "#{spec.version}" }
1010
spec.source_files = "sdk/**/*.{swift,h,m}"
1111
spec.requires_arc = true

sdk/SDKViewController.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ open class SDKViewController: UIViewController, WKScriptMessageHandler, PaymentH
7878
if (window.PNWidget.onready) {
7979
window.PNWidget.onready();
8080
}
81+
82+
window.addEventListener('webViewClose', (e) => {
83+
window.webkit.messageHandlers.PNWidget.postMessage('webViewClose');
84+
});
8185
})()
8286
""",
8387
injectionTime: WKUserScriptInjectionTime.atDocumentStart,
@@ -149,6 +153,10 @@ open class SDKViewController: UIViewController, WKScriptMessageHandler, PaymentH
149153
decisionHandler(.allow, pref)
150154
}
151155

156+
public func webViewWebContentProcessDidTerminate(webView: WKWebView){
157+
webView.reload();
158+
}
159+
152160
public func webView(_ webView: WKWebView,
153161
decidePolicyFor navigationResponse: WKNavigationResponse,
154162
decisionHandler: @escaping (WKNavigationResponsePolicy) -> Void) {
@@ -198,6 +206,13 @@ open class SDKViewController: UIViewController, WKScriptMessageHandler, PaymentH
198206
return;
199207
}
200208

209+
if (message.body as! String == "webViewClose") {
210+
if let delegate = self.sdkViewDelegate {
211+
delegate.sdkViewDismiss(error: nil)
212+
}
213+
return;
214+
}
215+
201216
var options = JSONDecodingOptions()
202217
options.ignoreUnknownFields = true
203218

sdk_demo/GazpromBonusSDK.xcodeproj/project.pbxproj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@
363363
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
364364
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
365365
CODE_SIGN_STYLE = Automatic;
366-
CURRENT_PROJECT_VERSION = 1;
366+
CURRENT_PROJECT_VERSION = 2;
367367
DEVELOPMENT_TEAM = 3V7NW97R8C;
368368
FRAMEWORK_SEARCH_PATHS = (
369369
"$(inherited)",
@@ -374,6 +374,7 @@
374374
);
375375
GENERATE_INFOPLIST_FILE = YES;
376376
INFOPLIST_FILE = GazpromBonusSDK/Info.plist;
377+
INFOPLIST_KEY_CFBundleDisplayName = "GPBonusSDK Demo";
377378
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
378379
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
379380
INFOPLIST_KEY_UIMainStoryboardFile = Main;
@@ -384,8 +385,8 @@
384385
"$(inherited)",
385386
"@executable_path/Frameworks",
386387
);
387-
MARKETING_VERSION = 1.0;
388-
PRODUCT_BUNDLE_IDENTIFIER = "ru.gpbonus.sdk-test";
388+
MARKETING_VERSION = 2.0.1;
389+
PRODUCT_BUNDLE_IDENTIFIER = ru.pnhub.partnerapplication;
389390
PRODUCT_NAME = "$(TARGET_NAME)";
390391
SWIFT_EMIT_LOC_STRINGS = YES;
391392
SWIFT_VERSION = 5.0;
@@ -400,7 +401,7 @@
400401
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
401402
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
402403
CODE_SIGN_STYLE = Automatic;
403-
CURRENT_PROJECT_VERSION = 1;
404+
CURRENT_PROJECT_VERSION = 2;
404405
DEVELOPMENT_TEAM = 3V7NW97R8C;
405406
FRAMEWORK_SEARCH_PATHS = (
406407
"$(inherited)",
@@ -411,6 +412,7 @@
411412
);
412413
GENERATE_INFOPLIST_FILE = YES;
413414
INFOPLIST_FILE = GazpromBonusSDK/Info.plist;
415+
INFOPLIST_KEY_CFBundleDisplayName = "GPBonusSDK Demo";
414416
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
415417
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
416418
INFOPLIST_KEY_UIMainStoryboardFile = Main;
@@ -421,8 +423,8 @@
421423
"$(inherited)",
422424
"@executable_path/Frameworks",
423425
);
424-
MARKETING_VERSION = 1.0;
425-
PRODUCT_BUNDLE_IDENTIFIER = "ru.gpbonus.sdk-test";
426+
MARKETING_VERSION = 2.0.1;
427+
PRODUCT_BUNDLE_IDENTIFIER = ru.pnhub.partnerapplication;
426428
PRODUCT_NAME = "$(TARGET_NAME)";
427429
SWIFT_EMIT_LOC_STRINGS = YES;
428430
SWIFT_VERSION = 5.0;

sdk_demo/GazpromBonusSDK/ViewController.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
//
77

88
import UIKit
9+
import GPBonusSDK
910

10-
class ViewController: UIViewController {
11+
class ViewController: UIViewController, SDKViewDelegate {
1112

1213
override func viewDidLoad() {
1314
super.viewDidLoad()
@@ -26,8 +27,13 @@ class ViewController: UIViewController {
2627
//TODO: place your token here
2728
//sdkView.token = "YOUR_TOKEN"
2829
sdkView.baseUrl = "https://widget.gazprombonus.ru"
30+
sdkView.sdkViewDelegate = self
2931

3032
navigationController?.pushViewController(sdkView, animated: true)
3133
}
34+
35+
func sdkViewDismiss(error: Error?) {
36+
navigationController?.popToRootViewController(animated: true)
37+
}
3238
}
3339

sdk_demo/Podfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PODS:
2-
- GPBonusSDK (2.0.0):
2+
- GPBonusSDK (2.0.1):
33
- SwiftProtobuf (~> 1.14.0)
44
- SwiftProtobuf (1.14.0)
55

@@ -15,9 +15,9 @@ EXTERNAL SOURCES:
1515
:path: "../"
1616

1717
SPEC CHECKSUMS:
18-
GPBonusSDK: 08cdb05b41d7d66a671f6bf872f115bb3cf37bb7
18+
GPBonusSDK: 056e491789c5c965a834cbd460c47205b7d5d7bd
1919
SwiftProtobuf: ed465ed18402f998fd117f631da27e0168e6b59c
2020

21-
PODFILE CHECKSUM: 872a5e1ccdd89d925717b81524605f01e0c23e29
21+
PODFILE CHECKSUM: 3c73ac9aac1f862646b280aa7f07de7eace745dc
2222

2323
COCOAPODS: 1.12.1

0 commit comments

Comments
 (0)