Skip to content

Commit

Permalink
Merge pull request #2 from sdip15fa/dev
Browse files Browse the repository at this point in the history
feat: use google play asset delivery
  • Loading branch information
sdip15fa authored Jan 27, 2024
2 parents 4a3dbe8 + 5c18037 commit 748b5aa
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 244 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
on:
pull_request:
branches:
- master
- dev
branches:
- master
- dev
push:
branches:
- master
- dev
branches:
- master
- dev
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -16,7 +16,7 @@ jobs:
with:
lfs: true
submodules: "recursive"

- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
Expand All @@ -38,6 +38,9 @@ jobs:

- name: create build directory
run: mkdir build

- name: 🚀 Build aab
run: NODE_OPTIONS=--max_old_space_size=4096 eas build --local --non-interactive --platform android --profile aab --output build/${{ steps.vars.outputs.sha_short }}.aab

- name: 🚀 Build app (android production)
run: eas build --local --non-interactive --platform android --profile production --output build/${{ steps.vars.outputs.sha_short }}.production.apk
Expand All @@ -49,8 +52,13 @@ jobs:
with:
name: android production apk
path: build/${{ steps.vars.outputs.sha_short }}.production.apk # or path/to/artifact

- uses: actions/upload-artifact@v4
with:
name: android development apk
path: build/${{ steps.vars.outputs.sha_short }}.development.apk # or path/to/artifact

- uses: actions/upload-artifact@v4
with:
name: android app bundle
path: build/${{ steps.vars.outputs.sha_short }}.aab # or path/to/artifact
12 changes: 1 addition & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,4 @@ jobs:
asset_path: build/v${{ env.RELEASE_VERSION }}.aab
asset_name: v${{ env.RELEASE_VERSION }}.aab
asset_content_type: application/x-authorware-bin

- name: Upload obb
id: upload-obb
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: assets/models/models.zip
asset_name: main.1.me.wcyat.safecantonese.ai.obb
asset_content_type: application/zip

