Skip to content

Commit

Permalink
Merge pull request #222 from lovegaoshi/dev-codepush
Browse files Browse the repository at this point in the history
feat: codepush
  • Loading branch information
lovegaoshi authored Oct 31, 2023
2 parents 2767149 + 546a201 commit b9171f6
Show file tree
Hide file tree
Showing 10 changed files with 361 additions and 223 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
apply plugin: "kotlin-android"
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
apply from: "../../node_modules/react-native-code-push/android/codepush.gradle"

import org.apache.tools.ant.taskdefs.condition.Os

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,20 @@
import com.facebook.soloader.SoLoader;

import java.util.List;
import com.microsoft.codepush.react.CodePush;

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost =
new ReactNativeHostWrapper(this, new DefaultReactNativeHost(this) {

// 2. Override the getJSBundleFile method in order to let
// the CodePush runtime determine where to get the JS
// bundle location from on each app start
@Override
protected String getJSBundleFile() {
return CodePush.getJSBundleFile();
}
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
Expand Down
1 change: 1 addition & 0 deletions android/app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<resources>
<string name="app_name">APM</string>
<string moduleConfig="true" name="CodePushDeploymentKey">r-Ioq8wnNEO-rSWn57I08syRY46vF_EKDdVIJ</string>
</resources>
3 changes: 2 additions & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
rootProject.name = 'azusa-player-mobile'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'
include ':app', ':react-native-code-push'
includeBuild('../node_modules/@react-native/gradle-plugin')
project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app')

apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle")
useExpoModules()
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import { AppRegistry } from 'react-native';
import TrackPlayer from 'react-native-track-player';
import 'react-native-gesture-handler';
import 'react-native-url-polyfill/auto';
import codePush from "react-native-code-push";

import App from './src/App';
import { PlaybackService } from './src/services';
import { name as appName } from './app.json';
import Share from './src/components/share/Share';

AppRegistry.registerComponent(appName, () => App);
AppRegistry.registerComponent(appName, () => codePush(App));
AppRegistry.registerComponent('ShareMenuModuleComponent', () => Share);
TrackPlayer.registerPlaybackService(() => PlaybackService);
3 changes: 2 additions & 1 deletion ios/example/AppDelegate.mm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "AppDelegate.h"

#import <CodePush/CodePush.h>
#import <React/RCTBundleURLProvider.h>

@implementation AppDelegate
Expand All @@ -19,7 +20,7 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
return [CodePush bundleURL];
#endif
}

Expand Down
2 changes: 2 additions & 0 deletions ios/example/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CodePushDeploymentKey</key>
<string>r-Ioq8wnNEO-rSWn57I08syRY46vF_EKDdVIJ</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"prepare": "yarn run compile",
"pretest": "yarn run compile",
"prettify": "prettier --write ./src",
"ios:build": "yarn; cd ios; rm Podfile.lock; pod install --repo-update; cd .."
"ios:build": "yarn; cd ios; rm Podfile.lock; pod install --repo-update; cd ..",
"codepush": "appcenter codepush release-react -a lovegaoshi/Azusa-Player-Mobile",
"codepush:rollback": "appcenter codepush rollback",
"codepush:promote": "appcenter codepush promote"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^1.18.1",
Expand Down Expand Up @@ -66,6 +69,7 @@
"react-native-background-timer": "git+https://github.com/lovegaoshi/react-native-background-timer.git",
"react-native-blob-jsi-helper": "git+https://github.com/lovegaoshi/react-native-blob-jsi-helper.git",
"react-native-blob-util": "^0.19.2",
"react-native-code-push": "^8.1.0",
"react-native-countdown-circle-timer": "^3.2.1",
"react-native-draggable-flatlist": "^4.0.1",
"react-native-gesture-handler": "^2.9.0",
Expand Down Expand Up @@ -95,7 +99,7 @@
"zustand": "^4.4.5"
},
"resolutions": {
"metro": "^0.79.1"
"metro": "^0.80.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
Expand Down Expand Up @@ -144,4 +148,4 @@
},
"isSwift": true,
"packageManager": "[email protected]"
}
}
2 changes: 1 addition & 1 deletion src/enums/Version.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export enum VERSIONS {
latest = '2.10.15',
latest = '2.11.0',
}
Loading

1 comment on commit b9171f6

@vercel
Copy link

@vercel vercel bot commented on b9171f6 Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.