Skip to content

Commit

Permalink
Merge branch 'dev' into add_friend_link
Browse files Browse the repository at this point in the history
  • Loading branch information
stavares843 authored Dec 5, 2024
2 parents 04d49b2 + 5a20508 commit 24e64d4
Show file tree
Hide file tree
Showing 11 changed files with 208 additions and 8 deletions.
2 changes: 2 additions & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ dependencies {
implementation project(':capacitor-clipboard')
implementation project(':capacitor-device')
implementation project(':capacitor-filesystem')
implementation project(':capacitor-keyboard')
implementation project(':capacitor-screen-orientation')
implementation project(':capacitor-splash-screen')
}


if (hasProperty('postBuildExtras')) {
postBuildExtras()
}
3 changes: 3 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/d
include ':capacitor-filesystem'
project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android')

include ':capacitor-keyboard'
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android')

include ':capacitor-screen-orientation'
project(':capacitor-screen-orientation').projectDir = new File('../node_modules/@capacitor/screen-orientation/android')

Expand Down
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def capacitor_pods
pod 'CapacitorClipboard', :path => '../../node_modules/@capacitor/clipboard'
pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device'
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
pod 'CapacitorScreenOrientation', :path => '../../node_modules/@capacitor/screen-orientation'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
end
Expand Down
14 changes: 10 additions & 4 deletions ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ PODS:
- Capacitor
- CapacitorFilesystem (6.0.2):
- Capacitor
- CapacitorKeyboard (6.0.3):
- Capacitor
- CapacitorScreenOrientation (6.0.3):
- Capacitor
- CapacitorSplashScreen (6.0.3):
- CapacitorSplashScreen (6.0.2):
- Capacitor

DEPENDENCIES:
Expand All @@ -22,6 +24,7 @@ DEPENDENCIES:
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
- "CapacitorDevice (from `../../node_modules/@capacitor/device`)"
- "CapacitorFilesystem (from `../../node_modules/@capacitor/filesystem`)"
- "CapacitorKeyboard (from `../../node_modules/@capacitor/keyboard`)"
- "CapacitorScreenOrientation (from `../../node_modules/@capacitor/screen-orientation`)"
- "CapacitorSplashScreen (from `../../node_modules/@capacitor/splash-screen`)"

Expand All @@ -38,6 +41,8 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capacitor/device"
CapacitorFilesystem:
:path: "../../node_modules/@capacitor/filesystem"
CapacitorKeyboard:
:path: "../../node_modules/@capacitor/keyboard"
CapacitorScreenOrientation:
:path: "../../node_modules/@capacitor/screen-orientation"
CapacitorSplashScreen:
Expand All @@ -50,9 +55,10 @@ SPEC CHECKSUMS:
CapacitorCordova: b33e7f4aa4ed105dd43283acdd940964374a87d9
CapacitorDevice: 1a215717f0b5061503b21a03508b0ec458a57d78
CapacitorFilesystem: c832a3f6d4870c3872688e782ae8e33665e6ecbf
CapacitorKeyboard: 460c6f9ec5e52c84f2742d5ce2e67bbc7ab0ebb0
CapacitorScreenOrientation: 3bb823f5d265190301cdc5d58a568a287d98972a
CapacitorSplashScreen: 68893659d77b5f82d753b3a70475082845e3039c
CapacitorSplashScreen: 250df9ef8014fac5c7c1fd231f0f8b1d8f0b5624

PODFILE CHECKSUM: 80366870d5c5081f271e0ddeab86b283217ebd9d
PODFILE CHECKSUM: 0bfaa008b5f31bb57606a8c6259197a6af507ba4

