Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:wireapp/wire-webapp into new-navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisamir98 committed Jun 27, 2024
2 parents 357954b + b855815 commit 0cdb89a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 19 deletions.
14 changes: 13 additions & 1 deletion bin/generate_react_icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ function capitalize(string: string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}

function convertToJsx(html: string): string {
// convert attributes to camelCase
return html.replace(/<(\w+)([^>]*)\/?>/g, (_, tagName: string, attributes: string) => {
// Convert attributes to camelCase
const camelCaseAttributes = attributes.trim().replace(/[\w-]+="[^"]*"/g, attr => {
const [key, value] = attr.split('=');
return `${camelize(key)}=${value}`;
});
return `<${tagName} ${camelCaseAttributes}>`;
});
}

function camelize(str: string) {
return str
.replace(/(?:^\w|[A-Z]|[\b\-_]\w)/g, function (word, index) {
Expand Down Expand Up @@ -56,7 +68,7 @@ const reactComponents = svgIcons.map(({name, content}) => {

return `export const ${capitalize(camelize(name.replace(/\.svg$/, '')))} = (props: IconProps) => {
return <svg width="${baseProps.width}" height="${baseProps.height}" viewBox="${baseProps.viewBox}" aria-hidden="true" {...props}>
${svgElement?.innerHTML}
${convertToJsx(svgElement?.innerHTML ?? '')}
</svg>;
};`;
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@mediapipe/tasks-vision": "0.10.14",
"@wireapp/avs": "9.7.15",
"@wireapp/commons": "5.2.8",
"@wireapp/core": "46.0.17",
"@wireapp/core": "46.0.18",
"@wireapp/react-ui-kit": "9.18.0",
"@wireapp/store-engine-dexie": "2.1.10",
"@wireapp/webapp-events": "0.22.0",
Expand Down
24 changes: 12 additions & 12 deletions src/script/main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ export class App {
onProgress(2.5);
telemetry.timeStep(AppInitTimingsStep.RECEIVED_ACCESS_TOKEN);

const selfUser = await this.repository.user.getSelf([{position: 'App.initiateSelfUser', vendor: 'webapp'}]);

await initializeDataDog(this.config, selfUser.qualifiedId);
onProgress(5, t('initReceivedSelfUser', selfUser.name()));

try {
await this.core.init(clientType);
} catch (error) {
Expand All @@ -384,7 +389,7 @@ export class App {
userRepository.addClientToUser(userId, newClient, true);
});

const selfUser = await this.initiateSelfUser();
await this.initiateSelfUser(selfUser);

const localClient = await this.core.getLocalClient();
if (!localClient) {
Expand All @@ -403,8 +408,6 @@ export class App {
},
});

await initializeDataDog(this.config, selfUser.qualifiedId);

// Setup all event middleware
const eventStorageMiddleware = new EventStorageMiddleware(this.service.event, selfUser);
const serviceMiddleware = new ServiceMiddleware(conversationRepository, userRepository, selfUser);
Expand All @@ -423,7 +426,6 @@ export class App {
const federationEventProcessor = new FederationEventProcessor(eventRepository, serverTimeHandler, selfUser);
eventRepository.setEventProcessors([federationEventProcessor]);

onProgress(5, t('initReceivedSelfUser', selfUser.name()));
telemetry.timeStep(AppInitTimingsStep.RECEIVED_SELF_USER);
const clientEntity = await this._initiateSelfUserClients(selfUser, clientRepository);
callingRepository.initAvs(selfUser, clientEntity.id);
Expand Down Expand Up @@ -612,20 +614,18 @@ export class App {
* Initiate the self user by getting it from the backend.
* @returns Resolves with the self user entity
*/
private async initiateSelfUser() {
const userEntity = await this.repository.user.getSelf([{position: 'App.initiateSelfUser', vendor: 'webapp'}]);

if (!userEntity.hasActivatedIdentity()) {
if (!userEntity.isTemporaryGuest()) {
private async initiateSelfUser(selfUser: User) {
if (!selfUser.hasActivatedIdentity()) {
if (!selfUser.isTemporaryGuest()) {
throw new Error('User does not have an activated identity');
}
}

container.resolve(StorageService).init(this.core.storage);
this.repository.client.init(userEntity);
await this.repository.properties.init(userEntity);
this.repository.client.init(selfUser);
await this.repository.properties.init(selfUser);

return userEntity;
return selfUser;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4846,9 +4846,9 @@ __metadata:
languageName: node
linkType: hard

"@wireapp/core@npm:46.0.17":
version: 46.0.17
resolution: "@wireapp/core@npm:46.0.17"
"@wireapp/core@npm:46.0.18":
version: 46.0.18
resolution: "@wireapp/core@npm:46.0.18"
dependencies:
"@wireapp/api-client": "npm:^27.0.10"
"@wireapp/commons": "npm:^5.2.8"
Expand All @@ -4868,7 +4868,7 @@ __metadata:
long: "npm:^5.2.0"
uuid: "npm:9.0.1"
zod: "npm:3.23.8"
checksum: 10/56aa7cd0afceb860475733935a3a3614cbd2a38cf2daffcf53d5a9f9b9dec875c49a7d3c7cb965c78df7be31ae33fbc41fff4eccd1096e2bdb136962af9289a7
checksum: 10/5bd51eeb83f0a82583ff19d9b2781985f05dd77815702fac0ae5953cfac1ec1eb6bd514aab57af7f8913b36192f5f5f22f7b1007cd646a22d06f5d19a7ab5551
languageName: node
linkType: hard

Expand Down Expand Up @@ -17500,7 +17500,7 @@ __metadata:
"@wireapp/avs": "npm:9.7.15"
"@wireapp/commons": "npm:5.2.8"
"@wireapp/copy-config": "npm:2.2.2"
"@wireapp/core": "npm:46.0.17"
"@wireapp/core": "npm:46.0.18"
"@wireapp/eslint-config": "npm:3.0.7"
"@wireapp/prettier-config": "npm:0.6.4"
"@wireapp/react-ui-kit": "npm:9.18.0"
Expand Down

0 comments on commit 0cdb89a

Please sign in to comment.