@@ -32,6 +32,7 @@ public class RepositoryCloneViewModel : BaseViewModel, IRepositoryCloneViewModel
3232 readonly IRepositoryCloneService cloneService ;
3333 readonly IOperatingSystem operatingSystem ;
3434 readonly INotificationService notificationService ;
35+ readonly IUsageTracker usageTracker ;
3536 readonly IReactiveCommand < IReadOnlyList < IRepositoryModel > > loadRepositoriesCommand ;
3637 readonly ReactiveCommand < object > browseForDirectoryCommand = ReactiveCommand . Create ( ) ;
3738 readonly ObservableAsPropertyHelper < bool > isLoading ;
@@ -45,20 +46,23 @@ public class RepositoryCloneViewModel : BaseViewModel, IRepositoryCloneViewModel
4546 IConnectionRepositoryHostMap connectionRepositoryHostMap ,
4647 IRepositoryCloneService repositoryCloneService ,
4748 IOperatingSystem operatingSystem ,
48- INotificationService notificationService )
49- : this ( connectionRepositoryHostMap . CurrentRepositoryHost , repositoryCloneService , operatingSystem , notificationService )
49+ INotificationService notificationService ,
50+ IUsageTracker usageTracker )
51+ : this ( connectionRepositoryHostMap . CurrentRepositoryHost , repositoryCloneService , operatingSystem , notificationService , usageTracker )
5052 { }
5153
5254 public RepositoryCloneViewModel (
5355 IRepositoryHost repositoryHost ,
5456 IRepositoryCloneService cloneService ,
5557 IOperatingSystem operatingSystem ,
56- INotificationService notificationService )
58+ INotificationService notificationService ,
59+ IUsageTracker usageTracker )
5760 {
5861 this . repositoryHost = repositoryHost ;
5962 this . cloneService = cloneService ;
6063 this . operatingSystem = operatingSystem ;
6164 this . notificationService = notificationService ;
65+ this . usageTracker = usageTracker ;
6266
6367 Title = string . Format ( CultureInfo . CurrentCulture , Resources . CloneTitle , repositoryHost . Title ) ;
6468 Repositories = new ReactiveList < IRepositoryModel > ( ) ;
@@ -139,9 +143,12 @@ IObservable<Unit> OnCloneRepository(object state)
139143 notificationService . ShowError ( Resources . RepositoryCloneFailedNoSelectedRepo ) ;
140144 return Observable . Return ( Unit . Default ) ;
141145 }
146+
142147 // The following is a noop if the directory already exists.
143148 operatingSystem . Directory . CreateDirectory ( BaseRepositoryPath ) ;
144- return cloneService . CloneRepository ( repository . CloneUrl , repository . Name , BaseRepositoryPath ) ;
149+
150+ return cloneService . CloneRepository ( repository . CloneUrl , repository . Name , BaseRepositoryPath )
151+ . Do ( _ => this . usageTracker . IncrementCloneCount ( ) ) ;
145152 } )
146153 . SelectMany ( _ => _ )
147154 . Catch < Unit , Exception > ( e =>
0 commit comments