Skip to content

Commit

Permalink
chore: ogging
Browse files Browse the repository at this point in the history
  • Loading branch information
farfromrefug committed Nov 18, 2024
1 parent 35fdfcf commit 67d8499
Show file tree
Hide file tree
Showing 16 changed files with 31 additions and 23 deletions.
6 changes: 3 additions & 3 deletions app/components/bottomsheet/BottomSheetInner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import { packageService } from '~/services/PackageService';
import { showError } from '@shared/utils/showError';
import { computeDistanceBetween } from '~/utils/geo';
import { share } from '@shared/utils/share';
import { share } from '@akylas/nativescript-app-utils/share';
import { navigate } from '@shared/utils/svelte/ui';
import { hideLoading, openLink, showLoading, showPopoverMenu } from '~/utils/ui/index.common';
import { actionBarButtonHeight, colors } from '~/variables';
Expand Down Expand Up @@ -137,7 +137,7 @@
const { highlight, onPathIndex, remainingDistance, remainingTime } = chartLoadHighlightData;
elevationChart.hilghlightPathIndex(onPathIndex, remainingDistance, remainingTime, highlight, false);
} catch (error) {
console.error(error);
console.error(error, error.stack);
} finally {
chartLoadHighlightData = null;
}
Expand Down Expand Up @@ -189,7 +189,7 @@
}
}
} catch (err) {
console.error(err);
console.error(err, err.stack);
if (query) {
const url = `https://duckduckgo.com/?kae=d&ks=s&ko=-2&kaj=m&k1=-1&q=${encodeURIComponent(query).toLowerCase().replace('/s+/g', '+')}`;
openLink(url);
Expand Down
1 change: 0 additions & 1 deletion app/components/common/OptionSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@
boxType={item.boxType}
checked={item.value}
col={item.boxType === 'circle' ? 0 : 2}
ios:marginRight={10}
verticalAlignment="center"
on:checkedChange={(e) => onCheckedChanged(item, e)} />
</ListItem>
Expand Down
2 changes: 1 addition & 1 deletion app/components/directions/DirectionsPanel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
profileCostingOptions = profileCostingOptions; // for svelte to see the update
saveProfileSettings(profile);
} catch (error) {
console.error(key, error);
console.error(key, error, error.stack);
}
}
// function valhallaSettingColor(key: string, options: any = profileCostingOptions) {
Expand Down
2 changes: 1 addition & 1 deletion app/components/items/IconChooser.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
canvas.drawText(item.icon, w / 2, h / 2 + 10, iconPaint);
}
} catch (err) {
console.error(err);
console.error(err, err.stack);
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion app/components/items/ItemInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import { Item } from '~/models/Item';
import { networkService } from '~/services/NetworkService';
import { showError } from '@shared/utils/showError';
import { share } from '@shared/utils/share';
import { share } from '@akylas/nativescript-app-utils/share';
import { openLink } from '~/utils/ui/index.common';
import { actionBarButtonHeight, actionBarHeight, colors, fonts } from '~/variables';
import IconButton from '../common/IconButton.svelte';
Expand Down
18 changes: 13 additions & 5 deletions app/components/items/ItemsList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
let loading = false;
function onNavigatedTo(args: NavigatedData) {
DEV_LOG && console.log('onNavigatedTo', args.isBackNavigation, navigatedTo);
if (!args.isBackNavigation && !navigatedTo) {
navigatedTo = true;
if (isServiceStarted()) {
Expand All @@ -65,6 +66,7 @@
}
}
onServiceStarted(() => {
DEV_LOG && console.log('onServiceStarted', needsFirstRefresh, navigatedTo);
if (navigatedTo && needsFirstRefresh) {
refresh();
}
Expand Down Expand Up @@ -129,15 +131,16 @@
return;
}
const firstLoad = !!needsFirstRefresh;
DEV_LOG && console.log('refresh');
needsFirstRefresh = false;
loading = true;
// if itemslist is opened too fast the db might not be fully initialized
itemsModule.onDbInit(async () => {
try {
nbSelected = 0;
if (firstLoad) {
const result = await itemsModule.itemRepository.database.query(SqlQuery.createFromTemplateString`SELECT COUNT(*) FROM Items WHERE "route" IS NOT NULL`);
tabIndex = result[0]['COUNT(*)'] > 0 ? 0 : 1;
// const result = await itemsModule.itemRepository.database.query(SqlQuery.createFromTemplateString`SELECT COUNT(*) FROM Items WHERE "route" IS NOT NULL`);
// tabIndex = result[0]['COUNT(*)'] > 0 ? 0 : 1;
}
const searchArgs = {
where: tabIndex === 1 ? SqlQuery.createFromTemplateString`"route" IS NULL` : SqlQuery.createFromTemplateString`"route" IS NOT NULL`,
Expand All @@ -151,7 +154,8 @@ LEFT JOIN (
) t USING (id)`
};
const sqlItems = (await itemsModule.itemRepository.searchItem(searchArgs)).map((i) => ({ ...i }));
const oldGroups = groups;
DEV_LOG && console.log('sqlItems', sqlItems, groups);
const oldGroups = groups;
groups = groupBy<Group>(await itemsModule.groupsRepository.search(), (i) => i.name);
if (!groups['none']) {
await itemsModule.groupsRepository.create({ id: Date.now() + '', name: 'none', onMap: 1, collapse: 0 });
Expand All @@ -164,7 +168,9 @@ LEFT JOIN (
// }
// });
// }
groupedItems = groupByArray<Item>(sqlItems, (i) => i.groups);
DEV_LOG && console.log('groups', groups);
groupedItems = groupByArray<Item>(sqlItems, (i) => i.groups);
DEV_LOG && console.log('groupedItems', groupedItems);
const groupsCount = Object.keys(groupedItems).length;
const noneGroupItems: CollectionItem[] = groupsCount > 1 ? [] : groupedItems['none'] || [];
if (groupsCount === 1) {
Expand Down Expand Up @@ -308,6 +314,7 @@ LEFT JOIN (
DEV_LOG && console.log('deleteItem group', group, groupIndex, groupedForItem.length);
if (groupIndex >= 0) {
const groupItem = items.getItem(groupIndex) as CollectionGroup;
DEV_LOG && console.log('groupedForItem', groupedForItem);
groupItem.count = groupedForItem.length;
updateGroupItemData(groupItem);
DEV_LOG && console.log('update group', groupItem);
Expand Down Expand Up @@ -586,6 +593,7 @@ LEFT JOIN (
if (__ANDROID__) {
Application.android.on(Application.android.activityBackPressedEvent, onAndroidBackButton);
}
DEV_LOG && console.log('onMount', !!getMapContext(), !!getMapContext().mapModules['items']);
getMapContext().mapModules['items'].on('itemChanged', refresh);
// TODO: listen for item change
});
Expand Down Expand Up @@ -875,7 +883,7 @@ LEFT JOIN (
color={actionBarLabelColor}
disableCss={true}
fontSize={15}
fontWeight="500"
fontWeight={500}
rippleColor={actionBarLabelColor}
text={lu('routes')}
textAlignment="center"
Expand Down
2 changes: 1 addition & 1 deletion app/components/map/Map.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import { Screen } from '@nativescript/core/platform';
import { debounce } from '@nativescript/core/utils';
import { Sentry, isSentryEnabled } from '@shared/utils/sentry';
import { share } from '@shared/utils/share';
import { share } from '@akylas/nativescript-app-utils/share';
import { showError } from '@shared/utils/showError';
import { navigate } from '@shared/utils/svelte/ui';
import type { Point as GeoJSONPoint } from 'geojson';
Expand Down
2 changes: 1 addition & 1 deletion app/components/settings/Settings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import { TextView } from '@nativescript-community/ui-material-textview';
import { ApplicationSettings, File, Folder, ObservableArray, ScrollView, StackLayout, Utils, View, path } from '@nativescript/core';
import { Sentry } from '@shared/utils/sentry';
import { share } from '@shared/utils/share';
import { share } from '@akylas/nativescript-app-utils/share';
import { showError } from '@shared/utils/showError';
import dayjs from 'dayjs';
import { Template } from 'svelte-native/components';
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function setLang(newLang) {
// TODO: check why getEmptyLocaleList does not reset the locale to system
actualNewLang = getActualLanguage(newLang);
} catch (error) {
console.error(error);
console.error(error, error.stack);
}
}
langStore.set(actualNewLang);
Expand Down
2 changes: 1 addition & 1 deletion app/mapModules/ItemsModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Point, PointStyleBuilder, PointStyleBuilderOptions } from '@nativescrip
import { getImagePipeline } from '@nativescript-community/ui-image';
import { ShareFile } from '@nativescript-community/ui-share-file';
import { File, Folder, ImageSource, Screen, knownFolders, path, profile } from '@nativescript/core';
import { shareFile } from '@shared/utils/share';
import { shareFile } from '@akylas/nativescript-app-utils/share';
import { showError } from '@shared/utils/showError';
import type { Feature, FeatureCollection, Point as GeometryPoint } from 'geojson';
import SqlQuery from 'kiss-orm/dist/Queries/SqlQuery';
Expand Down
1 change: 1 addition & 0 deletions app/mapModules/MapModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ export interface MapModules {
}

export function createTileDecoder(name: string, style: string = 'voyager') {
DEV_LOG && console.log('createTileDecoder', name, style, PRODUCTION, TEST_ZIP_STYLES);
return new MBVectorTileDecoder({
style,
pack:
Expand Down
2 changes: 1 addition & 1 deletion app/mapModules/UserLocationModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export default class UserLocationModule extends MapModule {
showSnack({
message: lc('location_error', event.error.toString())
});
console.error(event.error);
console.error(event.error, event.error.stack);
return;
} else if (event.location) {
if (get(queryingLocation) && event.location.horizontalAccuracy <= 20 && event.location.age < 10000) {
Expand Down
4 changes: 2 additions & 2 deletions app/models/Item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ export class GroupRepository extends CrudRepository<Group> {
[key]: GroupRepository.migrations[key]
});
} catch (error) {
console.error(error);
console.error(error, error.stack);
}
}
}
Expand Down Expand Up @@ -330,7 +330,7 @@ export class ItemRepository extends CrudRepository<Item> {
item.groups = item.groups || [];
item.groups.push(groupId);
} catch (error) {
console.error(error);
console.error(error, error.stack);
}
}
async setItemGroup(item: Item, groupName?: string) {
Expand Down
4 changes: 2 additions & 2 deletions app/services/BgService.common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export abstract class BgServiceCommon extends Observable {
DEV_LOG && console.log(TAG, 'stop');
await this.geoHandler.stop();
} catch (error) {
console.error(error);
console.error(error, error.stack);
this.notify({
eventName: BgServiceErrorEvent,
object: this,
Expand All @@ -103,7 +103,7 @@ export abstract class BgServiceCommon extends Observable {
onServiceStartedListeners.forEach((l) => l(this.geoHandler));
onServiceStartedListeners = [];
} catch (error) {
console.error(error);
console.error(error, error.stack);
this.notify({
eventName: BgServiceErrorEvent,
object: this,
Expand Down
2 changes: 1 addition & 1 deletion app/services/NetworkService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ export class NetworkService extends Observable {
//@ts-ignore
https.addNetworkInterceptor(com.nativescript.https.CacheInterceptor.INTERCEPTOR);
} catch (error) {
console.error(error);
console.error(error, error.stack);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/utils/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function valhallaSettingColor(key: string, profile: string, options: any,
return new Color(baseColor).setAlpha(perc * 200 + 55).hex;
}
} catch (error) {
console.error(key, error);
console.error(key, error, error.stack);
}
}

Expand Down

0 comments on commit 67d8499

Please sign in to comment.