COCOAPODS: 1.16.1
COCOAPODS: 1.16.2
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@capacitor/device": "^6.0.2",
"@capacitor/filesystem": "^6.0.1",
"@capacitor/ios": "^6.2.0",
"@capacitor/keyboard": "^6.0.3",
"@capacitor/screen-orientation": "^6.0.3",
"@capacitor/splash-screen": "^6.0.2",
"@dicebear/collection": "^9.0.1",
Expand Down
154 changes: 154 additions & 0 deletions src/lib/layouts/BottomNavBarMobile.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
<script lang="ts">
import { Button, Icon, Text } from "$lib/elements"
import { Appearance, CommunitySettingsRoute, Route, SettingsRoute } from "$lib/enums"
import { VoiceRTCInstance } from "$lib/media/Voice"
import { SettingsStore } from "$lib/state"
import { Store } from "$lib/state/Store"
import { UIStore } from "$lib/state/ui"
import type { FriendRequest, NavRoute } from "$lib/types"
import { checkMobile, isAndroidOriOS } from "$lib/utils/Mobile"
import { createEventDispatcher, onDestroy } from "svelte"
import { get } from "svelte/store"
export let routes: NavRoute[] = []
export let activeRoute: Route | SettingsRoute | CommunitySettingsRoute = Route.Home
export let icons: boolean = false
export let vertical: boolean = false
let incomingRequests: FriendRequest[] = []
let totalUnreads: number = 0
let badgeCounts: Record<string, number> = {}
const dispatch = createEventDispatcher()
// Subscribe to stores and update local state
const unsubscribeStore = Store.state.activeRequests.subscribe(r => {
incomingRequests = Store.inboundRequests(r)
updateBadgeCounts()
})
const unsubscribeUIStore = UIStore.state.chats.subscribe(() => {
totalUnreads = UIStore.getTotalNotifications()
updateBadgeCounts()
})
function updateBadgeCounts() {
badgeCounts = {}
for (const route of routes) {
badgeCounts[route.to] = calculateBadgeCount(route.to)
}
}
function calculateBadgeCount(route: string): number {
if (route === "/friends") {
return incomingRequests.length
} else if (route === "/chat") {
return totalUnreads
}
return 0
}
function handleNavigate(route: NavRoute) {
if (checkMobile() && !overrides(route)) UIStore.state.sidebarOpen.set(false)
if (isAndroidOriOS() && (route.to === Route.Settings || (route.to === Route.Chat && get(UIStore.state.chats).length > 0))) {
if (get(UIStore.state.sidebarOpen) === false) {
UIStore.toggleSidebar()
// Avoid keyboard when navigate to chat preview list
}
}
dispatch("navigate", route.to.toString())
}
function overrides(route: NavRoute) {
if (route.to === Route.Chat && $settings.messaging.quick) {
return true
}
if (route.to === Route.Settings) return true
}
// Clean up subscriptions when component is destroyed
onDestroy(() => {
setTimeout(() => {
if (get(Store.state.activeCall)) {
Store.setActiveCall(Store.getCallingChat(VoiceRTCInstance.channel!)!)
}
}, 100)
unsubscribeStore()
unsubscribeUIStore()
})
$: settings = SettingsStore.state
</script>

<div class="content"></div>

