Skip to content

Commit 61d4591

Browse files
Rename WebAppCordova to MeteorWebApp
1 parent c2e1e95 commit 61d4591

File tree

6 files changed

+36
-36
lines changed

6 files changed

+36
-36
lines changed

plugin.xml

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@
1616
<engine name="apple-xcode" version=">=7.2" />
1717
</engines>
1818

19-
<js-module src="www/webapp_cordova.js" name="WebAppCordova">
19+
<js-module src="www/webapp_cordova.js" name="MeteorWebApp">
2020
<merges target="WebAppCordova" />
2121
</js-module>
2222

2323
<platform name="ios">
2424
<hook type="after_plugin_install" src="scripts/iosAddBridgingHeader.js" />
2525

2626
<config-file target="config.xml" parent="/*">
27-
<feature name="WebAppCordova">
28-
<param name="ios-package" value="METWebAppCordova"/>
27+
<feature name="MeteorWebApp">
28+
<param name="ios-package" value="METWebApp"/>
2929
<param name="onload" value="true"/>
3030
</feature>
3131
</config-file>
3232

3333
<header-file src="src/ios/cordova-plugin-meteor-webapp-Bridging-Header.h" />
3434

35-
<source-file src="src/ios/WebAppCordova.swift" />
35+
<source-file src="src/ios/WebApp.swift" />
3636
<source-file src="src/ios/WebAppConfiguration.swift" />
3737
<source-file src="src/ios/AssetBundleManager.swift" />
3838
<source-file src="src/ios/AssetBundle.swift" />
@@ -90,7 +90,7 @@
9090

9191
<platform name="android">
9292
<config-file target="res/xml/config.xml" parent="/*">
93-
<feature name="WebAppCordova" >
93+
<feature name="MeteorWebApp" >
9494
<param name="android-package" value="com.meteor.webapp.WebApp" />
9595
<param name="onload" value="true" />
9696
</feature>

src/ios/WebAppCordova.swift renamed to src/ios/WebApp.swift

+20-20
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ let listeningPortRange: Range<UInt> = 12000...13000
1616
/// we revert to the last known good version
1717
let startupTimeoutInterval = 10.0
1818

19-
@objc(METWebAppCordova)
20-
final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
19+
@objc(METWebApp)
20+
final public class WebApp: CDVPlugin, AssetBundleManagerDelegate {
2121
/// The local web server responsible for serving assets to the web app
2222
private(set) var localServer: GCDWebServer!
23-
23+
2424
/// The listening port of the local web server
2525
private var localServerPort: UInt = 0
2626

2727
/// The www directory in the app bundle
2828
private(set) var wwwDirectoryURL: NSURL!
29-
29+
3030
/// Persistent configuration settings for the webapp
3131
private var configuration: WebAppConfiguration!
3232

@@ -98,10 +98,10 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
9898
NSLog("Could not remove versions directory: \(error)")
9999
return
100100
}
101-
101+
102102
configuration.reset()
103103
}
104-
104+
105105
// We keep track of the last seen initial version (see above)
106106
configuration.lastSeenInitialVersion = initialAssetBundle.version
107107

@@ -151,9 +151,9 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
151151
self?.revertToLastKnownGoodVersion()
152152
}
153153
}
154-
154+
155155
NSNotificationCenter.defaultCenter().addObserver(self, selector: "applicationDidEnterBackground", name: UIApplicationDidEnterBackgroundNotification, object: nil)
156-
156+
157157
NSNotificationCenter.defaultCenter().addObserver(self, selector: "pageDidLoad", name: CDVPageDidLoadNotification, object: webView)
158158
}
159159

@@ -166,7 +166,7 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
166166
currentAssetBundle = pendingAssetBundle
167167
self.pendingAssetBundle = nil
168168
}
169-
169+
170170
startupTimer?.startWithTimeInterval(startupTimeoutInterval)
171171
}
172172

@@ -241,7 +241,7 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
241241

