Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
appinventor-sources
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
appinventor-sources
Commits
79204ae5
Commit
79204ae5
authored
May 23, 2020
by
Evan W. Patton
Committed by
Jeffrey Schiller
May 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix galleryId, repo, and template URLs when autoload is false
Change-Id: If329454dfdb33f99df07be008369d220a4a11de9
parent
aa050c6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
33 deletions
+47
-33
appinventor/appengine/src/com/google/appinventor/client/Ode.java
...ntor/appengine/src/com/google/appinventor/client/Ode.java
+47
-33
No files found.
appinventor/appengine/src/com/google/appinventor/client/Ode.java
View file @
79204ae5
...
...
@@ -583,58 +583,72 @@ public class Ode implements EntryPoint {
resizeWorkArea
((
WorkAreaPanel
)
deckPanel
.
getWidget
(
debuggingTabIndex
));
}
public
void
openPreviousProject
()
{
/**
* Processes the template and galleryId flags.
*
* @return true if a template or gallery id is present and being handled, otherwise false.
*/
private
boolean
handleQueryString
()
{
if
(
userSettings
==
null
)
{
OdeLog
.
wlog
(
"Ignoring openPreviousProject() since userSettings is null"
);
return
;
return
false
;
}
OdeLog
.
log
(
"Ode.openPreviousProject called"
);
final
String
value
=
userSettings
.
getSettings
(
SettingsConstants
.
USER_GENERAL_SETTINGS
).
getPropertyValue
(
SettingsConstants
.
GENERAL_SETTINGS_CURRENT_PROJECT_ID
);
// Retrieve the userTemplates
String
userTemplates
=
userSettings
.
getSettings
(
SettingsConstants
.
USER_GENERAL_SETTINGS
)
.
getPropertyValue
(
SettingsConstants
.
USER_TEMPLATE_URLS
);
String
userTemplates
=
userSettings
.
getSettings
(
SettingsConstants
.
USER_GENERAL_SETTINGS
)
.
getPropertyValue
(
SettingsConstants
.
USER_TEMPLATE_URLS
);
TemplateUploadWizard
.
setStoredTemplateUrls
(
userTemplates
);
if
(
templateLoadingFlag
)
{
// We are loading a template, open it instead
// of the last project
NewProjectCommand
callbackCommand
=
new
NewProjectCommand
()
{
@Override
public
void
execute
(
Project
project
)
{
templateLoadingFlag
=
false
;
Ode
.
getInstance
().
openYoungAndroidProjectInDesigner
(
project
);
}
};
@Override
public
void
execute
(
Project
project
)
{
templateLoadingFlag
=
false
;
Ode
.
getInstance
().
openYoungAndroidProjectInDesigner
(
project
);
}
};
TemplateUploadWizard
.
openProjectFromTemplate
(
templatePath
,
callbackCommand
);
}
else
if
(
galleryIdLoadingFlag
){
return
true
;
}
else
if
(
galleryIdLoadingFlag
)
{
try
{
long
galleryId
_Long
=
Long
.
valueOf
(
galleryId
);
long
galleryId
=
Long
.
parseLong
(
this
.
galleryId
);
final
OdeAsyncCallback
<
GalleryApp
>
callback
=
new
OdeAsyncCallback
<
GalleryApp
>(
// failure message
MESSAGES
.
galleryError
())
{
@Override
public
void
onSuccess
(
GalleryApp
app
)
{
if
(
app
==
null
){
openProject
(
value
);
Window
.
alert
(
MESSAGES
.
galleryIdNotExist
());
}
else
{
Ode
.
getInstance
().
switchToGalleryAppView
(
app
,
GalleryPage
.
VIEWAPP
);
}
}
};
Ode
.
getInstance
().
getGalleryService
().
getApp
(
galleryId_Long
,
callback
);
@Override
public
void
onSuccess
(
GalleryApp
app
)
{
if
(
app
==
null
)
{
Window
.
alert
(
MESSAGES
.
galleryIdNotExist
());
// Reset the galleryId flag and then load the previous project
galleryIdLoadingFlag
=
false
;
openPreviousProject
();
}
else
{
Ode
.
getInstance
().
switchToGalleryAppView
(
app
,
GalleryPage
.
VIEWAPP
);
}
}
};
Ode
.
getInstance
().
getGalleryService
().
getApp
(
galleryId
,
callback
);
return
true
;
}
catch
(
NumberFormatException
e
)
{
openProject
(
value
);
Window
.
alert
(
MESSAGES
.
galleryIdNotExist
());
}
}
else
{
openProject
(
value
);
}
return
false
;
}
/**
* Opens the user's last project, if the information is known.
*/
private
void
openPreviousProject
()
{
if
(
userSettings
==
null
)
{
OdeLog
.
wlog
(
"Ignoring openPreviousProject() since userSettings is null"
);
return
;
}
final
String
value
=
userSettings
.
getSettings
(
SettingsConstants
.
USER_GENERAL_SETTINGS
)
.
getPropertyValue
(
SettingsConstants
.
GENERAL_SETTINGS_CURRENT_PROJECT_ID
);
openProject
(
value
);
}
private
void
openProject
(
String
projectIdString
)
{
OdeLog
.
log
(
"Ode.openProject called for "
+
projectIdString
);
if
(
projectIdString
.
equals
(
""
))
{
openPreviousProject
();
}
else
if
(!
projectIdString
.
equals
(
"0"
))
{
...
...
@@ -853,7 +867,7 @@ public class Ode implements EntryPoint {
@Override
public
void
onProjectsLoaded
()
{
projectManager
.
removeProjectManagerEventListener
(
this
);
if
(
shouldAutoloadLastProject
())
{
if
(
!
handleQueryString
()
&&
shouldAutoloadLastProject
())
{
openPreviousProject
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment