React-Native FBSDK Share Dialog only works in simulator (iOS) - dialog

I'm trying to share a link through the React-Native-FBSDK library using the ShareDialog. I've got my code set up like so:
const shareContent = {
contentType: 'link',
contentDescription: 'Stuff here',
contentTitle: 'Share Title',
contentUrl: 'https://google.com',
imageUrl: someUrl
}
ShareDialog.canShow(shareContent).then((canShow) => {
canShow && ShareDialog.show(shareContent);
}
This code works in the simulator when it opens in a Safari WebView but when I load it on a device with the Facebook app installed, it opens a model over my app but it only uses the url I give it, then it fills in all the other data from the meta tags on the page instead of using my code. Is there something I need to do to get this to work with the native app?
.
iOS 10, react-native 0.30.0, react-native-fbsdk 0.4.0

I have the same issue. My solution is to use the ShareButton instead of ShareDialog. It works perfectly in my iPhone 10.2.
import {ShareButton} from "react-native-fbsdk";
const shareModel = {
contentType: 'link',
contentUrl: this.url,
contentTitle: this.title,
contentDescription: this.description,
imageUrl: this.thumb
};
<ShareButton shareContent={shareModel}/>

Related

How to minimize a prime ng dialog?

I would like to know how can I minimize a prime ng dialog box. I read this but it is not working in Angular 7.
Also, as per their site here, the property minimizable is not present
Also I am using the dialogService of primeng. Is there any way that I can minimize the dialog and continue working.
Demo code for reference where I am using dialog service to open the angular component:
showPopup(header: string, groupName: string, controlName: string) {
const dialogRef = this.dialogService.open(StandardParagrahPopupComponent, {
header: header,
width: '60%',
closable: true,
data: {
groupName: groupName
}
});
dialogRef.onClose.subscribe(comments =>
this.onPopupClose(comments, controlName)
);
}
Minimize is not working in PrimeNG for Angular.
It is only working in Primefaces for JavaServletFaces.
The first link you provides leads to Primefaces Showcase, the second to PrimeNG showcase. So it is correct that on the second link you canĀ“t find the minimize feature.

how to add urls to Flash white list in puppeteer

I develop small crawler with puppeteer in Node.js.
the target site has Flash contents, so I want to enable Flash in puppeteer.
by default, puppeteer is unable to use Flash and white list of permitted sites is empty.
I know how to enable Flash in puppeteer, but I don't know how to set white list.
How to do that?
Is there flag like this?
const browser = await puppeteer.launch({
headless: false,
args: [
'--ppapi-flash-path = {FLASH_PATH}',
'--white-url = {TARGET_URL}'
]
});
Or, is it only way to simply manipulate DOM in setting page in browser (ex.chrome://settings/content/flash)?
I've solved the problem myself.
I can't find the flag of Flash white list and manipulate DOM of chrome's setting page is too tiring for me, but I got useful some params.
1. 'userDataDir: {PROFILE_FILE}'
First, manually launch chrome or chromium, and add url to the list.
Then, set PROFILE_FILE as its user data path.
2. executablePath: '{PATH_TO_CHROME}'
Basically, run on chrome but not chromium, we can use Flash and HLS and etc. by default.
Set manually white list, and it works.
After much tinkering I found a Preferences file configuration that whitelists all flash content by default.
I've made a small puppeteer wrapper to make using this very easy: puppeteer.setExtra({allowFlash: true})
{
"profile": {
"content_settings": {
"exceptions": {
"flash_data": {
"*,*": {
"setting": {
"flashPreviouslyChanged": true
}
}
},
"permission_autoblocking_data": {
"*,*": {
"setting": {
"Flash": {
"dismiss_count": 1
}
}
}
},
"plugins": {
"*,*": {
"per_resource": {
"adobe-flash-player": 1
}
}
}
},
"pref_version": 1
}
}
}

Chrome DevTools Protocol: control new tabs

Need to be done: I need to simulate user interactions (journeys) across a chain of sites.
Question: Do you have any tips how to programatically controll a tab opened as a result of a simulated click?
My experience:
I'm using the chrome-remote-interface npm package.
I'm able to simulate a click with a custom ChromeController class which initializes the chrome-remote-interface and these methods:
async simulateClick(selector) {
return await this.evaluate(function (selector) {
document.querySelector(selector).click()
}, selector);
}
/**
* Shamelessly stolen from simple-headless-browser
*/
async evaluate (fn, ...args) {
const exp = args && args.length > 0 ? `(${String(fn)}).apply(null, ${JSON.stringify(args)})` : `(${String(fn)}).apply(null)`
const result = await this.client.Runtime.evaluate({
expression: exp,
returnByValue: true
})
return result
}
Now I would like to interact with the recently opened tab. I can get the targetId of the new tab with the experimenetal Target Domain (prototyping in node cli):
var targets;
chromeController.client.Target.getTargets().then(t => targets = t);
Which results in:
{ targetInfos:
[ { targetId: '97556479-cdb6-415c-97a1-6efa4e00b281',
type: 'page',
title: 'xxx/preview/239402/',
url: 'xxx/preview/239402/' },
{ targetId: 'bbfe11d5-8e4a-4879-9081-10bb7234209c',
type: 'page',
title: 'Document',
url: 'xxx/preview/239402/teaser/0/' } ] }
I am able to switch between the tabs with:
chromeController.client.Target.activateTarget({targetId:'xxx'})
However I'm not able to get any interaction with this, I can't find the connection, how to load it into the Page and Runtime objects.
I've searched in the docs and also tried googling: 'site:chromedevtools.github.io targetId' which only lead me to
> chromeController.client.Browser.getWindowForTarget({targetId: '97556479-cdb6-415c-97a1-6efa4e00b281'}).catch(e => console.log(e.message));
Promise { <pending> }
> 'Browser.getWindowForTarget' wasn't found
I've also tried to Target.setDiscoverTargets({discover: true}) and to close the original tab.
Thanks for any help!
Recently faced this same issue and in short I had to create a new dev tools protocol client for each new target I wanted control over.
My experience is with dev tools protocol using direct communication with websocket but the api is the same so it should be similar. So here is a summary of what I had to do.
Initially looking at the docs I would have assumed Target.attachToTarget should give us control of the new tab but I found that it didn't work.
My workaround was to create a listener that listened for the Target.targetCreated event which provides a targetInfos just like you found with Target.getTargets but for every new target created like a new tab, page, or iframe. Note: you need to enable Target.setDiscoverTargets in order to receive these events over the protocol.
[ { targetId: '97556479-cdb6-415c-97a1-6efa4e00b281',
type: 'page',
title: 'xxx/preview/239402/',
url: 'xxx/preview/239402/' },
{ targetId: 'bbfe11d5-8e4a-4879-9081-10bb7234209c',
type: 'page',
title: 'Document',
url: 'xxx/preview/239402/teaser/0/' } ] }
With that listener I looked for targets that were of type page, you could filter on a specific url if you know what the page will be. With the targetId in hand I requested available websocket targets following the HTTPEndpoints section near the bottom of the devtools home page.
GET /json or /json/list
A list of all available websocket targets.
[ {
"description": "",
"devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734",
"id": "DAB7FB6187B554E10B0BD18821265734",
"title": "Yahoo",
"type": "page",
"url": "https://www.yahoo.com/",
"webSocketDebuggerUrl": "ws://localhost:9222/devtools/page/DAB7FB6187B554E10B0BD18821265734"
} ]
I could then launch a new dev tools protocol client using the webSocketDebuggerUrl and have full control over the tab.
I know this is a pretty round about way but, its the only way I was able to make if work.
Although these days it's probably easier to use something like puppeteer to interface with multiple tabs in chrome if you can. Here is the source code to a puppeteer module that follows new tabs that could be good reference for trying to replicate it pageVideoStreamCollector.ts
This is a very late answer but just putting this here if anyone else has the same issue as help on chrome dev tools is very hard to come by. Hope it helps someone out.
I also am getting "Browser.getWindowForTarget wasn't found" on debian, google-chrome-unstable version 61

FineUploaderBasic for Azure nothing shows up

var uploader = new qq.azure.FineUploaderBasic({
debug: true,
element: document.getElementById("fine-uploader-gallery"),
signature: {
endpoint: '#Url.Action("GetUploadSASUrl", "Upload")'
},
uploadSuccess: {
endpoint: '#Url.Action("ProcessImage", "Upload")'
},
scaling: {
sendOriginal: false,
sizes: [
{ name: "", maxSize: 800 }
]
},
validation: {
allowedExtensions: ['jpeg', 'jpg', 'png']
}
});
</script>
Trying to create a FineUploader Basic instance for Azure but nothing shows up. What am I doing wrong?
I've added a debug: true directive but nothing shows up in the console. The initial script tag is there and a div with the id of "fine-uploader-gallery" is there. All the scripts and CSS are on the page.
Why would you expect something to "show up"? You are using Fine Uploader's "core" mode, which assumes you are providing the entire UI yourself and simply making use of the API, options, and events to drive it. If you want to render a default but customizable UI, you should use UI mode instead. More information about all of these can be found on the docs site at http://docs.fineuploader.com. Before you go any further, you should spend some time familiarizing yourself with these options.

FineUploader onComplete not firing with CoffeeScript

I'm creating my first project with FineUploader using Node.JS, Express, and CoffeeScript. Everything is working perfectly so far, with one exception. After the upload completes, I am returning a JSON object containing the success variable, as well as one other variable that is necessary to proceed. Unfortunately, I cannot successfully get the onComplete callback to fire. I believe all of my code is correct, and the Chrome console is not throwing any errors. I have also tried printing to the Chrome console in the onComplete method, but to no avail. Any assistance would be greatly appreciated.
uploader = new $("#collaboration-fine-uploader").fineUploader
autoUpload: false
multiple: false
validation:
allowedExtensions: ['pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
sizeLimit: 1024*1024*1024*10 # 10MB
text:
uploadButton: "<i class='icon-plus icon-white'></i> Select Files"
request:
endpoint: "/files/discussions/collaborations/upload"
callbacks:
onComplete: (id, fileName, responseJSON) ->
if (responseJSON.success)
alert "response success"
discussionId = responseJSON.discussionId
$.ajax
type: "GET"
url: "/courses/"+serverData.course._id+"/discussions/"+discussionId
beforeSend: (xhr) ->
xhr.setRequestHeader 'x-pjax', 'true'
success: (html) ->
# Replace the old html
$(".discussions-tab").html html
$(".new-discussion").slideUp()
$("#new-discussion-modal").deactivateModal()
# History push
window.history.pushState window.history.state, "Discussions", "/courses/"+serverData.course._id+"/discussions/"+discussionId
# Scroll to top
$.scrollTo 0
$(".trigger-upload-and-submit").on "click", (e) ->
e.preventDefault()
uploader.fineUploader "setParams",
discussion:
title: $(".new-collaboration .discussion-title").val()
body: $(".new-collaboration .discussion-body").val()
groupId: serverData.course._id
showProfessors: $(".new-collaboration .show-professor-checkbox").attr("checked")
showStudents: $(".new-collaboration .show-students-checkbox").attr("checked")
type: "Collaboration"
uploader.fineUploader("uploadStoredFiles")
Check the jQuery section of the documentation.
You need to listen for the 'complete' event if you are using the jQuery plugin.
uploader.on 'complete', (id, fileName, responseJSON) ->
if (responseJSON.success)
// Other code

Resources