mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 11:41:20 +08:00
start versionParser
This commit is contained in:
@ -42,7 +42,7 @@ export class IonicApp {
|
|||||||
return this._ua;
|
return this._ua;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchesQuery(queryValue) {
|
matchQuery(queryValue) {
|
||||||
let val = this.query('ionicplatform');
|
let val = this.query('ionicplatform');
|
||||||
if (val) {
|
if (val) {
|
||||||
let valueSplit = val.toLowerCase().split(';');
|
let valueSplit = val.toLowerCase().split(';');
|
||||||
@ -55,17 +55,19 @@ export class IonicApp {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchesUserAgent(userAgentExpression) {
|
matchUserAgent(userAgentExpression) {
|
||||||
|
if (this._ua) {
|
||||||
let rx = new RegExp(userAgentExpression, 'i');
|
let rx = new RegExp(userAgentExpression, 'i');
|
||||||
return rx.test(this._ua);
|
return rx.exec(this._ua);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
matchesPlatform(queryValue, userAgentExpression) {
|
isPlatform(queryValue, userAgentExpression) {
|
||||||
if (!userAgentExpression) {
|
if (!userAgentExpression) {
|
||||||
userAgentExpression = queryValue;
|
userAgentExpression = queryValue;
|
||||||
}
|
}
|
||||||
return this.matchesQuery(queryValue) ||
|
return (this.matchQuery(queryValue)) ||
|
||||||
this.matchesUserAgent(userAgentExpression);
|
(this.matchUserAgent(userAgentExpression) !== null);
|
||||||
}
|
}
|
||||||
|
|
||||||
width(val) {
|
width(val) {
|
||||||
|
@ -55,7 +55,7 @@ Platform.register({
|
|||||||
mode: 'md'
|
mode: 'md'
|
||||||
},
|
},
|
||||||
isMatch(app) {
|
isMatch(app) {
|
||||||
return app.matchesPlatform('android');
|
return app.isPlatform('android');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -75,7 +75,11 @@ Platform.register({
|
|||||||
// SLEDGEHAMMER OVERRIDE FOR NOW
|
// SLEDGEHAMMER OVERRIDE FOR NOW
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return app.matchesPlatform('ios', 'iphone|ipad|ipod');
|
return app.isPlatform('ios', 'iphone|ipad|ipod');
|
||||||
|
},
|
||||||
|
versionParser: {
|
||||||
|
let val = app.matchUserAgent('OS (\d+)_(\d+)?');
|
||||||
|
console.log(val);
|
||||||
},
|
},
|
||||||
run() {
|
run() {
|
||||||
//Tap.run();
|
//Tap.run();
|
||||||
@ -87,7 +91,7 @@ Platform.register({
|
|||||||
name: 'ipad',
|
name: 'ipad',
|
||||||
superset: 'tablet',
|
superset: 'tablet',
|
||||||
isMatch(app) {
|
isMatch(app) {
|
||||||
return app.matchesPlatform('ipad');
|
return app.isPlatform('ipad');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -98,7 +102,7 @@ Platform.register({
|
|||||||
'phablet'
|
'phablet'
|
||||||
],
|
],
|
||||||
isMatch(app) {
|
isMatch(app) {
|
||||||
return app.matchesPlatform('iphone');
|
return app.isPlatform('iphone');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -114,7 +118,7 @@ Platform.register({
|
|||||||
mode: 'wp'
|
mode: 'wp'
|
||||||
},
|
},
|
||||||
isMatch(app) {
|
isMatch(app) {
|
||||||
return app.matchesPlatform('windowsphone', 'windows phone');
|
return app.isPlatform('windowsphone', 'windows phone');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user