-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Open OldDot links on Safari #5802
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this call blocked as well?
App/src/libs/actions/Report.js
Lines 755 to 758 in 24cc6ff
PushNotification.onSelected(PushNotification.TYPE.REPORT_COMMENT, ({reportID}) => { | |
Navigation.setDidTapNotification(); | |
Linking.openURL(`${CONST.DEEPLINK_BASE_URL}${ROUTES.getReportRoute(reportID)}`); | |
}); |
Is there no way to adapt this existing code? Looks very similar.
App/src/libs/asyncOpenURL/index.website.js
Lines 9 to 28 in 24cc6ff
export default function asyncOpenURL(promise, url) { | |
if (!url) { | |
return; | |
} | |
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); | |
if (!isSafari) { | |
promise.then(() => { | |
Linking.openURL(url); | |
}); | |
} else { | |
const windowRef = window.open(); | |
promise | |
.then(() => { | |
windowRef.location = url; | |
}) | |
.catch(() => windowRef.close()); | |
} | |
} |
One idea I have is to maybe make the url
parameter either a string or function. The function can take the .then()
value of the promise and return the url. Then you can do something like this...
const buildOldDotURL = ({shortLivedAuthToken}) => `${CONFIG.EXPENSIFY.URL_EXPENSIFY_COM}${url}${url.indexOf('?') === -1 ? '?' : '&'}authToken=${shortLivedAuthToken}&email=${encodeURIComponent(currentUserEmail)}`;
asyncOpenURL(API.GetShortLivedAuthToken(), buildOldDotURL);
Thanks for the review @marcaaron!
This call seems to work for me.
I'll take a look! I tried to adapt |
Updated with |
Open OldDot links on Safari (cherry picked from commit 6e74f2a)
🚀 Cherry-picked to staging by @luacmartins in version: 1.1.7-9 🚀
@Expensify/applauseleads please QA this PR and check it off on the deploy checklist if it passes. |
🚀 Deployed to production by @AndrewGable in version: 1.1.7-24 🚀
|
🚀 Deployed to staging by @luacmartins in version: 1.1.7-25 🚀
|
🚀 Deployed to production by @roryabraham in version: 1.1.8-9 🚀
|
Details
Safari blocks any pop up windows that are open within async calls. This PR adds a workaround to correctly open async links in Safari.
cc @tgolen
Fixed Issues
$ #5798
Tests
Pay Bills > View All Bills
Reimburse Receipts > View All Receipts
,Send Invoices > Send Invoice
, andSend Invoices > View All Invoices
.QA Steps
Steps above.
Tested On
Screenshots
Web
web-safari.mov
web-chrome.mov
Mobile Web
mWeb.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov
Note: my android emulator is not connecting to my VM, so the webpage does not load. However, the link shown in the browser is correct.