merged
36
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
# Created by https://www.gitignore.io/api/vim,emacs,android,pycharm+all,androidstudio,visualstudiocode,python,java
|
# Created by https://www.gitignore.io/api/vim,emacs,android,pycharm+all,androidstudio,visualstudiocode,python,java,angular
|
||||||
# Edit at https://www.gitignore.io/?templates=vim,emacs,android,pycharm+all,androidstudio,visualstudiocode,python,java
|
# Edit at https://www.gitignore.io/?templates=vim,emacs,android,pycharm+all,androidstudio,visualstudiocode,python,java,angular
|
||||||
|
|
||||||
### Android ###
|
### Android ###
|
||||||
# Built application files
|
# Built application files
|
||||||
|
@ -196,6 +196,36 @@ fabric.properties
|
||||||
|
|
||||||
!/gradle/wrapper/gradle-wrapper.jar
|
!/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
### Angular ###
|
||||||
|
## Angular ##
|
||||||
|
# compiled output
|
||||||
|
/dist
|
||||||
|
/tmp
|
||||||
|
/app/**/*.js
|
||||||
|
/app/**/*.js.map
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
/bower_components
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
|
||||||
|
# misc
|
||||||
|
/.sass-cache
|
||||||
|
/connect.lock
|
||||||
|
/coverage/*
|
||||||
|
/libpeerconnection.log
|
||||||
|
npm-debug.log
|
||||||
|
testem.log
|
||||||
|
/typings
|
||||||
|
|
||||||
|
# e2e
|
||||||
|
/e2e/*.js
|
||||||
|
/e2e/*.map
|
||||||
|
|
||||||
|
#System Files
|
||||||
|
|
||||||
### Emacs ###
|
### Emacs ###
|
||||||
# -*- mode: gitignore; -*-
|
# -*- mode: gitignore; -*-
|
||||||
\#*\#
|
\#*\#
|
||||||
|
@ -488,4 +518,4 @@ tags
|
||||||
# Ignore all local history of files
|
# Ignore all local history of files
|
||||||
.history
|
.history
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/vim,emacs,android,pycharm+all,androidstudio,visualstudiocode,python,java
|
# End of https://www.gitignore.io/api/vim,emacs,android,pycharm+all,androidstudio,visualstudiocode,python,java,angular
|
||||||
|
|
15
client/Nightr/.editorconfig
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
[*.json]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.ts]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 4
|
35
client/Nightr/.gitignore
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# NativeScript
|
||||||
|
hooks/
|
||||||
|
node_modules/
|
||||||
|
platforms/
|
||||||
|
App_Resources/iOS/
|
||||||
|
|
||||||
|
# NativeScript Template
|
||||||
|
*.js.map
|
||||||
|
*.js
|
||||||
|
!webpack.config.js
|
||||||
|
|
||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# General
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
.idea
|
||||||
|
.cloud
|
||||||
|
.project
|
||||||
|
tmp/
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode/*
|
||||||
|
!.vscode/settings.json
|
||||||
|
!.vscode/tasks.json
|
||||||
|
!.vscode/launch.json
|
||||||
|
!.vscode/extensions.json
|
||||||
|
|
20
client/Nightr/App_Resources/Android/app.gradle
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
// Add your native dependencies here:
|
||||||
|
|
||||||
|
// Uncomment to add recyclerview-v7 dependency
|
||||||
|
//dependencies {
|
||||||
|
// implementation 'com.android.support:recyclerview-v7:+'
|
||||||
|
//}
|
||||||
|
|
||||||
|
// If you want to add something to be applied before applying plugins' include.gradle files
|
||||||
|
// e.g. project.ext.googlePlayServicesVersion = "15.0.1"
|
||||||
|
// create a file named before-plugins.gradle in the current directory and place it there
|
||||||
|
|
||||||
|
android {
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion 17
|
||||||
|
generatedDensities = []
|
||||||
|
}
|
||||||
|
aaptOptions {
|
||||||
|
additionalParameters "--no-version-vectors"
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="__PACKAGE__"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
<supports-screens
|
||||||
|
android:smallScreens="true"
|
||||||
|
android:normalScreens="true"
|
||||||
|
android:largeScreens="true"
|
||||||
|
android:xlargeScreens="true"/>
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name="com.tns.NativeScriptApplication"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/icon"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/AppTheme">
|
||||||
|
|
||||||
|
<activity
|
||||||
|
android:name="com.tns.NativeScriptActivity"
|
||||||
|
android:label="@string/title_activity_kimera"
|
||||||
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
|
||||||
|
android:theme="@style/LaunchScreenTheme">
|
||||||
|
|
||||||
|
<meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.tns.ErrorReportActivity"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 16 KiB |
|
@ -0,0 +1,8 @@
|
||||||
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:gravity="fill">
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="fill" android:src="@drawable/background" />
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<bitmap android:gravity="center" android:src="@drawable/logo" />
|
||||||
|
</item>
|
||||||
|
</layer-list>
|
After Width: | Height: | Size: 5.3 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 54 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 193 KiB |
|
@ -0,0 +1,4 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ns_accent">#3d5afe</color>
|
||||||
|
</resources>
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
|
||||||
|
<!-- Application theme -->
|
||||||
|
<style name="AppTheme" parent="AppThemeBase">
|
||||||
|
<item name="android:datePickerStyle">@style/SpinnerDatePicker</item>
|
||||||
|
<item name="android:timePickerStyle">@style/SpinnerTimePicker</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Default style for DatePicker - in spinner mode -->
|
||||||
|
<style name="SpinnerDatePicker" parent="android:Widget.Material.Light.DatePicker">
|
||||||
|
<item name="android:datePickerMode">spinner</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- Default style for TimePicker - in spinner mode -->
|
||||||
|
<style name="SpinnerTimePicker" parent="android:Widget.Material.Light.TimePicker">
|
||||||
|
<item name="android:timePickerMode">spinner</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase">
|
||||||
|
<item name="android:elevation">4dp</item>
|
||||||
|
</style>
|
||||||
|
</resources>
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources>
|
||||||
|
<color name="ns_primary">#F5F5F5</color>
|
||||||
|
<color name="ns_primaryDark">#757575</color>
|
||||||
|
<color name="ns_accent">#33B5E5</color>
|
||||||
|
<color name="ns_blue">#272734</color>
|
||||||
|
</resources>
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resources xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- theme to use FOR launch screen-->
|
||||||
|
<style name="LaunchScreenThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
|
||||||
|
|
||||||
|
<item name="colorPrimary">@color/ns_primary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
|
||||||
|
<item name="colorAccent">@color/ns_accent</item>
|
||||||
|
|
||||||
|
<item name="android:windowBackground">@drawable/splash_screen</item>
|
||||||
|
|
||||||
|
<item name="android:windowActionBarOverlay">true</item>
|
||||||
|
<item name="android:windowTranslucentStatus">true</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="LaunchScreenTheme" parent="LaunchScreenThemeBase">
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- theme to use AFTER launch screen is loaded-->
|
||||||
|
<style name="AppThemeBase" parent="Theme.AppCompat.Light.NoActionBar">
|
||||||
|
<item name="toolbarStyle">@style/NativeScriptToolbarStyle</item>
|
||||||
|
|
||||||
|
<item name="colorPrimary">@color/ns_primary</item>
|
||||||
|
<item name="colorPrimaryDark">@color/ns_primaryDark</item>
|
||||||
|
<item name="colorAccent">@color/ns_accent</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="AppTheme" parent="AppThemeBase">
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<!-- theme for action-bar -->
|
||||||
|
<style name="NativeScriptToolbarStyleBase" parent="Widget.AppCompat.Toolbar">
|
||||||
|
<item name="android:background">@color/ns_primary</item>
|
||||||
|
<item name="theme">@style/ThemeOverlay.AppCompat.ActionBar</item>
|
||||||
|
<item name="popupTheme">@style/ThemeOverlay.AppCompat</item>
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<style name="NativeScriptToolbarStyle" parent="NativeScriptToolbarStyleBase">
|
||||||
|
</style>
|
||||||
|
</resources>
|
201
client/Nightr/LICENSE
Normal file
|
@ -0,0 +1,201 @@
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright (c) 2015-2019 Progress Software Corporation
|
||||||
|
|
||||||
|
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.
|
17
client/Nightr/angular.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
|
"version": 1,
|
||||||
|
"newProjectRoot": "projects",
|
||||||
|
"cli": {
|
||||||
|
"defaultCollection": "@nativescript/schematics"
|
||||||
|
},
|
||||||
|
"projects": {
|
||||||
|
"hello-world": {
|
||||||
|
"root": "",
|
||||||
|
"sourceRoot": "src",
|
||||||
|
"projectType": "application",
|
||||||
|
"prefix": "ns"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultProject": "hello-world"
|
||||||
|
}
|
4
client/Nightr/nsconfig.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"appResourcesPath": "App_Resources",
|
||||||
|
"appPath": "src"
|
||||||
|
}
|
6748
client/Nightr/package-lock.json
generated
Normal file
40
client/Nightr/package.json
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
{
|
||||||
|
"nativescript": {
|
||||||
|
"id": "org.nativescript.Nightr",
|
||||||
|
"tns-android": {
|
||||||
|
"version": "5.3.1"
|
||||||
|
},
|
||||||
|
"tns-ios": {
|
||||||
|
"version": "5.3.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"description": "NativeScript Application",
|
||||||
|
"license": "SEE LICENSE IN <your-license-filename>",
|
||||||
|
"repository": "<fill-your-repository-here>",
|
||||||
|
"dependencies": {
|
||||||
|
"@angular/animations": "~7.2.0",
|
||||||
|
"@angular/common": "~7.2.0",
|
||||||
|
"@angular/compiler": "~7.2.0",
|
||||||
|
"@angular/core": "~7.2.0",
|
||||||
|
"@angular/forms": "~7.2.0",
|
||||||
|
"@angular/http": "~7.2.0",
|
||||||
|
"@angular/platform-browser": "~7.2.0",
|
||||||
|
"@angular/platform-browser-dynamic": "~7.2.0",
|
||||||
|
"@angular/router": "~7.2.0",
|
||||||
|
"nativescript-angular": "~7.2.0",
|
||||||
|
"nativescript-theme-core": "~1.0.4",
|
||||||
|
"reflect-metadata": "~0.1.12",
|
||||||
|
"rxjs": "~6.3.0",
|
||||||
|
"tns-core-modules": "~5.3.0",
|
||||||
|
"zone.js": "~0.8.26"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@angular/compiler-cli": "~7.2.0",
|
||||||
|
"@nativescript/schematics": "~0.5.0",
|
||||||
|
"@ngtools/webpack": "~7.2.0",
|
||||||
|
"nativescript-dev-typescript": "~0.9.0",
|
||||||
|
"nativescript-dev-webpack": "~0.21.0"
|
||||||
|
},
|
||||||
|
"gitHead": "803cec054c44c99eaa59cdc267993e6346f6cb3a",
|
||||||
|
"readme": "NativeScript Application"
|
||||||
|
}
|
12
client/Nightr/src/app.css
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
/*
|
||||||
|
In NativeScript, the app.css file is where you place CSS rules that
|
||||||
|
you would like to apply to your entire application. Check out
|
||||||
|
http://docs.nativescript.org/ui/styling for a full list of the CSS
|
||||||
|
selectors and properties you can use to style UI components.
|
||||||
|
|
||||||
|
/*
|
||||||
|
In many cases you may want to use the NativeScript core theme instead
|
||||||
|
of writing your own CSS rules. For a full list of class names in the theme
|
||||||
|
refer to http://docs.nativescript.org/ui/theme.
|
||||||
|
*/
|
||||||
|
@import '~nativescript-theme-core/css/core.light.css';
|
18
client/Nightr/src/app/app-routing.module.ts
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
import { NgModule } from "@angular/core";
|
||||||
|
import { NativeScriptRouterModule } from "nativescript-angular/router";
|
||||||
|
import { Routes } from "@angular/router";
|
||||||
|
|
||||||
|
import { ItemsComponent } from "./item/items.component";
|
||||||
|
import { ItemDetailComponent } from "./item/item-detail.component";
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{ path: "", redirectTo: "/items", pathMatch: "full" },
|
||||||
|
{ path: "items", component: ItemsComponent },
|
||||||
|
{ path: "item/:id", component: ItemDetailComponent }
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [NativeScriptRouterModule.forRoot(routes)],
|
||||||
|
exports: [NativeScriptRouterModule]
|
||||||
|
})
|
||||||
|
export class AppRoutingModule { }
|
2
client/Nightr/src/app/app.component.html
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
<!-- https://docs.nativescript.org/angular/core-concepts/angular-navigation.html#page-router-outlet -->
|
||||||
|
<page-router-outlet></page-router-outlet>
|
8
client/Nightr/src/app/app.component.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import { Component } from "@angular/core";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "ns-app",
|
||||||
|
moduleId: module.id,
|
||||||
|
templateUrl: "./app.component.html"
|
||||||
|
})
|
||||||
|
export class AppComponent { }
|
36
client/Nightr/src/app/app.module.ts
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
|
||||||
|
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
|
||||||
|
|
||||||
|
import { AppRoutingModule } from "./app-routing.module";
|
||||||
|
import { AppComponent } from "./app.component";
|
||||||
|
import { ItemsComponent } from "./item/items.component";
|
||||||
|
import { ItemDetailComponent } from "./item/item-detail.component";
|
||||||
|
|
||||||
|
// Uncomment and add to NgModule imports if you need to use two-way binding
|
||||||
|
// import { NativeScriptFormsModule } from "nativescript-angular/forms";
|
||||||
|
|
||||||
|
// Uncomment and add to NgModule imports if you need to use the HttpClient wrapper
|
||||||
|
// import { NativeScriptHttpClientModule } from "nativescript-angular/http-client";
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
bootstrap: [
|
||||||
|
AppComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
NativeScriptModule,
|
||||||
|
AppRoutingModule
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
|
AppComponent,
|
||||||
|
ItemsComponent,
|
||||||
|
ItemDetailComponent
|
||||||
|
],
|
||||||
|
providers: [],
|
||||||
|
schemas: [
|
||||||
|
NO_ERRORS_SCHEMA
|
||||||
|
]
|
||||||
|
})
|
||||||
|
/*
|
||||||
|
Pass your application module to the bootstrapModule function located in main.ts to start your app
|
||||||
|
*/
|
||||||
|
export class AppModule { }
|
8
client/Nightr/src/app/item/item-detail.component.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<ActionBar title="Details" class="action-bar"></ActionBar>
|
||||||
|
<FlexboxLayout flexDirection="column" class="page">
|
||||||
|
<FlexboxLayout class="m-15">
|
||||||
|
<Label class="h2" [text]="item.id + '. '"></Label>
|
||||||
|
<Label class="h2" [text]="item.name"></Label>
|
||||||
|
</FlexboxLayout>
|
||||||
|
<Label class="h4" [text]="item.role"></Label>
|
||||||
|
</FlexboxLayout>
|
24
client/Nightr/src/app/item/item-detail.component.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
import { ActivatedRoute } from "@angular/router";
|
||||||
|
|
||||||
|
import { Item } from "./item";
|
||||||
|
import { ItemService } from "./item.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "ns-details",
|
||||||
|
moduleId: module.id,
|
||||||
|
templateUrl: "./item-detail.component.html"
|
||||||
|
})
|
||||||
|
export class ItemDetailComponent implements OnInit {
|
||||||
|
item: Item;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private itemService: ItemService,
|
||||||
|
private route: ActivatedRoute
|
||||||
|
) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
const id = +this.route.snapshot.params.id;
|
||||||
|
this.item = this.itemService.getItem(id);
|
||||||
|
}
|
||||||
|
}
|
41
client/Nightr/src/app/item/item.service.ts
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
|
import { Item } from "./item";
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: "root"
|
||||||
|
})
|
||||||
|
export class ItemService {
|
||||||
|
private items = new Array<Item>(
|
||||||
|
{ id: 1, name: "Ter Stegen", role: "Goalkeeper" },
|
||||||
|
{ id: 3, name: "Piqué", role: "Defender" },
|
||||||
|
{ id: 4, name: "I. Rakitic", role: "Midfielder" },
|
||||||
|
{ id: 5, name: "Sergio", role: "Midfielder" },
|
||||||
|
{ id: 6, name: "Denis Suárez", role: "Midfielder" },
|
||||||
|
{ id: 7, name: "Arda", role: "Midfielder" },
|
||||||
|
{ id: 8, name: "A. Iniesta", role: "Midfielder" },
|
||||||
|
{ id: 9, name: "Suárez", role: "Forward" },
|
||||||
|
{ id: 10, name: "Messi", role: "Forward" },
|
||||||
|
{ id: 11, name: "Neymar", role: "Forward" },
|
||||||
|
{ id: 12, name: "Rafinha", role: "Midfielder" },
|
||||||
|
{ id: 13, name: "Cillessen", role: "Goalkeeper" },
|
||||||
|
{ id: 14, name: "Mascherano", role: "Defender" },
|
||||||
|
{ id: 17, name: "Paco Alcácer", role: "Forward" },
|
||||||
|
{ id: 18, name: "Jordi Alba", role: "Defender" },
|
||||||
|
{ id: 19, name: "Digne", role: "Defender" },
|
||||||
|
{ id: 20, name: "Sergi Roberto", role: "Midfielder" },
|
||||||
|
{ id: 21, name: "André Gomes", role: "Midfielder" },
|
||||||
|
{ id: 22, name: "Aleix Vidal", role: "Midfielder" },
|
||||||
|
{ id: 23, name: "Umtiti", role: "Defender" },
|
||||||
|
{ id: 24, name: "Mathieu", role: "Defender" },
|
||||||
|
{ id: 25, name: "Masip", role: "Goalkeeper" }
|
||||||
|
);
|
||||||
|
|
||||||
|
getItems(): Array<Item> {
|
||||||
|
return this.items;
|
||||||
|
}
|
||||||
|
|
||||||
|
getItem(id: number): Item {
|
||||||
|
return this.items.filter((item) => item.id === id)[0];
|
||||||
|
}
|
||||||
|
}
|
5
client/Nightr/src/app/item/item.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
export interface Item {
|
||||||
|
id: number;
|
||||||
|
name: string;
|
||||||
|
role: string;
|
||||||
|
}
|
33
client/Nightr/src/app/item/items.component.html
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
<!--
|
||||||
|
The template defines the view of the component - what is actually rendered.
|
||||||
|
In NativeScript applications the template is defined with XML using NativeScript UI elements.
|
||||||
|
It is different from HTML. So instead of <input>, <span>, <div> etc. - we have <TextField>, <Label> and layouts.
|
||||||
|
The important thing is that although the elements are different - all of the Angular’s template syntax works exactly the same.
|
||||||
|
So you can still use template expressions, bindings, templates as well as all the built-in directives.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The ActionBar is the NativeScript common abstraction over the Android ActionBar and iOS NavigationBar.
|
||||||
|
http://docs.nativescript.org/ui/action-bar
|
||||||
|
-->
|
||||||
|
<ActionBar title="My App" class="action-bar">
|
||||||
|
</ActionBar>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The GridLayout arranges its child elements in a table structure of rows and columns.
|
||||||
|
A cell can contain multiple child elements, they can span over multiple rows and columns,
|
||||||
|
and even overlap each other. The GridLayout has one column and one row by default.
|
||||||
|
You can learn more about NativeScript layouts at https://docs.nativescript.org/ui/layout-containers.
|
||||||
|
|
||||||
|
These components make use of several CSS class names that are part of the NativeScript
|
||||||
|
core theme, such as p-20, btn, h2, and list-group. You can view a full list of the
|
||||||
|
class names available for styling your app at https://docs.nativescript.org/ui/theme.
|
||||||
|
-->
|
||||||
|
<GridLayout class="page">
|
||||||
|
<ListView [items]="items" class="list-group">
|
||||||
|
<ng-template let-item="item">
|
||||||
|
<Label [nsRouterLink]="['/item', item.id]" [text]="item.name"
|
||||||
|
class="list-group-item"></Label>
|
||||||
|
</ng-template>
|
||||||
|
</ListView>
|
||||||
|
</GridLayout>
|
23
client/Nightr/src/app/item/items.component.ts
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
import { Component, OnInit } from "@angular/core";
|
||||||
|
|
||||||
|
import { Item } from "./item";
|
||||||
|
import { ItemService } from "./item.service";
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: "ns-items",
|
||||||
|
moduleId: module.id,
|
||||||
|
templateUrl: "./items.component.html"
|
||||||
|
})
|
||||||
|
export class ItemsComponent implements OnInit {
|
||||||
|
items: Array<Item>;
|
||||||
|
|
||||||
|
// This pattern makes use of Angular’s dependency injection implementation to
|
||||||
|
// inject an instance of the ItemService service into this class.
|
||||||
|
// Angular knows about this service because it is included in your app’s main NgModule,
|
||||||
|
// defined in app.module.ts.
|
||||||
|
constructor(private itemService: ItemService) { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.items = this.itemService.getItems();
|
||||||
|
}
|
||||||
|
}
|
14
client/Nightr/src/main.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
// this import should be first in order to load some required settings (like globals and reflect-metadata)
|
||||||
|
var platform_1 = require("nativescript-angular/platform");
|
||||||
|
var app_module_1 = require("./app/app.module");
|
||||||
|
// A traditional NativeScript application starts by initializing global objects,
|
||||||
|
// setting up global CSS rules, creating, and navigating to the main page.
|
||||||
|
// Angular applications need to take care of their own initialization:
|
||||||
|
// modules, components, directives, routes, DI providers.
|
||||||
|
// A NativeScript Angular app needs to make both paradigms work together,
|
||||||
|
// so we provide a wrapper platform object, platformNativeScriptDynamic,
|
||||||
|
// that sets up a NativeScript application and can bootstrap the Angular framework.
|
||||||
|
platform_1.platformNativeScriptDynamic().bootstrapModule(app_module_1.AppModule);
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIm1haW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwR0FBMEc7QUFDMUcsMERBQTRFO0FBRTVFLCtDQUE2QztBQUU3QyxnRkFBZ0Y7QUFDaEYsMEVBQTBFO0FBQzFFLHNFQUFzRTtBQUN0RSx5REFBeUQ7QUFDekQseUVBQXlFO0FBQ3pFLHdFQUF3RTtBQUN4RSxtRkFBbUY7QUFDbkYsc0NBQTJCLEVBQUUsQ0FBQyxlQUFlLENBQUMsc0JBQVMsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gdGhpcyBpbXBvcnQgc2hvdWxkIGJlIGZpcnN0IGluIG9yZGVyIHRvIGxvYWQgc29tZSByZXF1aXJlZCBzZXR0aW5ncyAobGlrZSBnbG9iYWxzIGFuZCByZWZsZWN0LW1ldGFkYXRhKVxuaW1wb3J0IHsgcGxhdGZvcm1OYXRpdmVTY3JpcHREeW5hbWljIH0gZnJvbSBcIm5hdGl2ZXNjcmlwdC1hbmd1bGFyL3BsYXRmb3JtXCI7XG5cbmltcG9ydCB7IEFwcE1vZHVsZSB9IGZyb20gXCIuL2FwcC9hcHAubW9kdWxlXCI7XG5cbi8vIEEgdHJhZGl0aW9uYWwgTmF0aXZlU2NyaXB0IGFwcGxpY2F0aW9uIHN0YXJ0cyBieSBpbml0aWFsaXppbmcgZ2xvYmFsIG9iamVjdHMsXG4vLyBzZXR0aW5nIHVwIGdsb2JhbCBDU1MgcnVsZXMsIGNyZWF0aW5nLCBhbmQgbmF2aWdhdGluZyB0byB0aGUgbWFpbiBwYWdlLlxuLy8gQW5ndWxhciBhcHBsaWNhdGlvbnMgbmVlZCB0byB0YWtlIGNhcmUgb2YgdGhlaXIgb3duIGluaXRpYWxpemF0aW9uOlxuLy8gbW9kdWxlcywgY29tcG9uZW50cywgZGlyZWN0aXZlcywgcm91dGVzLCBESSBwcm92aWRlcnMuXG4vLyBBIE5hdGl2ZVNjcmlwdCBBbmd1bGFyIGFwcCBuZWVkcyB0byBtYWtlIGJvdGggcGFyYWRpZ21zIHdvcmsgdG9nZXRoZXIsXG4vLyBzbyB3ZSBwcm92aWRlIGEgd3JhcHBlciBwbGF0Zm9ybSBvYmplY3QsIHBsYXRmb3JtTmF0aXZlU2NyaXB0RHluYW1pYyxcbi8vIHRoYXQgc2V0cyB1cCBhIE5hdGl2ZVNjcmlwdCBhcHBsaWNhdGlvbiBhbmQgY2FuIGJvb3RzdHJhcCB0aGUgQW5ndWxhciBmcmFtZXdvcmsuXG5wbGF0Zm9ybU5hdGl2ZVNjcmlwdER5bmFtaWMoKS5ib290c3RyYXBNb2R1bGUoQXBwTW9kdWxlKTtcbiJdfQ==
|
13
client/Nightr/src/main.ts
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
// this import should be first in order to load some required settings (like globals and reflect-metadata)
|
||||||
|
import { platformNativeScriptDynamic } from "nativescript-angular/platform";
|
||||||
|
|
||||||
|
import { AppModule } from "./app/app.module";
|
||||||
|
|
||||||
|
// A traditional NativeScript application starts by initializing global objects,
|
||||||
|
// setting up global CSS rules, creating, and navigating to the main page.
|
||||||
|
// Angular applications need to take care of their own initialization:
|
||||||
|
// modules, components, directives, routes, DI providers.
|
||||||
|
// A NativeScript Angular app needs to make both paradigms work together,
|
||||||
|
// so we provide a wrapper platform object, platformNativeScriptDynamic,
|
||||||
|
// that sets up a NativeScript application and can bootstrap the Angular framework.
|
||||||
|
platformNativeScriptDynamic().bootstrapModule(AppModule);
|
6
client/Nightr/src/package.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"main": "main.js",
|
||||||
|
"android": {
|
||||||
|
"v8Flags": "--expose_gc"
|
||||||
|
}
|
||||||
|
}
|
25
client/Nightr/tsconfig.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "es5",
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"noEmitHelpers": true,
|
||||||
|
"noEmitOnError": true,
|
||||||
|
"lib": [
|
||||||
|
"es6",
|
||||||
|
"dom",
|
||||||
|
"es2015.iterable"
|
||||||
|
],
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"~/*": [
|
||||||
|
"src/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"platforms"
|
||||||
|
]
|
||||||
|
}
|
7
client/Nightr/tsconfig.tns.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig",
|
||||||
|
"compilerOptions": {
|
||||||
|
"module": "es2015",
|
||||||
|
"moduleResolution": "node"
|
||||||
|
}
|
||||||
|
}
|
4
client/Nightr/tsfmt.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"indentSize": 4,
|
||||||
|
"tabSize": 4
|
||||||
|
}
|
325
client/Nightr/webpack.config.js
Normal file
|
@ -0,0 +1,325 @@
|
||||||
|
const { join, relative, resolve, sep, dirname } = require("path");
|
||||||
|
|
||||||
|
const webpack = require("webpack");
|
||||||
|
const nsWebpack = require("nativescript-dev-webpack");
|
||||||
|
const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target");
|
||||||
|
const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns-replace-bootstrap");
|
||||||
|
const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader");
|
||||||
|
const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng");
|
||||||
|
const { getMainModulePath } = require("nativescript-dev-webpack/utils/ast-utils");
|
||||||
|
const CleanWebpackPlugin = require("clean-webpack-plugin");
|
||||||
|
const CopyWebpackPlugin = require("copy-webpack-plugin");
|
||||||
|
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");
|
||||||
|
const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin");
|
||||||
|
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
|
||||||
|
const { AngularCompilerPlugin } = require("@ngtools/webpack");
|
||||||
|
const hashSalt = Date.now().toString();
|
||||||
|
|
||||||
|
module.exports = env => {
|
||||||
|
// Add your custom Activities, Services and other Android app components here.
|
||||||
|
const appComponents = [
|
||||||
|
"tns-core-modules/ui/frame",
|
||||||
|
"tns-core-modules/ui/frame/activity",
|
||||||
|
];
|
||||||
|
|
||||||
|
const platform = env && (env.android && "android" || env.ios && "ios");
|
||||||
|
if (!platform) {
|
||||||
|
throw new Error("You need to provide a target platform!");
|
||||||
|
}
|
||||||
|
|
||||||
|
const projectRoot = __dirname;
|
||||||
|
|
||||||
|
// Default destination inside platforms/<platform>/...
|
||||||
|
const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot));
|
||||||
|
const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS";
|
||||||
|
|
||||||
|
const {
|
||||||
|
// The 'appPath' and 'appResourcesPath' values are fetched from
|
||||||
|
// the nsconfig.json configuration file
|
||||||
|
// when bundling with `tns run android|ios --bundle`.
|
||||||
|
appPath = "src",
|
||||||
|
appResourcesPath = "App_Resources",
|
||||||
|
|
||||||
|
// You can provide the following flags when running 'tns run android|ios'
|
||||||
|
aot, // --env.aot
|
||||||
|
snapshot, // --env.snapshot
|
||||||
|
uglify, // --env.uglify
|
||||||
|
report, // --env.report
|
||||||
|
sourceMap, // --env.sourceMap
|
||||||
|
hmr, // --env.hmr,
|
||||||
|
unitTesting, // --env.unitTesting
|
||||||
|
} = env;
|
||||||
|
|
||||||
|
const externals = nsWebpack.getConvertedExternals(env.externals);
|
||||||
|
const appFullPath = resolve(projectRoot, appPath);
|
||||||
|
const appResourcesFullPath = resolve(projectRoot, appResourcesPath);
|
||||||
|
const tsConfigName = "tsconfig.tns.json";
|
||||||
|
const entryModule = `${nsWebpack.getEntryModule(appFullPath)}.ts`;
|
||||||
|
const entryPath = `.${sep}${entryModule}`;
|
||||||
|
const entries = { bundle: entryPath };
|
||||||
|
if (platform === "ios") {
|
||||||
|
entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules.js";
|
||||||
|
};
|
||||||
|
|
||||||
|
const ngCompilerTransformers = [];
|
||||||
|
const additionalLazyModuleResources = [];
|
||||||
|
if (aot) {
|
||||||
|
ngCompilerTransformers.push(nsReplaceBootstrap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hmr) {
|
||||||
|
ngCompilerTransformers.push(nsSupportHmrNg);
|
||||||
|
}
|
||||||
|
|
||||||
|
// when "@angular/core" is external, it's not included in the bundles. In this way, it will be used
|
||||||
|
// directly from node_modules and the Angular modules loader won't be able to resolve the lazy routes
|
||||||
|
// fixes https://github.com/NativeScript/nativescript-cli/issues/4024
|
||||||
|
if (env.externals && env.externals.indexOf("@angular/core") > -1) {
|
||||||
|
const appModuleRelativePath = getMainModulePath(resolve(appFullPath, entryModule), tsConfigName);
|
||||||
|
if (appModuleRelativePath) {
|
||||||
|
const appModuleFolderPath = dirname(resolve(appFullPath, appModuleRelativePath));
|
||||||
|
// include the lazy loader inside app module
|
||||||
|
ngCompilerTransformers.push(nsReplaceLazyLoader);
|
||||||
|
// include the new lazy loader path in the allowed ones
|
||||||
|
additionalLazyModuleResources.push(appModuleFolderPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const ngCompilerPlugin = new AngularCompilerPlugin({
|
||||||
|
hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]),
|
||||||
|
platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule))),
|
||||||
|
mainPath: resolve(appPath, entryModule),
|
||||||
|
tsConfigPath: join(__dirname, tsConfigName),
|
||||||
|
skipCodeGeneration: !aot,
|
||||||
|
sourceMap: !!sourceMap,
|
||||||
|
additionalLazyModuleResources: additionalLazyModuleResources
|
||||||
|
});
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
mode: uglify ? "production" : "development",
|
||||||
|
context: appFullPath,
|
||||||
|
externals,
|
||||||
|
watchOptions: {
|
||||||
|
ignored: [
|
||||||
|
appResourcesFullPath,
|
||||||
|
// Don't watch hidden files
|
||||||
|
"**/.*",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
target: nativescriptTarget,
|
||||||
|
entry: entries,
|
||||||
|
output: {
|
||||||
|
pathinfo: false,
|
||||||
|
path: dist,
|
||||||
|
libraryTarget: "commonjs2",
|
||||||
|
filename: "[name].js",
|
||||||
|
globalObject: "global",
|
||||||
|
hashSalt
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: [".ts", ".js", ".scss", ".css"],
|
||||||
|
// Resolve {N} system modules from tns-core-modules
|
||||||
|
modules: [
|
||||||
|
resolve(__dirname, "node_modules/tns-core-modules"),
|
||||||
|
resolve(__dirname, "node_modules"),
|
||||||
|
"node_modules/tns-core-modules",
|
||||||
|
"node_modules",
|
||||||
|
],
|
||||||
|
alias: {
|
||||||
|
'~': appFullPath
|
||||||
|
},
|
||||||
|
symlinks: true
|
||||||
|
},
|
||||||
|
resolveLoader: {
|
||||||
|
symlinks: false
|
||||||
|
},
|
||||||
|
node: {
|
||||||
|
// Disable node shims that conflict with NativeScript
|
||||||
|
"http": false,
|
||||||
|
"timers": false,
|
||||||
|
"setImmediate": false,
|
||||||
|
"fs": "empty",
|
||||||
|
"__dirname": false,
|
||||||
|
},
|
||||||
|
devtool: sourceMap ? "inline-source-map" : "none",
|
||||||
|
optimization: {
|
||||||
|
runtimeChunk: "single",
|
||||||
|
splitChunks: {
|
||||||
|
cacheGroups: {
|
||||||
|
vendor: {
|
||||||
|
name: "vendor",
|
||||||
|
chunks: "all",
|
||||||
|
test: (module, chunks) => {
|
||||||
|
const moduleName = module.nameForCondition ? module.nameForCondition() : '';
|
||||||
|
return /[\\/]node_modules[\\/]/.test(moduleName) ||
|
||||||
|
appComponents.some(comp => comp === moduleName);
|
||||||
|
},
|
||||||
|
enforce: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
minimize: !!uglify,
|
||||||
|
minimizer: [
|
||||||
|
new UglifyJsPlugin({
|
||||||
|
parallel: true,
|
||||||
|
cache: true,
|
||||||
|
uglifyOptions: {
|
||||||
|
output: {
|
||||||
|
comments: false,
|
||||||
|
},
|
||||||
|
compress: {
|
||||||
|
// The Android SBG has problems parsing the output
|
||||||
|
// when these options are enabled
|
||||||
|
'collapse_vars': platform !== "android",
|
||||||
|
sequences: platform !== "android",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
],
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath),
|
||||||
|
use: [
|
||||||
|
// Require all Android app components
|
||||||
|
platform === "android" && {
|
||||||
|
loader: "nativescript-dev-webpack/android-app-components-loader",
|
||||||
|
options: { modules: appComponents }
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
loader: "nativescript-dev-webpack/bundle-config-loader",
|
||||||
|
options: {
|
||||||
|
angular: true,
|
||||||
|
loadCss: !snapshot, // load the application css if in debug mode
|
||||||
|
unitTesting,
|
||||||
|
appFullPath,
|
||||||
|
projectRoot,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
].filter(loader => !!loader)
|
||||||
|
},
|
||||||
|
|
||||||
|
{ test: /\.html$|\.xml$/, use: "raw-loader" },
|
||||||
|
|
||||||
|
// tns-core-modules reads the app.css and its imports using css-loader
|
||||||
|
{
|
||||||
|
test: /[\/|\\]app\.css$/,
|
||||||
|
use: [
|
||||||
|
"nativescript-dev-webpack/style-hot-loader",
|
||||||
|
{ loader: "css-loader", options: { minimize: false, url: false } }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /[\/|\\]app\.scss$/,
|
||||||
|
use: [
|
||||||
|
"nativescript-dev-webpack/style-hot-loader",
|
||||||
|
{ loader: "css-loader", options: { minimize: false, url: false } },
|
||||||
|
"sass-loader"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Angular components reference css files and their imports using raw-loader
|
||||||
|
{ test: /\.css$/, exclude: /[\/|\\]app\.css$/, use: "raw-loader" },
|
||||||
|
{ test: /\.scss$/, exclude: /[\/|\\]app\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] },
|
||||||
|
|
||||||
|
{
|
||||||
|
test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/,
|
||||||
|
use: [
|
||||||
|
"nativescript-dev-webpack/moduleid-compat-loader",
|
||||||
|
"nativescript-dev-webpack/lazy-ngmodule-hot-loader",
|
||||||
|
"@ngtools/webpack",
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
// Mark files inside `@angular/core` as using SystemJS style dynamic imports.
|
||||||
|
// Removing this will cause deprecation warnings to appear.
|
||||||
|
{
|
||||||
|
test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/,
|
||||||
|
parser: { system: true },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// Define useful constants like TNS_WEBPACK
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
"global.TNS_WEBPACK": "true",
|
||||||
|
"process": undefined,
|
||||||
|
}),
|
||||||
|
// Remove all files from the out dir.
|
||||||
|
new CleanWebpackPlugin([`${dist}/**/*`]),
|
||||||
|
// Copy assets to out dir. Add your own globs as needed.
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
{ from: { glob: "fonts/**" } },
|
||||||
|
{ from: { glob: "**/*.jpg" } },
|
||||||
|
{ from: { glob: "**/*.png" } },
|
||||||
|
], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }),
|
||||||
|
// Generate a bundle starter script and activate it in package.json
|
||||||
|
new nsWebpack.GenerateBundleStarterPlugin(
|
||||||
|
// Don't include `runtime.js` when creating a snapshot. The plugin
|
||||||
|
// configures the WebPack runtime to be generated inside the snapshot
|
||||||
|
// module and no `runtime.js` module exist.
|
||||||
|
(snapshot ? [] : ["./runtime"])
|
||||||
|
.concat([
|
||||||
|
"./vendor",
|
||||||
|
"./bundle",
|
||||||
|
])
|
||||||
|
),
|
||||||
|
// For instructions on how to set up workers with webpack
|
||||||
|
// check out https://github.com/nativescript/worker-loader
|
||||||
|
new NativeScriptWorkerPlugin(),
|
||||||
|
ngCompilerPlugin,
|
||||||
|
// Does IPC communication with the {N} CLI to notify events when running in watch mode.
|
||||||
|
new nsWebpack.WatchStateLoggerPlugin(),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
// Copy the native app resources to the out dir
|
||||||
|
// only if doing a full build (tns run/build) and not previewing (tns preview)
|
||||||
|
if (!externals || externals.length === 0) {
|
||||||
|
config.plugins.push(new CopyWebpackPlugin([
|
||||||
|
{
|
||||||
|
from: `${appResourcesFullPath}/${appResourcesPlatformDir}`,
|
||||||
|
to: `${dist}/App_Resources/${appResourcesPlatformDir}`,
|
||||||
|
context: projectRoot
|
||||||
|
},
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (report) {
|
||||||
|
// Generate report files for bundles content
|
||||||
|
config.plugins.push(new BundleAnalyzerPlugin({
|
||||||
|
analyzerMode: "static",
|
||||||
|
openAnalyzer: false,
|
||||||
|
generateStatsFile: true,
|
||||||
|
reportFilename: resolve(projectRoot, "report", `report.html`),
|
||||||
|
statsFilename: resolve(projectRoot, "report", `stats.json`),
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (snapshot) {
|
||||||
|
config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({
|
||||||
|
chunk: "vendor",
|
||||||
|
angular: true,
|
||||||
|
requireModules: [
|
||||||
|
"reflect-metadata",
|
||||||
|
"@angular/platform-browser",
|
||||||
|
"@angular/core",
|
||||||
|
"@angular/common",
|
||||||
|
"@angular/router",
|
||||||
|
"nativescript-angular/platform-static",
|
||||||
|
"nativescript-angular/router",
|
||||||
|
],
|
||||||
|
projectRoot,
|
||||||
|
webpackConfig: config,
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hmr) {
|
||||||
|
config.plugins.push(new webpack.HotModuleReplacementPlugin());
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
};
|
|
@ -1,4 +1,5 @@
|
||||||
```bash
|
```bash
|
||||||
cd server/
|
cd server/
|
||||||
source activate.sh
|
source activate.sh
|
||||||
|
run
|
||||||
```
|
```
|
||||||
|
|
|
@ -15,5 +15,5 @@ if (( $FIRST_RUN )); then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function run() {
|
function run() {
|
||||||
python -m
|
python -m nightr
|
||||||
}
|
}
|
||||||
|
|
4
server/nightr/__main__.py
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
from .app import main
|
||||||
|
main()
|
72
server/nightr/app.py
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
import inspect
|
||||||
|
import statistics
|
||||||
|
from dataclasses import asdict
|
||||||
|
from datetime import timedelta
|
||||||
|
from typing import List
|
||||||
|
|
||||||
|
import requests_cache
|
||||||
|
from flask import Flask, jsonify
|
||||||
|
|
||||||
|
from server.nightr.strategies import dmi, steam
|
||||||
|
from server.nightr.util import Context
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
|
||||||
|
requests_cache.install_cache("requests_cache.sqlite", expire_after=timedelta(minutes=10))
|
||||||
|
|
||||||
|
|
||||||
|
strategies = {
|
||||||
|
# name: (weight, probability function)
|
||||||
|
"dmi": (0.5, dmi.probability),
|
||||||
|
"steam": (1.0, steam.probability),
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/", methods=["GET", "POST"])
|
||||||
|
def probabilities():
|
||||||
|
phone_data = {} # TODO: get from POST request
|
||||||
|
context = Context(**phone_data)
|
||||||
|
|
||||||
|
predictions: List[dict] = []
|
||||||
|
for name, (weight, strategy) in strategies.items():
|
||||||
|
try:
|
||||||
|
prediction = strategy(context)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Strategy {name} failed: {e}")
|
||||||
|
continue
|
||||||
|
predictions.append({
|
||||||
|
"name": name,
|
||||||
|
"description": inspect.getdoc(strategy),
|
||||||
|
"weight": weight,
|
||||||
|
"weighted_probability": prediction.probability * weight,
|
||||||
|
"night": prediction.probability > 0.5,
|
||||||
|
**asdict(prediction),
|
||||||
|
})
|
||||||
|
|
||||||
|
mean = statistics.mean(p["weighted_probability"] for p in predictions)
|
||||||
|
median = statistics.median(p["weighted_probability"] for p in predictions)
|
||||||
|
night = mean > 0.5
|
||||||
|
|
||||||
|
# Calculate contributions of predictions
|
||||||
|
consensus_weight_sum = sum(p["weight"] for p in predictions if p["night"] == night)
|
||||||
|
for prediction in predictions:
|
||||||
|
# If this prediction agrees with the consensus it contributed
|
||||||
|
if prediction["night"] == night:
|
||||||
|
prediction["contribution"] = prediction["weight"] / consensus_weight_sum
|
||||||
|
else:
|
||||||
|
prediction["contribution"] = 0.0
|
||||||
|
|
||||||
|
return jsonify({
|
||||||
|
"predictions": predictions,
|
||||||
|
"weighted_probabilities_mean": mean,
|
||||||
|
"weighted_probabilities_median": median,
|
||||||
|
"night": night,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
app.run(host='0.0.0.0')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
|
@ -99,6 +99,16 @@ def scrape_weather():
|
||||||
soup = BeautifulSoup(r.content)
|
soup = BeautifulSoup(r.content)
|
||||||
print(soup.find_all('td', {'class': 'temp'})[0])
|
print(soup.find_all('td', {'class': 'temp'})[0])
|
||||||
|
|
||||||
|
def scrape_dmi_aarhus():
|
||||||
|
r = requests.get('https://www.dmi.dk/NinJo2DmiDk/ninjo2dmidk?cmd=obj&wmo=06074')
|
||||||
|
data = r.json()
|
||||||
|
latest_time, aarhus_latest_temp = max(data['Temperature2m'].items(), key= lambda x : x[0])
|
||||||
|
|
||||||
|
adak_r = requests.get('https://www.dmi.dk/NinJo2DmiDk/ninjo2dmidk?cmd=llj&id=5878818')
|
||||||
|
adak_data = adak_r.json()
|
||||||
|
adak_temp_latest = adak_data['timeserie'][0]['temp']
|
||||||
|
if aarhus_latest_temp-5 < adak_temp_latest:
|
||||||
|
return 1.0
|
||||||
|
return 0.0
|
||||||
|
#adak_latest_time, adak_latest_temp_aarhus = max(adak_timeserie.items(), key= lambda x : x[0])
|
||||||
|
|
||||||
|
|
BIN
server/nightr/strategies/day.png
Normal file
After Width: | Height: | Size: 576 KiB |
12
server/nightr/strategies/dmi.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from server.nightr.util import Context, Prediction
|
||||||
|
|
||||||
|
|
||||||
|
def probability(context: Context) -> Prediction:
|
||||||
|
"""
|
||||||
|
The data from DMI.
|
||||||
|
"""
|
||||||
|
p = Prediction()
|
||||||
|
p.probability = 0.7
|
||||||
|
p.reasons.append("It is raining in Tønder")
|
||||||
|
|
||||||
|
return p
|
25
server/nightr/strategies/miloStrats.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import cv2
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
from pytz import timezone
|
||||||
|
|
||||||
|
def camImgStrat():
|
||||||
|
img = cv2.imread('night.jpg',0)
|
||||||
|
average = img.mean(axis=0).mean(axis=0)
|
||||||
|
print(average)
|
||||||
|
if average < 100:
|
||||||
|
return 1.0
|
||||||
|
else:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
|
||||||
|
def australiaStrat():
|
||||||
|
australia = timezone('Australia/Melbourne')
|
||||||
|
t = datetime.now().astimezone(australia)
|
||||||
|
hour = t.hour
|
||||||
|
if hour > 22 or hour < 6:
|
||||||
|
return 1.0
|
||||||
|
else:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
|
|
||||||
|
print(australiaStrat())
|
BIN
server/nightr/strategies/night.jpg
Normal file
After Width: | Height: | Size: 53 KiB |
12
server/nightr/strategies/steam.py
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
from server.nightr.util import Context, Prediction
|
||||||
|
|
||||||
|
|
||||||
|
def probability(context: Context) -> Prediction:
|
||||||
|
"""
|
||||||
|
How many players are currently online on Steam.
|
||||||
|
"""
|
||||||
|
p = Prediction()
|
||||||
|
p.probability = 0.2
|
||||||
|
p.reasons.append("CSGO has more than 10.000 online players")
|
||||||
|
|
||||||
|
return p
|
14
server/nightr/util.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from typing import List, Tuple
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Context:
|
||||||
|
battery: float = 1.0
|
||||||
|
coordinates: Tuple[float, float] = (0.0, 0.0)
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Prediction:
|
||||||
|
probability: float = 0.5
|
||||||
|
reasons: List[str] = field(default_factory=list)
|
|
@ -1 +1,3 @@
|
||||||
Flask==1.0.2
|
Flask==1.0.2
|
||||||
|
requests==2.21.0
|
||||||
|
requests-cache==0.4.13
|
||||||
|
|