< Summary

Class:DCL.Social.Passports.PassportNavigationComponentController
Assembly:PassportHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Passport/Passport/PassportNavigation/PassportNavigationComponentController.cs
Covered lines:5
Uncovered lines:8
Coverable lines:13
Total lines:43
Line coverage:38.4% (5 of 13)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PassportNavigationComponentController(...)0%110100%
UpdateWithUserProfile(...)0%2100%
UpdateWithUserProfileAsync()0%12300%
FilterName()0%20400%
IsProfanityFilteringEnabled()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/Passport/Passport/PassportNavigation/PassportNavigationComponentController.cs

#LineLine coverage
 1using Cysharp.Threading.Tasks;
 2using System.Collections;
 3using System.Collections.Generic;
 4using UnityEngine;
 5
 6namespace DCL.Social.Passports
 7{
 8    public class PassportNavigationComponentController
 9    {
 10        private readonly IProfanityFilter profanityFilter;
 11        private readonly DataStore dataStore;
 12
 13        private IPassportNavigationComponentView view;
 14
 215        public PassportNavigationComponentController(IPassportNavigationComponentView view, IProfanityFilter profanityFi
 16        {
 217            this.view = view;
 218            this.profanityFilter = profanityFilter;
 219            this.dataStore = dataStore;
 220        }
 21
 022        public void UpdateWithUserProfile(UserProfile userProfile) => UpdateWithUserProfileAsync(userProfile);
 23
 24        private async UniTask UpdateWithUserProfileAsync(UserProfile userProfile)
 25        {
 026            string filteredName = await FilterName(userProfile);
 027            view.SetName(filteredName);
 028            view.SetGuestUser(userProfile.isGuest);
 029        }
 30
 31        private async UniTask<string> FilterName(UserProfile userProfile)
 32        {
 033            return IsProfanityFilteringEnabled()
 34                ? await profanityFilter.Filter(userProfile.userName)
 35                : userProfile.userName;
 036        }
 37
 38        private bool IsProfanityFilteringEnabled()
 39        {
 040            return dataStore.settings.profanityChatFilteringEnabled.Get();
 41        }
 42    }
 43}