Skip to content

Commit

Permalink
Merge pull request #205 from kilowatts-io/preview
Browse files Browse the repository at this point in the history
Eas Updates
  • Loading branch information
BenjaminWatts authored Feb 22, 2024
2 parents 7abdb2e + 645df41 commit 7a03f25
Show file tree
Hide file tree
Showing 15 changed files with 201 additions and 66 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/expo-preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: update
on:
push:
branches:
- preview

jobs:
update:
name: EAS Update
runs-on: ubuntu-latest
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: Setup EAS
uses: expo/expo-github-action@v8
with:
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}

- name: Install dependencies
run: yarn install

- name: Publish update
run: eas update --auto --channel preview
File renamed without changes.
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ android {
applicationId 'com.benjaminwatts.kilowatts'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 23
versionName "1.1.23"
versionCode 24
versionName "1.1.24"

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
}
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<string name="expo_splash_screen_resize_mode" translatable="false">contain</string>
<string name="expo_splash_screen_status_bar_translucent" translatable="false">false</string>
<string name="expo_system_ui_user_interface_style" translatable="false">automatic</string>
<string name="expo_runtime_version">1.1.23</string>
<string name="expo_runtime_version">1.1.24</string>
</resources>
6 changes: 3 additions & 3 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"expo": {
"name": "kilowatts",
"slug": "kilowatts",
"version": "1.1.23",
"version": "1.1.24",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "myapp",
Expand All @@ -19,7 +19,7 @@
"config": {
"usesNonExemptEncryption": false
},
"buildNumber": "1.1.23"
"buildNumber": "1.1.24"
},
"android": {
"adaptiveIcon": {
Expand All @@ -46,7 +46,7 @@
"projectId": "06a9e672-4ff0-4f7d-9373-6c4c8dcbdf91"
}
},
"runtimeVersion": "1.1.23",
"runtimeVersion": "1.1.24",
"updates": {
"url": "https://u.expo.dev/06a9e672-4ff0-4f7d-9373-6c4c8dcbdf91",
"enabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const styles = StyleSheet.create({
display: "flex",
flexDirection: "row",
gap: 10,
height: 35,
height: 40,
justifyContent: "flex-start",
padding: 5
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,45 @@ import { Text } from "@rneui/themed";

import { useGbSummaryOutputQuery } from "../../../../../state/apis/cloudfront/api";
import { londonTimeHHMMSS } from "../../../../../utils/dateTime";
import VersionInfo from "../../../version-info";
import { GbLiveListItemBalancingTotal } from "../../live-list-item/live-list-item";

export const GbBalancingTotals = () => {
const { data } = useGbSummaryOutputQuery(undefined, {
pollingInterval: 1000 * 15
});

if (!data) return null;

return (
<>
<View style={styles.totals}>
{data && (
<>
<GbLiveListItemBalancingTotal
name="Total Bid Acceptances"
balancingVolume={data && -data.balancing_totals.bids}
/>
<GbLiveListItemBalancingTotal
name="Total Offer Acceptances"
balancingVolume={data && data.balancing_totals.offers}
/>
<View style={styles.totals}>
<>
<GbLiveListItemBalancingTotal
name="Total Bid Acceptances"
balancingVolume={data && -data.balancing_totals.bids}
/>
<GbLiveListItemBalancingTotal
name="Total Offer Acceptances"
balancingVolume={data && data.balancing_totals.offers}
/>
</>
</View>
<View style={styles.center}>
<Text>
{data && `Valid for ${londonTimeHHMMSS(new Date(data.dt))}`}
</Text>
</View>
</>
</View>
<View style={styles.center}>
<Text>
{data && `Valid for ${londonTimeHHMMSS(new Date(data.dt))}`}
</Text>
</View>
)}
<VersionInfo />
</>
);
};

const styles = StyleSheet.create({
center: {
alignItems: "center",
paddingTop: 15
paddingTop: 50
},
totals: {
paddingTop: 15
Expand Down
19 changes: 14 additions & 5 deletions components/gb-live/bottom-sheet-tabs/totals-list/totals-list.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,32 @@
import React from "react";
import { FlatList } from "react-native";
import { FlatList, StyleSheet, View } from "react-native";
import { Button, Card, Icon, Text } from "@rneui/themed";

import { useGbSummaryOutputQuery } from "../../../../state/apis/cloudfront/api";
import {
calculateBalancingDirection,
calculateCapacityFactor,
calculateCycleSeconds
} from "../../../../state/utils";
import { ErrorDataRetryCard } from "../../error-data-retry-card";
import { GbLiveListItem } from "../live-list-item/live-list-item";

import { GbBalancingTotals } from "./balancing-totals/balancing-totals";

const capitalise = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);

export const GbTotalsList: React.FC = () => {
const { data, isLoading, refetch } = useGbSummaryOutputQuery(undefined, {
pollingInterval: 1000 * 15,
refetchOnReconnect: true
});
const { data, isLoading, refetch, isError } = useGbSummaryOutputQuery(
undefined,
{
pollingInterval: 1000 * 15,
refetchOnReconnect: true
}
);

if (isError && !data) {
return <ErrorDataRetryCard refetch={refetch} />;
}

return (
<FlatList
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,21 @@ import {
calculateCapacityFactor,
calculateCycleSeconds
} from "../../../../state/utils";
import { ErrorDataRetryCard } from "../../error-data-retry-card";
import { GbLiveListItem } from "../live-list-item/live-list-item";

import Pagination from "./pagination";

const WEB_PAGE_SIZE = 15;

export const GbUnitGroupsList: React.FC = () => {
const { data, isLoading, refetch } = useGbSummaryOutputQuery(undefined, {
pollingInterval: 1000 * 15,
refetchOnReconnect: true
});
const { data, isLoading, refetch, isError } = useGbSummaryOutputQuery(
undefined,
{
pollingInterval: 1000 * 15,
refetchOnReconnect: true
}
);
const [webPage, setWebPage] = React.useState(0);
const list = React.useRef<FlashList<{ GbSummaryOutputGenerator }>>(null);

Expand All @@ -49,6 +53,10 @@ export const GbUnitGroupsList: React.FC = () => {
}
}, [data, webPage]);

if (isError && !data) {
return <ErrorDataRetryCard refetch={refetch} />;
}

return (
<FlashList
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
41 changes: 41 additions & 0 deletions components/gb-live/error-data-retry-card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from "react";
import { View } from "react-native";
import { StyleSheet } from "react-native";
import { Button, Card, Icon, Text } from "@rneui/themed";

interface ErrorDataRetryCardProps {
refetch: () => void;
}
export const ErrorDataRetryCard: React.FC<ErrorDataRetryCardProps> = (p) => {
return (
<Card>
<Card.Title>Error</Card.Title>
<View style={styles.spaced}>
<Text>
Failed to load data from the internet. Check your internet connection
and try again.
</Text>
</View>
<Button
// title="Retry"
onPress={() => p.refetch()}
iconPosition="right"
icon={
<Icon
name="refresh"
type="material"
size={15}
color="white"
/>
}
/>
</Card>
);
};

const styles = StyleSheet.create({
spaced: {
paddingBottom: 20,
paddingTop: 20
}
});
31 changes: 31 additions & 0 deletions components/gb-live/version-info.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// text compoment which renders version information from expo-updates
import React from "react";
import { StyleSheet, View } from "react-native";
import { Text } from "@rneui/themed";
import * as Updates from "expo-updates";

const VersionInfo: React.FC = () => {
if (__DEV__) {
return (
<View style={styles.view}>
<Text>Development Mode</Text>
</View>
);
}

return (
<View style={styles.view}>
<Text>
{`Release ${Updates.releaseChannel} v${Updates.runtimeVersion} ${Updates.isEmbeddedLaunch ? "Original" : `Updated ${Updates.createdAt.toLocaleString()}`} `}
</Text>
</View>
);
};

const styles = StyleSheet.create({
view: {
paddingTop: 20
}
});

export default VersionInfo;
4 changes: 2 additions & 2 deletions ios/kilowatts.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.1.23;
MARKETING_VERSION = 1.1.24;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -457,7 +457,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.1.23;
MARKETING_VERSION = 1.1.24;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
2 changes: 1 addition & 1 deletion ios/kilowatts/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.1.23</string>
<string>1.1.24</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/kilowatts/Supporting/Expo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
<key>EXUpdatesURL</key>
<string>https://u.expo.dev/06a9e672-4ff0-4f7d-9373-6c4c8dcbdf91</string>
<key>EXUpdatesRuntimeVersion</key>
<string>1.1.23</string>
<string>1.1.24</string>
</dict>
</plist>
Loading

0 comments on commit 7a03f25

Please sign in to comment.