Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/1.4.0 #149

Merged
merged 15 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache
key: ${{ runner.os }}-setup-cache-2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
Expand All @@ -36,7 +36,7 @@ jobs:
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache
key: ${{ runner.os }}-setup-cache-2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
Expand All @@ -57,7 +57,7 @@ jobs:
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache
key: ${{ runner.os }}-setup-cache-2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
Expand All @@ -76,7 +76,7 @@ jobs:
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache
key: ${{ runner.os }}-setup-cache-2
- uses: actions/cache@v3
with:
path: |
Expand Down Expand Up @@ -113,7 +113,7 @@ jobs:
example/ios/Pods
example/ios/build
example/node_modules
key: ${{ runner.os }}-setup-cache
key: ${{ runner.os }}-setup-cache-2
- uses: actions/cache@v3
with:
path: |
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ test-butler-app.apk

# react-native-config codegen
example/ios/tmp.xcconfig
example/ios/.xcode.env.local
example/ios/.xcode.env.local

# env var
example/.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class AmazonIvsViewManager : SimpleViewManager<AmazonIvsView>() {
Commands.PLAY.ordinal,
"pause",
Commands.PAUSE.ordinal,
"seekTo",
Commands.SET_ORIGIN.ordinal,
"setOrigin",
Commands.SET_ORIGIN.ordinal,
"seekTo",
Commands.SEEK_TO.ordinal,
"togglePip",
Commands.TOGGLE_PIP.ordinal
Expand Down
6 changes: 3 additions & 3 deletions e2e/playgroundPlayer.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ describe('Playground player', () => {
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await scrollToModalBottom(100);
await element(by.id('muted')).tap();
await element(by.id('closeIcon')).tap();

Expand All @@ -134,7 +134,7 @@ describe('Playground player', () => {
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await scrollToModalBottom(100);
await waitToBeVisibleAndTap(by.id('autoplay'));
await waitToBeVisibleAndTap(by.id('closeIcon'));

Expand Down Expand Up @@ -244,7 +244,7 @@ describe('Playground player', () => {
.toBeVisible()
.withTimeout(TIMEOUT);
await element(by.id('settingsIcon')).tap();
await scrollToModalBottom();
await scrollToModalBottom(100);
await element(by.id('progressInterval')).replaceText('1');
await element(by.id('closeIcon')).tap();

Expand Down
2 changes: 1 addition & 1 deletion e2e/playgroundPlayerEvents.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe('Playground player events', () => {
);
await element(by.id('closeIcon')).tap();

await atLeastOneLogIsVisible('duration changed: 00:06:02');
await atLeastOneLogIsVisible('duration changed: 00:06:02.36');
});

it('Player notifies about quality change', async () => {
Expand Down
13 changes: 12 additions & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"

import org.apache.tools.ant.taskdefs.condition.Os
import com.android.build.OutputFile
import groovy.json.JsonSlurper

/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
Expand Down Expand Up @@ -130,6 +131,16 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

// Create an easy to use function
def getVersionFromNpm() {
// Read and parse package.json file from project root
def inputFile = new File("$rootDir/../package.json")
def packageJson = new JsonSlurper().parseText(inputFile.text)

// Return the version, you can get any value this way
return packageJson["version"]
}

android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
Expand All @@ -144,7 +155,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 16
versionName "1.3.0"
versionName getVersionFromNpm()
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
if (isNewArchitectureEnabled()) {
// We configure the NDK build only if you decide to opt-in for the New Architecture.
Expand Down
14 changes: 1 addition & 13 deletions example/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,4 @@
const path = require('path');
const pak = require('../package.json');

module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
[
'module-resolver',
{
alias: {
[pak.name]: path.join(__dirname, '..', `${pak.source}.ts`),
},
},
],
],
plugins: [['module:react-native-dotenv']],
};
4 changes: 2 additions & 2 deletions example/ios/AmazonIvsExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@
EXCLUDED_ARCHS = "";
INFOPLIST_FILE = AmazonIvsExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.4.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -624,7 +624,7 @@
EXCLUDED_ARCHS = "";
INFOPLIST_FILE = AmazonIvsExample/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.3.0;
MARKETING_VERSION = 1.4.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
Expand Down
7 changes: 7 additions & 0 deletions example/ios/AppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#import <React/RCTAppSetupUtils.h>

#import <AVFAudio/AVAudioSession.h>

#if RCT_NEW_ARCH_ENABLED
#import <React/CoreModulesPlugins.h>
#import <React/RCTCxxBridgeDelegate.h>
Expand Down Expand Up @@ -45,6 +47,11 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
bridge.surfacePresenter = _bridgeAdapter.surfacePresenter;
#endif

// https://stackoverflow.com/a/45430673
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
[audioSession setActive:YES error:nil];

NSDictionary *initProps = [self prepareInitialProps];
UIView *rootView = RCTAppSetupDefaultRootView(bridge, @"AmazonIvsExample", initProps);

Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- amazon-ivs-react-native-player (1.3.0):
- amazon-ivs-react-native-player (1.4.1):
- AmazonIVSPlayer (~> 1.18.0)
- React-Core
- AmazonIVSPlayer (1.18.0)
Expand Down Expand Up @@ -579,7 +579,7 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/yoga"

SPEC CHECKSUMS:
amazon-ivs-react-native-player: f49f58481eb27408c6598797a52b93eeb56e8e97
amazon-ivs-react-native-player: d62a63eecb2d952f3b25a663928d5b5453cd055f
AmazonIVSPlayer: 15b74392987e2385f9a859201273185f76d58959
boost: a7c83b31436843459a1961bfd74b96033dc77234
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
Expand Down
13 changes: 6 additions & 7 deletions example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"ios": "react-native run-ios --simulator=\"iPhone 14\"",
"start": "react-native start"
},
"dependencies": {
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/slider": "^4.1.12",
"@react-navigation/native": "^6.0.6",
"@react-navigation/stack": "^6.0.11",
"appcenter": "^4.4.3",
"appcenter-analytics": "^4.4.3",
"appcenter-crashes": "^4.4.3",
"react": "18.0.0",
"react-native": "0.69.9",
"react-native-config": "^1.4.3",
Expand All @@ -28,12 +25,14 @@
"react-native-vector-icons": "^9.1.0"
},
"devDependencies": {
"@babel/core": "^7.16.7",
"@babel/runtime": "^7.16.7",
"@babel/core": "^7.22.9",
"@babel/runtime": "^7.22.6",
"@types/react-native": "0.66.15",
"@types/react-native-dotenv": "^0.2.0",
"@types/react-native-vector-icons": "^6.4.6",
"babel-plugin-module-resolver": "^4.0.0",
"detox": "^20.1.0",
"metro-react-native-babel-preset": "^0.70.3"
"metro-react-native-babel-preset": "^0.70.3",
"react-native-dotenv": "^3.4.9"
}
}
4 changes: 3 additions & 1 deletion example/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ export const parseSecondsToString = (seconds: number) => {

const date = new Date(0);
date.setSeconds(seconds);
return date.toISOString().slice(11, 19);
date.setMilliseconds(seconds % 1000);

return date.toISOString().slice(11, 22);
};
10 changes: 10 additions & 0 deletions example/src/screens/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Card, Paragraph } from 'react-native-paper';
import { useNavigation } from '@react-navigation/native';
import type { StackNavigationProp } from '@react-navigation/stack';
import { SafeAreaView } from 'react-native-safe-area-context';
// @ts-expect-error these values come from .env file
import { GIT_BRANCH, GIT_COMMIT } from '@env';
import type { RootStackParamList } from '../App';

type HomeScreenNavigationProp = StackNavigationProp<RootStackParamList, 'Home'>;
Expand Down Expand Up @@ -59,6 +61,14 @@ function Home() {
</Paragraph>
</Card.Content>
</Card>
<Card testID="Version" style={styles.card}>
<Card.Title title="Version" />
<Card.Content>
<Paragraph>
{GIT_BRANCH} @ {GIT_COMMIT}
</Paragraph>
</Card.Content>
</Card>
</ScrollView>
</SafeAreaView>
);
Expand Down
16 changes: 16 additions & 0 deletions example/src/screens/PlaygroundExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default function PlaygroundExample() {
const [autoplay, setAutoplay] = useState(true);
const [paused, setPaused] = useState(false);
const [url, setUrl] = useState(URL);
const [origin, setOrigin] = useState('');
const [muted, setMuted] = useState(false);
const [pauseInBackground, setPauseInBackground] = useState(false);
const [manualQuality, setManualQuality] = useState<Quality | null>(null);
Expand Down Expand Up @@ -435,6 +436,21 @@ export default function PlaygroundExample() {
Add
</Button>
</SettingsItem>
<SettingsInputItem
label="origin"
onChangeText={setOrigin}
value={origin}
/>
<SettingsItem label=" ">
<Button
onPress={() => {
mediaPlayerRef.current?.setOrigin(origin);
log(`header origin set to: ${origin}`);
}}
>
setOrigin
</Button>
</SettingsItem>
</View>
</ScrollView>
</View>
Expand Down
Loading