mirror of
https://github.com/bitwarden/mobile
synced 2025-12-22 19:23:58 +00:00
tree node traversal for folder
This commit is contained in:
8
src/Core/Models/Domain/ITreeNodeObject.cs
Normal file
8
src/Core/Models/Domain/ITreeNodeObject.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
public interface ITreeNodeObject
|
||||
{
|
||||
string Id { get; set; }
|
||||
string Name { get; set; }
|
||||
}
|
||||
}
|
||||
18
src/Core/Models/Domain/TreeNode.cs
Normal file
18
src/Core/Models/Domain/TreeNode.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
public class TreeNode<T> where T : ITreeNodeObject
|
||||
{
|
||||
public T Parent { get; set; }
|
||||
public T Node { get; set; }
|
||||
public List<TreeNode<T>> Children { get; set; }
|
||||
|
||||
public TreeNode(T node, string name, T parent)
|
||||
{
|
||||
Parent = parent;
|
||||
Node = node;
|
||||
Node.Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Bit.Core.Models.View
|
||||
{
|
||||
public class CollectionView : View
|
||||
public class CollectionView : View, ITreeNodeObject
|
||||
{
|
||||
public CollectionView() { }
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
|
||||
namespace Bit.Core.Models.View
|
||||
{
|
||||
public class FolderView : View
|
||||
public class FolderView : View, ITreeNodeObject
|
||||
{
|
||||
public FolderView() { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user