diff --git a/client/absolute.ts b/client/absolute.ts index 422d9437..72ae80c7 100644 --- a/client/absolute.ts +++ b/client/absolute.ts @@ -16,10 +16,12 @@ import PushManager from './push/push_manager'; import Notification from './notification/notification_manager'; +import AppManager from './application/application_manager'; import IndexedDB from './indexeddb/indexeddb'; export default class absolute { static push: PushManager = new PushManager(); static notification: Notification = new Notification(); + static appManager: AppManager = new AppManager(); static indexeddb: IndexedDB = new IndexedDB(); } diff --git a/client/application/application_manager.test.ts b/client/application/application_manager.test.ts new file mode 100644 index 00000000..cc6e3f10 --- /dev/null +++ b/client/application/application_manager.test.ts @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2017 The Absolute Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {} from 'jest'; +import absolute from '../absolute'; + +test('absolute.appManager.isCromeBrowser()', async() => { + expect(await absolute.appManager.isCromeBrowser()).toBe(false); +}); \ No newline at end of file diff --git a/client/application/application_manager.ts b/client/application/application_manager.ts new file mode 100644 index 00000000..6f0a944c --- /dev/null +++ b/client/application/application_manager.ts @@ -0,0 +1,27 @@ +/** + * Copyright (c) 2017 The Absolute Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default class ApplicationManager { + + async isCromeBrowser(): Promise { + var agent = navigator.userAgent.toLowerCase(); + if(agent.indexOf('chrome') != -1){ + return true; + } else { + return false; + } + } +} \ No newline at end of file diff --git a/client/main.ts b/client/main.ts index 73fe0c73..d3786817 100644 --- a/client/main.ts +++ b/client/main.ts @@ -19,6 +19,7 @@ import absolute from './absolute'; async function main() { console.log(await absolute.push.register('key')); console.log(await absolute.push.unregister()); + console.log(await absolute.appManager.isCromeBrowser()); } main();