<div class="navigation {vertical ? 'vertical' : 'horizontal'} {icons ? 'icons' : ''}">
{#each routes as route}
<div class="navigation-control {!icons ? 'fill' : ''}">
<Button
hook="button-{route.name}"
badge={badgeCounts[route.to]}
fill={!icons}
tooltip={route.name}
icon={icons}
outline={activeRoute !== route.to && !icons}
appearance={activeRoute === route.to ? Appearance.Primary : Appearance.Alt}
on:click={() => handleNavigate(route)}>
<Icon alt={activeRoute === route.to} icon={route.icon} />
{#if !icons}
<Text appearance={activeRoute !== route.to ? Appearance.Default : Appearance.Alt}>{route.name}</Text>
{/if}
</Button>
</div>
{/each}
</div>

<style lang="scss">
.content {
height: 60px;
pointer-events: none;
background: transparent;
border: none;
}
.navigation {
display: inline-flex;
gap: var(--gap);
justify-content: space-evenly;
width: 100%;
border-top: 1px solid var(--border-color, #ccc);
box-shadow: 0px -4px 10px rgba(0, 0, 0, 0.1);
backdrop-filter: blur(10px);
-webkit-backdrop-filter: blur(10px);
z-index: 1000;
position: fixed;
bottom: 0;
left: 0;
right: 0;
padding: var(--padding, 10px);
&.vertical {
flex-direction: column;
}
.navigation-control {
display: inline-flex;
flex-direction: column;
align-items: center;
&.fill {
flex: 1;
:global(.text) {
justify-content: space-between;
}
}
}
}
@media only screen and (max-width: 600px) {
.navigation {
padding-bottom: var(--padding, 10px);
}
}
</style>
5 changes: 4 additions & 1 deletion src/lib/layouts/Sidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import { Slimbar } from "."
import WidgetBar from "$lib/components/widgets/WidgetBar.svelte"
import { SettingsStore, type ISettingsState } from "$lib/state"
import { isAndroidOriOS } from "$lib/utils/Mobile"
export let activeRoute: Route = Route.Chat
export let open: boolean = true
Expand Down Expand Up @@ -81,7 +82,9 @@
<div class="popups">
<CallControls activeRoute={activeRoute} />
</div>
<Navigation icons routes={routes} activeRoute={activeRoute} on:navigate={e => goto(e.detail)} />
{#if !isAndroidOriOS()}
<Navigation icons routes={routes} activeRoute={activeRoute} on:navigate={e => goto(e.detail)} />
{/if}
</div>
{/if}
</div>
Expand Down
12 changes: 10 additions & 2 deletions src/routes/chat/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@
import { debounce, getTimeAgo } from "$lib/utils/Functions"
import Controls from "$lib/layouts/Controls.svelte"
import { tempCDN } from "$lib/utils/CommonVariables"
import { checkMobile } from "$lib/utils/Mobile"
import { checkMobile, isAndroidOriOS } from "$lib/utils/Mobile"
import BrowseFiles from "../files/BrowseFiles.svelte"
import AttachmentRenderer from "$lib/components/messaging/AttachmentRenderer.svelte"
import ShareFile from "$lib/components/files/ShareFile.svelte"
import { ToastMessage } from "$lib/state/ui/toast"
import AddMembers from "$lib/components/group/AddMembers.svelte"
import { routes } from "$lib/defaults/routes"
import BottomNavBarMobile from "$lib/layouts/BottomNavBarMobile.svelte"
let loading = false
let contentAsideOpen = false
Expand Down Expand Up @@ -645,6 +647,9 @@
<ChatPreview slot="content" let:open on:contextmenu={open} chat={chat} loading={loading} cta={$activeChat === chat} />
</ContextMenu>
{/each}
{#if isAndroidOriOS()}
<BottomNavBarMobile icons routes={routes} activeRoute={Route.Chat} on:navigate={e => goto(e.detail)} />
{/if}
</Sidebar>

<div class="content">
Expand Down Expand Up @@ -975,7 +980,7 @@
})
}} />

{#if $activeChat.users.length > 0}
{#if $activeChat.users.length > 0 && (!isAndroidOriOS() || (isAndroidOriOS() && get(UIStore.state.sidebarOpen) === false))}
<Chatbar
replyTo={replyTo}
activeChat={$activeChat}
Expand Down Expand Up @@ -1066,6 +1071,9 @@
</div>
{/if}
</div>
{#if isAndroidOriOS() && $activeChat.users.length === 0}
<BottomNavBarMobile icons routes={routes} activeRoute={Route.Chat} on:navigate={e => goto(e.detail)} />
{/if}

<style lang="scss">
#page {
Expand Down
6 changes: 6 additions & 0 deletions src/routes/files/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
import { Store } from "$lib/state/Store"
import path from "path"
import { MultipassStoreInstance } from "$lib/wasm/MultipassStore"
import { routes } from "$lib/defaults/routes"
import { isAndroidOriOS } from "$lib/utils/Mobile"
import BottomNavBarMobile from "$lib/layouts/BottomNavBarMobile.svelte"
export let browseFilesForChatMode: boolean = false
Expand Down Expand Up @@ -806,6 +809,9 @@
</div>
</div>
</div>
{#if isAndroidOriOS()}
<BottomNavBarMobile icons routes={routes} activeRoute={Route.Files} on:navigate={e => goto(e.detail)} />
{/if}

<style lang="scss">
#page {
Expand Down
7 changes: 7 additions & 0 deletions src/routes/friends/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
import { CommonInputRules } from "$lib/utils/CommonInputRules"
import CreateGroup from "$lib/components/group/CreateGroup.svelte"
import AddFriendPopup from "$lib/components/friends/AddFriendPopup.svelte"
import { onDestroy } from "svelte"
import { isAndroidOriOS } from "$lib/utils/Mobile"
import { routes } from "$lib/defaults/routes"
import BottomNavBarMobile from "$lib/layouts/BottomNavBarMobile.svelte"
import { Clipboard } from "@capacitor/clipboard"
enum DIDCopy {
Expand Down Expand Up @@ -489,6 +493,9 @@
</Modal>
{/if}
</div>
{#if isAndroidOriOS()}
<BottomNavBarMobile icons routes={routes} activeRoute={Route.Friends} on:navigate={e => goto(e.detail)} />
{/if}

<style lang="scss">
#page {
Expand Down
11 changes: 10 additions & 1 deletion src/routes/settings/+layout.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<script lang="ts">
import { goto } from "$app/navigation"
import { page } from "$app/stores"
import { routes } from "$lib/defaults/routes"
import { Route, SettingsRoute, Shape } from "$lib/enums"
import BottomNavBarMobile from "$lib/layouts/BottomNavBarMobile.svelte"
import Navigation from "$lib/layouts/Navigation.svelte"
import Sidebar from "$lib/layouts/Sidebar.svelte"
Expand Down Expand Up @@ -79,7 +81,7 @@
let loading = false
let sidebarOpen: boolean = get(UIStore.state.sidebarOpen)
let activeRoute = SettingsRoute.Profile
let activeRoute: SettingsRoute = SettingsRoute.Developer
function toggleSidebar() {
UIStore.toggleSidebar()
Expand Down Expand Up @@ -187,6 +189,10 @@
routes={setRoutes}
vertical
on:navigate={e => {
let sideBarIsOpened = get(UIStore.state.sidebarOpen)
if (sideBarIsOpened) {
UIStore.toggleSidebar()
}
goto(e.detail)
activeRoute = e.detail
}}
Expand All @@ -202,6 +208,9 @@
</div>
</div>
</div>
{#if isAndroidOriOS()}
<BottomNavBarMobile icons routes={routes} activeRoute={Route.Settings} on:navigate={e => goto(e.detail)} />
{/if}

<style lang="scss">
#settings {
Expand Down

0 comments on commit 24e64d4

Please sign in to comment.