enrecipes/app/main.ts

49 lines
1.3 KiB
TypeScript
Raw Normal View History

2021-02-28 15:10:26 +00:00
import {
localize,
androidLaunchEventLocalizationHandler,
} from '@nativescript/localize'
2021-05-25 14:32:53 +00:00
import { Application, AndroidApplication, Utils } from '@nativescript/core'
const keepScreenOn = () => {
let ctx = Utils.ad.getApplicationContext()
const pm = ctx.getSystemService(android.content.Context.POWER_SERVICE)
let isScreenOff = !pm.isInteractive()
if (isScreenOff) {
console.log('keepScreenOn')
const window = Application.android.startActivity.getWindow()
const windowMgr = android.view.WindowManager
window.addFlags(
windowMgr.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
windowMgr.LayoutParams.FLAG_TURN_SCREEN_ON |
windowMgr.LayoutParams.FLAG_KEEP_SCREEN_ON
)
}
}
Application.on(Application.resumeEvent, keepScreenOn)
Application.on(Application.launchEvent, ({ android }) => {
console.log('launching')
2021-05-22 08:56:31 +00:00
if (android) androidLaunchEventLocalizationHandler()
})
2021-05-22 08:56:31 +00:00
2021-02-28 15:10:26 +00:00
import Vue from 'nativescript-vue'
2021-04-14 13:38:22 +00:00
import EnRecipes from './components/EnRecipes.vue'
2021-02-28 15:10:26 +00:00
import store from './store'
2020-10-14 19:32:32 +00:00
2021-05-22 08:56:31 +00:00
export const EventBus = new Vue()
2021-04-01 10:55:35 +00:00
import CollectionView from '@nativescript-community/ui-collectionview/vue'
Vue.use(CollectionView)
2021-01-23 17:20:15 +00:00
2021-05-25 14:32:53 +00:00
import { lvMixin } from './shared/mixins'
2021-04-01 10:55:35 +00:00
Vue.mixin(lvMixin)
2020-10-22 18:36:50 +00:00
2021-04-12 18:09:48 +00:00
Vue.config.silent = false
2021-01-23 17:20:15 +00:00
Vue.filter('L', localize)
2020-09-15 11:10:16 +00:00
new Vue({
store,
2021-04-01 10:55:35 +00:00
render: (h) => h(EnRecipes),
2020-09-15 11:10:16 +00:00
}).$start()