Commit b5376d0fd0f75e6f7c7ca76dfc14b64808e4f469
1 parent
4c01e0c9
Exists in
IosBuild
Fix Share
Showing
4 changed files
with
111 additions
and
101 deletions
Show diff stats
Assets/Plugins/IOS/iOSNativeShare.m
... | ... | @@ -14,106 +14,120 @@ extern UIViewController* UnityGetGLViewController(); |
14 | 14 | #endif |
15 | 15 | |
16 | 16 | +(id) withTitle:(char*)title withMessage:(char*)message{ |
17 | - | |
17 | + | |
18 | 18 | return [[iOSNativeShare alloc] initWithTitle:title withMessage:message]; |
19 | 19 | } |
20 | 20 | |
21 | 21 | -(id) initWithTitle:(char*)title withMessage:(char*)message{ |
22 | - | |
22 | + | |
23 | 23 | self = [super init]; |
24 | - | |
24 | + | |
25 | 25 | if( !self ) return self; |
26 | - | |
26 | + | |
27 | 27 | ShowAlertMessage([[NSString alloc] initWithUTF8String:title], [[NSString alloc] initWithUTF8String:message]); |
28 | - | |
28 | + | |
29 | 29 | return self; |
30 | - | |
30 | + | |
31 | 31 | } |
32 | 32 | |
33 | 33 | +(id) withTitle:(char*)path{ |
34 | - | |
34 | + | |
35 | 35 | return [[iOSNativeShare alloc] initWithTitle:path]; |
36 | 36 | } |
37 | 37 | |
38 | 38 | -(id) initWithTitle:(char*)path { |
39 | - | |
39 | + | |
40 | 40 | self = [super init]; |
41 | - | |
41 | + | |
42 | 42 | if( !self ) return self; |
43 | - | |
43 | + | |
44 | 44 | SendToGallery([[NSString alloc] initWithUTF8String:path]); |
45 | - | |
45 | + | |
46 | 46 | return self; |
47 | - | |
47 | + | |
48 | 48 | } |
49 | 49 | |
50 | 50 | void SendToGallery(NSString *path){ |
51 | 51 | if(UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(path)){ |
52 | - UISaveVideoAtPathToSavedPhotosAlbum (path,nil, nil, nil); | |
52 | + //UISaveVideoAtPathToSavedPhotosAlbum (path,self, nil, nil); | |
53 | + UISaveVideoAtPathToSavedPhotosAlbum (path,self, @selector(video:didFinishSavingWithError:contextInfo:), nil); | |
54 | + //ShowAlertMessage(@"Vlibras Vídeo",@"Video salvo na galeria."); | |
55 | + } | |
56 | +} | |
57 | + | |
58 | +- (void)video:(NSString*)videoPath didFinishSavingWithError:(NSError*)error contextInfo:(void*)contextInfo | |
59 | +{ | |
60 | + if (error) | |
61 | + { | |
62 | + ShowAlertMessage(@"Vlibras Vídeo",@"Error ao salvar vídeo."); | |
63 | + } | |
64 | + else | |
65 | + { | |
66 | + ShowAlertMessage(@"Vlibras Vídeo",@"Video salvo na galeria."); | |
53 | 67 | } |
54 | 68 | } |
55 | 69 | |
56 | 70 | void ShowAlertMessage (NSString *title, NSString *message){ |
57 | - | |
71 | + | |
58 | 72 | UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title |
59 | - | |
73 | + | |
60 | 74 | message:message |
61 | - | |
75 | + | |
62 | 76 | delegate:nil |
63 | - | |
77 | + | |
64 | 78 | cancelButtonTitle:@"OK" |
65 | - | |
79 | + | |
66 | 80 | otherButtonTitles: nil]; |
67 | - | |
81 | + | |
68 | 82 | [alert show]; |
69 | - | |
83 | + | |
70 | 84 | } |
71 | 85 | |
72 | 86 | +(id) withText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ |
73 | - | |
87 | + | |
74 | 88 | return [[iOSNativeShare alloc] initWithText:text withURL:url withImage:image withSubject:subject]; |
75 | 89 | } |
76 | 90 | |
77 | 91 | -(id) initWithText:(char*)text withURL:(char*)url withImage:(char*)image withSubject:(char*)subject{ |
78 | - | |
92 | + | |
79 | 93 | self = [super init]; |
80 | - | |
94 | + | |
81 | 95 | if( !self ) return self; |
82 | - | |
83 | - | |
84 | - | |
96 | + | |
97 | + | |
98 | + | |
85 | 99 | NSString *mText = text ? [[NSString alloc] initWithUTF8String:text] : nil; |
86 | - | |
100 | + | |
87 | 101 | NSString *mUrl = url ? [[NSString alloc] initWithUTF8String:url] : nil; |
88 | - | |
102 | + | |
89 | 103 | NSString *mImage = image ? [[NSString alloc] initWithUTF8String:image] : nil; |
90 | - | |
104 | + | |
91 | 105 | NSString *mSubject = subject ? [[NSString alloc] initWithUTF8String:subject] : nil; |
92 | - | |
93 | - | |
106 | + | |
107 | + | |
94 | 108 | //NSMutableArray *items = [NSMutableArray new]; |
95 | 109 | NSArray *postItems = [NSArray new]; |
96 | - | |
110 | + | |
97 | 111 | if(mImage != NULL && mImage.length > 0){ |
98 | - | |
112 | + | |
99 | 113 | NSFileManager *fileMgr = [NSFileManager defaultManager]; |
100 | 114 | if([fileMgr fileExistsAtPath:mImage]){ |
101 | - | |
115 | + | |
102 | 116 | //NSData *dataImage = [NSData dataWithContentsOfFile:mImage]; |
103 | - | |
117 | + | |
104 | 118 | // UIImage *imageFromUrl = [UIImage imageWithData:dataImage]; |
105 | 119 | NSData *data = [[NSData alloc] initWithContentsOfFile:mImage]; |
106 | 120 | NSURL *videoURL = [NSURL fileURLWithPath:mImage]; |
107 | - | |
121 | + | |
108 | 122 | // [items addObject:videoURL]; |
109 | 123 | postItems = @[videoURL]; |
110 | 124 | //NSArray *postItems = @[videoURL]; |
111 | 125 | }else{ |
112 | 126 | ShowAlertMessage(@"Error", @"Cannot find image"); |
113 | 127 | } |
114 | - | |
128 | + | |
115 | 129 | } |
116 | - | |
130 | + | |
117 | 131 | // UIActivityViewController *activity = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:Nil]; |
118 | 132 | // |
119 | 133 | // if(mSubject != NULL) { |
... | ... | @@ -133,7 +147,7 @@ void ShowAlertMessage (NSString *title, NSString *message){ |
133 | 147 | // UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activity]; |
134 | 148 | // [popup presentPopoverFromRect:CGRectMake(rootViewController.view.frame.size.width/2, rootViewController.view.frame.size.height/4, 0, 0)inView:rootViewController.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; |
135 | 149 | // } |
136 | - | |
150 | + | |
137 | 151 | UIActivityViewController *activityVc = [[UIActivityViewController alloc]initWithActivityItems:postItems applicationActivities:nil]; |
138 | 152 | if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && [activityVc respondsToSelector:@selector(popoverPresentationController)] ) { |
139 | 153 | UIPopoverController *popup = [[UIPopoverController alloc] initWithContentViewController:activityVc]; |
... | ... | @@ -142,15 +156,15 @@ void ShowAlertMessage (NSString *title, NSString *message){ |
142 | 156 | } |
143 | 157 | else |
144 | 158 | [[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:activityVc animated:YES completion:nil]; |
145 | - | |
146 | - | |
159 | + | |
160 | + | |
147 | 161 | return self; |
148 | 162 | } |
149 | 163 | |
150 | 164 | -(BOOL) isStringValideBase64:(NSString*)string{ |
151 | - | |
152 | - NSString *regExPattern = @"^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"; | |
153 | - | |
165 | + | |
166 | + NSString regExPattern = @"^(?:[A-Za-z0-9+/]{4})(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"; | |
167 | + | |
154 | 168 | NSRegularExpression *regEx = [[NSRegularExpression alloc] initWithPattern:regExPattern options:NSRegularExpressionCaseInsensitive error:nil]; |
155 | 169 | NSUInteger regExMatches = [regEx numberOfMatchesInString:string options:0 range:NSMakeRange(0, [string length])]; |
156 | 170 | return regExMatches != 0; | ... | ... |
Assets/Resources/ANIMS/Ç.anim
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: e0b82ea10d92c45a49236639d7e127a7, type: 2} | |
3595 | + m_Animation: {fileID: 7400000, guid: 365e5f41595503c48915848d883fabfe, type: 2} | |
3596 | 3596 | m_Animations: |
3597 | - - {fileID: 7400000, guid: 094c9782dfd1a4419b4300050525a196, type: 2} | |
3598 | - - {fileID: 7400000, guid: 0a25b7eb696464a9ba3fedba28052f44, type: 2} | |
3599 | - - {fileID: 7400000, guid: 212a470f4d8764d3aab828715dcceadd, type: 2} | |
3600 | - - {fileID: 7400000, guid: 24ccfe8cc110546aab2e9ea1edab0997, type: 2} | |
3601 | - - {fileID: 7400000, guid: 255d4ddbbcdac46d9917908e6dc83fbf, type: 2} | |
3602 | - - {fileID: 7400000, guid: 2fdb4638c75f24f0aabd6cc76fb610c4, type: 2} | |
3603 | - - {fileID: 7400000, guid: 353f223b7116a4871a1ed9cb10953fec, type: 2} | |
3604 | - - {fileID: 7400000, guid: 38aa20a48a06548d9946da7f3491fd79, type: 2} | |
3605 | - - {fileID: 7400000, guid: 3953996c14ada434e8bece627ea272fb, type: 2} | |
3606 | - - {fileID: 7400000, guid: 3b02e44ef03c5471c873718351272938, type: 2} | |
3607 | - - {fileID: 7400000, guid: 3ff67392ee17d46e8b75e23614754596, type: 2} | |
3608 | - - {fileID: 7400000, guid: 46db7a3a687d6491c87b272ba4a3af9b, type: 2} | |
3609 | - - {fileID: 7400000, guid: 48640d5b0a6804e8a892d7e3f9878338, type: 2} | |
3610 | - - {fileID: 7400000, guid: 6867e7a4c4a93433b85dd978831a5789, type: 2} | |
3611 | - - {fileID: 7400000, guid: 723477075e06c43dca279006c68f629a, type: 2} | |
3612 | - - {fileID: 7400000, guid: 75289ce9809d340a39e5d2d9896ef14e, type: 2} | |
3613 | - - {fileID: 7400000, guid: 773b86077b0a9459eb0d40f9c6147238, type: 2} | |
3614 | - - {fileID: 7400000, guid: 7ccd4c6ab0ec54ceaa2946562f1a9498, type: 2} | |
3615 | - - {fileID: 7400000, guid: 7f65fa3885c054b49ae6e5271be81d3f, type: 2} | |
3616 | - - {fileID: 7400000, guid: 8043026f4179c4e36bf9c52857439067, type: 2} | |
3617 | - - {fileID: 7400000, guid: 829700cfb4bf84f01a308423418d482d, type: 2} | |
3618 | - - {fileID: 7400000, guid: 87310cd5c3519409081aad5bc7d001f4, type: 2} | |
3619 | - - {fileID: 7400000, guid: 8b46d8bdc57654882b802d8a424bbc64, type: 2} | |
3620 | - - {fileID: 7400000, guid: 8c3b08031b41a4af6a38cddd30b6b711, type: 2} | |
3621 | - - {fileID: 7400000, guid: 922333c7fb2f24607a2b6bc7eddc0c92, type: 2} | |
3622 | - - {fileID: 7400000, guid: 93c97cf7199d14c8a85c6a47dfe96fdd, type: 2} | |
3623 | - - {fileID: 7400000, guid: 99e6d1fa06bef4cffb3985c33858ab7f, type: 2} | |
3624 | - - {fileID: 7400000, guid: 9a03fa44cc4e74406a490fa7a601eb2d, type: 2} | |
3625 | - - {fileID: 7400000, guid: 9d20ba4e0319344f29101e050835449a, type: 2} | |
3626 | - - {fileID: 7400000, guid: 9f404de03117c44fcbf5c4bebbdebc39, type: 2} | |
3627 | - - {fileID: 7400000, guid: 9fac8b289e9c34268bade7f7dc070255, type: 2} | |
3628 | - - {fileID: 7400000, guid: a2f710de3a93149d981cfd3643c29f5d, type: 2} | |
3629 | - - {fileID: 7400000, guid: a55f62e68785e4f16b38373c27770c2c, type: 2} | |
3630 | - - {fileID: 7400000, guid: ad8d4c5f8f40746fb809287d36da0da4, type: 2} | |
3631 | - - {fileID: 7400000, guid: b0298c4a0832c4567a80f0293805f766, type: 2} | |
3632 | - - {fileID: 7400000, guid: b90260b13c6b043008a3231f0e325d8b, type: 2} | |
3633 | - - {fileID: 7400000, guid: bd4784c7f8ccc4dd6b9c0d3bca313258, type: 2} | |
3634 | - - {fileID: 7400000, guid: d3a14cd4d3aef472f81d58456286f1da, type: 2} | |
3635 | - - {fileID: 7400000, guid: d902aa4db6b5e44fe9153e04e901b357, type: 2} | |
3636 | - - {fileID: 7400000, guid: d9a3268b5233b489489a6b406f5b560d, type: 2} | |
3637 | - - {fileID: 7400000, guid: daceeb12c57434b03ab14733724787b0, type: 2} | |
3638 | - - {fileID: 7400000, guid: e0b82ea10d92c45a49236639d7e127a7, type: 2} | |
3639 | - - {fileID: 7400000, guid: e0e4fafd1c404477a9330c24fad5c5d5, type: 2} | |
3640 | - - {fileID: 7400000, guid: e5df376619b5547418da0a4bb053a736, type: 2} | |
3641 | - - {fileID: 7400000, guid: edc0fe305be934cfdaf262b2372efc9f, type: 2} | |
3597 | + - {fileID: 7400000, guid: f1f36f20657e5244e9c1e21117d9a452, type: 2} | |
3598 | + - {fileID: 7400000, guid: 55bec2c04d14e74488ef127ee380a080, type: 2} | |
3599 | + - {fileID: 7400000, guid: b368bfe0efa37c04bb9c661058ccedb9, type: 2} | |
3600 | + - {fileID: 7400000, guid: 365e5f41595503c48915848d883fabfe, type: 2} | |
3601 | + - {fileID: 7400000, guid: fa9ef8a15fe08a143bc89dc00289fc17, type: 2} | |
3602 | + - {fileID: 7400000, guid: 939bebf16bb2dba44894c5745c5dc1f8, type: 2} | |
3603 | + - {fileID: 7400000, guid: aecdf652be04b444f84644ba7c403960, type: 2} | |
3604 | + - {fileID: 7400000, guid: 53ed20623f5573345a4fb057db454b05, type: 2} | |
3605 | + - {fileID: 7400000, guid: b0bafda258c57414ebfbc4cf89719795, type: 2} | |
3606 | + - {fileID: 7400000, guid: 67caa6e2d05387848a9448b57fffcb0f, type: 2} | |
3607 | + - {fileID: 7400000, guid: a79227e28dd60fa4c9812a51ab9d455e, type: 2} | |
3608 | + - {fileID: 7400000, guid: 8b1d930398178064795f5d23af67dce4, type: 2} | |
3609 | + - {fileID: 7400000, guid: af8192a32a30ab746be40ff1dcb8bc0a, type: 2} | |
3610 | + - {fileID: 7400000, guid: e282c734045b47241988e2b9fdf0dc7e, type: 2} | |
3611 | + - {fileID: 7400000, guid: 698d03f46785361449a10cc0003862eb, type: 2} | |
3612 | + - {fileID: 7400000, guid: e193836512c744c4299651990fc3ca10, type: 2} | |
3613 | + - {fileID: 7400000, guid: c4d452a56e2f4ee4a83e5679f969a354, type: 2} | |
3614 | + - {fileID: 7400000, guid: 220a675640cc72d4f9c8d364c9a377b4, type: 2} | |
3615 | + - {fileID: 7400000, guid: 9a1e34a6954967f4fb3982394bf61eef, type: 2} | |
3616 | + - {fileID: 7400000, guid: 039911b68664f7b40b97e2665893a1e5, type: 2} | |
3617 | + - {fileID: 7400000, guid: b4a4a507b5b85404f9ca30cf2855b359, type: 2} | |
3618 | + - {fileID: 7400000, guid: 3b67cb87e08f4e34badc00f7b49d2591, type: 2} | |
3619 | + - {fileID: 7400000, guid: dc854de773a9e3f488c7a1b42d6a460b, type: 2} | |
3620 | + - {fileID: 7400000, guid: 21b376087ddd4ec46a1da0c3ba1181d9, type: 2} | |
3621 | + - {fileID: 7400000, guid: db84b318b67dbc54fa1fab6d31dfeb6e, type: 2} | |
3622 | + - {fileID: 7400000, guid: 47e5da18eda740844ba111cfab49d0eb, type: 2} | |
3623 | + - {fileID: 7400000, guid: ba9dc32834cf193429f27449b1d9d701, type: 2} | |
3624 | + - {fileID: 7400000, guid: 22f7b3c892f0e5e41b120798d7953026, type: 2} | |
3625 | + - {fileID: 7400000, guid: 9396f2d833a082446b36b0cda61ba87c, type: 2} | |
3626 | + - {fileID: 7400000, guid: 289449396bffd4045b8657269df378f2, type: 2} | |
3627 | + - {fileID: 7400000, guid: 99bb7e6adbe6d5f4984c51d5d5e92045, type: 2} | |
3628 | + - {fileID: 7400000, guid: b6faf58a03a0dc24cb9777c70fda828b, type: 2} | |
3629 | + - {fileID: 7400000, guid: b2b18bfa970783a4ab32945b1c4bc54b, type: 2} | |
3630 | + - {fileID: 7400000, guid: a8b0488b23a43b3499d2b1d8b81f0707, type: 2} | |
3631 | + - {fileID: 7400000, guid: ccdf6bab5e56c0447abfc0a8f745b62c, type: 2} | |
3632 | + - {fileID: 7400000, guid: 8d2c7cdb67fea144e9660db7edd82239, type: 2} | |
3633 | + - {fileID: 7400000, guid: 6191f3fb2e8027b48ac60aa48c11065d, type: 2} | |
3634 | + - {fileID: 7400000, guid: dbf77a3c567182846bad50598584109d, type: 2} | |
3635 | + - {fileID: 7400000, guid: d2f41e4d1ce31a4458ccdab2cd91faae, type: 2} | |
3636 | + - {fileID: 7400000, guid: fc72e7fd88de0b94fb9b050fc1368547, type: 2} | |
3637 | + - {fileID: 7400000, guid: 5b7bf0ae891107f4aaa366ba42eac9ee, type: 2} | |
3638 | + - {fileID: 7400000, guid: d9c72b1fb167df045ae7ac711d1dee6c, type: 2} | |
3639 | + - {fileID: 7400000, guid: d927185f3fb021844834f7086d346e3a, type: 2} | |
3640 | + - {fileID: 7400000, guid: e62d77cfc7d0d104b84d8beb5ef72c33, type: 2} | |
3641 | + - {fileID: 7400000, guid: 1dd400df2179f94469eb2480a313a8cf, type: 2} | |
3642 | 3642 | m_WrapMode: 0 |
3643 | 3643 | m_PlayAutomatically: 1 |
3644 | 3644 | m_AnimatePhysics: 0 | ... | ... |
Assets/Scripts/Export Video/MediaShareIOS.cs
... | ... | @@ -46,17 +46,18 @@ public class MediaShareIOS : MonoBehaviour { |
46 | 46 | dir.Create(); |
47 | 47 | } |
48 | 48 | |
49 | - try | |
50 | - { | |
49 | + | |
51 | 50 | FileStream SourceStream = new FileStream(Path.Combine(path, FilePath), FileMode.OpenOrCreate); |
52 | 51 | if (SourceStream.CanWrite) |
53 | 52 | { |
54 | 53 | SourceStream.Write(videoContent, 0, bytes); |
55 | 54 | SourceStream.Close(); |
56 | 55 | ShareIOS.CallSendToGallery(Path.Combine(path,FilePath)); |
56 | + yield return new WaitForSeconds(0.5f); | |
57 | + | |
57 | 58 | finishWriting(); |
58 | 59 | |
59 | - yield break; | |
60 | + | |
60 | 61 | |
61 | 62 | } |
62 | 63 | else |
... | ... | @@ -67,13 +68,8 @@ public class MediaShareIOS : MonoBehaviour { |
67 | 68 | } |
68 | 69 | |
69 | 70 | |
70 | - } | |
71 | - catch (Exception e) | |
72 | - { | |
73 | - PlayerLogger.Log("MediaShareIOS", "WriteOnIOS", "Message: " + e.Message); | |
74 | - PlayerLogger.Log("MediaShareIOS", "WriteOnIOS", "Message: " + e.StackTrace); | |
75 | - errorWriting(); | |
76 | - } | |
71 | + | |
72 | + | |
77 | 73 | |
78 | 74 | yield break; |
79 | 75 | ... | ... |