Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions iOS_SDK/OneSignalSDK/OneSignal.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
1AF75EAF1E8569710097B315 /* NSString+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AF75EAD1E8567FD0097B315 /* NSString+OneSignal.m */; };
1AF75EB01E8569720097B315 /* NSString+OneSignal.m in Sources */ = {isa = PBXBuildFile; fileRef = 1AF75EAD1E8567FD0097B315 /* NSString+OneSignal.m */; };
1AF75EB11E8569F60097B315 /* NSString+OneSignal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF75EAC1E8567FD0097B315 /* NSString+OneSignal.h */; };
1F047020231A4D29002725D4 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F04701F231A4D29002725D4 /* WebKit.framework */; };
1F047021231A4D34002725D4 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F04701F231A4D29002725D4 /* WebKit.framework */; };
1F047022231A4D3E002725D4 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F04701F231A4D29002725D4 /* WebKit.framework */; };
37E6B2BB19D9CAF300D0C601 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 37E6B2BA19D9CAF300D0C601 /* UIKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
3E464ED71D88ED1F00DCF7E9 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 37E6B2BA19D9CAF300D0C601 /* UIKit.framework */; };
3E66F5821D90A2C600E45A01 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E08E2701D49A5C8002176DE /* SystemConfiguration.framework */; };
Expand Down Expand Up @@ -221,6 +224,7 @@
03389F681FB548A0006537F0 /* OneSignalTrackFirebaseAnalyticsOverrider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OneSignalTrackFirebaseAnalyticsOverrider.m; sourceTree = "<group>"; };
1AF75EAC1E8567FD0097B315 /* NSString+OneSignal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+OneSignal.h"; sourceTree = "<group>"; };
1AF75EAD1E8567FD0097B315 /* NSString+OneSignal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+OneSignal.m"; sourceTree = "<group>"; };
1F04701F231A4D29002725D4 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
37747F9319147D6500558FAD /* libOneSignal.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libOneSignal.a; sourceTree = BUILT_PRODUCTS_DIR; };
37E6B2BA19D9CAF300D0C601 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
3E08E2701D49A5C8002176DE /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -351,6 +355,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1F047022231A4D3E002725D4 /* WebKit.framework in Frameworks */,
37E6B2BB19D9CAF300D0C601 /* UIKit.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -359,6 +364,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1F047021231A4D34002725D4 /* WebKit.framework in Frameworks */,
3E66F5821D90A2C600E45A01 /* SystemConfiguration.framework in Frameworks */,
3E464ED71D88ED1F00DCF7E9 /* UIKit.framework in Frameworks */,
91719A9C1E80839500DBE43C /* UserNotifications.framework in Frameworks */,
Expand All @@ -369,6 +375,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1F047020231A4D29002725D4 /* WebKit.framework in Frameworks */,
911E2CC81E399834003112A4 /* UserNotifications.framework in Frameworks */,
911E2CC61E398B97003112A4 /* UIKit.framework in Frameworks */,
911E2CC51E398B53003112A4 /* SystemConfiguration.framework in Frameworks */,
Expand Down Expand Up @@ -403,6 +410,7 @@
37747F9519147D6500558FAD /* Frameworks */ = {
isa = PBXGroup;
children = (
1F04701F231A4D29002725D4 /* WebKit.framework */,
911E2CC71E399834003112A4 /* UserNotifications.framework */,
3E464ED91D88EE6A00DCF7E9 /* Foundation.framework */,
3E08E2701D49A5C8002176DE /* SystemConfiguration.framework */,
Expand Down
2 changes: 1 addition & 1 deletion iOS_SDK/OneSignalSDK/Source/OneSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ typedef NS_ENUM(NSUInteger, OSNotificationDisplayType) {
@property(readonly)NSString* subtitle;
@property(readonly)NSString* body;

/* Web address to launch within the app via a UIWebView */
/* Web address to launch within the app via a WKWebView */
@property(readonly)NSString* launchURL;

/* Additional key value properties set within the payload */
Expand Down
5 changes: 3 additions & 2 deletions iOS_SDK/OneSignalSDK/Source/OneSignalWebView.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
*/

#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>

@interface OneSignalWebView : UIViewController <UIWebViewDelegate>
@interface OneSignalWebView : UIViewController <WKNavigationDelegate>

@property(nonatomic, copy)NSURL *url;
@property(nonatomic)UIWebView *webView;
@property(nonatomic)WKWebView *webView;
@property(nonatomic)UIActivityIndicatorView *uiBusy;

-(void)dismiss:(id)sender;
Expand Down
18 changes: 10 additions & 8 deletions iOS_SDK/OneSignalSDK/Source/OneSignalWebView.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ @implementation OneSignalWebView
-(void)viewDidLoad {
[super viewDidLoad];

_webView = [UIWebView new];
_webView.delegate = self;
_webView = [WKWebView new];
_webView.navigationDelegate = self;
[self.view addSubview:_webView];

[self pinSubviewToMarginsWithSubview:_webView withSuperview:self.view];
Expand Down Expand Up @@ -73,17 +73,19 @@ -(void)dismiss:(id)sender {
}];
}

-(void)webViewDidStartLoad:(UIWebView *)webView {
-(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation {
[_uiBusy startAnimating];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView {
self.title = [_webView stringByEvaluatingJavaScriptFromString:@"document.title"];
self.navigationController.title = self.title;
[_uiBusy stopAnimating];
-(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation {
[_webView evaluateJavaScript:@"document.title" completionHandler:^(id _Nullable result, NSError * _Nullable error) {
self.title = result;
self.navigationController.title = self.title;
[_uiBusy stopAnimating];
}];
}

-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
-(void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error {
[OneSignal onesignal_Log:ONE_S_LL_ERROR message:error.localizedDescription];
}

Expand Down