diff --git a/scripts/_common.sh b/scripts/_common.sh index 1f9842d..a3b94b0 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -49,6 +49,9 @@ install_source() { a=${a//'*'/'\*'} } + # We get the name of the Lifecycle objet + Lifecycle_object_name=$(egrep -o "onLoggedIn:\w+\.setLoggedIn," bundle.js $final_path/bundles/*/bundle.js | egrep -o ":\w+\." | egrep -o "\w") + # We get the part witch we need to patch and create a regular expression a='case"start_login":this.setStateForNewView({view:unnamed_object.LOGIN}),this.notifyNewScreen("login");break;' escape_string @@ -58,6 +61,7 @@ install_source() { a="$(cat ../sources/bundle_patch.js)" escape_string a="${a//'unnamed_object'/'\1'}" + a="${a//'Lifecycle'/$Lifecycle_object_name}" a="$(echo "$a" | sed -r "s|//.*||g")" replace_string="$(echo $a)" sed --in-place -r "s|$match_string|$replace_string|g" $final_path/bundles/*/bundle.js diff --git a/sources/bundle_patch.js b/sources/bundle_patch.js index 14949dc..8469bfb 100644 --- a/sources/bundle_patch.js +++ b/sources/bundle_patch.js @@ -11,7 +11,7 @@ case "start_login": console.log(this.response); if ((xhr.status == '200') && this.response.accessToken) { - H.setLoggedIn(this.response); + Lifecycle.setLoggedIn(this.response); thisobject.setStateForNewView({ view: unnamed_object.LOGGING_IN });