Skip to content

Commit

Permalink
Merge pull request #128 from Giphy/fix/gph-grid-view
Browse files Browse the repository at this point in the history
Fix: GiphyGridView does not refresh its content in certain scenarios
  • Loading branch information
pshoniuk authored Jul 18, 2023
2 parents c0ba3e3 + 6bdbb68 commit 1ff600f
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 35 deletions.
9 changes: 0 additions & 9 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ runs:
example/yarn.lock
registry-url: 'https://registry.npmjs.org'

- name: ♻️ Restore node_modules from cache
id: node-modules-cache
uses: actions/cache@v3
with:
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock', 'example/yarn.lock') }}
path: |
node_modules
example/node_modules
- name: 📦 Install JS dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile && yarn example install --frozen-lockfile
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ name: 'CI'
on:
push:
branches: [ 'main' ]
tags: [ 'v*' ]
pull_request:
branches: [ 'main' ]
branches: [ '**' ]

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
Expand Down Expand Up @@ -54,5 +53,5 @@ jobs:
- name: 👮 Check Licenses
run: yarn licenses:check
env:
LICENSE_CATEGORIES_LOCATION: ${{ secrets.LICENSE_CATEGORIES_LOCATION }}
LICENSE_CATEGORIES_LOCATION: ${{ secrets.LICENSE_CATEGORIES_V2_LOCATION }}
LICENSE_PROJECT_LOCATION: ${{ secrets.LICENSE_PROJECT_LOCATION }}
2 changes: 1 addition & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/stale@v8
with:
days-before-close: 7
days-before-stale: 40
days-before-stale: 30
enable-statistics: true
only-labels: 'status:needs more information'
stale-issue-label: 'status:stale'
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,6 @@ preBuild.dependsOn configureGiphyVideoPlayerAdapter
dependencies {
// noinspection GradleDynamicVersion
api 'com.facebook.react:react-native:+'
implementation 'com.giphy.sdk:ui:2.3.6'
implementation 'com.giphy.sdk:ui:2.3.6-hotfix-grid'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.5.31'
}
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,14 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
boost: 57d2868c099736d80fcd648bf211b4431e51a558
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: a926a9aaa3596b181972abf0f47eff3dee796222
FBReactNativeSpec: f1141d5407f4a27c397bca5db03cc03919357b0d
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
Giphy: f64bff5937fbc4987b6a26c8ef625501c68a1e97
giphy-react-native-sdk: f616d6503c872e436fa51b5832a2d32eea371e2f
glog: 5337263514dd6f09803962437687240c5dc39aa4
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
RCT-Folly: a21c126816d8025b547704b777a2ba552f3d9fa9
RCTRequired: 405e24508a0feed1771d48caebb85c581db53122
Expand Down
2 changes: 1 addition & 1 deletion example/src/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react'
import { getStatusBarHeight } from 'react-native-status-bar-height'
import { StyleSheet, View, Modal, Text, TouchableOpacity, ModalProps, ScrollView } from 'react-native'
import { Modal, ModalProps, ScrollView, StyleSheet, Text, TouchableOpacity, View } from 'react-native'

const styles = StyleSheet.create({
container: {
Expand Down
33 changes: 16 additions & 17 deletions scripts/licenses.check.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,24 @@ async function fetchJSON(url) {
data += chunk
})
resp.on('end', () => {
const json = JSON.parse(data.replace(/\/\/.*/g, ''))
resolve(json)
resolve(JSON.parse(data))
})
})
.on('error', reject)
})
}

async function fetchLicenseCategories(categories) {
const data = {}
const uniqueCategories = [...new Set([...categories])]
for (const category of uniqueCategories) {
data[category] = await fetchJSON(`${LICENSE_CATEGORIES_LOCATION}/${category}.json`)
async function fetchCategoryLicenses(categories) {
let result = []
for (const category of categories) {
const ctgLicenses = await fetchJSON(`${LICENSE_CATEGORIES_LOCATION}/${category}.json`)
const flatCtgLicenses = Object.entries(ctgLicenses).flatMap(([licenseName, license]) => [
licenseName,
...license.aliases,
])
result = [...result, ...flatCtgLicenses]
}
return data
return result
}

function toSemicolonList(list) {
Expand All @@ -58,9 +61,6 @@ function toSemicolonList(list) {
return list.join(';')
}

function pickLicensesForCategories(categoriesMapping, categories) {
return categories.flatMap((category) => categoriesMapping[category])
}

function normalizeModuleName(name) {
return (name ?? '').trim().toLowerCase()
Expand All @@ -86,7 +86,7 @@ async function getExampleAppIOSDeps(filePath) {
const bytes = await fs.promises.readFile(filePath)
const data = plist.parse(bytes.toString())
return data.PreferenceSpecifiers.filter(
({ Title }) => Title && Title !== columnTitle
({ Title }) => Title && Title !== columnTitle,
).map(({ Title, License = '' }) => ({
moduleName: normalizeModuleName(Title),
moduleLicense: License || UNKNOWN_LICENSE,
Expand All @@ -101,7 +101,7 @@ function checkModules(modules, options = {}) {
const spdxIsValid = (spdx) => spdxCorrect(spdx) === spdx
const spdxIsInvalid = (spdx) => !spdxIsValid(spdx)
const validSPDXLicenses = allowedLicenses.filter(spdxIsValid)
const invalidSPDXLicenses = allowedLicenses.filter(spdxIsInvalid)
const invalidSPDXLicenses = allowedLicenses.filter(spdxIsInvalid).map(l => l.toLowerCase())
const spdxExcluder = '( ' + validSPDXLicenses.join(' OR ') + ' )'
const allowedLicensesRepr = JSON.stringify(allowedLicenses)

Expand All @@ -110,23 +110,22 @@ function checkModules(modules, options = {}) {
return false
}
return (
invalidSPDXLicenses.indexOf(l) >= 0 ||
invalidSPDXLicenses.indexOf(l.toLowerCase()) >= 0 ||
(spdxCorrect(l) && spdxSatisfies(spdxCorrect(l), spdxExcluder))
)
}

modules.forEach((m) => {
assert(
isModuleIgnored(m.moduleName) || isLicenseAllowed(m.moduleLicense),
`Module "${m.moduleName}" with "${m.moduleLicense}" license is not allowed. Allowed licenses: ${allowedLicensesRepr}`
`Module "${m.moduleName}" with "${m.moduleLicense}" license is not allowed. Allowed licenses: ${allowedLicensesRepr}`,
)
})
}

async function main() {
const projCfg = await fetchJSON(LICENSE_PROJECT_LOCATION)
const categories = await fetchLicenseCategories(projCfg.license_categories)
const allowedLicenses = pickLicensesForCategories(categories, projCfg.license_categories)
const allowedLicenses = await fetchCategoryLicenses(projCfg.license_categories)
const allowedLicensesStr = toSemicolonList(allowedLicenses).replace(/,/g, '')
const giphySDKPkg = require(path.posix.resolve(DEPENDENCIES.rootJS, 'package.json'))
const exampleAppPkg = require(path.posix.resolve(DEPENDENCIES.exampleAppJS, 'package.json'))
Expand Down

0 comments on commit 1ff600f

Please sign in to comment.