@24i/smartapps-bigscreen-rnv-build-engine 0.17.2 → 0.17.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/__tests__/resolvers/resolveBuildFileBaseName.spec.js +80 -0
- package/dist/src/resolvers/index.js +3 -1
- package/dist/src/resolvers/resolveBuildFileBaseName.js +34 -0
- package/dist/src/resolvers/resolveBuildFileName.js +3 -27
- package/dist/src/scripts/releaseAllWithScheme.js +1 -1
- package/dist/src/sdks/index.js +5 -1
- package/dist/src/sdks/sdk-androidtv/index.js +17 -0
- package/dist/src/sdks/sdk-androidtv/sdkAndroidtv.js +264 -0
- package/dist/src/sdks/sdk-utils/sdk-installer/services/unzip.js +3 -2
- package/dist/src/tasks/task.rnv.build.js +3 -1
- package/dist/src/tasks/task.rnv.configure.js +3 -1
- package/dist/src/tasks/task.rnv.platform.configure.js +4 -1
- package/dist/templates/platforms/_shared/template.js +3 -3
- package/dist/templates/platforms/androidtv/project/README.md +196 -0
- package/dist/templates/platforms/androidtv/project/amazoniap/build.gradle +37 -0
- package/dist/templates/platforms/androidtv/project/amazoniap/consumer-rules.pro +0 -0
- package/dist/templates/platforms/androidtv/project/amazoniap/libs/in-app-purchasing-2.0.76.jar +0 -0
- package/dist/templates/platforms/androidtv/project/amazoniap/proguard-rules.pro +21 -0
- package/dist/templates/platforms/androidtv/project/amazoniap/src/main/AndroidManifest.xml +4 -0
- package/dist/templates/platforms/androidtv/project/amazoniap/src/main/java/com/twentyfouri/bridgetv/amazoniap/AmazonIapSevice.kt +106 -0
- package/dist/templates/platforms/androidtv/project/app/build.gradle +112 -0
- package/dist/templates/platforms/androidtv/project/app/proguard-rules.pro +32 -0
- package/dist/templates/platforms/androidtv/project/app/src/bigscreenAppstage/java/com/twentyfouri/tvbridge/Flavor.kt +5 -0
- package/dist/templates/platforms/androidtv/project/app/src/bigscreenAppstage/res/raw/configuration.json +9 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/AndroidManifest.xml +53 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/FlavorBase.kt +12 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeFromJavaScript.kt +392 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/bridge/BridgeToJavaScript.kt +89 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/configuration/BridgeConfig.kt +16 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/configuration/ConfigCallback.kt +6 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/configuration/ConfigProvider.kt +27 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/configuration/Drm.kt +10 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/configuration/UserAgent.kt +6 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/BaseApplication.kt +73 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ActivityComponent.kt +13 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ActivityModule.kt +17 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ApplicationComponent.kt +26 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/ApplicationModule.kt +51 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/di/PerActivity.kt +26 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/LocalStorage.kt +30 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/LoggingDrmCallback.kt +38 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/OverriddenHttpMediaDrmCallback.kt +134 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/PlayerFactoryExoPlayerCustomized.kt +84 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/SimpleActivityLifecycleCallback.kt +32 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/global/utils/SourceDrmOverridden.kt +49 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/jump/JumpAnalytics.kt +211 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/sound/TouchPlayer.kt +86 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/client/BridgeWebView.kt +82 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/client/BridgeWebViewClient.kt +114 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/model/AnalyticsPlaybackInfo.kt +10 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/model/ContentModel.kt +14 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/model/DrmModel.kt +20 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/model/MediaEventType.kt +20 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/parser/ContentModelParser.kt +16 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/parser/DeviceInfoParser.kt +22 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/parser/PlaybackInfoParser.kt +10 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/parser/TrackJsonModelParser.kt +58 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/view/Mainview.kt +20 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/view/PlayerCache.kt +15 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/view/WebViewActivity.kt +306 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +609 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/drawable/button_background_focus.xml +10 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/drawable/button_background_normal.xml +7 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/drawable/button_background_pressed.xml +7 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/drawable/button_focus.xml +8 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/layout/activity_web_view.xml +76 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/raw/click.ogg +0 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/values/styles.xml +12 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/res/xml/network_security_config.xml +4 -0
- package/dist/templates/platforms/androidtv/project/build.gradle +48 -0
- package/dist/templates/platforms/androidtv/project/common/build.gradle +36 -0
- package/dist/templates/platforms/androidtv/project/common/consumer-rules.pro +0 -0
- package/dist/templates/platforms/androidtv/project/common/proguard-rules.pro +21 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/AndroidManifest.xml +4 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/java/com/twentyfouri/tvbridge/common/IapService.kt +114 -0
- package/dist/templates/platforms/androidtv/project/googleiap/build.gradle +38 -0
- package/dist/templates/platforms/androidtv/project/googleiap/consumer-rules.pro +0 -0
- package/dist/templates/platforms/androidtv/project/googleiap/proguard-rules.pro +21 -0
- package/dist/templates/platforms/androidtv/project/googleiap/src/main/AndroidManifest.xml +6 -0
- package/dist/templates/platforms/androidtv/project/googleiap/src/main/java/com/twentyfouri/tvbridge/googleiap/GoogleIapService.kt +29 -0
- package/dist/templates/platforms/androidtv/project/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/dist/templates/platforms/androidtv/project/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/dist/templates/platforms/androidtv/project/gradle.properties +4 -0
- package/dist/templates/platforms/androidtv/project/gradlew +185 -0
- package/dist/templates/platforms/androidtv/project/gradlew.bat +104 -0
- package/dist/templates/platforms/androidtv/project/proguard-rules.pro +42 -0
- package/dist/templates/platforms/androidtv/project/settings.gradle +4 -0
- package/package.json +3 -2
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Android TV Bridge
|
|
2
|
+
|
|
3
|
+
> Readme updated for the androidVersionCode 2
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
* Android Studio (https://developer.android.com/studio/index.html)
|
|
7
|
+
|
|
8
|
+
## Getting started
|
|
9
|
+
|
|
10
|
+
#### Repository
|
|
11
|
+
Clone the repository `git clone git@bitbucket.org:24imedia/androidtvbridge.git`
|
|
12
|
+
|
|
13
|
+
#### Editor
|
|
14
|
+
Open the project by opening Android Studio and selecting `Open an existing Android Studio project`. Select the folder in which you've cloned the repository.
|
|
15
|
+
|
|
16
|
+
#### Installation
|
|
17
|
+
Make sure you have ADB (Android Debug Bridge) install in order to run the app on a device through Android Studio or via "command line" (https://developer.android.com/studio/command-line/adb.html#wireless)
|
|
18
|
+
|
|
19
|
+
#### Launch
|
|
20
|
+
* Android Studio
|
|
21
|
+
* Once you've connected a device you can press `Run` in Android Studio and it will take care of building and running the app. You will be prompted with a dialog box asking where to run the application, select the device and the application will be started.
|
|
22
|
+
* Command line
|
|
23
|
+
* adb connect `<IP of the TV>`
|
|
24
|
+
* adb install `<apk file>`
|
|
25
|
+
|
|
26
|
+
## Changing the default URL
|
|
27
|
+
|
|
28
|
+
The application by default has a front-loading page where you can enter the URL you want to load. You can adjust this default by modifying the following values:
|
|
29
|
+
|
|
30
|
+
**app/build.gradle**
|
|
31
|
+
|
|
32
|
+
This file determines which URL is loaded.
|
|
33
|
+
|
|
34
|
+
productFlavors {
|
|
35
|
+
flavourName {
|
|
36
|
+
resValue "string", "app_name", "24i Bridge"
|
|
37
|
+
resValue "string", "url_base", "http://smart-template-sinclair-appcore.feature1.24i-dev.com/build/amazon-firetv_stb-default/index.html"
|
|
38
|
+
}
|
|
39
|
+
...
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
#### Adding new environments
|
|
43
|
+
Add a new flavour to let Android Studio generate a new version pointing to the new url.
|
|
44
|
+
|
|
45
|
+
### JS Methods
|
|
46
|
+
|
|
47
|
+
#### void bridgeAndroidToJavaScript_KeyEvent(int keyCode, String keyEvent)
|
|
48
|
+
Fires a JS key event
|
|
49
|
+
Possible events:
|
|
50
|
+
* keypress
|
|
51
|
+
* keyup
|
|
52
|
+
* keydown
|
|
53
|
+
|
|
54
|
+
Where keycode is the keycode that is send
|
|
55
|
+
|
|
56
|
+
#### void bridgeAndroidToJavaScript_MediaEvent(String mediaEvent)
|
|
57
|
+
Fires a JS MediaEvent
|
|
58
|
+
Possible mediaEvents:
|
|
59
|
+
* timeupdate
|
|
60
|
+
* error
|
|
61
|
+
* playing
|
|
62
|
+
* ended
|
|
63
|
+
* waiting
|
|
64
|
+
* seeked
|
|
65
|
+
|
|
66
|
+
#### void bridgeJavaScriptToAndroid_Message(String messageString)
|
|
67
|
+
Send a message/Toast to Android app
|
|
68
|
+
|
|
69
|
+
#### void bridgeJavaScriptToAndroid_SetVideoPath(final String jsonString)
|
|
70
|
+
Sets the content to the player. Can be only a stream Url example `http://www.stream.nl?lsadlk.m3u8`
|
|
71
|
+
Or:
|
|
72
|
+
Json string expected format:
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"streamUrl": "http://www.stream.nl?lsadlk.m3u8",
|
|
76
|
+
"drmConfig": {
|
|
77
|
+
"drmSchemeUuid": "widevine",
|
|
78
|
+
"drmLicenseUrl": "http://licenseurl.com",
|
|
79
|
+
"drmCustomData": {
|
|
80
|
+
"custom": "data",
|
|
81
|
+
"data": "custom"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
drmConfig is nullable
|
|
87
|
+
|
|
88
|
+
* streamUrl: the stream url
|
|
89
|
+
* drmSchemeUuid: widevine, playready, clearkey or custom UUID
|
|
90
|
+
* drmLicenseUrl: the license server url
|
|
91
|
+
* drmCustomData: key value pairs of custom data
|
|
92
|
+
|
|
93
|
+
#### void bridgeJavaScriptToAndroid_PlayVideo()
|
|
94
|
+
Plays the current stream
|
|
95
|
+
|
|
96
|
+
#### bridgeJavaScriptToAndroid_PauseVideo()
|
|
97
|
+
Pauses the current stream
|
|
98
|
+
|
|
99
|
+
#### bridgeJavaScriptToAndroid_StopVideo()
|
|
100
|
+
Stops the current stream
|
|
101
|
+
|
|
102
|
+
#### int bridgeJavaScriptToAndroid_GetCurrentTime()
|
|
103
|
+
Gets the current time from player
|
|
104
|
+
|
|
105
|
+
#### float bridgeJavaScriptToAndroid_GetCurrentTimeFloat()
|
|
106
|
+
Gets the current time float from player
|
|
107
|
+
|
|
108
|
+
#### void bridgeJavaScriptToAndroid_setNativeSubtitlesEnabled(boolean subtitlesEnabled)
|
|
109
|
+
Enable or disable subtitles in the player
|
|
110
|
+
|
|
111
|
+
#### int bridgeJavaScriptToAndroid_GetTotalTime()
|
|
112
|
+
Gets the duration of the stream
|
|
113
|
+
|
|
114
|
+
#### void bridgeJavaScriptToAndroid_SeekTo(int seconds)
|
|
115
|
+
Seek to a specific position in the stream
|
|
116
|
+
|
|
117
|
+
#### boolean bridgeJavaScriptToAndroid_IsPlaying()
|
|
118
|
+
Return true if the player is playing, otherwise false
|
|
119
|
+
|
|
120
|
+
#### void bridgeJavaScriptToAndroid_FullScreenVideo()
|
|
121
|
+
Sets the player to full screen mode
|
|
122
|
+
|
|
123
|
+
#### void bridgeJavaScriptToAndroid_SetVideoLayout(int width, int height, int left, int top)
|
|
124
|
+
Resize the player
|
|
125
|
+
|
|
126
|
+
#### void bridgeJavaScriptToAndroid_Back()
|
|
127
|
+
Simulate a native Android back press
|
|
128
|
+
|
|
129
|
+
#### void bridgeAndroidToJavaScript_MediaTrackEvent(String mediaEvent, List<TrackInfo> tracks)
|
|
130
|
+
Send event to JS
|
|
131
|
+
Possible event:
|
|
132
|
+
tracksChanged
|
|
133
|
+
|
|
134
|
+
TrackInfo list:
|
|
135
|
+
```json
|
|
136
|
+
[
|
|
137
|
+
{
|
|
138
|
+
"type": "",
|
|
139
|
+
"language": "",
|
|
140
|
+
"name": ""
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "",
|
|
144
|
+
"language": "",
|
|
145
|
+
"name": ""
|
|
146
|
+
}
|
|
147
|
+
]
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
#### void bridgeJavaScriptToAndroid_SetTrack(String trackJson)
|
|
151
|
+
Change the track thats currently playing
|
|
152
|
+
Returns void
|
|
153
|
+
trackJson format:
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"type": "",
|
|
157
|
+
"language": "",
|
|
158
|
+
"name": ""
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
* type: audio or subtitles
|
|
162
|
+
* language: the language String example: `en`
|
|
163
|
+
* name: the name of language(display name) example: `English`
|
|
164
|
+
Disable the tracks again. Set `off` in language
|
|
165
|
+
|
|
166
|
+
#### void bridgeJavaScriptToAndroid_SaveToLocalStorage(String key, String value)
|
|
167
|
+
Save an string to Android localStorage
|
|
168
|
+
* key: a constant set in JS app to save/get the saved value
|
|
169
|
+
* value: the value you want to save(can be a json string)
|
|
170
|
+
|
|
171
|
+
#### void bridgeJavaScriptToAndroid_RemoveFromLocalStorage(String key)
|
|
172
|
+
* key: a constant set in JS app to remove the saved value
|
|
173
|
+
|
|
174
|
+
#### String bridgeJavaScriptToAndroid_GetFromLocalStorage(String key)
|
|
175
|
+
* key: a constant set in JS app to get the saved value
|
|
176
|
+
|
|
177
|
+
#### void bridgeReceiptAmazonIAPValidation(String sku, String token, String urlReceiptValidation, String urlGetStatus)
|
|
178
|
+
Validate that the in app purchase is accepted by Amazon
|
|
179
|
+
* sku: id of the product
|
|
180
|
+
* token: token of the sell
|
|
181
|
+
* urlReceiptValidation: url where to validate the receipt
|
|
182
|
+
* urlGetStatus: url to get the status of the purchase
|
|
183
|
+
#### void bridgeReceiptAmazonIAPValidated(String receiptId)
|
|
184
|
+
In app purchase validation of a receipt by Amazon
|
|
185
|
+
* receiptId: id of the receipt
|
|
186
|
+
#### String bridgeGetHistoricPurchases()
|
|
187
|
+
Get the history of the purchases by Amazon of the current user
|
|
188
|
+
#### String bridgeJavaScriptToAndroid_GetDeviceInfo()
|
|
189
|
+
Returns a Json string with the information about the device brand, model and Android version.
|
|
190
|
+
Json format example:
|
|
191
|
+
```json
|
|
192
|
+
{ "deviceBrand": "Sony",
|
|
193
|
+
"deviceModel": "BRAVIA 4K 2015",
|
|
194
|
+
"osVersion": "7.0"
|
|
195
|
+
}
|
|
196
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
|
|
4
|
+
android {
|
|
5
|
+
compileSdkVersion 31
|
|
6
|
+
|
|
7
|
+
compileOptions {
|
|
8
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
9
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
defaultConfig {
|
|
13
|
+
minSdkVersion 21
|
|
14
|
+
targetSdkVersion 30
|
|
15
|
+
|
|
16
|
+
versionCode 1
|
|
17
|
+
versionName "1.0"
|
|
18
|
+
|
|
19
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
20
|
+
consumerProguardFiles "consumer-rules.pro"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
buildTypes {
|
|
24
|
+
release {
|
|
25
|
+
minifyEnabled false
|
|
26
|
+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
dependencies {
|
|
32
|
+
api fileTree(dir: "libs", include: ["*.jar"])
|
|
33
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
34
|
+
implementation 'androidx.core:core-ktx:1.3.2'
|
|
35
|
+
implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
36
|
+
implementation project(':common')
|
|
37
|
+
}
|
|
File without changes
|
package/dist/templates/platforms/androidtv/project/amazoniap/libs/in-app-purchasing-2.0.76.jar
ADDED
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# You can control the set of applied configuration files using the
|
|
3
|
+
# proguardFiles setting in build.gradle.
|
|
4
|
+
#
|
|
5
|
+
# For more details, see
|
|
6
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
7
|
+
|
|
8
|
+
# If your project uses WebView with JS, uncomment the following
|
|
9
|
+
# and specify the fully qualified class name to the JavaScript interface
|
|
10
|
+
# class:
|
|
11
|
+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
|
12
|
+
# public *;
|
|
13
|
+
#}
|
|
14
|
+
|
|
15
|
+
# Uncomment this to preserve the line number information for
|
|
16
|
+
# debugging stack traces.
|
|
17
|
+
#-keepattributes SourceFile,LineNumberTable
|
|
18
|
+
|
|
19
|
+
# If you keep the line number information, uncomment this to
|
|
20
|
+
# hide the original source file name.
|
|
21
|
+
#-renamesourcefileattribute SourceFile
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
package com.twentyfouri.bridgetv.amazoniap
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.os.Build
|
|
6
|
+
import androidx.core.content.ContextCompat
|
|
7
|
+
import com.amazon.device.iap.PurchasingListener
|
|
8
|
+
import com.amazon.device.iap.PurchasingService
|
|
9
|
+
import com.amazon.device.iap.model.*
|
|
10
|
+
import com.twentyfouri.tvbridge.common.*
|
|
11
|
+
|
|
12
|
+
object AmazonIapServiceFactory : IapServiceFactory {
|
|
13
|
+
override fun detectSupport(context: Context): Boolean {
|
|
14
|
+
val installer = context.installerPackageName
|
|
15
|
+
return when {
|
|
16
|
+
installer == "com.android.vending" -> false
|
|
17
|
+
installer == "com.amazon.venezia" -> true
|
|
18
|
+
Build.MANUFACTURER == "Amazon" -> true
|
|
19
|
+
else -> false
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
override fun build(context: Context): IapService =
|
|
24
|
+
AmazonIapService(context)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
class AmazonIapService(
|
|
28
|
+
private val context: Context
|
|
29
|
+
) : IapService, PurchasingListener {
|
|
30
|
+
|
|
31
|
+
private var callback: IapCallback? = null
|
|
32
|
+
|
|
33
|
+
override fun initialize() {
|
|
34
|
+
PurchasingService.registerListener(context, this)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override fun destroy() {
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun setCallback(callback: IapCallback?) {
|
|
41
|
+
this.callback = callback
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
override fun onUserDataResponse(result: UserDataResponse) {
|
|
45
|
+
// not called
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
override fun checkNewPurchases() {
|
|
49
|
+
PurchasingService.getPurchaseUpdates(true)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
override fun onPurchaseUpdatesResponse(result: PurchaseUpdatesResponse) {
|
|
53
|
+
if (result.requestStatus == PurchaseUpdatesResponse.RequestStatus.SUCCESSFUL) {
|
|
54
|
+
val iapPurchases = result.receipts.map { receipt ->
|
|
55
|
+
IapPurchase(receipt.sku, result.userData.userId, receipt.receiptId)
|
|
56
|
+
}
|
|
57
|
+
callback?.checkNewPurchasesFinished(iapPurchases)
|
|
58
|
+
} else {
|
|
59
|
+
callback?.checkNewPurchasesFinished(IapException(result.requestStatus.name))
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
override fun purchase(activity: Activity, sku: String) {
|
|
64
|
+
PurchasingService.purchase(sku)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
override fun onPurchaseResponse(result: PurchaseResponse) {
|
|
68
|
+
if (result.requestStatus == PurchaseResponse.RequestStatus.SUCCESSFUL) {
|
|
69
|
+
callback?.purchaseFinished(IapPurchase(
|
|
70
|
+
result.receipt.sku,
|
|
71
|
+
result.userData.userId,
|
|
72
|
+
result.receipt.receiptId
|
|
73
|
+
))
|
|
74
|
+
} else {
|
|
75
|
+
callback?.purchaseFinished(IapException(result.requestStatus.name))
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
override fun getProducts(skus: List<String>) {
|
|
80
|
+
PurchasingService.getProductData(skus.toSet())
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
override fun onProductDataResponse(result: ProductDataResponse) {
|
|
84
|
+
if (result.requestStatus == ProductDataResponse.RequestStatus.SUCCESSFUL) {
|
|
85
|
+
callback?.getProductsFinished(
|
|
86
|
+
result.productData.values.map {
|
|
87
|
+
IapProduct(
|
|
88
|
+
title = it.title ?: "",
|
|
89
|
+
description = it.description ?: "",
|
|
90
|
+
price = it.price ?: "",
|
|
91
|
+
icon = it.smallIconUrl ?: "",
|
|
92
|
+
type = it.productType.name,
|
|
93
|
+
sku = it.sku
|
|
94
|
+
)
|
|
95
|
+
},
|
|
96
|
+
result.unavailableSkus.toList()
|
|
97
|
+
)
|
|
98
|
+
} else {
|
|
99
|
+
callback?.getProductsFinished(IapException(result.requestStatus.name))
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
override fun acknowledgeReceipt(receipt: String) {
|
|
104
|
+
PurchasingService.notifyFulfillment(receipt, FulfillmentResult.FULFILLED)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
apply plugin: 'com.android.application'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
3
|
+
apply plugin: 'kotlin-kapt'
|
|
4
|
+
apply plugin: 'com.google.gms.google-services'
|
|
5
|
+
apply plugin: 'com.google.firebase.crashlytics'
|
|
6
|
+
|
|
7
|
+
android {
|
|
8
|
+
compileSdkVersion {{COMPILE_SDK_VERSION}}
|
|
9
|
+
|
|
10
|
+
compileOptions {
|
|
11
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
12
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
kotlinOptions {
|
|
16
|
+
jvmTarget = '1.8'
|
|
17
|
+
freeCompilerArgs = ['-Xjvm-default=compatibility']
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
packagingOptions {
|
|
21
|
+
exclude 'META-INF/*.kotlin_module'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
defaultConfig {
|
|
25
|
+
minSdkVersion {{MIN_SDK_VERSION}}
|
|
26
|
+
targetSdkVersion {{TARGET_SDK_VERSION}}
|
|
27
|
+
|
|
28
|
+
applicationId 'com.twentyfouri.tvbridge'
|
|
29
|
+
versionCode 1
|
|
30
|
+
versionName "1.0"
|
|
31
|
+
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
|
32
|
+
|
|
33
|
+
// necessary for Fire OS - installation of debug build fails otherwise
|
|
34
|
+
multiDexEnabled true
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
signingConfigs {
|
|
38
|
+
bigscreenAppstage {
|
|
39
|
+
keyAlias '{{KEY_ALIAS}}'
|
|
40
|
+
keyPassword '{{KEY_PASSWORD}}'
|
|
41
|
+
storeFile file('{{STORE_FILE}}')
|
|
42
|
+
storePassword '{{STORE_PASSWORD}}'
|
|
43
|
+
v1SigningEnabled true
|
|
44
|
+
v2SigningEnabled true
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
buildTypes {
|
|
49
|
+
debug {
|
|
50
|
+
// uncomment for signing testing builds
|
|
51
|
+
// signingConfig null
|
|
52
|
+
}
|
|
53
|
+
release {
|
|
54
|
+
minifyEnabled true
|
|
55
|
+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
buildFeatures {
|
|
60
|
+
dataBinding true
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
flavorDimensions "bridge"
|
|
64
|
+
productFlavors {
|
|
65
|
+
bigscreenAppstage {
|
|
66
|
+
// X.Y.Z XXYYZZUU -> version 1.2.3 will be 01020300, 5th update of 1.2.3 will be 01020305
|
|
67
|
+
dimension "bridge"
|
|
68
|
+
versionCode {{APP_VERSION_CODE}}
|
|
69
|
+
versionName "{{APP_VERSION_NAME}}"
|
|
70
|
+
applicationId "{{APP_ID}}"
|
|
71
|
+
resValue "string", "app_name", "{{configProps.appName}}"
|
|
72
|
+
{{SIGNING_CONFIG_REF}}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
//Enable GoogleServices and Crashlytics for specified variant
|
|
78
|
+
android.applicationVariants.all { variant ->
|
|
79
|
+
project.tasks.getByName('process' + variant.name.capitalize() + 'GoogleServices').enabled = false
|
|
80
|
+
tasks.whenTaskAdded { task ->
|
|
81
|
+
if (task.name.toLowerCase().contains("crashlytics")) {
|
|
82
|
+
task.enabled = false
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
dependencies {
|
|
88
|
+
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
|
89
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
|
90
|
+
api "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
91
|
+
api "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2"
|
|
92
|
+
|
|
93
|
+
compileOnly "javax.annotation:jsr250-api:1.0"
|
|
94
|
+
implementation "androidx.appcompat:appcompat:1.4.2"
|
|
95
|
+
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
|
|
96
|
+
implementation "androidx.recyclerview:recyclerview:1.2.1"
|
|
97
|
+
implementation 'com.google.firebase:firebase-crashlytics:18.2.11'
|
|
98
|
+
implementation 'com.google.firebase:firebase-analytics:21.0.0'
|
|
99
|
+
|
|
100
|
+
implementation "com.google.dagger:dagger:2.42"
|
|
101
|
+
kapt "com.google.dagger:dagger-compiler:2.42"
|
|
102
|
+
|
|
103
|
+
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
|
104
|
+
implementation "com.squareup.retrofit2:converter-gson:2.5.0"
|
|
105
|
+
implementation "com.squareup.okhttp3:logging-interceptor:4.9.2"
|
|
106
|
+
implementation "com.squareup.okhttp3:okhttp:4.9.2"
|
|
107
|
+
implementation "com.twentyfouri.player:exoplayer:0.6.0-alpha.23"
|
|
108
|
+
implementation 'com.google.android.exoplayer:extension-okhttp:2.17.1'
|
|
109
|
+
implementation "com.jumptvs.jumpkit:jumpkit-exoplayer:2.6.5"
|
|
110
|
+
|
|
111
|
+
implementation project(':common')
|
|
112
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Add project specific ProGuard rules here.
|
|
2
|
+
# By default, the flags in this file are appended to flags specified
|
|
3
|
+
# in /Applications/Android SDK/sdk/tools/proguard/proguard-android.txt
|
|
4
|
+
# You can edit the include path and order by changing the proguardFiles
|
|
5
|
+
# directive in build.gradle.
|
|
6
|
+
#
|
|
7
|
+
# For more details, see
|
|
8
|
+
# http://developer.android.com/guide/developing/tools/proguard.html
|
|
9
|
+
|
|
10
|
+
# Add any project specific keep options here:
|
|
11
|
+
|
|
12
|
+
# If your project uses WebView with JS, uncomment the following
|
|
13
|
+
# and specify the fully qualified class name to the JavaScript interface
|
|
14
|
+
# class:
|
|
15
|
+
-keepclassmembers class com.twentyfouri.tvbridge.bridge.JavaScript** {
|
|
16
|
+
public *;
|
|
17
|
+
}
|
|
18
|
+
-dontwarn okhttp3.**
|
|
19
|
+
-dontwarn javax.annotation.**
|
|
20
|
+
# A resource is loaded with a relative path so the package of this class must be preserved.
|
|
21
|
+
-keepnames class okhttp3.internal.publicsuffix.PublicSuffixDatabase
|
|
22
|
+
|
|
23
|
+
-ignorewarnings
|
|
24
|
+
-keep class * {
|
|
25
|
+
public private *;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
-dontwarn com.amazon.**
|
|
29
|
+
-keep class com.amazon.** {*;}
|
|
30
|
+
-keepattributes *Annotation*
|
|
31
|
+
|
|
32
|
+
-optimizationpasses 1
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
|
+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
3
|
+
xmlns:tools="http://schemas.android.com/tools"
|
|
4
|
+
package="com.twentyfouri.tvbridge" >
|
|
5
|
+
|
|
6
|
+
<!-- Allow the app to run on non-touch devices. -->
|
|
7
|
+
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
|
|
8
|
+
<uses-feature android:name="android.hardware.screen.portrait" android:required="false" />
|
|
9
|
+
<!-- Limit the app to running on Android TV devices. -->
|
|
10
|
+
<uses-feature android:name="android.software.leanback" android:required="true" />
|
|
11
|
+
|
|
12
|
+
<!-- Allow the app access to the internet. -->
|
|
13
|
+
<uses-permission android:name="android.permission.INTERNET" />
|
|
14
|
+
|
|
15
|
+
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
16
|
+
|
|
17
|
+
<uses-permission android:name="com.google.android.assistant.READ_HOTWORD_STATE" />
|
|
18
|
+
<uses-permission android:name="com.google.android.assistant.WRITE_HOTWORD_STATE" />
|
|
19
|
+
|
|
20
|
+
<application
|
|
21
|
+
android:name=".global.BaseApplication"
|
|
22
|
+
android:allowBackup="true"
|
|
23
|
+
android:banner="@drawable/banner"
|
|
24
|
+
android:icon="@mipmap/ic_launcher"
|
|
25
|
+
android:label="@string/app_name"
|
|
26
|
+
android:networkSecurityConfig="@xml/network_security_config"
|
|
27
|
+
tools:ignore="GoogleAppIndexingWarning"
|
|
28
|
+
android:usesCleartextTraffic="true"
|
|
29
|
+
android:extractNativeLibs="false"
|
|
30
|
+
android:theme="@style/AppTheme">
|
|
31
|
+
<activity
|
|
32
|
+
android:name=".webview.view.WebViewActivity"
|
|
33
|
+
android:hardwareAccelerated="true"
|
|
34
|
+
android:label="@string/app_name"
|
|
35
|
+
android:exported="true">
|
|
36
|
+
<intent-filter>
|
|
37
|
+
<action android:name="android.intent.action.MAIN" />
|
|
38
|
+
|
|
39
|
+
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
|
40
|
+
<category android:name="android.intent.category.LAUNCHER" />
|
|
41
|
+
</intent-filter>
|
|
42
|
+
</activity>
|
|
43
|
+
<receiver android:name="com.amazon.device.iap.ResponseReceiver"
|
|
44
|
+
android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY"
|
|
45
|
+
android:exported="true">
|
|
46
|
+
<intent-filter>
|
|
47
|
+
<action
|
|
48
|
+
android:name="com.amazon.inapp.purchasing.NOTIFY" />
|
|
49
|
+
</intent-filter>
|
|
50
|
+
</receiver>
|
|
51
|
+
</application>
|
|
52
|
+
|
|
53
|
+
</manifest>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.twentyfouri.tvbridge.common.IapServiceFactory
|
|
5
|
+
|
|
6
|
+
abstract class FlavorBase {
|
|
7
|
+
|
|
8
|
+
open fun signData(applicationContext: Context, dataJson: String) : String = ""
|
|
9
|
+
|
|
10
|
+
open fun getIapServiceFactories(): List<IapServiceFactory> =
|
|
11
|
+
emptyList()
|
|
12
|
+
}
|