2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "assets/models"]
path = assets/models
path = android/models_asset_pack/src/main/assets/models
url = https://huggingface.co/safecantonese/ggml-models
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ yarn install
eas build --platform android --profile production --local
```

### OBB

The app utilizes obb to store model files. The zip file can be found in `assets/models/models.zip`. Please rename it to main.1.me.wcyat.safecantonese.ai.obb and place it in `/storage/emulated/0/Android/obb/me.wcyat.safecantoneseai/`.

## Support

[telegram group](https://t.me/safecantoneseai)
Expand Down
5 changes: 3 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ android {
applicationId 'me.wcyat.safecantoneseai'
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.5.0"
versionCode 1610
versionName "1.6.1"

buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString())
}
Expand Down Expand Up @@ -117,6 +117,7 @@ android {

}
}
assetPacks = [":models_asset_pack"]
}

// Apply static values from `gradle.properties` to the `android.packagingOptions`
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<data android:scheme="https"/>
</intent>
</queries>
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme" android:requestLegacyExternalStorage="true">
<application android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:roundIcon="@mipmap/ic_launcher_round" android:allowBackup="true" android:theme="@style/AppTheme">
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
<meta-data android:name="expo.modules.updates.EXPO_SDK_VERSION" android:value="49.0.0"/>
<meta-data android:name="expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH" android:value="ALWAYS"/>
Expand Down
11 changes: 11 additions & 0 deletions android/models_asset_pack/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// In the asset pack’s build.gradle file:
plugins {
id 'com.android.asset-pack'
}

assetPack {
packName = "models_asset_pack" // Directory name for the asset pack
dynamicDelivery {
deliveryType = "install-time"
}
}
1 change: 1 addition & 0 deletions android/models_asset_pack/src/main/assets/models
Submodule models added at 1ffbef
1 change: 1 addition & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle
include ':react-native-share-menu', ':app'
project(':react-native-share-menu').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-share-menu/android')

include ':models_asset_pack'
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "safecantonese.ai",
"slug": "safecantonese-ai",
"scheme": "me.wcyat.safecantoneseai",
"version": "1.5.0",
"version": "1.6.1",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
Expand Down
88 changes: 43 additions & 45 deletions app/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import AppContextProvider from "../context/AppContext";
import RootContextProvider from "../context/RootContext";
import TipProvider from "react-native-tip";
import LicenseScreen from "../components/LicenseScreen";
import ExtractModelsScreen from "../components/ExtractModelsScreen";
import { LogBox } from 'react-native';

LogBox.ignoreLogs(['new NativeEventEmitter']); // Ignore log notification by message

export default function Layout() {
const router = useRouter();
Expand All @@ -24,50 +26,46 @@ export default function Layout() {
<LicenseScreen>
<RootContextProvider>
<AppContextProvider>

<ExtractModelsScreen>
<TipProvider statusBarTranslucent />
<Tabs
screenOptions={{
headerTintColor: "purple",
}}
>
<Tabs.Screen
name="index"
options={{
headerTitle: "Home - safecantonese.ai",
title: "Home",
tabBarIcon: (props) => <Icon name="home" {...props} />,
}}
/>
<Tabs.Screen
name="history"
options={{
headerTitle: "History - safecantonese.ai",
title: "History",
tabBarIcon: (props) => <Icon name="history" {...props} />,
}}
/>
<Tabs.Screen
name="models"
options={{
headerTitle: "Models - safecantonese.ai",
title: "Models",
tabBarIcon: (props) => <Icon name="gears" {...props} />,
}}
/>
<Tabs.Screen
name="about"
options={{
// This tab will no longer show up in the tab bar.
headerTitle: "About - safecantonese.ai",
title: "About",
tabBarIcon: (props) => <Icon name="info" {...props} />,
}}
/>
</Tabs>
</ExtractModelsScreen>

<TipProvider statusBarTranslucent />
<Tabs
screenOptions={{
headerTintColor: "purple",
}}
>
<Tabs.Screen
name="index"
options={{
headerTitle: "Home - safecantonese.ai",
title: "Home",
tabBarIcon: (props) => <Icon name="home" {...props} />,
}}
/>
<Tabs.Screen
name="history"
options={{
headerTitle: "History - safecantonese.ai",
title: "History",
tabBarIcon: (props) => <Icon name="history" {...props} />,
}}
/>
<Tabs.Screen
name="models"
options={{
headerTitle: "Models - safecantonese.ai",
title: "Models",
tabBarIcon: (props) => <Icon name="gears" {...props} />,
}}
/>
<Tabs.Screen
name="about"
options={{
// This tab will no longer show up in the tab bar.
headerTitle: "About - safecantonese.ai",
title: "About",
tabBarIcon: (props) => <Icon name="info" {...props} />,
}}
/>
</Tabs>
</AppContextProvider>
</RootContextProvider>
</LicenseScreen>
Expand Down
8 changes: 4 additions & 4 deletions app/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export default function Page() {
style={{ color: "blue", margin: 5 }}
onPress={() =>
Linking.openURL(
"https://github.com/sdip15fa/safecantonese.ai.app/releases/tag/1.5.0"
"https://github.com/sdip15fa/safecantonese.ai.app/releases/tag/1.6.1"
)
}
>
1.5.0
1.6.1
</Text>
<Text text40 style={{ margin: 5 }}>
Source Code
Expand All @@ -78,7 +78,7 @@ export default function Page() {
style={{ color: "blue", margin: 5 }}
onPress={() =>
Linking.openURL(
"https://github.com/sdip15fa/safecantonese.ai.app/blob/1.5.0/LICENSE.md"
"https://github.com/sdip15fa/safecantonese.ai.app/blob/1.6.1/LICENSE.md"
)
}
>
Expand All @@ -88,7 +88,7 @@ export default function Page() {
style={{ color: "blue", margin: 5 }}
onPress={() => {
Linking.openURL(
"https://github.com/sdip15fa/safecantonese.ai.app/blob/1.5.0/third-party-licenses.txt"
"https://github.com/sdip15fa/safecantonese.ai.app/blob/1.6.1/third-party-licenses.txt"
);
}}
>
Expand Down
1 change: 0 additions & 1 deletion assets/models
Submodule models deleted from b87c66
76 changes: 0 additions & 76 deletions components/ExtractModelsScreen.tsx

This file was deleted.

4 changes: 0 additions & 4 deletions context/AppContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Model } from "../hooks/useModels";
import useShareIntent from "../hooks/useShareIntent";
import { RootContext } from "./RootContext";
import { useTranscribe } from "../hooks/useTranscribe";
import useObb, { OBB } from "../hooks/useObb";

interface AppContextInterface {
history: {
Expand Down Expand Up @@ -34,7 +33,6 @@ interface AppContextInterface {
mimetype: string | null;
extraData?: object;
};
obb: OBB[];
}

export const AppContext = createContext<AppContextInterface>(
Expand All @@ -48,15 +46,13 @@ export default function AppContextProvider(props: {
const { models } = useContext(RootContext);
const transcribe = useTranscribe();
const { history } = useContext(RootContext);
const obb = useObb();
return (
<AppContext.Provider
value={{
shareIntent,
models,
history,
transcribe,
obb
}}
>
{props.children}
Expand Down
Loading

0 comments on commit 748b5aa

Please sign in to comment.