@ file : Jvm Name (" Market place Utils ") Ċ Ċ package Ġcom . jetbrains . edu . learning . marketplace Ċ Ċ import Ġcom . intellij . openapi . application . Application Manager Ċ import Ġcom . intellij . openapi . application . run In Ed t Ċ import Ġcom . intellij . openapi . project . Project Ċ import Ġcom . intellij . ui . Editor Notifications Ċ import Ġcom . jetbrains . edu . learning . E du Experimental Features Ċ import Ġcom . jetbrains . edu . learning . compute Under Progress Ċ import Ġcom . jetbrains . edu . learning . course Format . Course Ċ import Ġcom . jetbrains . edu . learning . course Format . Course Visibility Ċ import Ġcom . jetbrains . edu . learning . course Format . E du Course Ċ import Ġcom . jetbrains . edu . learning . course Format . Vendor Ċ import Ġcom . jetbrains . edu . learning . course Format . tasks . Theory Task Ċ import Ġcom . jetbrains . edu . learning . is Feature Enabled Ċ import Ġcom . jetbrains . edu . learning . marketplace . api . Market place Connector Ċ import Ġcom . jetbrains . edu . learning . marketplace . api . Market place Sub missions Connector Ċ import Ġcom . jetbrains . edu . learning . marketplace . new Project UI . Market place Platform Provider . Companion . MARK ET PLACE _ GROUP _ ID Ċ import Ġcom . jetbrains . edu . learning . marketplace . settings . Market place Settings Ċ import Ġcom . jetbrains . edu . learning . marketplace . update . Market place Course Updater Ċ import Ġcom . jetbrains . edu . learning . marketplace . update . get Update Version Ċ import Ġcom . jetbrains . edu . learning . messages . E du Core Bundle Ċ import Ġcom . jetbrains . edu . learning . run In Background Ċ import Ġcom . jetbrains . edu . learning . step ik . show Update Available Notification Ċ import Ġcom . jetbrains . edu . learning . yaml . Yaml Format Synchron izer Ċ Ċ private Ġconst Ġval ĠDATA _ DE LIMITER Ġ= Ġ";" Ċ private Ġconst Ġval ĠDE LIMITER Ġ= Ġ"." Ċ Ċ fun Ġdecode Hub Token ( token : ĠString ): ĠString ? Ġ{ ĊĠ Ġval Ġparts Ġ= Ġtoken . split ( DATA _ DE LIMITER ) ĊĠ Ġif Ġ( parts . size Ġ!= Ġ 2 ) Ġ{ ĊĠĠĠ Ġerror (" Hub Ġoauth Ġtoken Ġdata Ġpart Ġis Ġmalformed ") ĊĠ Ġ} ĊĠ Ġval ĠuserData Ġ= Ġparts [ 0 ]. split ( DE LIMITER ) ĊĠ Ġif Ġ( userData . size Ġ!= Ġ 4 ) Ġ{ ĊĠĠĠ Ġerror (" Hub Ġoauth Ġtoken Ġdata Ġpart Ġis Ġmalformed ") ĊĠ Ġ} ĊĠ Ġreturn Ġif Ġ( userData [ 2 ]. isEmpty ()) Ġnull Ġelse ĠuserData [ 2 ] Ċ } Ċ Ċ fun ĠCourse . update Course Items () Ġ{ ĊĠ Ġvisit Sections Ġ{ Ġsection Ġ-> Ġsection . generate Id () Ġ} ĊĠ Ġvisit Less ons Ġ{ Ġlesson Ġ-> ĊĠĠĠ Ġlesson . visit Tasks Ġ{ Ġtask Ġ-> ĊĠĠĠĠĠ Ġtask . generate Id () ĊĠĠĠ Ġ} ĊĠĠĠ Ġlesson . generate Id () ĊĠ Ġ} ĊĠ ĠYaml Format Synchron izer . save Remote Info ( this ) Ċ } Ċ Ċ fun ĠCourse . set Remote Market place Course Version () Ġ{ ĊĠ Ġval Ġupdate Info Ġ= ĠMarketplace Connector . getInstance (). get Latest Course Update Info ( id ) ĊĠ Ġif Ġ( update Info Ġ!= Ġnull ) Ġ{ ĊĠĠĠ Ġincrement Market place Course Version ( update Info . version ) ĊĠ Ġ} Ċ } Ċ Ċ fun Ġadd Vendor ( course : ĠCourse ): ĠBoolean Ġ{ ĊĠ Ġval ĠcurrentUser Ġ= ĠMarketplace Settings . INSTANCE . account Ġ?: Ġreturn Ġfalse ĊĠ Ġcourse . vendor Ġ= ĠVendor ( currentUser . userInfo . name ) ĊĠ Ġreturn Ġtrue Ċ } Ċ Ċ fun ĠCourse . load Market place Course Structure () Ġ{ ĊĠ Ġif Ġ( this Ġis ĠE du Course Ġ&& Ġis Market place Ġ&& Ġitems . isEmpty ()) Ġ{ ĊĠĠĠ Ġcompute Under Progress ( title Ġ= ĠE du Core Bundle . message (" progress . loading . course ")) Ġ{ ĊĠĠĠĠĠ ĠMarketplace Connector . getInstance (). load Course Structure ( this ) ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ fun ĠE du Course . check For Updates ( project : ĠProject , Ġupdate For ced : ĠBoolean , Ġon Finish : Ġ() Ġ-> ĠUnit ) Ġ{ ĊĠ Ġfun Ġdo Update In Background ( remote Course Version : ĠInt ) Ġ{ ĊĠĠĠ Ġrun In Background ( title Ġ= ĠE du Core Bundle . message (" progress . loading . course ")) Ġ{ ĊĠĠĠĠĠ ĠMarketplace Course Updater ( project , Ġthis , Ġremote Course Version ). update Course () ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ ĠApplication Manager . getApplication (). execute On P ooled Thread Ġ{ ĊĠĠĠ Ġval Ġremote Course Version Ġ= Ġget Update Version () ĊĠĠĠ Ġrun In Ed t Ġ{ ĊĠĠĠĠĠ Ġif Ġ( project . is Disposed ) Ġreturn @ run In Ed t ĊĠĠĠĠĠ Ġif Ġ( remote Course Version Ġ!= Ġnull ) Ġ{ ĊĠĠĠĠĠĠĠ Ġis Up ToDate Ġ= Ġfalse ĊĠĠĠĠĠĠĠ Ġif Ġ( update For ced ) Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġdo Update In Background ( remote Course Version ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠ Ġelse Ġ{ ĊĠĠĠĠĠĠĠĠĠ Ġshow Update Available Notification ( project ) Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġdo Update In Background ( remote Course Version ) ĊĠĠĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠĠĠĠĠ ĠEditor Notifications . getInstance ( project ). update All Notifications () ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġ} ĊĠĠĠĠĠ Ġon Finish () ĊĠĠĠ Ġ} ĊĠ Ġ} Ċ } Ċ Ċ fun ĠE du Course . update Feature d Status () Ġ{ ĊĠ Ġif Ġ( course . id Ġin ĠMarketplace List ed Courses Ids Loader . featured Courses Ids ) Ġ{ ĊĠĠĠ Ġcourse . visibility Ġ= ĠCourse Visibility . Feature d Visibility ( MARK ET PLACE _ GROUP _ ID ) ĊĠ Ġ} Ċ } Ċ Ċ fun Ġmark Theory Task As Completed ( project : ĠProject , Ġtask : ĠTheory Task ) Ġ{ ĊĠ Ġif Ġ(! is Feature Enabled ( E du Experimental Features . MARK ET PLACE _ SUB MISSION S )) Ġreturn ĊĠ Ġrun In Background ( project , ĠE du Core Bundle . message (" marketplace . post ing . theory "), Ġfalse ) Ġ{ ĊĠĠĠ ĠMarketplace Sub missions Connector . getInstance (). mark Theory Task As Completed ( project , Ġtask ) ĊĠ Ġ} Ċ } Ċ