Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
302 changes: 86 additions & 216 deletions lib/Source/io/newgrounds/NG.hx

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/Source/io/newgrounds/NGLite.hx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class NGLite {
create(appId, session, callback);
}

inline static public function getUrl():String {
inline static public function getUrl():Null<String> {

#if js
return js.Browser.document.location.href;
Expand All @@ -167,7 +167,7 @@ class NGLite {
#end
}

static public function getSessionId():String {
static public function getSessionId():Null<String> {

#if js

Expand Down
12 changes: 10 additions & 2 deletions lib/Source/io/newgrounds/components/AppComponent.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ class AppComponent extends Component {
.addComponentParameter("force", force, false);
}

public function checkSession():Call<SessionData> {
/**
* Checks the status of the supplied session id
* @param id If null, the current session is used
*/
public function checkSession(?id:String):Call<SessionData> {

return new Call<SessionData>(_core, "App.checkSession", true);
return if (id == null)
new Call<SessionData>(_core, "App.checkSession", true);
else
new Call<SessionData>(_core, "App.checkSession", false)
.addProperty("session_id", id);
}

public function endSession():Call<SessionData> {
Expand Down
2 changes: 1 addition & 1 deletion lib/Source/io/newgrounds/swf/MedalPopup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class MedalPopup extends BaseAsset {
onMedalsLoaded();
else {

NG.core.onLogin.addOnce(function () {
NG.core.session.onLogIn.addOnce(function () {

NG.core.medals.onLoad.addOnce(onMedalsLoaded);
NG.core.medals.loadList();
Expand Down
2 changes: 1 addition & 1 deletion lib/Source/io/newgrounds/utils/SaveSlotList.hx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private class RawSaveSlotList extends ObjectList<Int, SaveSlot> {
*/
public function loadList(?callback:(Outcome<CallError>)->Void) {

if (_core.loggedIn == false)
if (_core.session.status.match(LOGGED_IN(_)) == false)
throw "Must be logged in to request cloud saves";

if (checkState(callback) == false)
Expand Down
Loading