Skip to content

Commit

Permalink
Cleaned up some of the code and made it unity agnostic
Browse files Browse the repository at this point in the history
  • Loading branch information
treacher committed Nov 28, 2015
1 parent d8cc9b3 commit 5069b66
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 47 deletions.
Binary file modified Assets/ExampleScene.unity
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@interface FrispSocial : NSObject
+ (id) instance;
@interface FGSocial : NSObject
- (void) share:(NSString*)text media: (NSString*) media;
@end

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

34 changes: 34 additions & 0 deletions Assets/Plugins/iOS/FrispSocial/FGSocial.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#import "FGSocial.h"
#define IPAD UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad

@implementation FGSocial

- (void) share:(NSString *)text media:(NSString *) media {
UIActivityViewController *socialViewController;

// Create image from image data
NSData *imageData = [[NSData alloc] initWithBase64EncodedString:media options: 0];
UIImage *image = [[UIImage alloc] initWithData:imageData];

socialViewController = [[UIActivityViewController alloc] initWithActivityItems:@[text, image] applicationActivities:nil];

UIViewController *rootViewController = [[[[UIApplication sharedApplication]delegate] window] rootViewController];
if (IPAD) {
CGRect midScreen = CGRectMake(rootViewController.view.frame.size.width/2, rootViewController.view.frame.size.height/4, 0, 0);
UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:socialViewController];
[popup presentPopoverFromRect:midScreen inView:rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
} else {
[rootViewController presentViewController:socialViewController animated:YES completion:nil];
}
}

extern "C" {
void _Share(char* text, char* encodedMedia) {
NSString *status = [NSString stringWithUTF8String: text];
NSString *media = [NSString stringWithUTF8String: encodedMedia];

[[[FGSocial alloc] init] share:status media:media];
}
}

@end

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

40 changes: 0 additions & 40 deletions Assets/Plugins/iOS/FrispSocial/FrispSocial.mm

This file was deleted.

Binary file modified ProjectSettings/ProjectSettings.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 5.2.1f1
m_EditorVersion: 5.2.2f1
m_StandardAssetsVersion: 0
Binary file modified package/frisp-social.unitypackage
Binary file not shown.

0 comments on commit 5069b66

Please sign in to comment.