(fileName, file)
| 68 | } |
| 69 | |
| 70 | function install(fileName, file) { |
| 71 | var result = $file.write({ |
| 72 | data: file, |
| 73 | path: "app.ipa" |
| 74 | }) |
| 75 | if (result) { |
| 76 | startServer(port_number) |
| 77 | $location.startUpdates({ |
| 78 | handler: function(resp) { |
| 79 | console.info(resp.lat + " " + resp.lng + " " + resp.alt) |
| 80 | } |
| 81 | }) |
| 82 | var preResult = $app.openURL(plist_url); |
| 83 | if (preResult) { |
| 84 | $ui.alert({ |
| 85 | title: $l10n("installtitle"), |
| 86 | message: "\n" + fileName + $l10n("installmsg"), |
| 87 | actions: [{ |
| 88 | title: "Cancel", |
| 89 | style: "Cancel", |
| 90 | handler: function() { |
| 91 | $http.stopServer() |
| 92 | $file.delete("app.ipa") |
| 93 | delayClose(0.2) |
| 94 | } |
| 95 | }, |
| 96 | { |
| 97 | title: "Done", |
| 98 | handler: function() { |
| 99 | $http.stopServer() |
| 100 | $file.delete("app.ipa") |
| 101 | delayClose(0.2) |
| 102 | } |
| 103 | }] |
| 104 | }) |
| 105 | } else { |
| 106 | $ui.alert({ |
| 107 | title: "Open itms-services scheme failed", |
| 108 | message: "Please rerun the script or restart device", |
| 109 | actions: [ |
| 110 | { |
| 111 | title: "OK", |
| 112 | handler: function() { |
| 113 | delayClose(0.2) |
| 114 | } |
| 115 | }] |
| 116 | }) |
| 117 | } |
| 118 | } else { |
| 119 | $ui.alert({ |
| 120 | title: $l10n("inerrtitle"), |
| 121 | message: $l10n("inerrmsg"), |
| 122 | actions: [{ |
| 123 | title: "OK", |
| 124 | style: "Cancel", |
| 125 | handler: function() { |
| 126 | delayClose(0.2) |
| 127 | } |
no test coverage detected