Skip to content

Commit eaedc1c

Browse files
committed
user activation from backend
1 parent 9fcbba2 commit eaedc1c

File tree

1 file changed

+37
-29
lines changed

1 file changed

+37
-29
lines changed

ide-common/src/main/kotlin/org/digma/intellij/plugin/activation/UserActivationService.kt

Lines changed: 37 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ class UserActivationService : DisposableAdaptor {
101101
val project = findActiveProject()
102102
if (project != null) {
103103
val about = AnalyticsService.getInstance(project).about
104-
Log.log(logger::trace, "got server version {}", about.applicationVersion)
104+
Log.log(logger::trace, "server version {}", about.applicationVersion)
105105
if (isBackendVersion03114OrHigher(about)) {
106106
Log.log(logger::trace, "updating user activation status from server {}", about.applicationVersion)
107107
val discoveredDataResponse = AnalyticsService.getInstance(project).discoveredData
108-
Log.log(logger::trace, "got backend discovered data {}", discoveredDataResponse)
108+
Log.log(logger::trace, "backend discovered data {}", discoveredDataResponse)
109109
updateBackendStatus(discoveredDataResponse)
110110
}
111111
}
@@ -319,7 +319,7 @@ class UserActivationService : DisposableAdaptor {
319319

320320

321321
private fun setBackendRecentActivityFound(project: Project) {
322-
Log.log(logger::trace, "got backend recent activity found")
322+
Log.log(logger::trace, "backend recent activity found")
323323
setBackendDataFound(project)
324324
if (!isBackendRecentActivityFound()) {
325325
PersistenceService.getInstance().setBackendRecentActivityFound()
@@ -332,7 +332,7 @@ class UserActivationService : DisposableAdaptor {
332332
}
333333

334334
private fun setBackendAssetFound(project: Project) {
335-
Log.log(logger::trace, "got backend asset found")
335+
Log.log(logger::trace, "backend asset found")
336336
setBackendDataFound(project)
337337
if (!isBackendAssetFound()) {
338338
PersistenceService.getInstance().setBackendAssetFound()
@@ -345,7 +345,7 @@ class UserActivationService : DisposableAdaptor {
345345
}
346346

347347
private fun setBackendInsightFound(project: Project) {
348-
Log.log(logger::trace, "got backend insight found")
348+
Log.log(logger::trace, "backend insight found")
349349
setBackendDataFound(project)
350350
if (!isBackendInsightFound()) {
351351
PersistenceService.getInstance().setBackendInsightFound()
@@ -358,7 +358,7 @@ class UserActivationService : DisposableAdaptor {
358358
}
359359

360360
private fun setBackendIssueFound(project: Project) {
361-
Log.log(logger::trace, "got backend issue found")
361+
Log.log(logger::trace, "backend issue found")
362362
setBackendDataFound(project)
363363
if (!isBackendIssueFound()) {
364364
PersistenceService.getInstance().setBackendIssueFound()
@@ -371,7 +371,7 @@ class UserActivationService : DisposableAdaptor {
371371
}
372372

373373
private fun setBackendImportantIssueFound(project: Project) {
374-
Log.log(logger::trace, "got backend important issue found")
374+
Log.log(logger::trace, "backend important issue found")
375375
setBackendDataFound(project)
376376
if (!isBackendImportantIssueFound()) {
377377
PersistenceService.getInstance().setBackendImportantIssueFound()
@@ -396,7 +396,7 @@ class UserActivationService : DisposableAdaptor {
396396

397397

398398
fun setFirstIssueReceived(project: Project) {
399-
Log.log(logger::trace, "got plugin first issue received")
399+
Log.log(logger::trace, "plugin first issue received")
400400
issuesReceivedInProject(project)
401401
setFirstDataReceived(project)
402402
if (!isFirstIssueReceived()) {
@@ -425,7 +425,7 @@ class UserActivationService : DisposableAdaptor {
425425
*/
426426
fun issuesReceivedInProject(project: Project) {
427427

428-
//not interesting anymore
428+
//not interesting. user activation completed, not going to show notifications anymore
429429
if (isBackendUserActivationComplete()) {
430430
return
431431
}
@@ -435,15 +435,17 @@ class UserActivationService : DisposableAdaptor {
435435
return
436436
}
437437

438-
Log.log(logger::trace, "issues received in project {}", project.name)
439438
if (mainToolWindowOpen[project.name] == true && findActiveProject() == project) {
440-
Log.log(logger::trace, "marking userSawIssues = true")
439+
Log.log(logger::trace, "marking userSawIssues in project {}", project.name)
441440
userSawIssues = true
441+
//if we decide that user saw the issues then also mark the new issue notification as already shown
442+
// so that we don't show it after restart
443+
PersistenceService.getInstance().setAlreadyShowedNewIssueNotification()
442444
}
443445
}
444446

445447
fun setFirstAssetsReceived(project: Project) {
446-
Log.log(logger::trace, "got plugin first asset received")
448+
Log.log(logger::trace, "plugin first asset received")
447449
assetsReceivedInProject(project)
448450
setFirstDataReceived(project)
449451
if (!isFirstAssetsReceived()) {
@@ -458,7 +460,7 @@ class UserActivationService : DisposableAdaptor {
458460

459461
fun assetsReceivedInProject(project: Project) {
460462

461-
//not interesting anymore
463+
//not interesting. user activation completed, not going to show notifications anymore
462464
if (isBackendUserActivationComplete()) {
463465
return
464466
}
@@ -468,15 +470,18 @@ class UserActivationService : DisposableAdaptor {
468470
return
469471
}
470472

471-
Log.log(logger::trace, "assets received in project {}", project.name)
472473
if (mainToolWindowOpen[project.name] == true && findActiveProject() == project) {
473-
Log.log(logger::trace, "marking userSawAssets = true")
474+
Log.log(logger::trace, "marking userSawAssets in project {}", project.name)
474475
userSawAssets = true
476+
//if we decide that user saw the assets then also mark the new asset notification as already shown
477+
// so that we don't show it after restart
478+
PersistenceService.getInstance().setAlreadyShowedNewAssetNotification()
479+
475480
}
476481
}
477482

478483
fun setFirstInsightReceived(project: Project) {
479-
Log.log(logger::trace, "got plugin first insight received")
484+
Log.log(logger::trace, "plugin first insight received")
480485
insightsReceivedInProject(project)
481486
setFirstDataReceived(project)
482487
if (!isFirstInsightReceived()) {
@@ -491,7 +496,7 @@ class UserActivationService : DisposableAdaptor {
491496

492497
fun insightsReceivedInProject(project: Project) {
493498

494-
//not interesting anymore
499+
//not interesting. user activation completed, not going to show notifications anymore
495500
if (isBackendUserActivationComplete()) {
496501
return
497502
}
@@ -501,16 +506,18 @@ class UserActivationService : DisposableAdaptor {
501506
return
502507
}
503508

504-
Log.log(logger::trace, "insights received in project {}", project.name)
505509
if (mainToolWindowOpen[project.name] == true && findActiveProject() == project) {
506-
Log.log(logger::trace, "marking userSawInsights = true")
510+
Log.log(logger::trace, "marking userSawInsights in project {}", project.name)
507511
userSawInsights = true
512+
//if we decide that user saw the insights then also mark the new insight notification as already shown
513+
// so that we don't show it after restart
514+
PersistenceService.getInstance().setAlreadyShowedNewInsightNotification()
508515
}
509516
}
510517

511518

512519
fun setFirstRecentActivityReceived(project: Project) {
513-
Log.log(logger::trace, "got plugin first recent activity received")
520+
Log.log(logger::trace, "plugin first recent activity received")
514521
recentActivityReceivedInProject(project)
515522
setFirstDataReceived(project)
516523
if (!isFirstRecentActivityReceived()) {
@@ -525,7 +532,7 @@ class UserActivationService : DisposableAdaptor {
525532

526533
fun recentActivityReceivedInProject(project: Project) {
527534

528-
//not interesting anymore
535+
//not interesting. user activation completed, not going to show notifications anymore
529536
if (isBackendUserActivationComplete()) {
530537
return
531538
}
@@ -535,10 +542,12 @@ class UserActivationService : DisposableAdaptor {
535542
return
536543
}
537544

538-
Log.log(logger::trace, "recent activity received in project {}", project.name)
539545
if (recentActivityToolWindowOpen[project.name] == true && findActiveProject() == project) {
540-
Log.log(logger::trace, "marking userSawRecentActivity = true")
546+
Log.log(logger::trace, "marking userSawRecentActivity in project {}", project.name)
541547
userSawRecentActivity = true
548+
//if we decide that user saw recent activities then also mark the new recent activity notification as already shown
549+
// so that we don't show it after restart
550+
PersistenceService.getInstance().setAlreadyShowedNewRecentActivityNotification()
542551
}
543552
}
544553

@@ -556,12 +565,11 @@ class UserActivationService : DisposableAdaptor {
556565

557566

558567
fun isAnyUsageReported(): Boolean {
559-
return isBackendDataFound() ||
560-
isFirstDataReceived()
568+
return isBackendDataFound() || isFirstDataReceived()
561569
}
562570

563571
fun mainToolWindowShown(project: Project) {
564-
//not interesting anymore
572+
//not interesting. user activation completed, not going to show notifications anymore
565573
if (isBackendUserActivationComplete()) {
566574
return
567575
}
@@ -570,7 +578,7 @@ class UserActivationService : DisposableAdaptor {
570578
}
571579

572580
fun mainToolWindowHidden(project: Project) {
573-
//not interesting anymore
581+
//not interesting. user activation completed, not going to show notifications anymore
574582
if (isBackendUserActivationComplete()) {
575583
return
576584
}
@@ -579,7 +587,7 @@ class UserActivationService : DisposableAdaptor {
579587
}
580588

581589
fun recentActivityToolWindowShown(project: Project) {
582-
//not interesting anymore
590+
//not interesting. user activation completed, not going to show notifications anymore
583591
if (isBackendUserActivationComplete()) {
584592
return
585593
}
@@ -588,7 +596,7 @@ class UserActivationService : DisposableAdaptor {
588596
}
589597

590598
fun recentActivityToolWindowHidden(project: Project) {
591-
//not interesting anymore
599+
//not interesting. user activation completed, not going to show notifications anymore
592600
if (isBackendUserActivationComplete()) {
593601
return
594602
}

0 commit comments

Comments
 (0)