"Fossies" - the Fresh Open Source Software Archive

Member "jitsi-meet-7315/twa/app/build.gradle" (2 Jun 2023, 9533 Bytes) of package /linux/misc/jitsi-meet-7315.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Java source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2  * Copyright 2019 Google Inc.
    3  *
    4  * Licensed under the Apache License, Version 2.0 (the "License");
    5  * you may not use this file except in compliance with the License.
    6  * You may obtain a copy of the License at
    7  *
    8  *      http://www.apache.org/licenses/LICENSE-2.0
    9  *
   10  * Unless required by applicable law or agreed to in writing, software
   11  * distributed under the License is distributed on an "AS IS" BASIS,
   12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13  * See the License for the specific language governing permissions and
   14  * limitations under the License.
   15  */
   16 
   17 import groovy.xml.MarkupBuilder
   18 
   19 apply plugin: 'com.android.application'
   20 
   21 def twaManifest = [
   22     applicationId: 'org.jitsi.meet',
   23     hostName: 'meet.jit.si', // The domain being opened in the TWA.
   24     launchUrl: '/', // The start path for the TWA. Must be relative to the domain.
   25     name: 'Jitsi Meet', // The application name.
   26     launcherName: 'Jitsi Meet', // The name shown on the Android Launcher.
   27     themeColor: '#17A0DB', // The color used for the status bar.
   28     navigationColor: '#000000', // The color used for the navigation bar.
   29     navigationColorDark: '#000000', // The color used for the dark navbar.
   30     navigationDividerColor: '#000000', // The navbar divider color.
   31     navigationDividerColorDark: '#000000', // The dark navbar divider color.
   32     backgroundColor: '#17A0DB', // The color used for the splash screen background.
   33     enableNotifications: false, // Set to true to enable notification delegation.
   34     // Every shortcut must include the following fields:
   35     // - name: String that will show up in the shortcut.
   36     // - short_name: Shorter string used if |name| is too long.
   37     // - url: Absolute path of the URL to launch the app with (e.g '/create').
   38     // - icon: Name of the resource in the drawable folder to use as an icon.
   39     shortcuts: [],
   40     // The duration of fade out animation in milliseconds to be played when removing splash screen.
   41     splashScreenFadeOutDuration: 300,
   42     generatorApp: 'bubblewrap-cli', // Application that generated the Android Project
   43     // The fallback strategy for when Trusted Web Activity is not available. Possible values are
   44     // 'customtabs' and 'webview'.
   45     fallbackType: 'customtabs',
   46     enableSiteSettingsShortcut: 'true',
   47 ]
   48 
   49 android {
   50     compileSdkVersion 29
   51     defaultConfig {
   52         applicationId "org.jitsi.meet"
   53         minSdkVersion 19
   54         targetSdkVersion 29
   55         versionCode 2000000000
   56         versionName "1.0.0"
   57 
   58         // The name for the application
   59         resValue "string", "appName", twaManifest.name
   60 
   61         // The name for the application on the Android Launcher
   62         resValue "string", "launcherName", twaManifest.launcherName
   63 
   64         // The URL that will be used when launching the TWA from the Android Launcher
   65         def launchUrl = "https://" + twaManifest.hostName + twaManifest.launchUrl
   66         resValue "string", "launchUrl", launchUrl
   67 
   68         
   69             // The URL the Web Manifest for the Progressive Web App that the TWA points to. This
   70             // is used by Chrome OS to open the Web version of the PWA instead of the TWA, as it
   71             // will probably give a better user experience for non-mobile devices.
   72             resValue "string", "webManifestUrl", 'https://meet.jit.si/manifest.json'
   73         
   74 
   75         // The hostname is used when building the intent-filter, so the TWA is able to
   76         // handle Intents to open https://svgomg.firebaseapp.com.
   77         resValue "string", "hostName", twaManifest.hostName
   78 
   79         // This variable below expresses the relationship between the app and the site,
   80         // as documented in the TWA documentation at
   81         // https://developers.google.com/web/updates/2017/10/using-twa#set_up_digital_asset_links_in_an_android_app
   82         // and is injected into the AndroidManifest.xml
   83         resValue "string", "assetStatements",
   84                 '[{ \\"relation\\": [\\"delegate_permission/common.handle_all_urls\\"],' +
   85                         '\\"target\\": {\\"namespace\\": \\"web\\", \\"site\\": \\"https://' +
   86                         twaManifest.hostName + '\\"}}]'
   87 
   88         // This attribute sets the status bar color for the TWA. It can be either set here or in
   89         // `res/values/colors.xml`. Setting in both places is an error and the app will not
   90         // compile. If not set, the status bar color defaults to #FFFFFF - white.
   91         resValue "color", "colorPrimary", twaManifest.themeColor
   92 
   93         // This attribute sets the navigation bar color for the TWA. It can be either set here or
   94         // in `res/values/colors.xml`. Setting in both places is an error and the app will not
   95         // compile. If not set, the navigation bar color defaults to #FFFFFF - white.
   96         resValue "color", "navigationColor", twaManifest.navigationColor
   97 
   98         // This attribute sets the dark navigation bar color for the TWA. It can be either set here
   99         // or in `res/values/colors.xml`. Setting in both places is an error and the app will not
  100         // compile. If not set, the navigation bar color defaults to #000000 - black.
  101         resValue "color", "navigationColorDark", twaManifest.navigationColorDark
  102 
  103         // This attribute sets the navbar divider color for the TWA. It can be either 
  104         // set here or in `res/values/colors.xml`. Setting in both places is an error and the app 
  105         // will not compile. If not set, the divider color defaults to #00000000 - transparent.
  106         resValue "color", "navigationDividerColor", twaManifest.navigationDividerColor
  107 
  108         // This attribute sets the dark navbar divider color for the TWA. It can be either 
  109         // set here or in `res/values/colors.xml`. Setting in both places is an error and the 
  110         //app will not compile. If not set, the divider color defaults to #000000 - black.
  111         resValue "color", "navigationDividerColorDark", twaManifest.navigationDividerColorDark
  112 
  113         // Sets the color for the background used for the splash screen when launching the
  114         // Trusted Web Activity.
  115         resValue "color", "backgroundColor", twaManifest.backgroundColor
  116 
  117         // Defines a provider authority fot the Splash Screen
  118         resValue "string", "providerAuthority", twaManifest.applicationId + '.fileprovider'
  119 
  120         // The enableNotification resource is used to enable or disable the
  121         // TrustedWebActivityService, by changing the android:enabled and android:exported
  122         // attributes
  123         resValue "bool", "enableNotification", twaManifest.enableNotifications.toString()
  124 
  125         twaManifest.shortcuts.eachWithIndex { shortcut, index ->
  126             resValue "string", "shortcut_name_$index", "$shortcut.name"
  127             resValue "string", "shortcut_short_name_$index", "$shortcut.short_name"
  128         }
  129 
  130         // The splashScreenFadeOutDuration resource is used to set the duration of fade out animation in milliseconds
  131         // to be played when removing splash screen. The default is 0 (no animation).
  132         resValue "integer", "splashScreenFadeOutDuration", twaManifest.splashScreenFadeOutDuration.toString()
  133 
  134         resValue "string", "generatorApp", twaManifest.generatorApp
  135 
  136         resValue "string", "fallbackType", twaManifest.fallbackType
  137 
  138         resValue "bool", "enableSiteSettingsShortcut", twaManifest.enableSiteSettingsShortcut
  139     }
  140     buildTypes {
  141         release {
  142             minifyEnabled true
  143         }
  144     }
  145     compileOptions {
  146         sourceCompatibility JavaVersion.VERSION_1_8
  147         targetCompatibility JavaVersion.VERSION_1_8
  148     }
  149 }
  150 
  151 task generateShorcutsFile {
  152     assert twaManifest.shortcuts.size() < 5, "You can have at most 4 shortcuts."
  153     twaManifest.shortcuts.eachWithIndex { s, i ->
  154         assert s.name != null, 'Missing `name` in shortcut #' + i
  155         assert s.short_name != null, 'Missing `short_name` in shortcut #' + i
  156         assert s.url != null, 'Missing `icon` in shortcut #' + i
  157         assert s.icon != null, 'Missing `url` in shortcut #' + i
  158     }
  159 
  160     def shortcutsFile = new File("$projectDir/src/main/res/xml", "shortcuts.xml")
  161 
  162     def xmlWriter = new StringWriter()
  163     def xmlMarkup = new MarkupBuilder(new IndentPrinter(xmlWriter, "    ", true))
  164 
  165     xmlMarkup
  166         .'shortcuts'('xmlns:android': 'http://schemas.android.com/apk/res/android') {
  167             twaManifest.shortcuts.eachWithIndex { s, i ->
  168                 'shortcut'(
  169                         'android:shortcutId': 'shortcut' + i,
  170                         'android:enabled': 'true',
  171                         'android:icon': '@drawable/' + s.icon,
  172                         'android:shortcutShortLabel': '@string/shortcut_short_name_' + i,
  173                         'android:shortcutLongLabel': '@string/shortcut_name_' + i) {
  174                     'intent'(
  175                             'android:action': 'android.intent.action.MAIN',
  176                             'android:targetPackage': twaManifest.applicationId,
  177                             'android:targetClass': twaManifest.applicationId + '.LauncherActivity',
  178                             'android:data': s.url)
  179                     'categories'('android:name': 'android.intent.category.LAUNCHER')
  180                 }
  181             }
  182         }
  183     shortcutsFile.text = xmlWriter.toString() + '\n'
  184 }
  185 
  186 preBuild.dependsOn(generateShorcutsFile)
  187 
  188 repositories {
  189     
  190 }
  191 
  192 dependencies {
  193     implementation fileTree(include: ['*.jar'], dir: 'libs')
  194     
  195     implementation 'com.google.androidbrowserhelper:androidbrowserhelper:2.0.0'    
  196 }