242242
private func notifyDownloadFailure(error: ErrorType) {
243243
NSLog("Failure: \(error)")
244-
244+
245245
let errorMessage = String(error)
246246
let result = CDVPluginResult(status: CDVCommandStatus_OK, messageAsString: errorMessage)
247247
commandDelegate?.sendPluginResult(result, callbackId: downloadFailureCallbackId)
@@ -252,7 +252,7 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
252252
func revertToLastKnownGoodVersion() {
253253
// Blacklist the current version, so we don't update to it again rightaway
254254
configuration.addBlacklistedVersion(currentAssetBundle.version)
255-
255+
256256
if let lastKnownGoodVersion = configuration.lastKnownGoodVersion,
257257
let lastKnownGoodAssetBundle = assetBundleManager.downloadedAssetBundleWithVersion(lastKnownGoodVersion) {
258258
pendingAssetBundle = lastKnownGoodAssetBundle
@@ -287,31 +287,31 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
287287

288288
func assetBundleManager(assetBundleManager: AssetBundleManager, didFinishDownloadingBundle assetBundle: AssetBundle) {
289289
NSLog("Finished downloading new asset bundle version: \(assetBundle.version)")
290-
290+
291291
do {
292292
try verifyDownloadedAssetBundle(assetBundle)
293-
293+
294294
configuration.lastDownloadedVersion = assetBundle.version
295295
pendingAssetBundle = assetBundle
296296
notifyNewVersionDownloaded(assetBundle.version)
297297
} catch {
298298
notifyDownloadFailure(error)
299299
}
300300
}
301-
301+
302302
private func verifyDownloadedAssetBundle(assetBundle: AssetBundle) throws {
303303
guard let appId = assetBundle.appId else {
304304
throw WebAppError.UnsuitableAssetBundle(reason: "Could not find appId in downloaded asset bundle", underlyingError: nil)
305305
}
306-
306+
307307
if appId != configuration.appId {
308308
throw WebAppError.UnsuitableAssetBundle(reason: "appId in downloaded asset bundle does not match current appId", underlyingError: nil)
309309
}
310-
310+
311311
guard let rootURL = assetBundle.rootURL else {
312312
throw WebAppError.UnsuitableAssetBundle(reason: "Could not find ROOT_URL in downloaded asset bundle", underlyingError: nil)
313313
}
314-
314+
315315
if configuration.rootURL?.host != "localhost" && rootURL.host == "localhost" {
316316
throw WebAppError.UnsuitableAssetBundle(reason: "ROOT_URL in downloaded asset bundle would change current ROOT_URL to localhost. Make sure ROOT_URL has been configured correctly on the server.", underlyingError: nil)
317317
}
@@ -389,11 +389,11 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
389389
private func addIndexFileHandler() {
390390
localServer.addHandlerWithMatchBlock({ [weak self] (requestMethod, requestURL, requestHeaders, URLPath, URLQuery) -> GCDWebServerRequest! in
391391
if requestMethod != "GET" { return nil }
392-
392+
393393
if URLPath == "/favicon.ico" { return nil }
394394

395395
guard let indexFile = self?.currentAssetBundle?.indexFile else { return nil }
396-
396+
397397
let request = GCDWebServerRequest(method: requestMethod, url: requestURL, headers: requestHeaders, path: URLPath, query: URLQuery)
398398
request.setAttribute(Box(indexFile), forKey: GCDWebServerRequestAttribute_Asset)
399399
return request
@@ -402,7 +402,7 @@ final public class WebAppCordova: CDVPlugin, AssetBundleManagerDelegate {
402402
return self.responseForAsset(request, asset: asset)
403403
}
404404
}
405-
405+
406406
private func addNotFoundHandler() {
407407
localServer.addDefaultHandlerForMethod("GET", requestClass: GCDWebServerRequest.self) { (request) -> GCDWebServerResponse! in
408408
return GCDWebServerResponse(statusCode: GCDWebServerClientErrorHTTPStatusCode.HTTPStatusCode_NotFound.rawValue)

tests/plugin.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<clobbers target="WebAppMockRemoteServer" />
1919
</js-module>
2020

21-
<js-module src="www/webapp_cordova_testing.js" name="WebAppCordovaTesting">
21+
<js-module src="www/webapp_cordova_testing.js" name="MeteorWebAppTesting">
2222
<merges target="WebAppCordova" />
2323
</js-module>
2424

tests/src/ios/WebAppCordova+Testing.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extension WebAppCordova {
1+
extension WebApp {
22
func resetToInitialState(command: CDVInvokedUrlCommand) {
33
commandDelegate?.runInBackground() {
44
self.stopLocalServer()

tests/www/webapp_cordova_testing.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
cordova.exec(
44
callback,
55
console.error,
6-
"WebAppCordova",
6+
"MeteorWebApp",
77
"resetToInitialState",
88
[]);
99
},
@@ -12,7 +12,7 @@ module.exports = {
1212
cordova.exec(
1313
callback,
1414
console.error,
15-
"WebAppCordova",
15+
"MeteorWebApp",
1616
"simulatePageReload",
1717
[]);
1818
},
@@ -21,7 +21,7 @@ module.exports = {
2121
cordova.exec(
2222
callback,
2323
console.error,
24-
"WebAppCordova",
24+
"MeteorWebApp",
2525
"simulateAppRestart",
2626
[]);
2727
},
@@ -30,7 +30,7 @@ module.exports = {
3030
cordova.exec(
3131
callback,
3232
console.error,
33-
"WebAppCordova",
33+
"MeteorWebApp",
3434
"downloadedVersionExists",
3535
[version]);
3636
},
@@ -39,7 +39,7 @@ module.exports = {
3939
cordova.exec(
4040
callback,
4141
console.error,
42-
"WebAppCordova",
42+
"MeteorWebApp",
4343
"simulatePartialDownload",
4444
[version]);
4545
}

www/webapp_cordova.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = {
33
cordova.exec(
44
callback,
55
console.error,
6-
"WebAppCordova",
6+
"MeteorWebApp",
77
"startupDidComplete",
88
[]);
99
},
@@ -12,7 +12,7 @@ module.exports = {
1212
cordova.exec(
1313
callback,
1414
console.error,
15-
"WebAppCordova",
15+
"MeteorWebApp",
1616
"checkForUpdates",
1717
[]);
1818
},
@@ -21,7 +21,7 @@ module.exports = {
2121
cordova.exec(
2222
callback,
2323
console.error,
24-
"WebAppCordova",
24+
"MeteorWebApp",
2525
"onNewVersionDownloaded",
2626
[]);
2727
},
@@ -34,7 +34,7 @@ module.exports = {
3434
callback(error);
3535
},
3636
console.error,
37-
"WebAppCordova",
37+
"MeteorWebApp",
3838
"onDownloadFailure",
3939
[]);
4040
}

0 commit comments

Comments
 (0)