Commit edce21d5b933dd65855110801afbcabf9cfcc354
1 parent
eb8200fd
Exists in
IosBuild
Finish IOS Build
Showing
11 changed files
with
333 additions
and
273 deletions
Show diff stats
.DS_Store
No preview for this file type
Assets/.DS_Store
No preview for this file type
Assets/Plugins/.DS_Store
No preview for this file type
Assets/Plugins/IOS/.DS_Store
No preview for this file type
Assets/Plugins/IOS/iOSNativeShare.h
1 | -#import "UnityAppController.h" | |
2 | - | |
3 | -@interface iOSNativeShare : UIViewController | |
4 | -{ | |
5 | - UINavigationController *navController; | |
6 | -} | |
7 | - | |
8 | - | |
9 | -struct ConfigStruct { | |
10 | - char* title; | |
11 | - char* message; | |
12 | -}; | |
13 | - | |
14 | -struct SocialSharingStruct { | |
15 | - char* text; | |
16 | - char* url; | |
17 | - char* image; | |
18 | - char* subject; | |
19 | -}; | |
20 | - | |
21 | - | |
22 | -#ifdef __cplusplus | |
23 | -extern "C" { | |
24 | -#endif | |
25 | - | |
26 | - void showAlertMessage(struct ConfigStruct *confStruct); | |
27 | - void showSocialSharing(struct SocialSharingStruct *confStruct); | |
28 | - void sendToGallery(struct ConfigStruct *confStruct); | |
29 | - | |
30 | -#ifdef __cplusplus | |
31 | -} | |
32 | -#endif | |
33 | - | |
34 | - | |
35 | -@end | |
1 | +#import "UnityAppController.h" | |
2 | + | |
3 | + | |
4 | +@interface iOSNativeShare : UIViewController | |
5 | +{ | |
6 | + UINavigationController *navController; | |
7 | +} | |
8 | + | |
9 | + | |
10 | +struct ConfigStruct { | |
11 | + char* title; | |
12 | + char* message; | |
13 | +}; | |
14 | + | |
15 | +struct SocialSharingStruct { | |
16 | + char* text; | |
17 | + char* url; | |
18 | + char* image; | |
19 | + char* subject; | |
20 | +}; | |
21 | + | |
22 | + | |
23 | +#ifdef __cplusplus | |
24 | +extern "C" { | |
25 | +#endif | |
26 | + | |
27 | + void showAlertMessage(struct ConfigStruct *confStruct); | |
28 | + void showSocialSharing(struct SocialSharingStruct *confStruct); | |
29 | + void sendToGallery(struct ConfigStruct *confStruct); | |
30 | + void askForPermission(struct ConfigStruct *confStruct); | |
31 | + | |
32 | +#ifdef __cplusplus | |
33 | +} | |
34 | +#endif | |
35 | + | |
36 | + | |
37 | +@end | ... | ... |
Assets/Plugins/IOS/iOSNativeShare.m
1 | -#import "iOSNativeShare.h" | |
2 | - | |
3 | -@implementation iOSNativeShare{ | |
4 | -} | |
5 | - | |
6 | -#ifdef UNITY_4_0 || UNITY_5_0 | |
7 | - | |
8 | -#import "iPhone_View.h" | |
9 | - | |
10 | -#else | |
11 | - | |
12 | -extern UIViewController* UnityGetGLViewController(); | |
13 | - | |
14 | -#endif | |
15 | - | |
16 | -+(id) withTitle:(char*)title withMessage:(char*)message{ | |
17 | - | |
18 | - return [[iOSNativeShare alloc] initWithTitle:title withMessage:message]; | |
19 | -} | |
20 | - | |
21 | --(id) initWithTitle:(char*)title withMessage:(char*)message{ | |
22 | - | |
23 | - self = [super init]; | |
24 | - | |
25 | - if( !self ) return self; | |
26 | - | |
27 | - ShowAlertMessage([[NSString alloc] initWithUTF8String:title], [[NSString alloc] initWithUTF8String:message]); | |
28 | - | |
29 | - return self; | |
30 | - | |
31 | -} | |
32 | - | |
33 | -+(id) withTitle:(char*)path{ | |
34 | - | |
35 | - return [[iOSNativeShare alloc] initWithTitle:path]; | |
36 | -} | |
37 | - | |
38 | --(id) initWithTitle:(char*)path { | |
39 | - | |
40 | - self = [super init]; | |
41 | - | |
42 | - if( !self ) return self; | |
43 | - | |
44 | - SendToGallery([[NSString alloc] initWithUTF8String:path]); | |
45 | - | |
46 | - return self; | |
47 | - | |
48 | -} | |
49 | - | |
50 | -void SendToGallery(NSString *path){ | |
51 | - if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path)){ | |
52 | - //UISaveVideoAtPathToSavedPhotosAlbum (path,self, nil, nil); | |
53 | - UISaveVideoAtPathToSavedPhotosAlbum (path,nil, nil, nil); | |
54 | - //ShowAlertMessage(@"Vlibras Vídeo",@"Video salvo na galeria."); | |
55 | - } | |
56 | -} | |
57 | - | |
58 | - | |
59 | -void ShowAlertMessage (NSString *title, NSString *message){ | |
60 | - | |
61 | - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title | |
62 | - | |
63 | - message:message | |
64 | - | |
65 | - delegate:nil | |
66 | - | |
67 | - cancelButtonTitle:@"OK" | |
68 | - | |
69 | - otherButtonTitles: nil]; | |
70 | - | |
71 | - [alert show]; | |
72 | - | |
73 | -} | |
74 | - | |
75 | -+(id) withText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ | |
76 | - | |
77 | - return [[iOSNativeShare alloc] initWithText:text withURL:url withImage:image withSubject:subject]; | |
78 | -} | |
79 | - | |
80 | --(id) initWithText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ | |
81 | - | |
82 | - self = [super init]; | |
83 | - | |
84 | - if( !self ) return self; | |
85 | - | |
86 | - | |
87 | - | |
88 | - NSString *mText = text ? [[NSString alloc] initWithUTF8String:text] : nil; | |
89 | - | |
90 | - NSString *mUrl = url ? [[NSString alloc] initWithUTF8String:url] : nil; | |
91 | - | |
92 | - NSString *mImage = image ? [[NSString alloc] initWithUTF8String:image] : nil; | |
93 | - | |
94 | - NSString *mSubject = subject ? [[NSString alloc] initWithUTF8String:subject] : nil; | |
95 | - | |
96 | - | |
97 | - //NSMutableArray *items = [NSMutableArray new]; | |
98 | - NSArray *postItems = [NSArray new]; | |
99 | - | |
100 | - if(mImage != NULL && mImage.length > 0){ | |
101 | - | |
102 | - NSFileManager *fileMgr = [NSFileManager defaultManager]; | |
103 | - if([fileMgr fileExistsAtPath:mImage]){ | |
104 | - | |
105 | - //NSData *dataImage = [NSData dataWithContentsOfFile:mImage]; | |
106 | - | |
107 | - // UIImage *imageFromUrl = [UIImage imageWithData:dataImage]; | |
108 | - NSData *data = [[NSData alloc] initWithContentsOfFile:mImage]; | |
109 | - NSURL *videoURL = [NSURL fileURLWithPath:mImage]; | |
110 | - | |
111 | - // [items addObject:videoURL]; | |
112 | - postItems = @[videoURL]; | |
113 | - //NSArray *postItems = @[videoURL]; | |
114 | - }else{ | |
115 | - ShowAlertMessage(@"Error", @"Cannot find image"); | |
116 | - } | |
117 | - | |
118 | - } | |
119 | - | |
120 | - // UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:Nil]; | |
121 | - // | |
122 | - // if(mSubject != NULL) { | |
123 | - // [activity setValue:mSubject forKey:@"subject"]; | |
124 | - // } else { | |
125 | - // [activity setValue:@"" forKey:@"subject"]; | |
126 | - // } | |
127 | - // | |
128 | - // UIViewController *rootViewController = UnityGetGLViewController(); | |
129 | - // //if iPhone | |
130 | - // if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { | |
131 | - // [rootViewController presentViewController:activity animated:YES completion:Nil]; | |
132 | - // } | |
133 | - // //if iPad | |
134 | - // else { | |
135 | - // // Change Rect to position Popover | |
136 | - // UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activity]; | |
137 | - // [popup presentPopoverFromRect:CGRectMake(rootViewController.view.frame.size.width/2, rootViewController.view.frame.size.height/4, 0, 0)inView:rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; | |
138 | - // } | |
139 | - | |
140 | - UIActivityViewController *activityVc = [[UIActivityViewController alloc]initWithActivityItems:postItems applicationActivities:nil]; | |
141 | - if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && [activityVc respondsToSelector:@selector(popoverPresentationController)] ) { | |
142 | - UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVc]; | |
143 | - [popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0) | |
144 | - inView:[UIApplication sharedApplication].keyWindow.rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; | |
145 | - } | |
146 | - else | |
147 | - [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:activityVc animated:YES completion:nil]; | |
148 | - | |
149 | - | |
150 | - return self; | |
151 | -} | |
152 | - | |
153 | -# pragma mark - C API | |
154 | -iOSNativeShare* instance; | |
155 | - | |
156 | -void showAlertMessage(struct ConfigStruct *confStruct) { | |
157 | - instance = [iOSNativeShare withTitle:confStruct->title withMessage:confStruct->message]; | |
158 | -} | |
159 | -void sendToGallery(struct ConfigStruct *confStruct) { | |
160 | - instance = [iOSNativeShare withTitle:confStruct->title]; | |
161 | -} | |
162 | - | |
163 | -void showSocialSharing(struct SocialSharingStruct *confStruct) { | |
164 | - instance = [iOSNativeShare withText:confStruct->text withURL:confStruct->url withImage:confStruct->image withSubject:confStruct->subject]; | |
165 | -} | |
166 | - | |
167 | -@end | |
1 | +#import "iOSNativeShare.h" | |
2 | +#import <AssetsLibrary/ALAssetsLibrary.h> | |
3 | +#import <Photos/Photos.h> | |
4 | + | |
5 | + | |
6 | + | |
7 | +@implementation iOSNativeShare{ | |
8 | +} | |
9 | + | |
10 | +#ifdef UNITY_4_0 || UNITY_5_0 | |
11 | + | |
12 | +#import "iPhone_View.h" | |
13 | + | |
14 | +#else | |
15 | + | |
16 | +extern UIViewController* UnityGetGLViewController(); | |
17 | + | |
18 | +#endif | |
19 | + | |
20 | +static NSURL *video; | |
21 | + | |
22 | + | |
23 | + | |
24 | +ALAssetsLibrary* defaultAssetsLibrary() { | |
25 | + static dispatch_once_t pred = 0; | |
26 | + static ALAssetsLibrary *library = nil; | |
27 | + dispatch_once(&pred, ^{ | |
28 | + library = [[ALAssetsLibrary alloc] init]; | |
29 | + }); | |
30 | + return library; | |
31 | +} | |
32 | + | |
33 | + | |
34 | ++(id) withTitle:(char*)title withMessage:(char*)message{ | |
35 | + | |
36 | + return [[iOSNativeShare alloc] initWithTitle:title withMessage:message]; | |
37 | +} | |
38 | + | |
39 | +-(id) initWithTitle:(char*)title withMessage:(char*)message{ | |
40 | + | |
41 | + self = [super init]; | |
42 | + | |
43 | + if( !self ) return self; | |
44 | + | |
45 | + ShowAlertMessage([[NSString alloc] initWithUTF8String:title], [[NSString alloc] initWithUTF8String:message]); | |
46 | + | |
47 | + return self; | |
48 | + | |
49 | +} | |
50 | + | |
51 | ++(id) withTitle:(char*)path{ | |
52 | + | |
53 | + return [[iOSNativeShare alloc] initWithTitle:path]; | |
54 | +} | |
55 | + | |
56 | +-(id) initWithTitle:(char*)path { | |
57 | + | |
58 | + self = [super init]; | |
59 | + | |
60 | + if( !self ) return self; | |
61 | + | |
62 | + SendToGallery([[NSString alloc] initWithUTF8String:path]); | |
63 | + | |
64 | + return self; | |
65 | + | |
66 | +} | |
67 | + | |
68 | ++(id) withTitleSubtitle:(char*)title withSubtitle:(char*)message{ | |
69 | + | |
70 | + return [[iOSNativeShare alloc] initWithTitleSubtitle: title withSubtitle:message]; | |
71 | + | |
72 | + | |
73 | +} | |
74 | + | |
75 | +-(id) initWithTitleSubtitle: (char*)object withSubtitle:(char*)methodName{ | |
76 | + self = [super init]; | |
77 | + | |
78 | + if( !self ) return self; | |
79 | + | |
80 | + AskForPermission( object,methodName); | |
81 | + | |
82 | + return self; | |
83 | +} | |
84 | + | |
85 | +void AskForPermission( char *object, char *method){ | |
86 | + | |
87 | + | |
88 | + PHAuthorizationStatus status = [PHPhotoLibrary authorizationStatus]; | |
89 | + | |
90 | + if (status == PHAuthorizationStatusAuthorized) { | |
91 | + UnitySendMessage(object, method, "PERMITIDO"); | |
92 | + } | |
93 | + | |
94 | + else if (status == PHAuthorizationStatusDenied) { | |
95 | + UnitySendMessage(object, method, "NAOPERMITIDO"); | |
96 | + } | |
97 | + | |
98 | + else if (status == PHAuthorizationStatusNotDetermined) { | |
99 | + | |
100 | + // Access has not been determined. | |
101 | + [PHPhotoLibrary requestAuthorization:^(PHAuthorizationStatus status) { | |
102 | + | |
103 | + if (status == PHAuthorizationStatusAuthorized) { | |
104 | + UnitySendMessage(object, method, "PERMITIDO"); | |
105 | + } | |
106 | + | |
107 | + else { | |
108 | + UnitySendMessage(object, method, "NAOPERMITIDO"); | |
109 | + } | |
110 | + }]; | |
111 | + } | |
112 | + | |
113 | + else if (status == PHAuthorizationStatusRestricted) { | |
114 | + UnitySendMessage(object, method, "NAOPERMITIDO"); | |
115 | + } | |
116 | + | |
117 | + | |
118 | +} | |
119 | + | |
120 | +void SendToGallery(NSString *path){ | |
121 | + | |
122 | + | |
123 | + // if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path)){ | |
124 | + //UISaveVideoAtPathToSavedPhotosAlbum (path,self, nil, nil); | |
125 | + // UISaveVideoAtPathToSavedPhotosAlbum (path,nil, nil, nil); | |
126 | + //ShowAlertMessage(@"Vlibras Vídeo",@"Video salvo na galeria."); | |
127 | + //} | |
128 | + NSURL *videoURL = [NSURL fileURLWithPath:path]; | |
129 | + ALAssetsLibrary *assetLibrary = defaultAssetsLibrary(); | |
130 | + | |
131 | + [assetLibrary writeVideoAtPathToSavedPhotosAlbum:videoURL completionBlock:^(NSURL *assetURL, NSError *error){ | |
132 | + if(error) { | |
133 | + NSLog(@"error while saving to camera roll %@",[error localizedDescription]); | |
134 | + UnitySendMessage("ShareIOS", "SaveGalleryResponse", "ERROR"); | |
135 | + } else { | |
136 | + //For removing the back up copy from the documents directory | |
137 | + NSError *removeError = nil; | |
138 | + video = assetURL; | |
139 | + NSLog(@"Path: %@",assetURL); | |
140 | + | |
141 | + // [[NSFileManager defaultManager] removeItemAtURL:videoURL error:&removeError]; | |
142 | + UnitySendMessage("ShareIOS", "SaveGalleryResponse", "SUCESS"); | |
143 | + | |
144 | + } | |
145 | + }]; | |
146 | +} | |
147 | + | |
148 | + | |
149 | +void ShowAlertMessage (NSString *title, NSString *message){ | |
150 | + | |
151 | + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title | |
152 | + | |
153 | + message:message | |
154 | + | |
155 | + delegate:nil | |
156 | + | |
157 | + cancelButtonTitle:@"OK" | |
158 | + | |
159 | + otherButtonTitles: nil]; | |
160 | + | |
161 | + [alert show]; | |
162 | + | |
163 | +} | |
164 | + | |
165 | ++(id) withText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ | |
166 | + | |
167 | + return [[iOSNativeShare alloc] initWithText:text withURL:url withImage:image withSubject:subject]; | |
168 | +} | |
169 | + | |
170 | +-(id) initWithText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ | |
171 | + | |
172 | + self = [super init]; | |
173 | + | |
174 | + if( !self ) return self; | |
175 | + | |
176 | + //NSMutableArray *items = [NSMutableArray new]; | |
177 | + NSArray *postItems = [NSArray new]; | |
178 | + | |
179 | + postItems = @[video]; | |
180 | + UIActivityViewController *activityVc = [[UIActivityViewController alloc]initWithActivityItems:postItems applicationActivities:nil]; | |
181 | + if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && [activityVc respondsToSelector:@selector(popoverPresentationController)] ) { | |
182 | + UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVc]; | |
183 | + [popup presentPopoverFromRect:CGRectMake(self.view.frame.size.width/2, self.view.frame.size.height/4, 0, 0) | |
184 | + inView:[UIApplication sharedApplication].keyWindow.rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; | |
185 | + } | |
186 | + else | |
187 | + [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:activityVc animated:YES completion:nil]; | |
188 | + | |
189 | + | |
190 | + return self; | |
191 | +} | |
192 | + | |
193 | +# pragma mark - C API | |
194 | +iOSNativeShare* instance; | |
195 | + | |
196 | +void showAlertMessage(struct ConfigStruct *confStruct) { | |
197 | + instance = [iOSNativeShare withTitle:confStruct->title withMessage:confStruct->message]; | |
198 | +} | |
199 | +void sendToGallery(struct ConfigStruct *confStruct) { | |
200 | + instance = [iOSNativeShare withTitle:confStruct->title]; | |
201 | +} | |
202 | + | |
203 | +void showSocialSharing(struct SocialSharingStruct *confStruct) { | |
204 | + instance = [iOSNativeShare withText:confStruct->text withURL:confStruct->url withImage:confStruct->image withSubject:confStruct->subject]; | |
205 | +} | |
206 | + | |
207 | +void askForPermission(struct ConfigStruct *confStruct){ | |
208 | + instance = [iOSNativeShare withTitleSubtitle:confStruct->title withSubtitle:confStruct->message]; | |
209 | + | |
210 | +} | |
211 | +@end | ... | ... |
Assets/Scenes/Main.unity
... | ... | @@ -3592,53 +3592,53 @@ Animation: |
3592 | 3592 | m_GameObject: {fileID: 535548070} |
3593 | 3593 | m_Enabled: 1 |
3594 | 3594 | serializedVersion: 3 |
3595 | - m_Animation: {fileID: 7400000, guid: f30af7c2c0e25834596c036ffc483e8d, type: 2} | |
3595 | + m_Animation: {fileID: 7400000, guid: e0b82ea10d92c45a49236639d7e127a7, type: 2} | |
3596 | 3596 | m_Animations: |
3597 | - - {fileID: 7400000, guid: 024715f83bda3a24e845e4380e74b282, type: 2} | |
3598 | - - {fileID: 7400000, guid: 0b1faa650ee11974bb7b2688b8f77d9e, type: 2} | |
3599 | - - {fileID: 7400000, guid: 192e5450bc9b51249a4695055efa808e, type: 2} | |
3600 | - - {fileID: 7400000, guid: 1962fa434eeeb6f4289ee601a7d750e9, type: 2} | |
3601 | - - {fileID: 7400000, guid: 1e76a7ed8eda9e3418938f9f4bade52a, type: 2} | |
3602 | - - {fileID: 7400000, guid: 307a3165c8fa5ec4e9e1dbd14c938201, type: 2} | |
3603 | - - {fileID: 7400000, guid: 3ae51d5645a3e844aa539b198f435fb7, type: 2} | |
3604 | - - {fileID: 7400000, guid: 3bcf756871574ae4f8098ecde067d0c5, type: 2} | |
3605 | - - {fileID: 7400000, guid: 3bf1eb146bbc3df488121950abe1b8cf, type: 2} | |
3606 | - - {fileID: 7400000, guid: 43e3f3c6f22a59f4b9a9fe7c7eaa2e60, type: 2} | |
3607 | - - {fileID: 7400000, guid: 47abf9561f7dc544fbd158a753c48030, type: 2} | |
3608 | - - {fileID: 7400000, guid: 4f5d38ce9a4791a45a65a6d5cf651942, type: 2} | |
3609 | - - {fileID: 7400000, guid: 6157701b991b24d46903d222e5733a65, type: 2} | |
3610 | - - {fileID: 7400000, guid: 6738b13e2a5c77b419d466a9b07b93da, type: 2} | |
3611 | - - {fileID: 7400000, guid: 6c071acda0226cc4682dd95a24ba34c7, type: 2} | |
3612 | - - {fileID: 7400000, guid: 70717780c0ae91c4fa79d0230c07e877, type: 2} | |
3613 | - - {fileID: 7400000, guid: 71670a3ee1d3fd84d881cdcbe35aac33, type: 2} | |
3614 | - - {fileID: 7400000, guid: 75124670012910744b6b20baa43f6773, type: 2} | |
3615 | - - {fileID: 7400000, guid: 78643954b61e2af40855b1d7edb59e68, type: 2} | |
3616 | - - {fileID: 7400000, guid: 8105d762612034947a4e8aa08e6e743a, type: 2} | |
3617 | - - {fileID: 7400000, guid: 83b94fb00e13b6441b62d3c50f8fc057, type: 2} | |
3618 | - - {fileID: 7400000, guid: 8486f353c66ec3747ac807d5254ab572, type: 2} | |
3619 | - - {fileID: 7400000, guid: 865af1e6ffb998e4391c1f5a4fa963f4, type: 2} | |
3620 | - - {fileID: 7400000, guid: 89844a05f01e2884db62dfc23e3bb020, type: 2} | |
3621 | - - {fileID: 7400000, guid: 8d329b13dcec31a43a5a846e2e002e08, type: 2} | |
3622 | - - {fileID: 7400000, guid: 9c285cd93505250428536521f358b998, type: 2} | |
3623 | - - {fileID: 7400000, guid: a70ed1e393ddc29418dd2055d0fa69ea, type: 2} | |
3624 | - - {fileID: 7400000, guid: b3c940c8bb0a40d4197bab5861c5f147, type: 2} | |
3625 | - - {fileID: 7400000, guid: b557ac09196b9c245b4bf0aa00511bcf, type: 2} | |
3626 | - - {fileID: 7400000, guid: b55e4eebb1540b24f9dee194b2621df3, type: 2} | |
3627 | - - {fileID: 7400000, guid: b8ec32612eba3c94c8b9e075a2b84cd5, type: 2} | |
3628 | - - {fileID: 7400000, guid: bb38a59cd20338341ae0bc9c73cd88b6, type: 2} | |
3629 | - - {fileID: 7400000, guid: c67e687da6409ef48b294fb4b0a48d5c, type: 2} | |
3630 | - - {fileID: 7400000, guid: cce493d72e67b4c49859605a34148c59, type: 2} | |
3631 | - - {fileID: 7400000, guid: d2fd3606f0e661044aee19011e22f191, type: 2} | |
3632 | - - {fileID: 7400000, guid: d50be78006beb2945a10f60a10832a15, type: 2} | |
3633 | - - {fileID: 7400000, guid: d5a9e2c65d62b07478c2a9c546209722, type: 2} | |
3634 | - - {fileID: 7400000, guid: d9d8762439eb57e43b4fd6cc957fd2bb, type: 2} | |
3635 | - - {fileID: 7400000, guid: e559c6348bb5e304aa4eccc562e061bb, type: 2} | |
3636 | - - {fileID: 7400000, guid: ea652f2c75fa62844afdcd1b896aa400, type: 2} | |
3637 | - - {fileID: 7400000, guid: ed250cdb586bb4b46b964189a7ce2788, type: 2} | |
3638 | - - {fileID: 7400000, guid: f30af7c2c0e25834596c036ffc483e8d, type: 2} | |
3639 | - - {fileID: 7400000, guid: f674d89e422b07a4384b425e639d0901, type: 2} | |
3640 | - - {fileID: 7400000, guid: f7f9e787f918e0f4a975903fc0866f68, type: 2} | |
3641 | - - {fileID: 7400000, guid: f9e186c4e38b30b458eb71901806aa4f, type: 2} | |
3597 | + - {fileID: 7400000, guid: edc0fe305be934cfdaf262b2372efc9f, type: 2} | |
3598 | + - {fileID: 7400000, guid: 9f404de03117c44fcbf5c4bebbdebc39, type: 2} | |
3599 | + - {fileID: 7400000, guid: e0b82ea10d92c45a49236639d7e127a7, type: 2} | |
3600 | + - {fileID: 7400000, guid: b90260b13c6b043008a3231f0e325d8b, type: 2} | |
3601 | + - {fileID: 7400000, guid: daceeb12c57434b03ab14733724787b0, type: 2} | |
3602 | + - {fileID: 7400000, guid: 094c9782dfd1a4419b4300050525a196, type: 2} | |
3603 | + - {fileID: 7400000, guid: 3ff67392ee17d46e8b75e23614754596, type: 2} | |
3604 | + - {fileID: 7400000, guid: 8c3b08031b41a4af6a38cddd30b6b711, type: 2} | |
3605 | + - {fileID: 7400000, guid: 9a03fa44cc4e74406a490fa7a601eb2d, type: 2} | |
3606 | + - {fileID: 7400000, guid: 38aa20a48a06548d9946da7f3491fd79, type: 2} | |
3607 | + - {fileID: 7400000, guid: 6867e7a4c4a93433b85dd978831a5789, type: 2} | |
3608 | + - {fileID: 7400000, guid: d3a14cd4d3aef472f81d58456286f1da, type: 2} | |
3609 | + - {fileID: 7400000, guid: 87310cd5c3519409081aad5bc7d001f4, type: 2} | |
3610 | + - {fileID: 7400000, guid: e5df376619b5547418da0a4bb053a736, type: 2} | |
3611 | + - {fileID: 7400000, guid: a55f62e68785e4f16b38373c27770c2c, type: 2} | |
3612 | + - {fileID: 7400000, guid: 773b86077b0a9459eb0d40f9c6147238, type: 2} | |
3613 | + - {fileID: 7400000, guid: 723477075e06c43dca279006c68f629a, type: 2} | |
3614 | + - {fileID: 7400000, guid: 922333c7fb2f24607a2b6bc7eddc0c92, type: 2} | |
3615 | + - {fileID: 7400000, guid: bd4784c7f8ccc4dd6b9c0d3bca313258, type: 2} | |
3616 | + - {fileID: 7400000, guid: 93c97cf7199d14c8a85c6a47dfe96fdd, type: 2} | |
3617 | + - {fileID: 7400000, guid: 9fac8b289e9c34268bade7f7dc070255, type: 2} | |
3618 | + - {fileID: 7400000, guid: 2fdb4638c75f24f0aabd6cc76fb610c4, type: 2} | |
3619 | + - {fileID: 7400000, guid: 7f65fa3885c054b49ae6e5271be81d3f, type: 2} | |
3620 | + - {fileID: 7400000, guid: 75289ce9809d340a39e5d2d9896ef14e, type: 2} | |
3621 | + - {fileID: 7400000, guid: 46db7a3a687d6491c87b272ba4a3af9b, type: 2} | |
3622 | + - {fileID: 7400000, guid: b0298c4a0832c4567a80f0293805f766, type: 2} | |
3623 | + - {fileID: 7400000, guid: 7ccd4c6ab0ec54ceaa2946562f1a9498, type: 2} | |
3624 | + - {fileID: 7400000, guid: 99e6d1fa06bef4cffb3985c33858ab7f, type: 2} | |
3625 | + - {fileID: 7400000, guid: 353f223b7116a4871a1ed9cb10953fec, type: 2} | |
3626 | + - {fileID: 7400000, guid: 48640d5b0a6804e8a892d7e3f9878338, type: 2} | |
3627 | + - {fileID: 7400000, guid: d9a3268b5233b489489a6b406f5b560d, type: 2} | |
3628 | + - {fileID: 7400000, guid: 255d4ddbbcdac46d9917908e6dc83fbf, type: 2} | |
3629 | + - {fileID: 7400000, guid: 0a25b7eb696464a9ba3fedba28052f44, type: 2} | |
3630 | + - {fileID: 7400000, guid: 3953996c14ada434e8bece627ea272fb, type: 2} | |
3631 | + - {fileID: 7400000, guid: 24ccfe8cc110546aab2e9ea1edab0997, type: 2} | |
3632 | + - {fileID: 7400000, guid: d902aa4db6b5e44fe9153e04e901b357, type: 2} | |
3633 | + - {fileID: 7400000, guid: 8b46d8bdc57654882b802d8a424bbc64, type: 2} | |
3634 | + - {fileID: 7400000, guid: e0e4fafd1c404477a9330c24fad5c5d5, type: 2} | |
3635 | + - {fileID: 7400000, guid: 3b02e44ef03c5471c873718351272938, type: 2} | |
3636 | + - {fileID: 7400000, guid: 9d20ba4e0319344f29101e050835449a, type: 2} | |
3637 | + - {fileID: 7400000, guid: a2f710de3a93149d981cfd3643c29f5d, type: 2} | |
3638 | + - {fileID: 7400000, guid: 212a470f4d8764d3aab828715dcceadd, type: 2} | |
3639 | + - {fileID: 7400000, guid: ad8d4c5f8f40746fb809287d36da0da4, type: 2} | |
3640 | + - {fileID: 7400000, guid: 8043026f4179c4e36bf9c52857439067, type: 2} | |
3641 | + - {fileID: 7400000, guid: 829700cfb4bf84f01a308423418d482d, type: 2} | |
3642 | 3642 | m_WrapMode: 0 |
3643 | 3643 | m_PlayAutomatically: 1 |
3644 | 3644 | m_AnimatePhysics: 0 | ... | ... |
Assets/Scripts/Export Video/ExportVideo.cs
... | ... | @@ -78,7 +78,7 @@ public class ExportVideo : MonoBehaviour { |
78 | 78 | } |
79 | 79 | |
80 | 80 | |
81 | - /* RunTime Android Permission being asked*/ | |
81 | + /* RunTime IOS Permission being asked*/ | |
82 | 82 | private void onClickExport() |
83 | 83 | { |
84 | 84 | PlayerLogger.Log("ExportVideo", "OnClickExport", "Starting Export..."); |
... | ... | @@ -90,7 +90,8 @@ public class ExportVideo : MonoBehaviour { |
90 | 90 | |
91 | 91 | |
92 | 92 | private void Permitted(bool PermissionGranted) |
93 | - { | |
93 | + { | |
94 | + PlayerLogger.Log ("ExportVideo", "Permitted", "Permission granted."); | |
94 | 95 | if (PermissionGranted) |
95 | 96 | { |
96 | 97 | int fiveTimesCount; | ... | ... |
Assets/Scripts/Export Video/MediaShareIOS.cs
... | ... | @@ -26,7 +26,6 @@ using System.IO; |
26 | 26 | |
27 | 27 | public class MediaShareIOS : MonoBehaviour { |
28 | 28 | private static string path; |
29 | - private string VlibrasFolder = "VLibras"; | |
30 | 29 | private string Filen = "VLibrasVideo_"; |
31 | 30 | private static string FilePath = ""; |
32 | 31 | |
... | ... | @@ -37,7 +36,6 @@ public class MediaShareIOS : MonoBehaviour { |
37 | 36 | { |
38 | 37 | path = Application.persistentDataPath; |
39 | 38 | PlayerLogger.Log("ExportVideo", "VideoDownload", "Writing at: " + path); |
40 | - /*FilePath se refere ao nome que o arquivo será salvo. Este deve ser mantido como está.*/ | |
41 | 39 | FilePath = Filen + CurrentTime + ".mp4"; |
42 | 40 | /* Checking if folder Vlibras exists*/ |
43 | 41 | DirectoryInfo dir = new DirectoryInfo(path); |
... | ... | @@ -53,18 +51,19 @@ public class MediaShareIOS : MonoBehaviour { |
53 | 51 | SourceStream.Write(videoContent, 0, bytes); |
54 | 52 | SourceStream.Close(); |
55 | 53 | #if UNITY_IOS |
56 | - ShareIOS.CallSendToGallery(Path.Combine(path,FilePath)); | |
54 | + Action<bool> callBack = (response) => { | |
55 | + if(response) | |
56 | + finishWriting(); | |
57 | + else | |
58 | + errorWriting(); | |
59 | + }; | |
60 | + ShareIOS.CallSendToGallery(Path.Combine(path,FilePath),callBack); | |
57 | 61 | #endif |
58 | - yield return new WaitForSeconds(1.0f); | |
59 | - | |
60 | - finishWriting(); | |
61 | - | |
62 | - | |
62 | + yield return new WaitForSeconds(1.0f); | |
63 | 63 | |
64 | 64 | } |
65 | 65 | else |
66 | 66 | { |
67 | - | |
68 | 67 | |
69 | 68 | errorWriting(); |
70 | 69 | } |
... | ... | @@ -73,6 +72,7 @@ public class MediaShareIOS : MonoBehaviour { |
73 | 72 | yield break; |
74 | 73 | |
75 | 74 | } |
75 | + | |
76 | 76 | |
77 | 77 | public void showAlert(string title,string message){ |
78 | 78 | #if UNITY_IOS |
... | ... | @@ -86,24 +86,16 @@ public class MediaShareIOS : MonoBehaviour { |
86 | 86 | public IEnumerator ShareIntent(Action errorAction) { |
87 | 87 | |
88 | 88 | #if UNITY_IOS |
89 | - if(File.Exists(Path.Combine(path,FilePath))){ | |
89 | + | |
90 | 90 | ShareIOS share = new ShareIOS(); |
91 | 91 | PlayerLogger.Log("MediaShareIOS","ShareIntent","Trying to share video."); |
92 | 92 | try{ |
93 | - share.Share("Vlibras Video",Path.Combine(path,FilePath),"",""); | |
93 | + share.Share("Vlibras Video","","",""); | |
94 | 94 | }catch(Exception e){ |
95 | 95 | PlayerLogger.Log("MediaShareIOS", "ShareIntent", "Message: " + e.Message); |
96 | 96 | PlayerLogger.Log("MediaShareIOS", "ShareIntent", "Message: " + e.StackTrace); |
97 | 97 | errorAction(); |
98 | 98 | } |
99 | - | |
100 | - }else{ | |
101 | - PlayerLogger.Log("MediaShareIOS","ShareIntent","File doesnt exist"); | |
102 | - errorAction(); | |
103 | - } | |
104 | - | |
105 | - | |
106 | - //GeneralSharingiOSBridge.ShareTextWithImage (Path.Combine(path, FilePath), "Vlibras video"); | |
107 | 99 | #endif |
108 | 100 | |
109 | 101 | yield break; | ... | ... |
Assets/Scripts/Export Video/ShareIOS.cs
... | ... | @@ -13,8 +13,10 @@ public class ShareIOS : MonoBehaviour { |
13 | 13 | private static ShareIOS instance; |
14 | 14 | |
15 | 15 | private static Action<bool> PermittedAction; |
16 | + private static Action<bool> SaveGallerySucess; | |
16 | 17 | private static bool initialized = false; |
17 | 18 | |
19 | + | |
18 | 20 | public void Awake() |
19 | 21 | { |
20 | 22 | instance = this; |
... | ... | @@ -85,7 +87,8 @@ public class ShareIOS : MonoBehaviour { |
85 | 87 | } |
86 | 88 | [DllImport ("__Internal")] private static extern void sendToGallery(ref ConfigStruct conf); |
87 | 89 | |
88 | - public static void CallSendToGallery(string path){ | |
90 | + public static void CallSendToGallery(string path,Action<bool>CallBack){ | |
91 | + SaveGallerySucess = CallBack; | |
89 | 92 | ConfigStruct conf = new ConfigStruct (); |
90 | 93 | conf.title = path; |
91 | 94 | conf.message = ""; |
... | ... | @@ -120,10 +123,28 @@ public class ShareIOS : MonoBehaviour { |
120 | 123 | } |
121 | 124 | |
122 | 125 | } |
123 | - PermittedAction = null; | |
126 | + | |
124 | 127 | |
125 | 128 | |
126 | 129 | } |
127 | 130 | |
131 | + private void SaveGalleryResponse(string response){ | |
132 | + if (!initialized) | |
133 | + initialize (); | |
134 | + if (SaveGallerySucess != null) { | |
135 | + if (response == "SUCESS") { | |
136 | + SaveGallerySucess (true); | |
137 | + | |
138 | + } else { | |
139 | + SaveGallerySucess (false); | |
140 | + } | |
141 | + | |
142 | + | |
143 | + | |
144 | + } | |
145 | + | |
146 | + | |
147 | + } | |
148 | + | |
128 | 149 | #endif |
129 | 150 | } | ... | ... |
Assets/Scripts/VoiceRecognition.cs
... | ... | @@ -34,7 +34,7 @@ public class VoiceRecognition { |
34 | 34 | |
35 | 35 | public VoiceRecognition() |
36 | 36 | { |
37 | -#if !UNITY_EDITOR | |
37 | + #if !UNITY_EDITOR && !UNITY_IOS | |
38 | 38 | unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); |
39 | 39 | currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"); |
40 | 40 | #endif |
... | ... | @@ -43,7 +43,7 @@ public class VoiceRecognition { |
43 | 43 | // Calls Google Speech from plugin method and returns recognized text |
44 | 44 | public string callRecognition() |
45 | 45 | { |
46 | -#if !UNITY_EDITOR | |
46 | +#if !UNITY_EDITOR && !UNITY_IOS | |
47 | 47 | voiceText = currentActivity.Call<string>("callGoogleSpeech"); |
48 | 48 | #endif |
49 | 49 | ... | ... |