Browse Source

fix: clear logs

stage
Vitalik 3 months ago
parent
commit
8516b73966
  1. 2
      android/app/build.gradle
  2. 27
      android/app/src/main/AndroidManifest.xml
  3. 8
      ios/taskme2.xcodeproj/project.pbxproj
  4. 5
      src/App.tsx
  5. 6
      src/config/index.ts
  6. 8
      src/managers/chat.manager.ts
  7. 1
      src/managers/comment.manager.ts
  8. 19
      src/managers/contact.manager.ts
  9. 4
      src/managers/factory.manager.ts
  10. 4
      src/managers/fake-message.manager.ts
  11. 7
      src/managers/permissions.manager.ts
  12. 13
      src/managers/task-document.manager.ts
  13. 9
      src/managers/task.manager.ts
  14. 15
      src/managers/taxonomy.manager.ts
  15. 1
      src/managers/user.manager.ts
  16. 14
      src/managers/version.manager.ts
  17. 2
      src/modules/account/hooks/use-change-phone-number.hook.ts
  18. 10
      src/modules/calls/configs/ice-servers.config.ts
  19. 2
      src/modules/calls/hooks/use-call-streams.hook.ts
  20. 37
      src/modules/calls/screens/call/atoms/calling.atom.tsx
  21. 17
      src/modules/calls/screens/call/index.tsx
  22. 55
      src/modules/calls/services/callkeep-notifications-android.service.ts
  23. 3
      src/modules/calls/services/calls-events.service.ts
  24. 66
      src/modules/calls/services/icendidates/ice-candidate-handler.ts
  25. 16
      src/modules/calls/services/icendidates/ice-candidates.service.ts
  26. 21
      src/modules/calls/services/peer-connection.service.ts
  27. 1
      src/modules/calls/widgets/incoming-call.widget.tsx
  28. 1
      src/modules/chats/hooks/use-chat-messages.hook.ts
  29. 4
      src/modules/chats/hooks/use-create-text-message.hook.ts
  30. 8
      src/modules/chats/screens/chat-file-preview.screen.tsx
  31. 6
      src/modules/chats/transforms/chat-messages.transforms.ts
  32. 1
      src/modules/root/hooks/use-app-badge.hook.ts
  33. 2
      src/modules/tasks/hooks/use-task-actions.hook.ts
  34. 7
      src/services/domain/auth.service.ts
  35. 26
      src/services/system/fs.service.ts
  36. 2
      src/services/system/media-permissions.service.ts
  37. 2
      src/services/system/synchronization.service.ts
  38. 3
      src/shared/abstract/events-listener.ts
  39. 6
      src/shared/abstract/manager.ts
  40. 1
      src/shared/abstract/sqlite-repository.ts
  41. 2
      src/shared/components/elements/icon.component.tsx
  42. 8
      src/shared/components/forms/touchable-fake-input.atom.tsx
  43. 6
      src/shared/components/plugins/webview.component.tsx
  44. 5
      src/shared/hooks/use-shared-files.hook.ts

2
android/app/build.gradle

