Flutter iOS: How to expose "Look Up" toolbarOptions in SelectableText? - ios

I'm developing an app in Flutter for iOS where the user can easily look-up a word using the built-in dictionaries.
I used SelectableText for text so that user could select a word and that toolbar options for the selected text could be displayed. Among the ToolbarOptions of SelectableText I see copy, cut, paste and selectAll but not lookUp nor share.
I didn't try yet, but I know that share is available through a flutter package called "share". How do I add a lookUp to the SelectableText's toolbar menu? Is there any package that I do not aware of or I should dive into native for this?
My current code:
SelectableText(
this.deck[index % this.deck.length].front,
style: kCardTextStyle,
toolbarOptions: ToolbarOptions(copy: true, /* share: ??? */))

Related

Detect empty, new tab openings in Google Chrome

I just published a Google Chrome extension which loads background images into new, empty tabs. The plugin is found here in the Chrome Web Store.
For detecting new and empty tabs, I need to ask for "tab" permissions in the extension's manifest.json. This, however, gives the extension the permission to read the browser's history. Not all users will want this and we don't actually need it. Is there a way to detect empty tabs without this permission requirement? Currently our check looks like this:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab){
if (changeInfo.status == "loading" && tab.url == 'chrome://newtab/')
{ /* load background into tab */ }
});
If you want to customize the new tab page you should add this to your manifest:
"chrome_url_overrides": {
"newtab": "newtab.html"
}
Then place the script you are currently injecting into new tab pages as a <script> tag in the newtab.html file. That won't cause that permission message.

Facebook SDK, how to hide "Share" title on iOS?

In my Unity3D application for iOS I want to share some info in Facebook. So I have used FB.ShareLink() method in this situation.
But when it shows Share dialog there are two buttons Cancel at the left side and Share at the right side, also there is a title with "Share" text.
How can I delete or hide that "Share" title in the middle of the window?
public override void ShareLink(
Uri contentURL,
string contentTitle,
string contentDescription,
Uri photoURL,
FacebookDelegate<IShareResult> callback)
{
MethodArguments args = new MethodArguments();
args.AddUri("content_url", contentURL);
args.AddString("content_title", contentTitle);
args.AddString("content_description", contentDescription);
args.AddUri("photo_url", photoURL);
var shareLinkCall = new JavaMethodCall<IShareResult>(this, "ShareLink");
shareLinkCall.Callback = callback;
shareLinkCall.Call(args);
}
This is the code that Facebook use for sharing on Android in Facebook Unity SDK. As I see, there is no way to modify share gui from unity plugin, because all of this processes are completed in java classes.
Edit: For editing an external .jar file look at this topic:
I have an external executable jar file that I wish to edit the java files in it with Eclipse

How Automatically On "Content Blocker" Extension in Safari section?

I am creating an Ad Blocker. I am just trying to Automatically on safari extension of "Content Blocker". I went through examples but did't found any solution. Is there any way to "ON" extension or manually we have to start it?
On iOS, Safari Content Blockers are disabled by default.
There is no way to automatically enable them from your app. You must instruct the user to:
Open the Settings app.
Go to Safari > Content Blockers.
Toggle on your Content Blocker extension.
On macOS (as of 10.12), a similar rule applies: Content Blocker extensions (bundled with your app) are disabled by default, and must be toggled on by the user in Safari Preferences > Extensions.
Assuming you want to test your "personal AdBlock program", first prepare a dummy HTML, with this line <div class="ads">hello</div>,
next apply your "personal AdBlock program", assuming it is JavaScript/CSS based and not proxy-like, you either hide, or remove the element (Node) from the DOM.
for example:
document.querySelector('div[class*="ads"]') -- this is nice and (very) generic way to find the element.
this is how to hide "the ads"
document.querySelector('div[class*="ads"]').style.display="none";
or, to make it stronger, related to other rules on the page, make it a local style + important notifier: document.querySelector('div[class*="ads"]').style.cssText="display:none !important;" ;
you can also remove the element (Node) from the DOM:
var e = document.querySelector('div[class*="ads"]') follow by:
e.parentNode.removeChild(e);
now, you probably want to see that "YOUR ADBLOCK" worked,
later (after the page has loaded, and your javascript code runned) type:
console.log(null === document.querySelector('div[class*="ads"]') ? "removed(success)" : "still here(failed)")
note that for this example (to make things simple) I assume there is only one div with that class in the page (avoiding loops :) ).
if you've just going to hide the element, you should query its current (most updated) style-condition, using a native method exist under window:
console.log("none" === window.getComputedStyle(document.querySelector('div[class*="ads"]')) ? "hidden(success)" : "still here(failed)")
Enjoy!

How to custom alignment in Sublime Text 2?

Well I'm using Sublime Text 2 for a lot of tasks, included the creation of documents with LaTeX. I downloaded and installed the alignmentpackage and works great when I want to align respect the = symbol. But in LaTeX I need to align also with respect to & and sometimes % but I don't understand where or how can I custom that. I read the documentation about that package here, and now I see I must go to Preferences > Package Settings > Alignment > Settings – User but there the only I see is:
{
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"font_size": 12.0,
"ignored_packages":
[
"Vintage",
"PyV8"
]
}
And I don't know what exactly should I add, and if it's before close the {} o later opening a new pair. Could someone help me with that?
On my mac you would need to look at Alignment/Base File.sublime-settings
// The mid-line characters to align in a multi-line selection, changing
// this to an empty array will disable mid-line alignment
"alignment_chars": ["="],
Add the characters you want to align on either to this file, or create a user settings file as you indicated.
"alignment_chars": ["=", "%", "&"],
The contents of the file you listed is actually your user system preferences, not the user settings file for Alignment.

Is there a DXL API to get the reference count of opened modules?

The "Manage Open Modules" dialog of DOORS 8.3 lists all open modules, their mode, if visible, etc. and the number of references. I want to use that reference count to decide if my script can securely close the module and to avoid closing if it is currently in use. I'm not sure what the "References" column displays exactly. I didn't find a description of it in the help or corresponding informations on the internet. Does anybody know if there is some undocumented DXL API which gives me access to that information?
Edit: I found the function refcount_ which returns an integer. But I have no idea what the return value means.
It looks like References refers to the number of open modules currently referencing that module. For example: when you open a module that has links, DOORS also opens in the background all of the Link Modules that the links use. So if I open a document that has links through LINKMOD_A, LINKMOD_A will show 1 reference. If I then open another document that has links through that same LINKMOD_A the number of references will increase to 2. I do not see the number of references ever higher than 1 on a Formal Module. Try this on some of your modules and see when you get more than one reference on a link module, then run your refcount_ function against that link module and see if you get the same number. I am not sure if that is the function you are looking for but it is certainly possible. Good Luck!
I assume your script is opening the modules, so all you need to do is check if it is already open first.
string sModuleFullName = "/Some/Module/Path"
Module oModule = module(sModuleFullName)
bool bClose = null(oModule)
if(null(oModule)) {
oModule = read(sModuleFullName, true,true)
}
// do stuff
if(bClose) {
close(oModule)
}
Edit:
Alternative method for closing modules opened by triggers, attribute or layout dxl
// Save currently open Modules to a Skip
Skip oOpenModulesSkip = createString()
Module oModule
for oModule in database do {
put(oOpenModulesSkip, fullName(oModule), fullName(oModule))
}
// do stuff
// Close Modules not in the Skip
for oModule in database do {
if(!find(oOpenModulesSkip, fullName(oModule))) {
close(oModule, false)
}
}
delete(oOpenModulesSkip)

Resources