Merge pull request #12854 from Florin9doi/ios_share

iOS : Share PPSSPP button
This commit is contained in:
Henrik Rydgård 2020-04-25 11:43:59 +02:00 committed by GitHub
commit 900316aeba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 1 deletions

View File

@ -535,7 +535,7 @@ void CreditsScreen::CreateViews() {
root_->Add(new Button("www.ppsspp.org", new AnchorLayoutParams(260, 64, 10, NONE, NONE, 10, false)))->OnClick.Handle(this, &CreditsScreen::OnPPSSPPOrg);
root_->Add(new Button(cr->T("Privacy Policy"), new AnchorLayoutParams(260, 64, 10, NONE, NONE, 84, false)))->OnClick.Handle(this, &CreditsScreen::OnPrivacy);
root_->Add(new Button(cr->T("Twitter @PPSSPP_emu"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, rightYOffset + 84, false)))->OnClick.Handle(this, &CreditsScreen::OnTwitter);
#if PPSSPP_PLATFORM(ANDROID)
#if PPSSPP_PLATFORM(ANDROID) || PPSSPP_PLATFORM(IOS)
root_->Add(new Button(cr->T("Share PPSSPP"), new AnchorLayoutParams(260, 64, NONE, NONE, 10, rightYOffset + 158, false)))->OnClick.Handle(this, &CreditsScreen::OnShare);
#endif
if (System_GetPropertyBool(SYSPROP_APP_GOLD)) {

View File

@ -12,6 +12,7 @@
@interface ViewController : GLKViewController <iCadeEventDelegate,
LocationHandlerDelegate, CameraFrameDelegate>
- (void)shareText:(NSString *)text;
- (void)shutdown;
@end

View File

@ -148,6 +148,14 @@ static LocationHelper *locationHelper;
- (void)subtleVolume:(SubtleVolume *)volumeView didChange:(CGFloat)value {
}
- (void)shareText:(NSString *)text {
NSArray *items = @[text];
UIActivityViewController * viewController = [[UIActivityViewController alloc] initWithActivityItems:items applicationActivities:nil];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentViewController:viewController animated:YES completion:nil];
});
}
- (void)viewSafeAreaInsetsDidChange {
if (@available(iOS 11.0, *)) {
[super viewSafeAreaInsetsDidChange];

View File

@ -114,6 +114,9 @@ void System_SendMessage(const char *command, const char *parameter) {
// [sharedViewController shutdown];
// exit(0);
// });
} else if (!strcmp(command, "sharetext")) {
NSString *text = [NSString stringWithUTF8String:parameter];
[sharedViewController shareText:text];
} else if (!strcmp(command, "camera_command")) {
if (!strncmp(parameter, "startVideo", 10)) {
int width = 0, height = 0;