Skip to content

Commit c89fced

Browse files
committed
chore: testing
1 parent a317790 commit c89fced

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

app/components/bottomsheet/BottomSheetInner.svelte

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import { computeDistanceBetween } from '~/utils/geo';
3333
import { share } from '@akylas/nativescript-app-utils/share';
3434
import { navigate } from '@shared/utils/svelte/ui';
35-
import { hideLoading, openLink, showLoading, showPopoverMenu, showSlidersPopover } from '~/utils/ui/index.common';
35+
import { hideLoading, openURL, showLoading, showPopoverMenu, showSlidersPopover } from '~/utils/ui/index.common';
3636
import { actionBarButtonHeight, colors } from '~/variables';
3737
import ElevationChart from '../chart/ElevationChart.svelte';
3838
import IconButton from '../common/IconButton.svelte';
@@ -149,15 +149,6 @@
149149
console.error(error, error.stack);
150150
}
151151
}
152-
function openURL(url) {
153-
const useInAppBrowser = ApplicationSettings. getBoolean("url_use_inapp_browser", true);
154-
if (useInAppBrowser) {
155-
openLink(url);
156-
} else {
157-
Utils.openUrl(url);
158-
}
159-
160-
}
161152
162153
function openWikipedia() {
163154
try {

app/components/items/ItemInfo.svelte

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import { networkService } from '~/services/NetworkService';
1515
import { showError } from '@shared/utils/showError';
1616
import { share } from '@akylas/nativescript-app-utils/share';
17-
import { openLink } from '~/utils/ui/index.common';
17+
import { openURL } from '~/utils/ui/index.common';
1818
import { actionBarButtonHeight, actionBarHeight, colors, fonts } from '~/variables';
1919
import IconButton from '../common/IconButton.svelte';
2020
import JsonViewer from './JSONViewer.svelte';
@@ -335,7 +335,7 @@
335335
try {
336336
switch (listItem.id) {
337337
case 'website':
338-
await openLink(listItem.subtitle);
338+
await openURL(listItem.subtitle);
339339
break;
340340
case 'phone':
341341
openUrl('tel:' + listItem.subtitle);
@@ -346,13 +346,13 @@
346346
});
347347
break;
348348
case 'wikipedia':
349-
await openLink(`https://en.wikipedia.org/wiki/${listItem.subtitle}`);
349+
await openURL(`https://en.wikipedia.org/wiki/${listItem.subtitle}`);
350350
break;
351351
case 'wikidata':
352-
await openLink(`https://www.wikidata.org/wiki/${listItem.subtitle}`);
352+
await openURL(`https://www.wikidata.org/wiki/${listItem.subtitle}`);
353353
break;
354354
case 'mapillary':
355-
await openLink(`https://www.mapillary.com/app/?pKey=${listItem.subtitle}&focus=photo`);
355+
await openURL(`https://www.mapillary.com/app/?pKey=${listItem.subtitle}&focus=photo`);
356356
break;
357357
default:
358358
if (listItem.expandable) {
@@ -402,7 +402,7 @@
402402
case 'operator':
403403
case 'wikidata':
404404
if (listItem.wikidata) {
405-
await openLink(`https://www.wikidata.org/wiki/${listItem.wikidata}`);
405+
await openURL(`https://www.wikidata.org/wiki/${listItem.wikidata}`);
406406
}
407407
break;
408408
case 'phone':

app/components/settings/Settings.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
186186
type: 'switch',
187187
key: 'url_use_inapp_browser',
188-
value: ApplicationSettings.getBoolean('url_use_inapp_browser', false),
188+
value: ApplicationSettings.getBoolean('url_use_inapp_browser', true),
189189
title: lc('url_use_inapp_browser')
190190
}
191191
].concat(__ANDROID__ ? [{

app/utils/ui/index.common.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import { lc } from '@nativescript-community/l';
33
import { MDCAlertControlerOptions, alert, confirm } from '@nativescript-community/ui-material-dialogs';
44
import { HorizontalPosition, PopoverOptions, VerticalPosition } from '@nativescript-community/ui-popover';
55
import { closePopover, showPopover } from '@nativescript-community/ui-popover/svelte';
6-
import { AlertOptions, Application, GridLayout, View } from '@nativescript/core';
6+
import { AlertOptions, Application, GridLayout, Utils, View } from '@nativescript/core';
77
import { SDK_VERSION, copyToClipboard, debounce } from '@nativescript/core/utils';
88
import { tryCatchFunction } from '@shared/utils/ui';
99
import { showError } from '@shared/utils/showError';
1010
import { navigate } from '@shared/utils/svelte/ui';
11-
import { hideLoading, showSnack, showToast } from '@shared/utils/ui';
11+
import { hideLoading, openLink, showSnack, showToast } from '@shared/utils/ui';
1212
import { ComponentProps } from 'svelte';
1313
import { ComponentInstanceInfo, resolveComponentElement } from 'svelte-native/dom';
1414
import { get } from 'svelte/store';
@@ -18,6 +18,15 @@ import { colors, fontScale, screenWidthDips } from '~/variables';
1818

1919
export * from '@shared/utils/ui';
2020

21+
export async function openURL(url) {
22+
const useInAppBrowser = ApplicationSettings. getBoolean("url_use_inapp_browser", true);
23+
if (useInAppBrowser) {
24+
return openLink(url);
25+
} else {
26+
Utils.openUrl(url);
27+
}
28+
}
29+
2130
export async function promptForGroup(defaultGroup: string, groups?: Group[]): Promise<string> {
2231
const TagView = (await import('~/components/common/TagView.svelte')).default;
2332
const componentInstanceInfo = resolveComponentElement(TagView, { groups, defaultGroup });

0 commit comments

Comments
 (0)