@ -27,7 +27,7 @@ android { @@ -27,7 +27,7 @@ android {
applicationId "com.app.task_me"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 254
versionCode 255
versionName "2.6"
resValue "string", "build_config_package", "com.app.task_me"

27
android/app/src/main/AndroidManifest.xml

@ -1,6 +1,5 @@ @@ -1,6 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
@ -17,14 +16,12 @@ @@ -17,14 +16,12 @@
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.READ_PHONE_NUMBERS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-feature
android:name="android.hardware.camera"
android:required="false" />
<uses-feature
android:name="android.hardware.camera.front"
android:required="false" />
<uses-permission
android:name="com.sec.android.provider.badge.permission.READ"
tools:node="remove" />
@ -72,7 +69,6 @@ @@ -72,7 +69,6 @@
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<application
android:name=".MainApplication"
android:allowBackup="false"
@ -91,7 +87,6 @@ @@ -91,7 +87,6 @@
<meta-data
android:name="com.onesignal.messaging.default_notification_icon"
android:resource="@mipmap/ic_launcher" />
<activity
android:name="com.app.task_me.MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
@ -109,26 +104,12 @@ @@ -109,26 +104,12 @@
<intent-filter>
<action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="application/pdf" />
<data android:mimeType="application/msword" />
<data android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
<data android:mimeType="application/vnd.ms-excel" />
<data android:mimeType="application/zip" />
<data android:mimeType="*/*" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="image/*" />
<data android:mimeType="video/*" />
<data android:mimeType="application/pdf" />
<data android:mimeType="application/msword" />
<data android:mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
<data android:mimeType="application/vnd.ms-excel" />
<data android:mimeType="application/zip" />
<data android:mimeType="*/*" />
</intent-filter>
</activity>
<provider
@ -140,7 +121,6 @@ @@ -140,7 +121,6 @@
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_viewer_provider_paths" />
</provider>
<service
android:name="io.wazo.callkeep.VoiceConnectionService"
android:exported="true"
@ -165,7 +145,6 @@ @@ -165,7 +145,6 @@
</service>
<service android:name="com.app.task_me.domain.ApiService" />
<activity
android:name="com.app.task_me.features.activity.CallActivity"
android:excludeFromRecents="true"
@ -183,10 +162,8 @@ @@ -183,10 +162,8 @@
android:exported="true"
android:launchMode="singleInstance"
android:theme="@style/NoAnimation" />
<receiver android:name="com.app.task_me.core.action.ActionReceiver" />
</application>
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />

8
ios/taskme2.xcodeproj/project.pbxproj

@ -875,7 +875,7 @@ @@ -875,7 +875,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = taskme2/taskme2Stage.Debug.entitlements;
CURRENT_PROJECT_VERSION = 58;
CURRENT_PROJECT_VERSION = 60;
DEVELOPMENT_TEAM = HQ3J3TDPR2;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
@ -1159,7 +1159,7 @@ @@ -1159,7 +1159,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = taskme2/taskme2Stage.Release.entitlements;
CURRENT_PROJECT_VERSION = 58;
CURRENT_PROJECT_VERSION = 60;
DEVELOPMENT_TEAM = HQ3J3TDPR2;
HEADER_SEARCH_PATHS = (
"$(inherited)",
@ -1439,7 +1439,7 @@ @@ -1439,7 +1439,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = taskme2/taskme2.entitlements;
CURRENT_PROJECT_VERSION = 58;
CURRENT_PROJECT_VERSION = 60;
DEVELOPMENT_TEAM = HQ3J3TDPR2;
ENABLE_BITCODE = NO;
HEADER_SEARCH_PATHS = (
@ -1577,7 +1577,7 @@ @@ -1577,7 +1577,7 @@
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = taskme2/taskme2.entitlements;
CURRENT_PROJECT_VERSION = 58;
CURRENT_PROJECT_VERSION = 60;
DEVELOPMENT_TEAM = HQ3J3TDPR2;
HEADER_SEARCH_PATHS = (
"$(inherited)",

5
src/App.tsx

@ -35,10 +35,6 @@ LoggerService.init() @@ -35,10 +35,6 @@ LoggerService.init()
LogBox.ignoreLogs(['Warning: ...', 'Require cycle: ...'])
LogBox.ignoreAllLogs()
if (Platform.OS === 'android') {
require('./modules/calls/services/callkeep-notifications-android.service')
}
callKeepService.register()
const App = props => {
@ -54,7 +50,6 @@ const App = props => { @@ -54,7 +50,6 @@ const App = props => {
appEvents.emit('android/acceptIncomingCall', {
callUUID: data.uuid,
})
// Alert.alert('SOME CALL EVENT', JSON.stringify(event))
},
)

6
src/config/index.ts

@ -5,9 +5,9 @@ export const dynamicConfig = { @@ -5,9 +5,9 @@ export const dynamicConfig = {
baseUrl: Config.API_URL,
socketUrl: Config.SOCKET_URL,
// baseUrl: 'http://localhost:3000', // Config.API_URL,
// socketUrl: 'http://localhost:3000', //Config.SOCKET_URL,]
// .SOCKET_URL,
// baseUrl: 'http://10.10.10.213:3000', // Config.API_URL,
// socketUrl: 'http://10.10.10.213:3000', //Config.SOCKET_URL,]
// // .SOCKET_URL,
oneSignalKey: Config.ONE_SIGNAL_KEY,
showVersionModal: Config.SHOW_VERSION_MODAL === 'true',

8
src/managers/chat.manager.ts

@ -39,7 +39,6 @@ export class ChatManager extends Manager { @@ -39,7 +39,6 @@ export class ChatManager extends Manager {
public async getChats(params: IFetchChatsParams) {
if (this.isConnected === 'online') {
console.log('params', params)
const resp = await this.chatRepository.getChatsListReq(params)
if (resp.data) {
@ -56,7 +55,6 @@ export class ChatManager extends Manager { @@ -56,7 +55,6 @@ export class ChatManager extends Manager {
section: 'chats',
},
})
console.log('SAVE CHATS TO LOCAL DB FAILED', e)
}
}
@ -245,12 +243,6 @@ export class ChatManager extends Manager { @@ -245,12 +243,6 @@ export class ChatManager extends Manager {
}),
)
console.log('no connection, load chat details from local db', {
...dbChat,
unreadMessagesCount: null,
isChatMuted: dbChat.isChatMuted ? dbChat.isChatMuted : false,
})
return {
...dbChat,
unreadMessagesCount: null,

1
src/managers/comment.manager.ts

@ -68,7 +68,6 @@ export class CommentManager extends Manager { @@ -68,7 +68,6 @@ export class CommentManager extends Manager {
appEvents.emit('onTaskChanged', { ids: [taskId] })
}
console.log('no connection, load comments from local db', comments)
return {
data: comments,
}

19
src/managers/contact.manager.ts

@ -4,10 +4,7 @@ import { @@ -4,10 +4,7 @@ import {
IFetchContactDetailRes,
IFetchContactsRes,
} from '@/api/contacts/responses.interfaces'
import {
ApiContactRepository,
DbUserRepository,
} from '@/repositories'
import { ApiContactRepository, DbUserRepository } from '@/repositories'
import { IContactDetail } from '@/shared'
import { Manager } from '@/shared/abstract'
@ -25,10 +22,6 @@ export class ContactManager extends Manager { @@ -25,10 +22,6 @@ export class ContactManager extends Manager {
const dbContacts = await this.dbUserRepository.fetchContacts(
params.params,
)
console.log(
'no connection, load contacts from local db',
dbContacts,
)
return {
data: dbContacts,
}
@ -48,14 +41,10 @@ export class ContactManager extends Manager { @@ -48,14 +41,10 @@ export class ContactManager extends Manager {
const dbContact = await this.dbUserRepository.fetchUser(
Number(params.contactId),
)
console.log(
'no connection, load contact details from local db',
dbContact,
)
return {
data: {
...dbContact,
chatId: dbContact.info.chatId
chatId: dbContact.info.chatId,
} as IContactDetail,
}
}
@ -70,10 +59,6 @@ export class ContactManager extends Manager { @@ -70,10 +59,6 @@ export class ContactManager extends Manager {
return resp
} else {
const count = await this.dbUserRepository.getBirthdayCountToday()
console.log(
'no connection, load today birthday count from local db',
count,
)
return {
data: { count },
}

4
src/managers/factory.manager.ts

@ -18,10 +18,6 @@ export class FactoryManager extends Manager { @@ -18,10 +18,6 @@ export class FactoryManager extends Manager {
return data
} else {
const dbFactories = await this.dbFactoryRepository.fetchFactories()
console.log(
'no connection, load factories from local db',
dbFactories,
)
return dbFactories
}
}

4
src/managers/fake-message.manager.ts

@ -82,17 +82,13 @@ export class FakeMessageManager { @@ -82,17 +82,13 @@ export class FakeMessageManager {
}
public async storeFakeMessage(message: IChatMessage) {
console.log('FAKE MESSAGE', message)
const fakedMsgs = await storageService.get(StorageKey.Messages)
const encodeFakeMessage = JSON.parse(
fakedMsgs || '[]',
) as IChatMessage[]
console.log('encodeFakeMessage', encodeFakeMessage)
const mergedMsgs = [..._.defaultTo(encodeFakeMessage, []), message]
console.log('mergedMsgs', mergedMsgs)
const value = JSON.stringify(mergedMsgs)
await storageService.set(StorageKey.Messages, value)

7
src/managers/permissions.manager.ts

@ -29,11 +29,8 @@ export class PermissionsManager extends Manager { @@ -29,11 +29,8 @@ export class PermissionsManager extends Manager {
} else {
const dbPermissions =
await this.dbPermissionsRepository.fetchPermissions()
console.log(
'no connection, load permissions from local db',
dbPermissions,
)
return dbPermissions.permissions
return dbPermissions.permissions
}
}

13
src/managers/task-document.manager.ts

@ -25,10 +25,6 @@ export class TaskDocumentManager extends Manager { @@ -25,10 +25,6 @@ export class TaskDocumentManager extends Manager {
const dbTask = await this.dbTaskRepository.fetchTask(
taskId.toString(),
)
console.log(
'no connection, load task documents from local db',
dbTask.documents,
)
return {
data: dbTask.documents,
}
@ -112,10 +108,11 @@ export class TaskDocumentManager extends Manager { @@ -112,10 +108,11 @@ export class TaskDocumentManager extends Manager {
if (_.isEmpty(files))
await this.dbAQRepository.removeFromQueue(it.id)
else await this.dbAQRepository.update(it.id, {
...it.data,
files,
})
else
await this.dbAQRepository.update(it.id, {
...it.data,
files,
})
}
}),
)

9
src/managers/task.manager.ts

@ -231,10 +231,6 @@ export class TaskManager extends Manager { @@ -231,10 +231,6 @@ export class TaskManager extends Manager {
const account = await this.accountManager.getDbAccount()
const prepared = await this.prepareTasks(items, account.id)
console.log('no connection, load tasks from local db', {
items: prepared,
count,
})
return {
data: {
items: prepared,
@ -272,10 +268,6 @@ export class TaskManager extends Manager { @@ -272,10 +268,6 @@ export class TaskManager extends Manager {
await this.dbTaskRepository.readTask(dbTask.id, account.id)
}
console.log(
'no connection, load task details from local db',
taskDetails,
)
return {
data: taskDetails,
}
@ -578,7 +570,6 @@ export class TaskManager extends Manager { @@ -578,7 +570,6 @@ export class TaskManager extends Manager {
status: TaskStatus.Active,
})
const unreadItems = _.filter(items, it => !it.isRead)
console.log('no connection, load task details from local db')
return {
data: { count: unreadItems.length },
}

15
src/managers/taxonomy.manager.ts

@ -50,7 +50,6 @@ export class TaxonomyManager extends Manager { @@ -50,7 +50,6 @@ export class TaxonomyManager extends Manager {
const dbGroups = await this.dbTaxonomyRepository.fetchTaxonomies(
TaxonomyTypes.Category,
)
console.log('no connection, load groups from local db', dbGroups)
return dbGroups
}
}
@ -77,7 +76,6 @@ export class TaxonomyManager extends Manager { @@ -77,7 +76,6 @@ export class TaxonomyManager extends Manager {
const dbReasons = await this.dbTaxonomyRepository.fetchTaxonomies(
TaxonomyTypes.Reason,
)
console.log('no connection, load reasons from local db', dbReasons)
return dbReasons
}
}
@ -110,10 +108,7 @@ export class TaxonomyManager extends Manager { @@ -110,10 +108,7 @@ export class TaxonomyManager extends Manager {
)),
),
)
console.log(
'no connection, load groups with tasks count from local db',
dbGroups,
)
if (params.params.withoutEmpty) {
const emptyGroups = _.filter(
dbGroups.items,
@ -141,8 +136,12 @@ export class TaxonomyManager extends Manager { @@ -141,8 +136,12 @@ export class TaxonomyManager extends Manager {
) {
if (this.isConnected === 'online') {
const req = isPersonal
? this.taxonomyRepository.createNewPersonalTaxonomyReason.bind(this.taxonomyRepository)
: this.taxonomyRepository.createNewTaxonomyReason.bind(this.taxonomyRepository)
? this.taxonomyRepository.createNewPersonalTaxonomyReason.bind(
this.taxonomyRepository,
)
: this.taxonomyRepository.createNewTaxonomyReason.bind(
this.taxonomyRepository,
)
const resp = await req(params)

1
src/managers/user.manager.ts

@ -48,7 +48,6 @@ export class UserManager extends Manager { @@ -48,7 +48,6 @@ export class UserManager extends Manager {
const dbUsers = await this.dbUserRepository.fetchUsers(
params.params,
)
console.log('no connection, load users from local db', dbUsers)
return {
data: dbUsers,
}

14
src/managers/version.manager.ts

@ -17,13 +17,6 @@ export class VersionManager extends Manager { @@ -17,13 +17,6 @@ export class VersionManager extends Manager {
return data
} catch (e) {
console.log(
`error on fetch ${_.findKey(
EntityType,
it => it === type,
)?.toLowerCase()} versions from api`,
e,
)
return null
}
}
@ -48,13 +41,6 @@ export class VersionManager extends Manager { @@ -48,13 +41,6 @@ export class VersionManager extends Manager {
versions: data,
})
} catch (e) {
console.log(
`error on load ${_.findKey(
EntityType,
it => it === type,
)?.toLowerCase()} versions`,
e,
)
return null
}
}

2
src/modules/account/hooks/use-change-phone-number.hook.ts

@ -38,7 +38,6 @@ export const useChangePhoneNumber = () => { @@ -38,7 +38,6 @@ export const useChangePhoneNumber = () => {
clearError()
return false
} catch (e) {
console.log(e)
} finally {
setIsLoading(false)
}
@ -59,7 +58,6 @@ export const useChangePhoneNumber = () => { @@ -59,7 +58,6 @@ export const useChangePhoneNumber = () => {
clearError()
return true
} catch (e: any) {
console.log('ERR', e)
setError(getMessageByExceptionKey(e.response?.data?.key))
} finally {
setIsLoading(false)

10
src/modules/calls/configs/ice-servers.config.ts

@ -8,9 +8,9 @@ export const iceServers = [ @@ -8,9 +8,9 @@ export const iceServers = [
{
urls: 'stun:stun2.l.google.com:19302',
},
{
urls: 'turn:relay1.expressturn.com:3478',
username: 'efFBS0EV3YVRQY4HFQ',
credential: 'ssU85viEgPpENkG7',
},
// {
// urls: 'turn:relay1.expressturn.com:3478',
// username: 'efFBS0EV3YVRQY4HFQ',
// credential: 'ssU85viEgPpENkG7',
// },
]

2
src/modules/calls/hooks/use-call-streams.hook.ts

@ -79,7 +79,7 @@ export const initCallsMediaDevices = async (peerConnection: any) => { @@ -79,7 +79,7 @@ export const initCallsMediaDevices = async (peerConnection: any) => {
peerConnection.addTrack(track as any, stream as any)
})
} catch (e) {
console.log('eerror')
console.log('Error init calls media devices', e)
}
}

37
src/modules/calls/screens/call/atoms/calling.atom.tsx

@ -1,17 +1,19 @@ @@ -1,17 +1,19 @@
import { Txt } from '@/shared'
import React, { FC } from 'react'
import { View } from 'react-native'
import { Image, StyleSheet, View } from 'react-native'
import { RTCView } from 'react-native-webrtc'
interface IProps {
localStream: any
remoteStream: any
isRemoteCameraOn?: boolean
avatarImageUrl?: string
}
export const CallingAtom: FC<IProps> = ({
localStream,
remoteStream,
isRemoteCameraOn,
avatarImageUrl,
}) => {
return (
<View
@ -39,7 +41,7 @@ export const CallingAtom: FC<IProps> = ({ @@ -39,7 +41,7 @@ export const CallingAtom: FC<IProps> = ({
/>
</View>
) : null}
{remoteStream ? (
{isRemoteCameraOn && remoteStream ? (
<RTCView
objectFit={'cover'}
style={
@ -55,7 +57,36 @@ export const CallingAtom: FC<IProps> = ({ @@ -55,7 +57,36 @@ export const CallingAtom: FC<IProps> = ({
}
streamURL={remoteStream.toURL()}
/>
) : null}
) : (
<View style={styles.imgBgContainer}>
<Image
source={{
uri: avatarImageUrl,
}}
resizeMode="cover"
style={styles.imgBg}
/>
</View>
)}
</View>
)
}
const styles = StyleSheet.create({
imgBg: {
width: 200,
height: 200,
borderRadius: 500,
},
imgBgContainer: {
flex: 1,
position: 'absolute',
top: 0,
height: '100%',
width: '100%',
left: 0,
justifyContent: 'flex-start',
alignItems: 'center',
paddingTop: 200,
},
})

17
src/modules/calls/screens/call/index.tsx

@ -36,10 +36,6 @@ export const CallScreen = () => { @@ -36,10 +36,6 @@ export const CallScreen = () => {
FailedIceStatusHandler.clear()
}, [])
console.log('isRemoteCameraOn', isRemoteCameraOn)
console.log('isCameraOn', isCameraOn)
console.log('avatarImageUrl', avatarImageUrl)
const templates = {
[CallMod.Speaking]: (
<CallBackground
@ -50,13 +46,12 @@ export const CallScreen = () => { @@ -50,13 +46,12 @@ export const CallScreen = () => {
subtitle={label}
subtitleComponent={<Timmer startTime={startTime} />}
fullComponent={
isRemoteCameraOn ? (
<CallingAtom
localStream={isCameraOn ? localStream : null}
remoteStream={remoteStream}
isRemoteCameraOn={isRemoteCameraOn}
/>
) : null
<CallingAtom
localStream={isCameraOn ? localStream : null}
remoteStream={remoteStream}
isRemoteCameraOn={isRemoteCameraOn}
avatarImageUrl={avatarImageUrl}
/>
}>
<View style={styles.callRow}>
<CallBtn

55
src/modules/calls/services/callkeep-notifications-android.service.ts

@ -1,55 +0,0 @@ @@ -1,55 +0,0 @@
import messaging from '@react-native-firebase/messaging'
import { Alert } from 'react-native'
import RNCallKeep from 'react-native-callkeep'
// messaging().setBackgroundMessageHandler(async message => {
// const data = message.data as any
// if (!data) {
// return
// }
// if (data?.type === 'callAnswered') {
// RNCallKeep.endAllCalls()
// return
// }
// if (data?.uuid) {
// RNCallKeep.displayIncomingCall(
// data.uuid,
// data.handle,
// data.callerName,
// 'number',
// false,
// )
// }
// })
messaging().onMessage(async message => {
try {
// console.log(message)
// Alert.alert(JSON.stringify(message))
const data = message.data as any
// if (!data) {
// return
// }
// if (data?.type === 'callAnswered') {
// RNCallKeep.endAllCalls()
// return
// }
// if (data?.uuid) {
// RNCallKeep.displayIncomingCall(
// data.uuid,
// data.handle,
// data.callerName,
// 'number',
// false,
// )
// }
} catch (e) {
console.log(e)
}
})

3
src/modules/calls/services/calls-events.service.ts

@ -75,6 +75,8 @@ class CallsEventsService extends CallRoot { @@ -75,6 +75,8 @@ class CallsEventsService extends CallRoot {
}
private async handleAnsweredCall(data: SocketEvents['call/answered']) {
Alert.alert('HANDLE ANSWERED CALL')
inCallManager.stopRingback()
this.store.peerConnection.setRemoteDescription(
new RTCSessionDescription(data.rtcMessage),
@ -144,6 +146,7 @@ class CallsEventsService extends CallRoot { @@ -144,6 +146,7 @@ class CallsEventsService extends CallRoot {
private proccessIceCandidateEvent(data) {
try {
// Alert.alert('PROCCESS ICE CANDIDATE EVENT')
const candidates = data.candidates
const peerConnection = this.store.peerConnection

66
src/modules/calls/services/icendidates/ice-candidate-handler.ts

@ -0,0 +1,66 @@ @@ -0,0 +1,66 @@
import { RTCIceCandidate, RTCPeerConnection } from 'react-native-webrtc'
import { iceCandidatesService } from './ice-candidates.service'
export class IceCandidateHandler {
private peerConnection: RTCPeerConnection
private iceCandidatesService = iceCandidatesService
private icecandidates: RTCIceCandidate[] = []
private sendIceCandidatesInterval: NodeJS.Timeout | null = null
private counter = 0
constructor(peerConnection: RTCPeerConnection, store: any) {
this.peerConnection = peerConnection
// Регістрація обробника події icecandidate
this.peerConnection.addEventListener(
'icecandidate',
this.handleIceCandidate.bind(this),
)
}
// Функція для періодичного виклику sendIcecandidates
private startSendingIceCandidates(): void {
if (!this.sendIceCandidatesInterval) {
this.sendIceCandidatesInterval = setInterval(() => {
if (this.icecandidates.length > 0) {
this.sendIcecandidates()
}
this.counter++
if (this.counter > 10) {
this.counter = 0
this.stopSendingIceCandidates()
}
}, 500) // 1 секунд
}
}
// Функція для зупинки періодичного виклику sendIcecandidates
private stopSendingIceCandidates(): void {
if (this.sendIceCandidatesInterval) {
clearInterval(this.sendIceCandidatesInterval)
this.sendIceCandidatesInterval = null
}
}
// Обробка події icecandidate
private handleIceCandidate(event: any): void {
if (event.candidate === null) {
this.sendIcecandidates()
this.stopSendingIceCandidates()
return
}
this.icecandidates.push(event.candidate)
this.startSendingIceCandidates()
}
// Функція для відправки кандидатів
private sendIcecandidates(): void {
// Реалізація відправлення кандидатів (наприклад, через WebSocket або інший механізм)
console.log('Sending ICE candidates:', this.icecandidates)
// Очищення списку кандидатів після відправлення
this.iceCandidatesService.onLocalIceCandidate(this.icecandidates)
this.icecandidates = []
}
}

16
src/modules/calls/services/icendidates/ice-candidates.service.ts

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
import { SocketIo } from '@/services/system'
import { CallRoot } from '../call-root.service'
class IceCandidatesService extends CallRoot {
public onLocalIceCandidate(candidates: any[]) {
const socketIo = SocketIo.get()
const callId = this.store.callId
socketIo.emit('iceCandidate', {
callId: callId,
iceCandidates: candidates,
})
}
}
export const iceCandidatesService = new IceCandidatesService()

21
src/modules/calls/services/peer-connection.service.ts

@ -6,14 +6,14 @@ import { initCallsMediaDevices } from '../hooks' @@ -6,14 +6,14 @@ import { initCallsMediaDevices } from '../hooks'
import RTCDataChannel from 'react-native-webrtc/lib/typescript/RTCDataChannel'
import { appEvents } from '@/shared'
import { IceStatusHandlerProxy } from './ice-status-handler/ice-status-handler.proxy'
import { Alert } from 'react-native'
import { negotiationService } from './negotiation.service'
import { IceCandidateHandler } from './icendidates/ice-candidate-handler'
class PeerConnectionService extends CallRoot {
private icecandidates: any[]
private dataChannel: RTCDataChannel
private remoteDataChannel: RTCDataChannel
private iceCandidateHandler: IceCandidateHandler
public async createIns() {
this.icecandidates = []
@ -32,6 +32,11 @@ class PeerConnectionService extends CallRoot { @@ -32,6 +32,11 @@ class PeerConnectionService extends CallRoot {
}
private async addListeners(peerConnection: RTCPeerConnection) {
this.iceCandidateHandler = new IceCandidateHandler(
peerConnection,
this.store,
)
peerConnection.addEventListener('track', event => {
try {
const existremoteStream = this.streamsStore.remoteStream
@ -43,17 +48,6 @@ class PeerConnectionService extends CallRoot { @@ -43,17 +48,6 @@ class PeerConnectionService extends CallRoot {
}
})
peerConnection.addEventListener('icecandidate', event => {
if (event.candidate === null) {
if (this.store.isIncomeCall) {
this.sendIcecandidates()
}
return
}
this.icecandidates.push(event.candidate)
})
peerConnection.addEventListener('iceconnectionstatechange', event => {
new IceStatusHandlerProxy(this.store)
.setStatus(peerConnection.iceConnectionState)
@ -62,7 +56,6 @@ class PeerConnectionService extends CallRoot { @@ -62,7 +56,6 @@ class PeerConnectionService extends CallRoot {
peerConnection.addEventListener('negotiationneeded', async () => {
try {
console.log('Negotiation needed', peerConnection.signalingState)
negotiationService.startNegotiation()
} catch (error) {
console.error('Error creating offer/answer:', error)

1
src/modules/calls/widgets/incoming-call.widget.tsx

@ -49,7 +49,6 @@ export const IncomingCallWidget = () => { @@ -49,7 +49,6 @@ export const IncomingCallWidget = () => {
}, [])
useEventsListener('android/acceptIncomingCall', data => {
console.log('callUUID', data)
callKeepService.onAnswer({ callUUID: data.callUUID })
})

1
src/modules/chats/hooks/use-chat-messages.hook.ts

@ -663,7 +663,6 @@ export const useChatMessages = () => { @@ -663,7 +663,6 @@ export const useChatMessages = () => {
useEventsListener(
'onNewMessage',
data => {
console.log('ON NEW MESSAGE', data)
onNewMessage(data)
},
[chatId, messages],

4
src/modules/chats/hooks/use-create-text-message.hook.ts

@ -87,9 +87,7 @@ export const useCreateTextMessage = ({ @@ -87,9 +87,7 @@ export const useCreateTextMessage = ({
})
setEditedMessage(null)
} else {
await chatMessageManager.sendTextMessage.bind(
chatMessageManager,
)(data)
await chatMessageManager.sendTextMessage(data)
}
} catch (e) {
console.log('SEND MESSAGE ERROR', e)

8
src/modules/chats/screens/chat-file-preview.screen.tsx

@ -45,14 +45,6 @@ export const ChatFilePreviewScreen = () => { @@ -45,14 +45,6 @@ export const ChatFilePreviewScreen = () => {
onLoad={stopLoading}
/>
)
// case FileType.TXT:
// return (
// <WebviewPlugin
// url={params?.fileUrl}
// renderHtml
// onLoaded={stopLoading}
// />
// )
default:
return (
<WebviewPlugin

6
src/modules/chats/transforms/chat-messages.transforms.ts

@ -216,11 +216,5 @@ export const transformMessages = ( @@ -216,11 +216,5 @@ export const transformMessages = (
result[i] = transformMessage(it, members, accountId)
})
console.log(
'transformedMessages',
messages[messages.length - 1],
result[result.length - 1],
)
return result
}

1
src/modules/root/hooks/use-app-badge.hook.ts

@ -119,7 +119,6 @@ export const useAppBadge = () => { @@ -119,7 +119,6 @@ export const useAppBadge = () => {
await tasksService.getUnreadTasksCount()
const onChatIsRead = async (data: SocketEvents['chat/is-read']) => {
console.log('chatWasReaddeed', data)
if (data.userId === account.id)
setTimeout(async () => await reloadUnreadMessagesCount(), 1000)
}

2
src/modules/tasks/hooks/use-task-actions.hook.ts

@ -106,8 +106,6 @@ export const useTaskActions = (reload = (id: number) => {}) => { @@ -106,8 +106,6 @@ export const useTaskActions = (reload = (id: number) => {}) => {
...payload,
})
console.log('TASK DONE', action, result)
if (action === FullTaskActions.Reassign) onReassing(result)
} catch (e: any) {
console.log('Error on do task action', e.response.data.message)

7
src/services/domain/auth.service.ts

@ -70,17 +70,11 @@ export const autoAuth = async () => { @@ -70,17 +70,11 @@ export const autoAuth = async () => {
if (!existTokens.refreshToken) {
throw new Error('refreshToken didnt exists')
}
console.log('AUTO AUTH 1 ')
await authTokensService.saveTokens(existTokens)
const cacheInfo = await accountService.getCacheInfo()
console.log('AUTO AUTH 2 ')
await loadDataAfterAuth(cacheInfo)
console.log('AUTO AUTH 3')
loadNotImportantData(cacheInfo)
// ***** run synchronization *****
@ -97,7 +91,6 @@ export const autoAuth = async () => { @@ -97,7 +91,6 @@ export const autoAuth = async () => {
},
})
// await dropTokens().catch()
onLogout()
NavigationService.setModule(NavigationModuleKey.Auth)
}

26
src/services/system/fs.service.ts

@ -4,9 +4,11 @@ import { @@ -4,9 +4,11 @@ import {
createUniqueFileName,
getFileExtension,
getFileName,
getFileNameFromUrl,
getFileUri,
getMimeTypeByExtension,
getNameFromFileUrl,
getOriginFileName,
getUrlExtension,
isAndroid,
isImage,
@ -196,37 +198,23 @@ const _downloadFile = ( @@ -196,37 +198,23 @@ const _downloadFile = (
export const shareText = async (title: string, message: string) => {
try {
const result = await Share.open({
await Share.open({
title: title,
message: message,
})
if (result.success) {
console.log('succes sharing')
} else if (result.dismissedAction) {
console.log('dismissed')
}
} catch (error: any) {
console.log(error.message)
// Alert.alert(error.message)
}
}
export const shareUrl = async (title: string, message: string) => {
try {
const result = await Share.open({
await Share.open({
title: title,
url: message,
})
if (result.success) {
console.log('succes sharing')
} else if (result.dismissedAction) {
console.log('dismissed')
}
} catch (error: any) {
console.log(error.message)
// Alert.alert(error.message)
}
}
@ -359,10 +347,12 @@ const validFileType = [ @@ -359,10 +347,12 @@ const validFileType = [
const previewFile = (url: string) => {
try {
const extension = getUrlExtension(url)
if (!_.includes(validFileType, extension)) throw new Error()
const localFile = `${RNFS.DocumentDirectoryPath}/temporaryfile.${extension}`
if (!_.includes(validFileType, extension)) throw new Error()
const name = getOriginFileName(url)
const localFile = `${RNFS.DocumentDirectoryPath}/${name}`
console.log(localFile)
const options = {
fromUrl: url,
toFile: localFile,

2
src/services/system/media-permissions.service.ts

@ -20,8 +20,6 @@ const checkCameraPermissions = async (permission: any): Promise<boolean> => { @@ -20,8 +20,6 @@ const checkCameraPermissions = async (permission: any): Promise<boolean> => {
default: {
const requestRes = await request(permission)
console.log('requestRes', requestRes)
if (
requestRes === RESULTS.GRANTED ||
requestRes === RESULTS.LIMITED

2
src/services/system/synchronization.service.ts

@ -33,7 +33,6 @@ export class SynchronizationService extends EventsListener { @@ -33,7 +33,6 @@ export class SynchronizationService extends EventsListener {
}
public async runSynchronization() {
console.log('I RUN SYNCHRONIZATION', this.isRunning)
if (this.isRunning) return
this.isRunning = true
@ -106,7 +105,6 @@ export class SynchronizationService extends EventsListener { @@ -106,7 +105,6 @@ export class SynchronizationService extends EventsListener {
* в т.ч. задач, яких ще нема в локальній бд
*/
const isSuccess = await this.tasksManager.loadTasks(diffIds)
// console.log('is success', isSuccess)
if (isSuccess)
await this.versionsManager.saveVersions({

3
src/shared/abstract/events-listener.ts

@ -9,17 +9,14 @@ export abstract class EventsListener { @@ -9,17 +9,14 @@ export abstract class EventsListener {
constructor() {
socketEvents.on('version', (data: SocketEvents['version']) => {
console.log('CATCH CHANGE VERSION SOCKET', data)
this.onChangeVersion(data)
})
appEvents.on('onReconnect', () => {
console.log('CATCH RECONNECT SOCKET')
this.onReconnect()
})
socketEvents.on('user/new-user', () => {
console.log('CATCH NEW USER SOCKET')
this.onNewUser()
})
}

6
src/shared/abstract/manager.ts

@ -7,12 +7,6 @@ export abstract class Manager { @@ -7,12 +7,6 @@ export abstract class Manager {
appEvents.on(
'onChangeConnection',
({ status }: AppEvents['onChangeConnection']) => {
// console.log(
// 'i change connection status from',
// this.isConnected,
// 'to',
// status,
// )
this.isConnected = status
},
)

1
src/shared/abstract/sqlite-repository.ts

@ -119,7 +119,6 @@ export abstract class SqliteRepository extends Repository { @@ -119,7 +119,6 @@ export abstract class SqliteRepository extends Repository {
constructor() {
super()
appEvents.on('logout', () => {
// console.log('LOGOUT')
this.onLogout()
})
}

2
src/shared/components/elements/icon.component.tsx

@ -16,7 +16,7 @@ interface IProps { @@ -16,7 +16,7 @@ interface IProps {
export const IconComponent = ({ onPress, ...props }: IProps) => {
if (onPress) {
return (
<TouchableOpacity onPress={onPress} style={[props.btnStyle]}>
<TouchableOpacity onPress={onPress} style={props.btnStyle}>
<Icon
name={props.name}
size={props.size}

8
src/shared/components/forms/touchable-fake-input.atom.tsx

@ -109,8 +109,12 @@ const createStyles = (theme: PartialTheme) => @@ -109,8 +109,12 @@ const createStyles = (theme: PartialTheme) =>
},
icon: {
position: 'absolute',
right: $size(20, 18),
top: $size(12, 10),
right: $size(10),
top: 0,
height: $size(46, 44),
paddingHorizontal: 10,
justifyContent: 'center',
alignItems: 'center',
},
error: {
color: theme.$errorText,

6
src/shared/components/plugins/webview.component.tsx

@ -19,10 +19,8 @@ export const WebviewPlugin: FC<IProps> = ({ @@ -19,10 +19,8 @@ export const WebviewPlugin: FC<IProps> = ({
const { styles } = useTheme(createStyles)
const { fileContent } = useFileContent(url)
const webViewRef = useRef<WebView>()
console.log(url)
const _onLoaded = () => {
console.log(webViewRef.current)
onLoaded()
}
@ -57,10 +55,6 @@ export const WebviewPlugin: FC<IProps> = ({ @@ -57,10 +55,6 @@ export const WebviewPlugin: FC<IProps> = ({
}
}}
scalesPageToFit={false}
onError={e => {
Alert.alert('asdasd')
console.log('errore', e)
}}
/>
)}
</View>

5
src/shared/hooks/use-shared-files.hook.ts

@ -19,9 +19,7 @@ export const useSharedFiles = () => { @@ -19,9 +19,7 @@ export const useSharedFiles = () => {
(receivedFiles: ISharedFile[]) => {
setFiles(receivedFiles)
},
(error: unknown) => {
// console.log('Error on receive shared files', error)
},
() => {},
'ComTaskmeAppShare',
)
}
@ -31,7 +29,6 @@ export const useSharedFiles = () => { @@ -31,7 +29,6 @@ export const useSharedFiles = () => {
useEffect(() => {
if (activeModule === NavigationModuleKey.User && !_.isEmpty(files)) {
console.log('FILES', files)
NavigationService.navigate(RouteKey.SendSharedFiles, {
files,
})

Loading…
Cancel
Save