cianru / huawei-appgallery-publish-gradle-plugin

Huawei AppGallery Publish Gradle Plugin allows you to publish the android release build file (*.apk or *.aab) to the Huawei AppGallery store
Apache License 2.0
113 stars 20 forks source link

HTML tags stripping #50

Closed rtsisyk closed 6 months ago

rtsisyk commented 11 months ago

It looks like that Huawei's AppGallery doesn't support HTML tags in the release notes and description, like Google Play does.

image

Please consider adding automated stripping of HTML tags to allow sharing of the same description with Google Play.

cosic commented 11 months ago

@rtsisyk Hi! I don't like idea to add some html tags stripper into the plugin because it should be stupid and not thinging about what a release notes text it got. But inspired your idea I'm going to add new param text which would hight priorited then filePath. So you can create function in gradle build script wich would fetch release noted and strip html from text on your side.

For example

huaweiPublish {
    instances {
        create("release") {
            releaseNotes = listOf(
                ru.cian.huawei.publish.ReleaseNote(
                    lang = "ru-RU",
                    text = getReleaseNotes("$projectDir/release-notes-ru.txt")
                ),
                ru.cian.huawei.publish.ReleaseNote(
                    lang = "en-US",
                    text = getReleaseNotes("$projectDir/release-notes-en.txt")
                )
            )
        }   
    }
}

and

fun getReleaseNotes(filePath: String): String {
    return File(filePath).readAll().replaceAll("\\<[^>]*>","")
}

What do you think about it?

rtsisyk commented 11 months ago

The best option would be to support Triple-T structure out of the box.

cosic commented 11 months ago

@rtsisyk How does Triple-T Release Notes structure help us to solve problem that AppGallery doesn't support html tags?

cosic commented 10 months ago

@rtsisyk Hi! Please try a new 1.4.1-SNAPSHOT version with a new removeHtmlTags parameter. For more information see README/snapshot-1.4.1.

Pay attention I've changed releaseNotes block. Instead of

           releaseNotes = listOf(
                ru.cian.rustore.publish.ReleaseNote(
                          lang = "en-US",
                          filePath = "$projectDir/release-notes-en.txt"
                ),
            )

new configuration

          releaseNotes = ru.cian.huawei.publish.ReleaseNotesExtension(
              descriptions = listOf(
                  ru.cian.huawei.publish.ReleaseNote(
                          lang = "en-US",
                          filePath = "$projectDir/release-notes-en.txt"
                  )
              ),
              removeHtmlTags = false
          )

And I remember you are using a trick to support Google Play languages. A new version should be

huaweiPublish {
  instances {
    huaweiRelease {
      credentialsPath = "$rootDir/huawei-appgallery.json"
      buildFormat = 'aab'
      deployType = 'draft' // confirm manually
      releaseDescriptions = []
      def localeOverride = [
          'am' : 'am-ET',
          'gu': 'gu_IN',
          'iw-IL': 'he_IL',
          'kn-IN': 'kn_IN',
          'ml-IN': 'ml_IN',
          'mn-MN': 'mn_MN',
          'mr-IN': 'mr_IN',
          'ta-IN': 'ta_IN',
          'te-IN': 'te_IN',
      ]
      def files = fileTree(dir: "$projectDir/src/google/play/release-notes",
          include: '**/default.txt')
      files.each { File file ->
        def path = file.getPath()
        def locale = file.parentFile.getName()
        locale = localeOverride.get(locale, locale)
        releaseDescriptions.add(new ru.cian.huawei.publish.ReleaseNote(locale, path))
      }
      releaseNotes = new ru.cian.huawei.publish.ReleaseNotesExtension(releaseDescriptions, true)
    }
  }
}
rtsisyk commented 10 months ago

@rtsisyk Hi! Please try a new 1.4.1-SNAPSHOT version with a new removeHtmlTags parameter. For more information see README/snapshot-1.4.1.

Wow, fantastic! Sorry for the silence. I will try.

cosic commented 10 months ago

@rtsisyk Hi! In 1.4.1 version has been found a small issue. Please try 1.4.2.