From edce21d5b933dd65855110801afbcabf9cfcc354 Mon Sep 17 00:00:00 2001 From: caio.marcelo Date: Tue, 4 Apr 2017 15:54:39 -0300 Subject: [PATCH] Finish IOS Build --- .DS_Store | Bin 6148 -> 0 bytes Assets/.DS_Store | Bin 6148 -> 0 bytes Assets/Plugins/.DS_Store | Bin 6148 -> 0 bytes Assets/Plugins/IOS/.DS_Store | Bin 6148 -> 0 bytes Assets/Plugins/IOS/iOSNativeShare.h | 72 +++++++++++++++++++++++++++++++++++++----------------------------------- Assets/Plugins/IOS/iOSNativeShare.m | 378 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------------------------------------------------------------- Assets/Scenes/Main.unity | 92 ++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- Assets/Scripts/Export Video/ExportVideo.cs | 5 +++-- Assets/Scripts/Export Video/MediaShareIOS.cs | 30 +++++++++++------------------- Assets/Scripts/Export Video/ShareIOS.cs | 25 +++++++++++++++++++++++-- Assets/Scripts/VoiceRecognition.cs | 4 ++-- 11 files changed, 333 insertions(+), 273 deletions(-) diff --git a/.DS_Store b/.DS_Store index cdce778..8141fba 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/Assets/.DS_Store b/Assets/.DS_Store index 5e61194..f98b95c 100644 Binary files a/Assets/.DS_Store and b/Assets/.DS_Store differ diff --git a/Assets/Plugins/.DS_Store b/Assets/Plugins/.DS_Store index 907e703..08c3063 100644 Binary files a/Assets/Plugins/.DS_Store and b/Assets/Plugins/.DS_Store differ diff --git a/Assets/Plugins/IOS/.DS_Store b/Assets/Plugins/IOS/.DS_Store index b6c798e..4d89401 100644 Binary files a/Assets/Plugins/IOS/.DS_Store and b/Assets/Plugins/IOS/.DS_Store differ diff --git a/Assets/Plugins/IOS/iOSNativeShare.h b/Assets/Plugins/IOS/iOSNativeShare.h index a160c60..aa31271 100755 --- a/Assets/Plugins/IOS/iOSNativeShare.h +++ b/Assets/Plugins/IOS/iOSNativeShare.h @@ -1,35 +1,37 @@ -#import "UnityAppController.h" - -@interface iOSNativeShare : UIViewController -{ - UINavigationController *navController; -} - - -struct ConfigStruct { - char* title; - char* message; -}; - -struct SocialSharingStruct { - char* text; - char* url; - char* image; - char* subject; -}; - - -#ifdef __cplusplus -extern "C" { -#endif - - void showAlertMessage(struct ConfigStruct *confStruct); - void showSocialSharing(struct SocialSharingStruct *confStruct); - void sendToGallery(struct ConfigStruct *confStruct); - -#ifdef __cplusplus -} -#endif - - -@end +#import "UnityAppController.h" + + +@interface iOSNativeShare : UIViewController +{ + UINavigationController *navController; +} + + +struct ConfigStruct { + char* title; + char* message; +}; + +struct SocialSharingStruct { + char* text; + char* url; + char* image; + char* subject; +}; + + +#ifdef __cplusplus +extern "C" { +#endif + + void showAlertMessage(struct ConfigStruct *confStruct); + void showSocialSharing(struct SocialSharingStruct *confStruct); + void sendToGallery(struct ConfigStruct *confStruct); + void askForPermission(struct ConfigStruct *confStruct); + +#ifdef __cplusplus +} +#endif + + +@end diff --git a/Assets/Plugins/IOS/iOSNativeShare.m b/Assets/Plugins/IOS/iOSNativeShare.m index da4981c..242e23b 100755 --- a/Assets/Plugins/IOS/iOSNativeShare.m +++ b/Assets/Plugins/IOS/iOSNativeShare.m @@ -1,167 +1,211 @@ -#import "iOSNativeShare.h" - -@implementation iOSNativeShare{ -} - -#ifdef UNITY_4_0 || UNITY_5_0 - -#import "iPhone_View.h" - -#else - -extern UIViewController* UnityGetGLViewController(); - -#endif - -+(id) withTitle:(char*)title withMessage:(char*)message{ - - return [[iOSNativeShare alloc] initWithTitle:title withMessage:message]; -} - --(id) initWithTitle:(char*)title withMessage:(char*)message{ - - self = [super init]; - - if( !self ) return self; - - ShowAlertMessage([[NSString alloc] initWithUTF8String:title], [[NSString alloc] initWithUTF8String:message]); - - return self; - -} - -+(id) withTitle:(char*)path{ - - return [[iOSNativeShare alloc] initWithTitle:path]; -} - --(id) initWithTitle:(char*)path { - - self = [super init]; - - if( !self ) return self; - - SendToGallery([[NSString alloc] initWithUTF8String:path]); - - return self; - -} - -void SendToGallery(NSString *path){ - if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path)){ - //UISaveVideoAtPathToSavedPhotosAlbum (path,self, nil, nil); - UISaveVideoAtPathToSavedPhotosAlbum (path,nil, nil, nil); - //ShowAlertMessage(@"Vlibras Vídeo",@"Video salvo na galeria."); - } -} - - -void ShowAlertMessage (NSString *title, NSString *message){ - - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title - - message:message - - delegate:nil - - cancelButtonTitle:@"OK" - - otherButtonTitles: nil]; - - [alert show]; - -} - -+(id) withText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ - - return [[iOSNativeShare alloc] initWithText:text withURL:url withImage:image withSubject:subject]; -} - --(id) initWithText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ - - self = [super init]; - - if( !self ) return self; - - - - NSString *mText = text ? [[NSString alloc] initWithUTF8String:text] : nil; - - NSString *mUrl = url ? [[NSString alloc] initWithUTF8String:url] : nil; - - NSString *mImage = image ? [[NSString alloc] initWithUTF8String:image] : nil; - - NSString *mSubject = subject ? [[NSString alloc] initWithUTF8String:subject] : nil; - - - //NSMutableArray *items = [NSMutableArray new]; - NSArray *postItems = [NSArray new]; - - if(mImage != NULL && mImage.length > 0){ - - NSFileManager *fileMgr = [NSFileManager defaultManager]; - if([fileMgr fileExistsAtPath:mImage]){ - - //NSData *dataImage = [NSData dataWithContentsOfFile:mImage]; - - // UIImage *imageFromUrl = [UIImage imageWithData:dataImage]; - NSData *data = [[NSData alloc] initWithContentsOfFile:mImage]; - NSURL *videoURL = [NSURL fileURLWithPath:mImage]; - - // [items addObject:videoURL]; - postItems = @[videoURL]; - //NSArray *postItems = @[videoURL]; - }else{ - ShowAlertMessage(@"Error", @"Cannot find image"); - } - - } - - // UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:Nil]; - // - // if(mSubject != NULL) { - // [activity setValue:mSubject forKey:@"subject"]; - // } else { - // [activity setValue:@"" forKey:@"subject"]; - // } - // - // UIViewController *rootViewController = UnityGetGLViewController(); - // //if iPhone - // if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - // [rootViewController presentViewController:activity animated:YES completion:Nil]; - // } - // //if iPad - // else { - // // Change Rect to position Popover - // UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activity]; - // [popup presentPopoverFromRect:CGRectMake(rootViewController.view.frame.size.width/2, rootViewController.view.frame.size.height/4, 0, 0)inView:rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; - // } - - UIActivityViewController *activityVc = [[UIActivityViewController alloc]initWithActivityItems:postItems applicationActivities:nil]; - if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && [activityVc respondsToSelector:@selector(popoverPresentationController)] ) { - UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVc]; - [popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0) - inView:[UIApplication sharedApplication].keyWindow.rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; - } - else - [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:activityVc animated:YES completion:nil]; - - - return self; -} - -# pragma mark - C API -iOSNativeShare* instance; - -void showAlertMessage(struct ConfigStruct *confStruct) { - instance = [iOSNativeShare withTitle:confStruct->title withMessage:confStruct->message]; -} -void sendToGallery(struct ConfigStruct *confStruct) { - instance = [iOSNativeShare withTitle:confStruct->title]; -} - -void showSocialSharing(struct SocialSharingStruct *confStruct) { - instance = [iOSNativeShare withText:confStruct->text withURL:confStruct->url withImage:confStruct->image withSubject:confStruct->subject]; -} - -@end +#import "iOSNativeShare.h" +#import +#import + + + +@implementation iOSNativeShare{ +} + +#ifdef UNITY_4_0 || UNITY_5_0 + +#import "iPhone_View.h" + +#else + +extern UIViewController* UnityGetGLViewController(); + +#endif + +static NSURL *video; + + + +ALAssetsLibrary* defaultAssetsLibrary() { + static dispatch_once_t pred = 0; + static ALAssetsLibrary *library = nil; + dispatch_once(&pred, ^{ + library = [[ALAssetsLibrary alloc] init]; + }); + return library; +} + + ++(id) withTitle:(char*)title withMessage:(char*)message{ + + return [[iOSNativeShare alloc] initWithTitle:title withMessage:message]; +} + +-(id) initWithTitle:(char*)title withMessage:(char*)message{ + + self = [super init]; + + if( !self ) return self; + + ShowAlertMessage([[NSString alloc] initWithUTF8String:title], [[NSString alloc] initWithUTF8String:message]); + + return self; + +} + ++(id) withTitle:(char*)path{ + + return [[iOSNativeShare alloc] initWithTitle:path]; +} + +-(id) initWithTitle:(char*)path { + + self = [super init]; + + if( !self ) return self; + + SendToGallery([[NSString alloc] initWithUTF8String:path]); + + return self; + +} + ++(id) withTitleSubtitle:(char*)title withSubtitle:(char*)message{ + + return [[iOSNativeShare alloc] initWithTitleSubtitle: title withSubtitle:message]; + + +} + +-(id) initWithTitleSubtitle: (char*)object withSubtitle:(char*)methodName{ + self = [super init]; + + if( !self ) return self; + + AskForPermission( object,methodName); + + return self; +} + +void AskForPermission( char *object, char *method){ + + + PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus]; + + if (status == PHAuthorizationStatusAuthorized) { + UnitySendMessage(object, method, "PERMITIDO"); + } + + else if (status == PHAuthorizationStatusDenied) { + UnitySendMessage(object, method, "NAOPERMITIDO"); + } + + else if (status == PHAuthorizationStatusNotDetermined) { + + // Access has not been determined. + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { + + if (status == PHAuthorizationStatusAuthorized) { + UnitySendMessage(object, method, "PERMITIDO"); + } + + else { + UnitySendMessage(object, method, "NAOPERMITIDO"); + } + }]; + } + + else if (status == PHAuthorizationStatusRestricted) { + UnitySendMessage(object, method, "NAOPERMITIDO"); + } + + +} + +void SendToGallery(NSString *path){ + + + // if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path)){ + //UISaveVideoAtPathToSavedPhotosAlbum (path,self, nil, nil); + // UISaveVideoAtPathToSavedPhotosAlbum (path,nil, nil, nil); + //ShowAlertMessage(@"Vlibras Vídeo",@"Video salvo na galeria."); + //} + NSURL *videoURL = [NSURL fileURLWithPath:path]; + ALAssetsLibrary *assetLibrary = defaultAssetsLibrary(); + + [assetLibrary writeVideoAtPathToSavedPhotosAlbum:videoURL completionBlock:^(NSURL *assetURL, NSError *error){ + if(error) { + NSLog(@"error while saving to camera roll %@",[error localizedDescription]); + UnitySendMessage("ShareIOS", "SaveGalleryResponse", "ERROR"); + } else { + //For removing the back up copy from the documents directory + NSError *removeError = nil; + video = assetURL; + NSLog(@"Path: %@",assetURL); + + // [[NSFileManager defaultManager] removeItemAtURL:videoURL error:&removeError]; + UnitySendMessage("ShareIOS", "SaveGalleryResponse", "SUCESS"); + + } + }]; +} + + +void ShowAlertMessage (NSString *title, NSString *message){ + + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title + + message:message + + delegate:nil + + cancelButtonTitle:@"OK" + + otherButtonTitles: nil]; + + [alert show]; + +} + ++(id) withText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ + + return [[iOSNativeShare alloc] initWithText:text withURL:url withImage:image withSubject:subject]; +} + +-(id) initWithText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ + + self = [super init]; + + if( !self ) return self; + + //NSMutableArray *items = [NSMutableArray new]; + NSArray *postItems = [NSArray new]; + + postItems = @[video]; + UIActivityViewController *activityVc = [[UIActivityViewController alloc]initWithActivityItems:postItems applicationActivities:nil]; + if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && [activityVc respondsToSelector:@selector(popoverPresentationController)] ) { + UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVc]; + [popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0) + inView:[UIApplication sharedApplication].keyWindow.rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; + } + else + [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:activityVc animated:YES completion:nil]; + + + return self; +} + +# pragma mark - C API +iOSNativeShare* instance; + +void showAlertMessage(struct ConfigStruct *confStruct) { + instance = [iOSNativeShare withTitle:confStruct->title withMessage:confStruct->message]; +} +void sendToGallery(struct ConfigStruct *confStruct) { + instance = [iOSNativeShare withTitle:confStruct->title]; +} + +void showSocialSharing(struct SocialSharingStruct *confStruct) { + instance = [iOSNativeShare withText:confStruct->text withURL:confStruct->url withImage:confStruct->image withSubject:confStruct->subject]; +} + +void askForPermission(struct ConfigStruct *confStruct){ + instance = [iOSNativeShare withTitleSubtitle:confStruct->title withSubtitle:confStruct->message]; + +} +@end diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 7edafae..3f7ccee 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -3592,53 +3592,53 @@ Animation: m_GameObject: {fileID: 535548070} m_Enabled: 1 serializedVersion: 3 - m_Animation: {fileID: 7400000, guid: f30af7c2c0e25834596c036ffc483e8d, type: 2} + m_Animation: {fileID: 7400000, guid: e0b82ea10d92c45a49236639d7e127a7, type: 2} m_Animations: - - {fileID: 7400000, guid: 024715f83bda3a24e845e4380e74b282, type: 2} - - {fileID: 7400000, guid: 0b1faa650ee11974bb7b2688b8f77d9e, type: 2} - - {fileID: 7400000, guid: 192e5450bc9b51249a4695055efa808e, type: 2} - - {fileID: 7400000, guid: 1962fa434eeeb6f4289ee601a7d750e9, type: 2} - - {fileID: 7400000, guid: 1e76a7ed8eda9e3418938f9f4bade52a, type: 2} - - {fileID: 7400000, guid: 307a3165c8fa5ec4e9e1dbd14c938201, type: 2} - - {fileID: 7400000, guid: 3ae51d5645a3e844aa539b198f435fb7, type: 2} - - {fileID: 7400000, guid: 3bcf756871574ae4f8098ecde067d0c5, type: 2} - - {fileID: 7400000, guid: 3bf1eb146bbc3df488121950abe1b8cf, type: 2} - - {fileID: 7400000, guid: 43e3f3c6f22a59f4b9a9fe7c7eaa2e60, type: 2} - - {fileID: 7400000, guid: 47abf9561f7dc544fbd158a753c48030, type: 2} - - {fileID: 7400000, guid: 4f5d38ce9a4791a45a65a6d5cf651942, type: 2} - - {fileID: 7400000, guid: 6157701b991b24d46903d222e5733a65, type: 2} - - {fileID: 7400000, guid: 6738b13e2a5c77b419d466a9b07b93da, type: 2} - - {fileID: 7400000, guid: 6c071acda0226cc4682dd95a24ba34c7, type: 2} - - {fileID: 7400000, guid: 70717780c0ae91c4fa79d0230c07e877, type: 2} - - {fileID: 7400000, guid: 71670a3ee1d3fd84d881cdcbe35aac33, type: 2} - - {fileID: 7400000, guid: 75124670012910744b6b20baa43f6773, type: 2} - - {fileID: 7400000, guid: 78643954b61e2af40855b1d7edb59e68, type: 2} - - {fileID: 7400000, guid: 8105d762612034947a4e8aa08e6e743a, type: 2} - - {fileID: 7400000, guid: 83b94fb00e13b6441b62d3c50f8fc057, type: 2} - - {fileID: 7400000, guid: 8486f353c66ec3747ac807d5254ab572, type: 2} - - {fileID: 7400000, guid: 865af1e6ffb998e4391c1f5a4fa963f4, type: 2} - - {fileID: 7400000, guid: 89844a05f01e2884db62dfc23e3bb020, type: 2} - - {fileID: 7400000, guid: 8d329b13dcec31a43a5a846e2e002e08, type: 2} - - {fileID: 7400000, guid: 9c285cd93505250428536521f358b998, type: 2} - - {fileID: 7400000, guid: a70ed1e393ddc29418dd2055d0fa69ea, type: 2} - - {fileID: 7400000, guid: b3c940c8bb0a40d4197bab5861c5f147, type: 2} - - {fileID: 7400000, guid: b557ac09196b9c245b4bf0aa00511bcf, type: 2} - - {fileID: 7400000, guid: b55e4eebb1540b24f9dee194b2621df3, type: 2} - - {fileID: 7400000, guid: b8ec32612eba3c94c8b9e075a2b84cd5, type: 2} - - {fileID: 7400000, guid: bb38a59cd20338341ae0bc9c73cd88b6, type: 2} - - {fileID: 7400000, guid: c67e687da6409ef48b294fb4b0a48d5c, type: 2} - - {fileID: 7400000, guid: cce493d72e67b4c49859605a34148c59, type: 2} - - {fileID: 7400000, guid: d2fd3606f0e661044aee19011e22f191, type: 2} - - {fileID: 7400000, guid: d50be78006beb2945a10f60a10832a15, type: 2} - - {fileID: 7400000, guid: d5a9e2c65d62b07478c2a9c546209722, type: 2} - - {fileID: 7400000, guid: d9d8762439eb57e43b4fd6cc957fd2bb, type: 2} - - {fileID: 7400000, guid: e559c6348bb5e304aa4eccc562e061bb, type: 2} - - {fileID: 7400000, guid: ea652f2c75fa62844afdcd1b896aa400, type: 2} - - {fileID: 7400000, guid: ed250cdb586bb4b46b964189a7ce2788, type: 2} - - {fileID: 7400000, guid: f30af7c2c0e25834596c036ffc483e8d, type: 2} - - {fileID: 7400000, guid: f674d89e422b07a4384b425e639d0901, type: 2} - - {fileID: 7400000, guid: f7f9e787f918e0f4a975903fc0866f68, type: 2} - - {fileID: 7400000, guid: f9e186c4e38b30b458eb71901806aa4f, type: 2} + - {fileID: 7400000, guid: edc0fe305be934cfdaf262b2372efc9f, type: 2} + - {fileID: 7400000, guid: 9f404de03117c44fcbf5c4bebbdebc39, type: 2} + - {fileID: 7400000, guid: e0b82ea10d92c45a49236639d7e127a7, type: 2} + - {fileID: 7400000, guid: b90260b13c6b043008a3231f0e325d8b, type: 2} + - {fileID: 7400000, guid: daceeb12c57434b03ab14733724787b0, type: 2} + - {fileID: 7400000, guid: 094c9782dfd1a4419b4300050525a196, type: 2} + - {fileID: 7400000, guid: 3ff67392ee17d46e8b75e23614754596, type: 2} + - {fileID: 7400000, guid: 8c3b08031b41a4af6a38cddd30b6b711, type: 2} + - {fileID: 7400000, guid: 9a03fa44cc4e74406a490fa7a601eb2d, type: 2} + - {fileID: 7400000, guid: 38aa20a48a06548d9946da7f3491fd79, type: 2} + - {fileID: 7400000, guid: 6867e7a4c4a93433b85dd978831a5789, type: 2} + - {fileID: 7400000, guid: d3a14cd4d3aef472f81d58456286f1da, type: 2} + - {fileID: 7400000, guid: 87310cd5c3519409081aad5bc7d001f4, type: 2} + - {fileID: 7400000, guid: e5df376619b5547418da0a4bb053a736, type: 2} + - {fileID: 7400000, guid: a55f62e68785e4f16b38373c27770c2c, type: 2} + - {fileID: 7400000, guid: 773b86077b0a9459eb0d40f9c6147238, type: 2} + - {fileID: 7400000, guid: 723477075e06c43dca279006c68f629a, type: 2} + - {fileID: 7400000, guid: 922333c7fb2f24607a2b6bc7eddc0c92, type: 2} + - {fileID: 7400000, guid: bd4784c7f8ccc4dd6b9c0d3bca313258, type: 2} + - {fileID: 7400000, guid: 93c97cf7199d14c8a85c6a47dfe96fdd, type: 2} + - {fileID: 7400000, guid: 9fac8b289e9c34268bade7f7dc070255, type: 2} + - {fileID: 7400000, guid: 2fdb4638c75f24f0aabd6cc76fb610c4, type: 2} + - {fileID: 7400000, guid: 7f65fa3885c054b49ae6e5271be81d3f, type: 2} + - {fileID: 7400000, guid: 75289ce9809d340a39e5d2d9896ef14e, type: 2} + - {fileID: 7400000, guid: 46db7a3a687d6491c87b272ba4a3af9b, type: 2} + - {fileID: 7400000, guid: b0298c4a0832c4567a80f0293805f766, type: 2} + - {fileID: 7400000, guid: 7ccd4c6ab0ec54ceaa2946562f1a9498, type: 2} + - {fileID: 7400000, guid: 99e6d1fa06bef4cffb3985c33858ab7f, type: 2} + - {fileID: 7400000, guid: 353f223b7116a4871a1ed9cb10953fec, type: 2} + - {fileID: 7400000, guid: 48640d5b0a6804e8a892d7e3f9878338, type: 2} + - {fileID: 7400000, guid: d9a3268b5233b489489a6b406f5b560d, type: 2} + - {fileID: 7400000, guid: 255d4ddbbcdac46d9917908e6dc83fbf, type: 2} + - {fileID: 7400000, guid: 0a25b7eb696464a9ba3fedba28052f44, type: 2} + - {fileID: 7400000, guid: 3953996c14ada434e8bece627ea272fb, type: 2} + - {fileID: 7400000, guid: 24ccfe8cc110546aab2e9ea1edab0997, type: 2} + - {fileID: 7400000, guid: d902aa4db6b5e44fe9153e04e901b357, type: 2} + - {fileID: 7400000, guid: 8b46d8bdc57654882b802d8a424bbc64, type: 2} + - {fileID: 7400000, guid: e0e4fafd1c404477a9330c24fad5c5d5, type: 2} + - {fileID: 7400000, guid: 3b02e44ef03c5471c873718351272938, type: 2} + - {fileID: 7400000, guid: 9d20ba4e0319344f29101e050835449a, type: 2} + - {fileID: 7400000, guid: a2f710de3a93149d981cfd3643c29f5d, type: 2} + - {fileID: 7400000, guid: 212a470f4d8764d3aab828715dcceadd, type: 2} + - {fileID: 7400000, guid: ad8d4c5f8f40746fb809287d36da0da4, type: 2} + - {fileID: 7400000, guid: 8043026f4179c4e36bf9c52857439067, type: 2} + - {fileID: 7400000, guid: 829700cfb4bf84f01a308423418d482d, type: 2} m_WrapMode: 0 m_PlayAutomatically: 1 m_AnimatePhysics: 0 diff --git a/Assets/Scripts/Export Video/ExportVideo.cs b/Assets/Scripts/Export Video/ExportVideo.cs index 98dc6af..78f4207 100644 --- a/Assets/Scripts/Export Video/ExportVideo.cs +++ b/Assets/Scripts/Export Video/ExportVideo.cs @@ -78,7 +78,7 @@ public class ExportVideo : MonoBehaviour { } - /* RunTime Android Permission being asked*/ + /* RunTime IOS Permission being asked*/ private void onClickExport() { PlayerLogger.Log("ExportVideo", "OnClickExport", "Starting Export..."); @@ -90,7 +90,8 @@ public class ExportVideo : MonoBehaviour { private void Permitted(bool PermissionGranted) - { + { + PlayerLogger.Log ("ExportVideo", "Permitted", "Permission granted."); if (PermissionGranted) { int fiveTimesCount; diff --git a/Assets/Scripts/Export Video/MediaShareIOS.cs b/Assets/Scripts/Export Video/MediaShareIOS.cs index efbbed0..465f25c 100644 --- a/Assets/Scripts/Export Video/MediaShareIOS.cs +++ b/Assets/Scripts/Export Video/MediaShareIOS.cs @@ -26,7 +26,6 @@ using System.IO; public class MediaShareIOS : MonoBehaviour { private static string path; - private string VlibrasFolder = "VLibras"; private string Filen = "VLibrasVideo_"; private static string FilePath = ""; @@ -37,7 +36,6 @@ public class MediaShareIOS : MonoBehaviour { { path = Application.persistentDataPath; PlayerLogger.Log("ExportVideo", "VideoDownload", "Writing at: " + path); - /*FilePath se refere ao nome que o arquivo será salvo. Este deve ser mantido como está.*/ FilePath = Filen + CurrentTime + ".mp4"; /* Checking if folder Vlibras exists*/ DirectoryInfo dir = new DirectoryInfo(path); @@ -53,18 +51,19 @@ public class MediaShareIOS : MonoBehaviour { SourceStream.Write(videoContent, 0, bytes); SourceStream.Close(); #if UNITY_IOS - ShareIOS.CallSendToGallery(Path.Combine(path,FilePath)); + Action callBack = (response) => { + if(response) + finishWriting(); + else + errorWriting(); + }; + ShareIOS.CallSendToGallery(Path.Combine(path,FilePath),callBack); #endif - yield return new WaitForSeconds(1.0f); - - finishWriting(); - - + yield return new WaitForSeconds(1.0f); } else { - errorWriting(); } @@ -73,6 +72,7 @@ public class MediaShareIOS : MonoBehaviour { yield break; } + public void showAlert(string title,string message){ #if UNITY_IOS @@ -86,24 +86,16 @@ public class MediaShareIOS : MonoBehaviour { public IEnumerator ShareIntent(Action errorAction) { #if UNITY_IOS - if(File.Exists(Path.Combine(path,FilePath))){ + ShareIOS share = new ShareIOS(); PlayerLogger.Log("MediaShareIOS","ShareIntent","Trying to share video."); try{ - share.Share("Vlibras Video",Path.Combine(path,FilePath),"",""); + share.Share("Vlibras Video","","",""); }catch(Exception e){ PlayerLogger.Log("MediaShareIOS", "ShareIntent", "Message: " + e.Message); PlayerLogger.Log("MediaShareIOS", "ShareIntent", "Message: " + e.StackTrace); errorAction(); } - - }else{ - PlayerLogger.Log("MediaShareIOS","ShareIntent","File doesnt exist"); - errorAction(); - } - - - //GeneralSharingiOSBridge.ShareTextWithImage (Path.Combine(path, FilePath), "Vlibras video"); #endif yield break; diff --git a/Assets/Scripts/Export Video/ShareIOS.cs b/Assets/Scripts/Export Video/ShareIOS.cs index 2620cb3..db595ff 100644 --- a/Assets/Scripts/Export Video/ShareIOS.cs +++ b/Assets/Scripts/Export Video/ShareIOS.cs @@ -13,8 +13,10 @@ public class ShareIOS : MonoBehaviour { private static ShareIOS instance; private static Action PermittedAction; + private static Action SaveGallerySucess; private static bool initialized = false; + public void Awake() { instance = this; @@ -85,7 +87,8 @@ public class ShareIOS : MonoBehaviour { } [DllImport ("__Internal")] private static extern void sendToGallery(ref ConfigStruct conf); - public static void CallSendToGallery(string path){ + public static void CallSendToGallery(string path,ActionCallBack){ + SaveGallerySucess = CallBack; ConfigStruct conf = new ConfigStruct (); conf.title = path; conf.message = ""; @@ -120,10 +123,28 @@ public class ShareIOS : MonoBehaviour { } } - PermittedAction = null; + } + private void SaveGalleryResponse(string response){ + if (!initialized) + initialize (); + if (SaveGallerySucess != null) { + if (response == "SUCESS") { + SaveGallerySucess (true); + + } else { + SaveGallerySucess (false); + } + + + + } + + + } + #endif } diff --git a/Assets/Scripts/VoiceRecognition.cs b/Assets/Scripts/VoiceRecognition.cs index 44f83c0..1fa131f 100644 --- a/Assets/Scripts/VoiceRecognition.cs +++ b/Assets/Scripts/VoiceRecognition.cs @@ -34,7 +34,7 @@ public class VoiceRecognition { public VoiceRecognition() { -#if !UNITY_EDITOR + #if !UNITY_EDITOR && !UNITY_IOS unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); currentActivity = unity.GetStatic("currentActivity"); #endif @@ -43,7 +43,7 @@ public class VoiceRecognition { // Calls Google Speech from plugin method and returns recognized text public string callRecognition() { -#if !UNITY_EDITOR +#if !UNITY_EDITOR && !UNITY_IOS voiceText = currentActivity.Call("callGoogleSpeech"); #endif -- libgit2 0.21.2