Skip to content

Commit

Permalink
Added iOS SDK 2.0.0 (objective-c)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsarfati committed Nov 8, 2018
1 parent f1689db commit b880199
Show file tree
Hide file tree
Showing 187 changed files with 5,496 additions and 7,869 deletions.
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ Carthage/

\.vscode/

Assets/Plugins/iOS/

Assets/Plugins/

Assets/Plugins\.meta

unity\.log

ICSharpCode\.SharpZipLib\.dll
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/Plugins/iOS/Zapic/Controllers.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Assets/Plugins/iOS/Zapic/Controllers/ZPCBannerManager.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#import <Foundation/Foundation.h>
#import "ZPCScriptMessageHandler.h"

@interface ZPCBannerManager : NSObject
@property (nonatomic) ZPCScriptMessageHandler *messageHandler;
@end
30 changes: 30 additions & 0 deletions Assets/Plugins/iOS/Zapic/Controllers/ZPCBannerManager.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 40 additions & 0 deletions Assets/Plugins/iOS/Zapic/Controllers/ZPCBannerManager.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#import "ZPCBannerManager.h"
#import "ZPCBanner.h"
#import "ZPCImageUtils.h"
#import "ZPCUtils.h"
#import "Zapic.h"

@implementation ZPCBannerManager

- (void)setMessageHandler:(ZPCScriptMessageHandler *)messageHandler {
[messageHandler addBannerHandler:^(ZPCBannerMessage *message) {
UIImage *icon = message.icon;

if (!icon) {
icon = [ZPCImageUtils getZapicLogo];
}

ZPCBanner *banner = [[ZPCBanner alloc] initWithTitle:message.title subtitle:message.subtitle image:icon];

if (message.data) {
banner.callback = ^{
[Zapic handleInteraction:message.data];
};
}

[banner show:3.0];
}];
}

+ (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)newSize {
//UIGraphicsBeginImageContext(newSize);
// In next line, pass 0.0 to use the current device's pixel scaling factor (and thus account for Retina resolution).
// Pass 1.0 to force exact pixel size.
UIGraphicsBeginImageContextWithOptions(newSize, NO, 0.0);
[image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}

@end
30 changes: 30 additions & 0 deletions Assets/Plugins/iOS/Zapic/Controllers/ZPCBannerManager.m.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Assets/Plugins/iOS/Zapic/Controllers/ZPCCore.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#import "ZPCBackgroundView.h"
#import "ZPCNotificationManager.h"
#import "ZPCPlayerManager.h"
#import "ZPCQueryManager.h"
#import "ZPCWebApp.h"

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSUInteger, ZPCEventType) {
ZPCEventTypeGameplay,
ZPCEventTypeInteraction,
};

@interface ZPCCore : UIViewController
@property (readonly) ZPCPlayerManager *playerManager;
@property (readonly) ZPCNotificationManager *notificationManager;
@property (readonly, strong) ZPCScriptMessageHandler *messageHandler;
@property (nonnull, readonly) ZPCQueryManager *queryManager;

- (void)start;
- (void)showPage:(NSString *)pageName;
- (void)showDefaultPage;
- (void)submitEvent:(ZPCEventType)eventType withPayload:(NSObject *)payload;
- (void)closePage;
@end
30 changes: 30 additions & 0 deletions Assets/Plugins/iOS/Zapic/Controllers/ZPCCore.h.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b880199

Please sign in to comment.