Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change close text / done button #70

Open
hirbod opened this issue Jun 28, 2017 · 14 comments
Open

Change close text / done button #70

hirbod opened this issue Jun 28, 2017 · 14 comments

Comments

@hirbod
Copy link

hirbod commented Jun 28, 2017

Hi @EddyVerbruggen ,

is it possible to change the "Done" Button text? I know it's not implemented, but prob. possible to implement? Any Ideas? Also, is it possible to "lift it up" on iPad like it does on the iPhone? Is it possible to decide where the "done" button has to be? (on the right side e.g. instead of the left)

I know these are many questions, but I am just asking what my customer was asking :D

Thanks for your support

@jvjvjv
Copy link

jvjvjv commented Aug 8, 2017

  • "Done" button text. This feature will only be available for iOS 11+.
  • Position of button. It doesn't look like this is configurable.

@EddyVerbruggen
Copy link
Owner

@jvjvjv Can you please link to the doc for that iOS 11+ feature? Thx!

@jayj
Copy link

jayj commented Aug 30, 2017

@EddyVerbruggen Here's a link: https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller.dismissbuttonstyle
Looks like it supports "Done", "Close", and "Cancel".

Here's some screenshots from a pdf I found (page 86-90)
image

@EddyVerbruggen
Copy link
Owner

@simonwatt
Copy link

@EddyVerbruggen Now that iOS 11 is out of beta is it likely that dismissButtonStyle will be added as a configurable option to the plugin?

@EddyVerbruggen
Copy link
Owner

Anyone up for the challenge?

@jvjvjv
Copy link

jvjvjv commented Oct 5, 2017

@EddyVerbruggen @simonwatt Got a deadline on this? I've already created a branch.

@jvjvjv
Copy link

jvjvjv commented Oct 5, 2017

Oh goodness. All the errors I'm getting in the XCode project now!
No visible @interface for 'SafariViewController' declares the selector 'getTransitionStyle:'
is one of them. And I keep seeing similar errors for each option. Any ideas why this is happening now?

@simonwatt
Copy link

@jvjvjv Did you ever end up having any success with getting this to work?

@nivaldocavalcanti
Copy link

nivaldocavalcanti commented Nov 14, 2020

I know this is an old question but I hope this might help someone...

I put dismissButton: 1 in options:

SafariViewController.show({
    url: 'http://your-url.com',
    hidden: false, // default false. You can use this to load cookies etc in the background (see issue #1 for details).
    animated: false, // default true, note that 'hide' will reuse this preference (the 'Done' button will always animate though)
    transition: 'slide', // (this only works in iOS 9.1/9.2 and lower) unless animated is false you can choose from: curl, flip, fade, slide (default)
    enterReaderModeIfAvailable: false, // default false
    dismissButton: 1, //0 - Done, 1 - Close, 2 - Cancel
    tintColor: "#00ffff", // default is ios blue
    barColor: "#0000ff", // on iOS 10+ you can change the background color as well
    controlTintColor: "#ffffff" // on iOS 10+ you can override the default tintColor
},
...

And in SafariViewController.m file I put this code below right after vc.delegate = self:

NSNumber *dismissButton = options[@"dismissButton"];
if(dismissButton != nil){
    vc.dismissButtonStyle = [dismissButton intValue];
}

According to @jayj comment and Apple documentation now I can choose Done, Close or Cancel label for dismiss button. =)

I'm using deployment target iOS 12.

@javierjsp
Copy link

I know this is an old question but I hope this might help someone...

I put dismissButton: 1 in options:

SafariViewController.show({
    url: 'http://your-url.com',
    hidden: false, // default false. You can use this to load cookies etc in the background (see issue #1 for details).
    animated: false, // default true, note that 'hide' will reuse this preference (the 'Done' button will always animate though)
    transition: 'slide', // (this only works in iOS 9.1/9.2 and lower) unless animated is false you can choose from: curl, flip, fade, slide (default)
    enterReaderModeIfAvailable: false, // default false
    dismissButton: 1, //0 - Done, 1 - Close, 2 - Cancel
    tintColor: "#00ffff", // default is ios blue
    barColor: "#0000ff", // on iOS 10+ you can change the background color as well
    controlTintColor: "#ffffff" // on iOS 10+ you can override the default tintColor
},
...

And in SafariViewController.m file I put this code below right after vc.delegate = self:

NSNumber *dismissButton = options[@"dismissButton"];
if(dismissButton != nil){
    vc.dismissButtonStyle = [dismissButton intValue];
}

According to @jayj comment and Apple documentation now I can choose Done, Close or Cancel label for dismiss button. =)

I'm using deployment target iOS 12.

this should be a pull request, nice @nivaldocavalcanti , and maybe for Ionic developers need to update
index.d.ts on @ionic-native\safari-view-controller\ngx put below url?: string; -> dismissButton?: number; in order to use dismissButton inside the options of .show({}) otherwise a error will show on console because that variable not exist on interface SafariViewControllerOptions

@WuglyakBolgoink
Copy link

I put dismissButton: 1 in options:

SafariViewController.show({
    url: 'http://your-url.com',
    hidden: false, // default false. You can use this to load cookies etc in the background (see issue #1 for details).
    animated: false, // default true, note that 'hide' will reuse this preference (the 'Done' button will always animate though)
    transition: 'slide', // (this only works in iOS 9.1/9.2 and lower) unless animated is false you can choose from: curl, flip, fade, slide (default)
    enterReaderModeIfAvailable: false, // default false
    dismissButton: 1, //0 - Done, 1 - Close, 2 - Cancel
    tintColor: "#00ffff", // default is ios blue
    barColor: "#0000ff", // on iOS 10+ you can change the background color as well
    controlTintColor: "#ffffff" // on iOS 10+ you can override the default tintColor
},
...

any progress on this?

@hirbod
Copy link
Author

hirbod commented Mar 29, 2022

Still people out there using Cordova? 😅

@snblackout
Copy link

Still people out there using Cordova? 😅

Unfortunately, yes. LOL Legacy code be damned. We are planning migration to new stuff though. But things still work, so tweaking things here and there makes more sense until a full re-write is completed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants