@24i/smartapps-bigscreen-rnv-build-engine 0.18.2-alpha.2824 → 0.18.2-alpha.2828
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/sdks/sdk-androidtv/sdkAndroidtv.js +7 -4
- package/dist/templates/platforms/androidtv/project/amazoniap/build.gradle +10 -9
- package/dist/templates/platforms/androidtv/project/amazoniap/src/main/kotlin/com/twentyfouri/bridgetv/amazoniap/AmazonIapService.kt +7 -8
- package/dist/templates/platforms/androidtv/project/amazoniap/src/main/kotlin/com/twentyfouri/bridgetv/amazoniap/AmazonIapServiceFactory.kt +1 -1
- package/dist/templates/platforms/androidtv/project/app/build.gradle +21 -20
- package/dist/templates/platforms/androidtv/project/app/src/bigscreenAppstage/kotlin/com/twentyfouri/tvbridge/Flavor.kt +9 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/kotlin/com/twentyfouri/tvbridge/FlavorBase.kt +9 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/bridge/BridgeFromJavaScript.kt +8 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/di/ActivityComponent.kt +1 -1
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/di/ActivityModule.kt +1 -1
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/di/ApplicationComponent.kt +2 -5
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/di/ApplicationModule.kt +4 -4
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/view/Mainview.kt +1 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/view/WebViewActivity.kt +4 -0
- package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/viewmodel/WebViewModel.kt +50 -8
- package/dist/templates/platforms/androidtv/project/build.gradle +4 -4
- package/dist/templates/platforms/androidtv/project/common/build.gradle +11 -10
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/Util.kt +11 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/iap/IapCallback.kt +11 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/iap/IapException.kt +14 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/iap/IapProduct.kt +16 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/iap/IapPurchase.kt +9 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/iap/IapService.kt +14 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/iap/IapServiceFactory.kt +8 -0
- package/dist/templates/platforms/androidtv/project/common/src/main/kotlin/com/twentyfouri/tvbridge/common/iap/NullIapService.kt +32 -0
- package/dist/templates/platforms/androidtv/project/googleiap/build.gradle +10 -9
- package/dist/templates/platforms/androidtv/project/googleiap/src/main/kotlin/com/twentyfouri/tvbridge/googleiap/GoogleIapService.kt +6 -0
- package/dist/templates/platforms/androidtv/project/googleiap/src/main/kotlin/com/twentyfouri/tvbridge/googleiap/GoogleIapServiceFactory.kt +13 -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 +1 -1
- package/dist/templates/platforms/androidtv/project/gradlew +1 -1
- package/package.json +1 -1
- package/dist/templates/platforms/androidtv/project/app/src/bigscreenAppstage/java/com/twentyfouri/tvbridge/Flavor.kt +0 -10
- package/dist/templates/platforms/androidtv/project/app/src/main/java/com/twentyfouri/tvbridge/FlavorBase.kt +0 -12
- package/dist/templates/platforms/androidtv/project/common/src/main/java/com/twentyfouri/tvbridge/common/IapService.kt +0 -115
- package/dist/templates/platforms/androidtv/project/googleiap/src/main/java/com/twentyfouri/tvbridge/googleiap/GoogleIapService.kt +0 -29
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/bridge/BridgeToJavaScript.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/configuration/BridgeConfig.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/configuration/ConfigCallback.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/configuration/ConfigProvider.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/configuration/Drm.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/configuration/UserAgent.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/BaseApplication.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/di/PerActivity.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/LocalStorage.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/LoggingDrmCallback.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/OverriddenHttpMediaDrmCallback.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/PlayerFactoryBitmovinCustomized.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/PlayerFactoryConfigured.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/PlayerFactoryExoPlayerCustomized.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/PlayerFactoryExoPlayerNpaw.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/PlayerFactoryVersion.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/SimpleActivityLifecycleCallback.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/global/utils/SourceDrmOverridden.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/sound/TouchPlayer.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/client/BridgeWebView.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/client/BridgeWebViewClient.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/model/AnalyticsPlaybackInfo.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/model/ContentModel.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/model/DrmModel.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/model/MediaEventType.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/parser/PlaybackInfoParser.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/parser/SourceParser.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/parser/TrackJsonModelParser.kt +0 -0
- /package/dist/templates/platforms/androidtv/project/app/src/main/{java → kotlin}/com/twentyfouri/tvbridge/webview/view/PlayerCache.kt +0 -0
|
@@ -133,7 +133,7 @@ const configureSigning = (c) => {
|
|
|
133
133
|
};
|
|
134
134
|
const configureProject = (c) => {
|
|
135
135
|
rnv_1.Logger.logTask('configureProject');
|
|
136
|
-
const
|
|
136
|
+
const gradleModules = ['amazoniap', 'app', 'common', 'googleiap'];
|
|
137
137
|
const version = semver.coerce(rnv_1.Common.getAppVersion(c, c.platform));
|
|
138
138
|
const semVerObj = semver.parse(version);
|
|
139
139
|
if (!semVerObj) {
|
|
@@ -141,7 +141,7 @@ const configureProject = (c) => {
|
|
|
141
141
|
}
|
|
142
142
|
const appId = rnv_1.Common.getConfigProp(c, c.platform, 'id', '');
|
|
143
143
|
const minSdkVersion = rnv_1.Common.getConfigProp(c, c.platform, 'minSdkVersion', 21);
|
|
144
|
-
const targetSdkVersion = rnv_1.Common.getConfigProp(c, c.platform, 'targetSdkVersion',
|
|
144
|
+
const targetSdkVersion = rnv_1.Common.getConfigProp(c, c.platform, 'targetSdkVersion', 36);
|
|
145
145
|
const compileSdkVersion = rnv_1.Common.getConfigProp(c, c.platform, 'compileSdkVersion', 36);
|
|
146
146
|
let versionCode = rnv_1.Common.getConfigProp(c, c.platform, 'versionCode');
|
|
147
147
|
if (typeof versionCode === 'undefined') {
|
|
@@ -170,7 +170,10 @@ const configureProject = (c) => {
|
|
|
170
170
|
override: appId,
|
|
171
171
|
}];
|
|
172
172
|
rnv_1.Common.addSystemInjects(c, injects);
|
|
173
|
-
|
|
173
|
+
gradleModules.forEach((mod) => {
|
|
174
|
+
const buildGradleFilePath = path.join(rnv_1.Common.getPlatformProjectDir(c), mod, buildGradleFileName);
|
|
175
|
+
rnv_1.FileUtils.writeCleanFile(buildGradleFilePath, buildGradleFilePath, injects, null, c);
|
|
176
|
+
});
|
|
174
177
|
};
|
|
175
178
|
const getHostedAppEntryUrl = (c) => {
|
|
176
179
|
const { platform, runtime, program } = c;
|
|
@@ -220,7 +223,7 @@ const configureIap = (c) => {
|
|
|
220
223
|
rnv_1.Logger.logTask('configureIap');
|
|
221
224
|
const projectDir = rnv_1.Common.getPlatformProjectDir(c);
|
|
222
225
|
const buildGradleFilePath = path.join(projectDir, 'app', buildGradleFileName);
|
|
223
|
-
const flavorFilePath = path.join(projectDir, `app/src/${flavourName}/
|
|
226
|
+
const flavorFilePath = path.join(projectDir, `app/src/${flavourName}/kotlin/com/twentyfouri/tvbridge/Flavor.kt`);
|
|
224
227
|
const enableIap = rnv_1.Common.getConfigProp(c, c.platform, 'enableIap', false);
|
|
225
228
|
let iapDependencies = [];
|
|
226
229
|
let flavorImports = [];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
2
|
+
|
|
1
3
|
plugins {
|
|
2
4
|
id 'com.android.library'
|
|
3
5
|
id 'kotlin-android'
|
|
@@ -5,22 +7,19 @@ plugins {
|
|
|
5
7
|
|
|
6
8
|
android {
|
|
7
9
|
namespace = "com.twentyfouri.androidtv.amazoniap"
|
|
8
|
-
compileSdk =
|
|
10
|
+
compileSdk = {{COMPILE_SDK_VERSION}}
|
|
9
11
|
|
|
10
12
|
compileOptions {
|
|
11
13
|
sourceCompatibility JavaVersion.VERSION_17
|
|
12
14
|
targetCompatibility JavaVersion.VERSION_17
|
|
13
15
|
}
|
|
14
|
-
kotlinOptions {
|
|
15
|
-
jvmTarget = '17'
|
|
16
|
-
}
|
|
17
16
|
|
|
18
17
|
defaultConfig {
|
|
19
|
-
minSdk =
|
|
20
|
-
targetSdk =
|
|
18
|
+
minSdk = {{MIN_SDK_VERSION}}
|
|
19
|
+
targetSdk = {{TARGET_SDK_VERSION}}
|
|
21
20
|
|
|
22
|
-
versionCode
|
|
23
|
-
versionName "
|
|
21
|
+
versionCode {{APP_VERSION_CODE}}
|
|
22
|
+
versionName "{{APP_VERSION_NAME}}"
|
|
24
23
|
|
|
25
24
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
26
25
|
consumerProguardFiles "consumer-rules.pro"
|
|
@@ -34,7 +33,9 @@ android {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
kotlin.compilerOptions.jvmTarget = JvmTarget.JVM_17
|
|
37
|
+
|
|
37
38
|
dependencies {
|
|
38
|
-
implementation 'com.amazon.device:amazon-appstore-sdk:3.0.
|
|
39
|
+
implementation 'com.amazon.device:amazon-appstore-sdk:3.0.8'
|
|
39
40
|
implementation project(':common')
|
|
40
41
|
}
|
|
@@ -9,11 +9,11 @@ import com.amazon.device.iap.model.ProductDataResponse
|
|
|
9
9
|
import com.amazon.device.iap.model.PurchaseResponse
|
|
10
10
|
import com.amazon.device.iap.model.PurchaseUpdatesResponse
|
|
11
11
|
import com.amazon.device.iap.model.UserDataResponse
|
|
12
|
-
import com.twentyfouri.tvbridge.common.IapCallback
|
|
13
|
-
import com.twentyfouri.tvbridge.common.IapException
|
|
14
|
-
import com.twentyfouri.tvbridge.common.IapProduct
|
|
15
|
-
import com.twentyfouri.tvbridge.common.IapPurchase
|
|
16
|
-
import com.twentyfouri.tvbridge.common.IapService
|
|
12
|
+
import com.twentyfouri.tvbridge.common.iap.IapCallback
|
|
13
|
+
import com.twentyfouri.tvbridge.common.iap.IapException
|
|
14
|
+
import com.twentyfouri.tvbridge.common.iap.IapProduct
|
|
15
|
+
import com.twentyfouri.tvbridge.common.iap.IapPurchase
|
|
16
|
+
import com.twentyfouri.tvbridge.common.iap.IapService
|
|
17
17
|
import org.json.JSONObject
|
|
18
18
|
|
|
19
19
|
class AmazonIapService(private val context: Context) : IapService, PurchasingListener {
|
|
@@ -61,7 +61,7 @@ class AmazonIapService(private val context: Context) : IapService, PurchasingLis
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
override fun getProducts(skus:
|
|
64
|
+
override fun getProducts(skus: Iterable<String>) {
|
|
65
65
|
PurchasingService.getProductData(skus.toSet())
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -86,7 +86,6 @@ class AmazonIapService(private val context: Context) : IapService, PurchasingLis
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
override fun acknowledgeReceipt(receipt: JSONObject) {
|
|
89
|
-
|
|
90
|
-
PurchasingService.notifyFulfillment(receiptId, FulfillmentResult.FULFILLED)
|
|
89
|
+
PurchasingService.notifyFulfillment(receipt.getString("receiptId"), FulfillmentResult.FULFILLED)
|
|
91
90
|
}
|
|
92
91
|
}
|
|
@@ -2,7 +2,7 @@ package com.twentyfouri.bridgetv.amazoniap
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import android.os.Build
|
|
5
|
-
import com.twentyfouri.tvbridge.common.IapServiceFactory
|
|
5
|
+
import com.twentyfouri.tvbridge.common.iap.IapServiceFactory
|
|
6
6
|
import com.twentyfouri.tvbridge.common.installerPackageName
|
|
7
7
|
|
|
8
8
|
object AmazonIapServiceFactory : IapServiceFactory {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
2
|
+
|
|
1
3
|
plugins {
|
|
2
4
|
id 'com.android.application'
|
|
3
5
|
id 'kotlin-android'
|
|
@@ -10,7 +12,7 @@ def npawAccountCode = '{{NPAW_ACCOUNT_CODE}}'
|
|
|
10
12
|
def useNpawPlugin = npawAccountCode != ''
|
|
11
13
|
def useImaSdk = {{ENABLE_IMA_SDK}}
|
|
12
14
|
|
|
13
|
-
def player_version = '0.8.0-alpha.
|
|
15
|
+
def player_version = '0.8.0-alpha.35'
|
|
14
16
|
|
|
15
17
|
android {
|
|
16
18
|
namespace = 'com.twentyfouri.tvbridge'
|
|
@@ -21,10 +23,6 @@ android {
|
|
|
21
23
|
sourceCompatibility JavaVersion.VERSION_17
|
|
22
24
|
targetCompatibility JavaVersion.VERSION_17
|
|
23
25
|
}
|
|
24
|
-
kotlinOptions {
|
|
25
|
-
jvmTarget = '17'
|
|
26
|
-
freeCompilerArgs = ['-Xjvm-default=all-compatibility']
|
|
27
|
-
}
|
|
28
26
|
|
|
29
27
|
packagingOptions {
|
|
30
28
|
exclude 'META-INF/*.kotlin_module'
|
|
@@ -90,6 +88,11 @@ android {
|
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
|
|
91
|
+
kotlin.compilerOptions {
|
|
92
|
+
jvmTarget = JvmTarget.JVM_17
|
|
93
|
+
freeCompilerArgs.add('-Xjvm-default=all-compatibility')
|
|
94
|
+
}
|
|
95
|
+
|
|
93
96
|
dependencies {
|
|
94
97
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
|
|
95
98
|
|
|
@@ -99,16 +102,12 @@ dependencies {
|
|
|
99
102
|
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
|
|
100
103
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2"
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
implementation "
|
|
105
|
+
implementation "androidx.lifecycle:lifecycle-common:2.9.2"
|
|
106
|
+
implementation "com.google.code.gson:gson:2.13.1"
|
|
104
107
|
|
|
105
|
-
implementation "com.google.dagger:dagger:2.
|
|
106
|
-
kapt "com.google.dagger:dagger-compiler:2.
|
|
108
|
+
implementation "com.google.dagger:dagger:2.57"
|
|
109
|
+
kapt "com.google.dagger:dagger-compiler:2.57"
|
|
107
110
|
|
|
108
|
-
implementation "com.squareup.retrofit2:retrofit:2.11.0"
|
|
109
|
-
implementation "com.squareup.retrofit2:converter-gson:2.11.0"
|
|
110
|
-
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
|
|
111
|
-
implementation "com.squareup.okhttp3:okhttp:4.12.0"
|
|
112
111
|
if (useBitmovin) {
|
|
113
112
|
compileOnly "com.twentyfouri.player:exoplayer:$player_version"
|
|
114
113
|
implementation "com.twentyfouri.player:bitmovin:$player_version"
|
|
@@ -117,14 +116,16 @@ dependencies {
|
|
|
117
116
|
compileOnly "com.twentyfouri.player:bitmovin:$player_version"
|
|
118
117
|
}
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
implementation
|
|
119
|
+
def npaw = '7.3.7'
|
|
120
|
+
def exo = '2.19.1'
|
|
121
|
+
if (useNpawPlugin && !useBitmovin) {
|
|
122
|
+
implementation "com.npaw.plugin:plugin:$npaw"
|
|
123
|
+
implementation "com.npaw.plugin:plugin-exoplayer:$exo-$npaw"
|
|
124
|
+
implementation "com.google.android.exoplayer:extension-okhttp:$exo"
|
|
124
125
|
} else {
|
|
125
|
-
compileOnly
|
|
126
|
-
compileOnly
|
|
127
|
-
compileOnly
|
|
126
|
+
compileOnly "com.npaw.plugin:plugin:$npaw"
|
|
127
|
+
compileOnly "com.npaw.plugin:plugin-exoplayer:$exo-$npaw"
|
|
128
|
+
compileOnly "com.google.android.exoplayer:extension-okhttp:$exo"
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
if (useImaSdk) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import com.twentyfouri.tvbridge.common.iap.IapServiceFactory
|
|
5
|
+
|
|
6
|
+
abstract class FlavorBase {
|
|
7
|
+
open val iapServiceFactories = emptyList<IapServiceFactory>()
|
|
8
|
+
open fun signData(applicationContext: Context, dataJson: String) = ""
|
|
9
|
+
}
|
|
@@ -401,6 +401,14 @@ class BridgeFromJavaScript(
|
|
|
401
401
|
@JavascriptInterface
|
|
402
402
|
fun bridgeJavaScriptToAndroid_GetOsLanguage() = viewModel.language
|
|
403
403
|
|
|
404
|
+
/*
|
|
405
|
+
Bridge Android 2 JS to reload the player
|
|
406
|
+
*/
|
|
407
|
+
@JavascriptInterface
|
|
408
|
+
fun bridgeJavaScriptToAndroid_ReloadPlayer() {
|
|
409
|
+
viewModel.reloadPlayer()
|
|
410
|
+
}
|
|
411
|
+
|
|
404
412
|
companion object {
|
|
405
413
|
const val LOG_TAG = "JavaScriptBridge"
|
|
406
414
|
val DISABLED_AUDIO_TRACK = JsonObject().apply {
|
|
@@ -2,15 +2,12 @@ package com.twentyfouri.tvbridge.global.di
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import com.twentyfouri.player.base.PlayerFactoryBase
|
|
5
|
-
import com.twentyfouri.tvbridge.common.IapService
|
|
5
|
+
import com.twentyfouri.tvbridge.common.iap.IapService
|
|
6
6
|
import com.twentyfouri.tvbridge.configuration.BridgeConfig
|
|
7
7
|
import com.twentyfouri.tvbridge.global.BaseApplication
|
|
8
8
|
import com.twentyfouri.tvbridge.global.utils.LocalStorage
|
|
9
9
|
import com.twentyfouri.tvbridge.sound.TouchPlayer
|
|
10
|
-
import com.twentyfouri.tvbridge.webview.viewmodel.WebViewModel
|
|
11
10
|
import dagger.Component
|
|
12
|
-
import dagger.internal.Factory
|
|
13
|
-
import javax.inject.Provider
|
|
14
11
|
import javax.inject.Singleton
|
|
15
12
|
|
|
16
13
|
@Singleton
|
|
@@ -23,4 +20,4 @@ interface ApplicationComponent {
|
|
|
23
20
|
val applicationContext: Context
|
|
24
21
|
val touchPlayer: TouchPlayer
|
|
25
22
|
val iapService: IapService
|
|
26
|
-
}
|
|
23
|
+
}
|
|
@@ -3,7 +3,7 @@ package com.twentyfouri.tvbridge.global.di
|
|
|
3
3
|
import android.content.Context
|
|
4
4
|
import com.twentyfouri.player.base.PlayerFactoryBase
|
|
5
5
|
import com.twentyfouri.tvbridge.Flavor
|
|
6
|
-
import com.twentyfouri.tvbridge.common.NullIapService
|
|
6
|
+
import com.twentyfouri.tvbridge.common.iap.NullIapService
|
|
7
7
|
import com.twentyfouri.tvbridge.configuration.BridgeConfig
|
|
8
8
|
import com.twentyfouri.tvbridge.global.BaseApplication
|
|
9
9
|
import com.twentyfouri.tvbridge.global.utils.LocalStorage
|
|
@@ -37,8 +37,8 @@ class ApplicationModule(
|
|
|
37
37
|
|
|
38
38
|
@Singleton
|
|
39
39
|
@Provides
|
|
40
|
-
fun provideIapService() = Flavor
|
|
41
|
-
.
|
|
40
|
+
fun provideIapService() = Flavor
|
|
41
|
+
.iapServiceFactories
|
|
42
42
|
.firstOrNull { it.detectSupport(baseApplication) }
|
|
43
43
|
?.build(baseApplication)
|
|
44
44
|
?: NullIapService()
|
|
@@ -48,4 +48,4 @@ class ApplicationModule(
|
|
|
48
48
|
fun providePlayerFactory(config: BridgeConfig): PlayerFactoryBase =
|
|
49
49
|
PlayerFactoryConfigured.buildFactory(config, baseApplication)
|
|
50
50
|
|
|
51
|
-
}
|
|
51
|
+
}
|
|
@@ -81,6 +81,10 @@ class WebViewActivity : AppCompatActivity(), Mainview {
|
|
|
81
81
|
initialized = true
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
override fun reloadPlayer() {
|
|
85
|
+
binding.playerView.playerFactory = viewModel.playerFactory
|
|
86
|
+
}
|
|
87
|
+
|
|
84
88
|
override fun hideKeyboard() {
|
|
85
89
|
val imm = getSystemService(Activity.INPUT_METHOD_SERVICE) as? InputMethodManager
|
|
86
90
|
?: return
|
|
@@ -16,12 +16,50 @@ import android.webkit.WebView
|
|
|
16
16
|
import com.google.android.gms.ads.identifier.AdvertisingIdClient
|
|
17
17
|
import com.google.gson.JsonArray
|
|
18
18
|
import com.google.gson.JsonObject
|
|
19
|
-
import com.twentyfouri.player.base
|
|
19
|
+
import com.twentyfouri.player.base.AbrStrategy
|
|
20
|
+
import com.twentyfouri.player.base.AdBreakEndedEvent
|
|
21
|
+
import com.twentyfouri.player.base.AdBreakStartedEvent
|
|
22
|
+
import com.twentyfouri.player.base.AdBreaksRescheduledEvent
|
|
23
|
+
import com.twentyfouri.player.base.AdErrorEvent
|
|
24
|
+
import com.twentyfouri.player.base.AdSkippedEvent
|
|
25
|
+
import com.twentyfouri.player.base.AdStartedEvent
|
|
26
|
+
import com.twentyfouri.player.base.AddAudioTrackEvent
|
|
27
|
+
import com.twentyfouri.player.base.AddTextTrackEvent
|
|
28
|
+
import com.twentyfouri.player.base.AudioTrack
|
|
29
|
+
import com.twentyfouri.player.base.CanPlayEvent
|
|
30
|
+
import com.twentyfouri.player.base.ChangeAudioTrackEvent
|
|
31
|
+
import com.twentyfouri.player.base.ChangeTextTrackEvent
|
|
32
|
+
import com.twentyfouri.player.base.EndedEvent
|
|
33
|
+
import com.twentyfouri.player.base.ErrorEvent
|
|
34
|
+
import com.twentyfouri.player.base.Event
|
|
35
|
+
import com.twentyfouri.player.base.EventListener
|
|
36
|
+
import com.twentyfouri.player.base.LoadedDataEvent
|
|
37
|
+
import com.twentyfouri.player.base.LoadedMetadataEvent
|
|
38
|
+
import com.twentyfouri.player.base.PauseEvent
|
|
39
|
+
import com.twentyfouri.player.base.PlayerBase
|
|
40
|
+
import com.twentyfouri.player.base.PlayerFactoryBase
|
|
41
|
+
import com.twentyfouri.player.base.PlayingEvent
|
|
42
|
+
import com.twentyfouri.player.base.RemoveAudioTrackEvent
|
|
43
|
+
import com.twentyfouri.player.base.RemoveTextTrackEvent
|
|
44
|
+
import com.twentyfouri.player.base.SeekedEvent
|
|
45
|
+
import com.twentyfouri.player.base.SeekingEvent
|
|
46
|
+
import com.twentyfouri.player.base.Source
|
|
47
|
+
import com.twentyfouri.player.base.SourceDrmPlayready
|
|
48
|
+
import com.twentyfouri.player.base.SourceDrmWidevine
|
|
49
|
+
import com.twentyfouri.player.base.TextTrack
|
|
50
|
+
import com.twentyfouri.player.base.TimeUpdateEvent
|
|
51
|
+
import com.twentyfouri.player.base.TrackKind
|
|
52
|
+
import com.twentyfouri.player.base.WaitingEvent
|
|
53
|
+
import com.twentyfouri.player.base.buildUpon
|
|
20
54
|
import com.twentyfouri.tvbridge.BuildConfig
|
|
21
55
|
import com.twentyfouri.tvbridge.Flavor
|
|
22
56
|
import com.twentyfouri.tvbridge.bridge.BridgeFromJavaScript
|
|
23
57
|
import com.twentyfouri.tvbridge.bridge.BridgeToJavaScript
|
|
24
|
-
import com.twentyfouri.tvbridge.common
|
|
58
|
+
import com.twentyfouri.tvbridge.common.iap.IapCallback
|
|
59
|
+
import com.twentyfouri.tvbridge.common.iap.IapException
|
|
60
|
+
import com.twentyfouri.tvbridge.common.iap.IapProduct
|
|
61
|
+
import com.twentyfouri.tvbridge.common.iap.IapPurchase
|
|
62
|
+
import com.twentyfouri.tvbridge.common.iap.IapService
|
|
25
63
|
import com.twentyfouri.tvbridge.configuration.BridgeConfig
|
|
26
64
|
import com.twentyfouri.tvbridge.global.utils.LocalStorage
|
|
27
65
|
import com.twentyfouri.tvbridge.global.utils.PlayerFactoryVersion
|
|
@@ -45,11 +83,11 @@ import javax.inject.Inject
|
|
|
45
83
|
* Created by destivar on 15/02/16.
|
|
46
84
|
*/
|
|
47
85
|
class WebViewModel @Inject constructor(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
86
|
+
private val context: Context,
|
|
87
|
+
private val localStorage: LocalStorage,
|
|
88
|
+
private val config: BridgeConfig,
|
|
89
|
+
private val iapService: IapService,
|
|
90
|
+
val playerFactory: PlayerFactoryBase
|
|
53
91
|
) : EventListener {
|
|
54
92
|
var player: PlayerBase? = null
|
|
55
93
|
private var view: Mainview? = null
|
|
@@ -238,6 +276,10 @@ class WebViewModel @Inject constructor(
|
|
|
238
276
|
player.unload()
|
|
239
277
|
}
|
|
240
278
|
|
|
279
|
+
fun reloadPlayer() {
|
|
280
|
+
view?.reloadPlayer()
|
|
281
|
+
}
|
|
282
|
+
|
|
241
283
|
val currentPosition: Double
|
|
242
284
|
get() = player?.currentTime ?: playerCache.savedPlayerPosition
|
|
243
285
|
val duration: Double
|
|
@@ -468,7 +510,7 @@ class WebViewModel @Inject constructor(
|
|
|
468
510
|
}
|
|
469
511
|
|
|
470
512
|
fun signData(dataJson: String?): String? {
|
|
471
|
-
return if (dataJson == null || dataJson.isEmpty()) "" else Flavor
|
|
513
|
+
return if (dataJson == null || dataJson.isEmpty()) "" else Flavor.signData(context, dataJson)
|
|
472
514
|
}
|
|
473
515
|
|
|
474
516
|
fun launchIapPurchase(sku: String?) {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
buildscript {
|
|
2
|
-
ext.kotlin_version = '2.
|
|
2
|
+
ext.kotlin_version = '2.2.10'
|
|
3
3
|
|
|
4
4
|
repositories {
|
|
5
5
|
google()
|
|
6
6
|
mavenCentral()
|
|
7
7
|
}
|
|
8
8
|
dependencies {
|
|
9
|
-
classpath 'com.android.tools.build:gradle:8.
|
|
9
|
+
classpath 'com.android.tools.build:gradle:8.12.1'
|
|
10
10
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
11
|
-
classpath 'com.google.gms:google-services:4.4.
|
|
12
|
-
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.
|
|
11
|
+
classpath 'com.google.gms:google-services:4.4.3'
|
|
12
|
+
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.6'
|
|
13
13
|
|
|
14
14
|
// NOTE: Do not place your application dependencies here; they belong
|
|
15
15
|
// in the individual module build.gradle files
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
2
|
+
|
|
1
3
|
plugins {
|
|
2
4
|
id 'com.android.library'
|
|
3
5
|
id 'kotlin-android'
|
|
@@ -5,22 +7,19 @@ plugins {
|
|
|
5
7
|
|
|
6
8
|
android {
|
|
7
9
|
namespace = "com.twentyfouri.tvbridge.common"
|
|
8
|
-
compileSdk =
|
|
10
|
+
compileSdk = {{COMPILE_SDK_VERSION}}
|
|
9
11
|
|
|
10
12
|
compileOptions {
|
|
11
13
|
sourceCompatibility JavaVersion.VERSION_17
|
|
12
14
|
targetCompatibility JavaVersion.VERSION_17
|
|
13
15
|
}
|
|
14
|
-
kotlinOptions {
|
|
15
|
-
jvmTarget = '17'
|
|
16
|
-
}
|
|
17
16
|
|
|
18
17
|
defaultConfig {
|
|
19
|
-
minSdk =
|
|
20
|
-
targetSdk =
|
|
18
|
+
minSdk = {{MIN_SDK_VERSION}}
|
|
19
|
+
targetSdk = {{TARGET_SDK_VERSION}}
|
|
21
20
|
|
|
22
|
-
versionCode
|
|
23
|
-
versionName "
|
|
21
|
+
versionCode {{APP_VERSION_CODE}}
|
|
22
|
+
versionName "{{APP_VERSION_NAME}}"
|
|
24
23
|
|
|
25
24
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
26
25
|
consumerProguardFiles "consumer-rules.pro"
|
|
@@ -34,7 +33,9 @@ android {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
kotlin.compilerOptions.jvmTarget = JvmTarget.JVM_17
|
|
37
|
+
|
|
37
38
|
dependencies {
|
|
38
|
-
api 'androidx.core:core-ktx:1.
|
|
39
|
-
api 'androidx.appcompat:appcompat:1.7.
|
|
39
|
+
api 'androidx.core:core-ktx:1.17.0'
|
|
40
|
+
api 'androidx.appcompat:appcompat:1.7.1'
|
|
40
41
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.common
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
|
|
5
|
+
@Suppress("DEPRECATION", "unused")
|
|
6
|
+
val Context.installerPackageName get() =
|
|
7
|
+
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R) {
|
|
8
|
+
packageManager.getInstallSourceInfo(packageName).installingPackageName
|
|
9
|
+
} else {
|
|
10
|
+
packageManager.getInstallerPackageName(packageName)
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.common.iap
|
|
2
|
+
|
|
3
|
+
interface IapCallback {
|
|
4
|
+
fun checkNewPurchasesFinished(result: List<IapPurchase>)
|
|
5
|
+
fun checkNewPurchasesFinished(exception: Exception)
|
|
6
|
+
fun getProductsFinished(result: List<IapProduct>, missing: List<String>)
|
|
7
|
+
fun getProductsFinished(exception: Exception)
|
|
8
|
+
fun purchaseFinished(result: IapPurchase)
|
|
9
|
+
fun purchaseFinished(exception: Exception)
|
|
10
|
+
fun acknowledgeReceiptFinished(exception: Exception?)
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.common.iap
|
|
2
|
+
|
|
3
|
+
class IapException(
|
|
4
|
+
val status: String,
|
|
5
|
+
message: String = "In-app payment failed: $status",
|
|
6
|
+
cause: Exception? = null
|
|
7
|
+
) : Exception(message, cause) {
|
|
8
|
+
companion object {
|
|
9
|
+
const val STATUS_FAILED = "FAILED"
|
|
10
|
+
const val STATUS_NOT_SUPPORTED = "NOT_SUPPORTED"
|
|
11
|
+
const val STATUS_INVALID_SKU = "INVALID_SKU"
|
|
12
|
+
const val STATUS_ALREADY_PURCHASED = "ALREADY_PURCHASED"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.common.iap
|
|
2
|
+
|
|
3
|
+
data class IapProduct(
|
|
4
|
+
val title: String,
|
|
5
|
+
val description: String,
|
|
6
|
+
val price: String,
|
|
7
|
+
val icon: String,
|
|
8
|
+
val type: String,
|
|
9
|
+
val sku: String,
|
|
10
|
+
) {
|
|
11
|
+
companion object {
|
|
12
|
+
const val TYPE_CONSUMABLE = "CONSUMABLE"
|
|
13
|
+
const val TYPE_SUBSCRIPTION = "SUBSCRIPTION"
|
|
14
|
+
const val TYPE_ENTITLED = "ENTITLED"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.common.iap
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
|
|
6
|
+
interface IapService {
|
|
7
|
+
fun initialize()
|
|
8
|
+
fun destroy()
|
|
9
|
+
fun checkNewPurchases()
|
|
10
|
+
fun getProducts(skus: Iterable<String>)
|
|
11
|
+
fun purchase(activity: Activity, sku: String)
|
|
12
|
+
fun acknowledgeReceipt(receipt: JSONObject)
|
|
13
|
+
fun setCallback(callback: IapCallback?)
|
|
14
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.common.iap
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import org.json.JSONObject
|
|
5
|
+
|
|
6
|
+
open class NullIapService : IapService {
|
|
7
|
+
private var callback: IapCallback? = null
|
|
8
|
+
|
|
9
|
+
override fun initialize() = Unit
|
|
10
|
+
|
|
11
|
+
override fun destroy() = Unit
|
|
12
|
+
|
|
13
|
+
override fun checkNewPurchases() {
|
|
14
|
+
callback?.checkNewPurchasesFinished(UnsupportedOperationException())
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
override fun getProducts(skus: Iterable<String>) {
|
|
18
|
+
callback?.getProductsFinished(UnsupportedOperationException())
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
override fun purchase(activity: Activity, sku: String) {
|
|
22
|
+
callback?.purchaseFinished(UnsupportedOperationException())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override fun acknowledgeReceipt(receipt: JSONObject) {
|
|
26
|
+
callback?.acknowledgeReceiptFinished(UnsupportedOperationException())
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override fun setCallback(callback: IapCallback?) {
|
|
30
|
+
this.callback = callback
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
2
|
+
|
|
1
3
|
plugins {
|
|
2
4
|
id 'com.android.library'
|
|
3
5
|
id 'kotlin-android'
|
|
@@ -5,22 +7,19 @@ plugins {
|
|
|
5
7
|
|
|
6
8
|
android {
|
|
7
9
|
namespace = "com.twentyfouri.tvbridge.googleiap"
|
|
8
|
-
compileSdk =
|
|
10
|
+
compileSdk = {{COMPILE_SDK_VERSION}}
|
|
9
11
|
|
|
10
12
|
compileOptions {
|
|
11
13
|
sourceCompatibility JavaVersion.VERSION_17
|
|
12
14
|
targetCompatibility JavaVersion.VERSION_17
|
|
13
15
|
}
|
|
14
|
-
kotlinOptions {
|
|
15
|
-
jvmTarget = '17'
|
|
16
|
-
}
|
|
17
16
|
|
|
18
17
|
defaultConfig {
|
|
19
|
-
minSdk =
|
|
20
|
-
targetSdk =
|
|
18
|
+
minSdk = {{MIN_SDK_VERSION}}
|
|
19
|
+
targetSdk = {{TARGET_SDK_VERSION}}
|
|
21
20
|
|
|
22
|
-
versionCode
|
|
23
|
-
versionName "
|
|
21
|
+
versionCode {{APP_VERSION_CODE}}
|
|
22
|
+
versionName "{{APP_VERSION_NAME}}"
|
|
24
23
|
|
|
25
24
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
26
25
|
consumerProguardFiles "consumer-rules.pro"
|
|
@@ -34,7 +33,9 @@ android {
|
|
|
34
33
|
}
|
|
35
34
|
}
|
|
36
35
|
|
|
36
|
+
kotlin.compilerOptions.jvmTarget = JvmTarget.JVM_17
|
|
37
|
+
|
|
37
38
|
dependencies {
|
|
38
39
|
implementation project(':common')
|
|
39
|
-
implementation 'com.android.billingclient:billing-ktx:
|
|
40
|
+
implementation 'com.android.billingclient:billing-ktx:8.0.0'
|
|
40
41
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
package com.twentyfouri.tvbridge.googleiap
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.os.Build
|
|
5
|
+
import com.twentyfouri.tvbridge.common.iap.IapServiceFactory
|
|
6
|
+
import com.twentyfouri.tvbridge.common.installerPackageName
|
|
7
|
+
|
|
8
|
+
object GoogleIapServiceFactory : IapServiceFactory {
|
|
9
|
+
override fun detectSupport(context: Context) =
|
|
10
|
+
Build.MANUFACTURER != "Amazon" && context.installerPackageName != "com.amazon.venezia"
|
|
11
|
+
|
|
12
|
+
override fun build(context: Context) = GoogleIapService
|
|
13
|
+
}
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
|
|
4
4
|
networkTimeout=10000
|
|
5
5
|
validateDistributionUrl=true
|
|
6
6
|
zipStoreBase=GRADLE_USER_HOME
|
package/package.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
package com.twentyfouri.tvbridge
|
|
2
|
-
|
|
3
|
-
import com.twentyfouri.tvbridge.common.IapServiceFactory
|
|
4
|
-
{{FLAVOR_IMPORTS}}
|
|
5
|
-
|
|
6
|
-
class Flavor: FlavorBase() {
|
|
7
|
-
override fun getIapServiceFactories(): List<IapServiceFactory> {
|
|
8
|
-
return listOf({{FLAVOR_IAP_FACTORIES}})
|
|
9
|
-
}
|
|
10
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
package com.twentyfouri.tvbridge.common
|
|
2
|
-
|
|
3
|
-
import android.app.Activity
|
|
4
|
-
import android.content.Context
|
|
5
|
-
import org.json.JSONObject
|
|
6
|
-
|
|
7
|
-
interface IapServiceFactory {
|
|
8
|
-
fun detectSupport(context: Context): Boolean
|
|
9
|
-
fun build(context: Context): IapService
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@Suppress("DEPRECATION", "unused")
|
|
13
|
-
val Context.installerPackageName: String?
|
|
14
|
-
get() = when {
|
|
15
|
-
android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.R ->
|
|
16
|
-
packageManager.getInstallSourceInfo(packageName).installingPackageName
|
|
17
|
-
else ->
|
|
18
|
-
packageManager.getInstallerPackageName(packageName)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface IapService {
|
|
22
|
-
fun initialize()
|
|
23
|
-
fun destroy()
|
|
24
|
-
fun checkNewPurchases()
|
|
25
|
-
fun getProducts(skus: List<String>)
|
|
26
|
-
fun purchase(activity: Activity, sku: String)
|
|
27
|
-
fun acknowledgeReceipt(receipt: JSONObject)
|
|
28
|
-
fun setCallback(callback: IapCallback?)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
interface IapCallback {
|
|
32
|
-
fun checkNewPurchasesFinished(result: List<IapPurchase>)
|
|
33
|
-
fun checkNewPurchasesFinished(exception: Exception)
|
|
34
|
-
fun getProductsFinished(result: List<IapProduct>, missing: List<String>)
|
|
35
|
-
fun getProductsFinished(exception: Exception)
|
|
36
|
-
fun purchaseFinished(result: IapPurchase)
|
|
37
|
-
fun purchaseFinished(exception: Exception)
|
|
38
|
-
fun acknowledgeReceiptFinished(exception: Exception?)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
open class IapProduct(
|
|
42
|
-
val title: String,
|
|
43
|
-
val description: String,
|
|
44
|
-
val price: String,
|
|
45
|
-
val icon: String,
|
|
46
|
-
val type: String,
|
|
47
|
-
val sku: String,
|
|
48
|
-
) {
|
|
49
|
-
companion object {
|
|
50
|
-
const val TYPE_CONSUMABLE = "CONSUMABLE"
|
|
51
|
-
const val TYPE_SUBSCRIPTION = "SUBSCRIPTION"
|
|
52
|
-
const val TYPE_ENTITLED = "ENTITLED"
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
open class IapPurchase(
|
|
57
|
-
val sku: String,
|
|
58
|
-
val userId: String,
|
|
59
|
-
val receipt: JSONObject
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
open class IapException(
|
|
63
|
-
val status: String,
|
|
64
|
-
message: String,
|
|
65
|
-
cause: Exception?
|
|
66
|
-
): Exception(message, cause) {
|
|
67
|
-
|
|
68
|
-
constructor(
|
|
69
|
-
status: String
|
|
70
|
-
) : this(status, "In-app payment failed: $status", null)
|
|
71
|
-
|
|
72
|
-
constructor(
|
|
73
|
-
status: String,
|
|
74
|
-
cause: Exception?
|
|
75
|
-
) : this(status, cause?.message ?: "In-app payment failed: $status", cause)
|
|
76
|
-
|
|
77
|
-
companion object {
|
|
78
|
-
const val STATUS_FAILED = "FAILED"
|
|
79
|
-
const val STATUS_NOT_SUPPORTED = "NOT_SUPPORTED"
|
|
80
|
-
const val STATUS_INVALID_SKU = "INVALID_SKU"
|
|
81
|
-
const val STATUS_ALREADY_PURCHASED = "ALREADY_PURCHASED"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
open class NullIapService : IapService {
|
|
86
|
-
|
|
87
|
-
protected var callback: IapCallback? = null
|
|
88
|
-
private set
|
|
89
|
-
|
|
90
|
-
override fun initialize() {
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
override fun destroy() {
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
override fun checkNewPurchases() {
|
|
97
|
-
callback?.checkNewPurchasesFinished(UnsupportedOperationException())
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
override fun getProducts(skus: List<String>) {
|
|
101
|
-
callback?.getProductsFinished(UnsupportedOperationException())
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
override fun purchase(activity: Activity, sku: String) {
|
|
105
|
-
callback?.purchaseFinished(UnsupportedOperationException())
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
override fun acknowledgeReceipt(receipt: JSONObject) {
|
|
109
|
-
callback?.acknowledgeReceiptFinished(UnsupportedOperationException())
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
override fun setCallback(callback: IapCallback?) {
|
|
113
|
-
this.callback = callback
|
|
114
|
-
}
|
|
115
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
package com.twentyfouri.tvbridge.googleiap
|
|
2
|
-
|
|
3
|
-
import android.content.Context
|
|
4
|
-
import android.os.Build
|
|
5
|
-
import com.twentyfouri.tvbridge.common.IapService
|
|
6
|
-
import com.twentyfouri.tvbridge.common.IapServiceFactory
|
|
7
|
-
import com.twentyfouri.tvbridge.common.NullIapService
|
|
8
|
-
import com.twentyfouri.tvbridge.common.installerPackageName
|
|
9
|
-
|
|
10
|
-
object GoogleIapServiceFactory : IapServiceFactory {
|
|
11
|
-
override fun detectSupport(context: Context): Boolean {
|
|
12
|
-
val installer = context.installerPackageName
|
|
13
|
-
return when {
|
|
14
|
-
installer == "com.android.vending" -> true
|
|
15
|
-
installer == "com.amazon.venezia" -> false
|
|
16
|
-
Build.MANUFACTURER == "Amazon" -> false
|
|
17
|
-
else -> true // for non-Fire devices we assume that Google Play is installed
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
override fun build(context: Context): IapService =
|
|
22
|
-
GoogleIapService(context)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
class GoogleIapService(
|
|
26
|
-
private val context: Context
|
|
27
|
-
): NullIapService() {
|
|
28
|
-
// we'll implement this when the feature is confirmed
|
|
29
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|