-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.js
83 lines (59 loc) · 2.13 KB
/
configure.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* TBH-Kitsu
*
* This package is a integration of Toon Boom Harmony with Kitsu. This integration creates
* an easier production management flow by allowing creators to push task updates directly
* from their working space to kitsu for review, tracking and compilation.
*
* Kitsu is a validation tracking app for animation productions. Through its clean UI, APIs and shared database
* it allows you to communicate efficiently with all the shareholders of the production: Artists,
* Production managers, TDs, Supervisors, Vendors, and Clients.
*/
//import global functions
var globalImport = require("./helpers/globals.js")
var alert = new globalImport.Alert()
var fileOperations = new globalImport.FileOperations()
var jsonFilePath = globalImport.localScriptsPath() + "/config.json"
//import app page functions
var app = require("./app.js")
alert.log("Successfully loaded the TBH-Kitsu package")
function configure(packageFolder, packageName) {
ScriptManager.addView({
id: "TBH Kitsu",
text: "TBH Kitsu",
action: "initAppUI in ./configure.js"
})
}
function initAppUI(){
try{
//load app base ui
alert.log("Loaded ui")
//check for config file
if(fileOperations.exists(jsonFilePath)){
var packageConfigFile = fileOperations.read(jsonFilePath)
var packageConfig = JSON.parse(packageConfigFile)
//check for setup details
if(!packageConfig.kitsu_address){
app.showPage(0)
}else{
//check for auth details
if(packageConfig.access_token && packageConfig.refresh_token){
//check for selected active production
if(packageConfig.current_project.id){
app.showPage(3)
}else{
app.showPage(2)
}
}else{
app.showPage(1)
}
}
}else{
app.showPage(0)
}
app.show()
}catch(err){
alert.log(err)
}
}
exports.configure = configure