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

Update react-native to 0.31.0 #11

Merged
merged 1 commit into from
Oct 7, 2016
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new ReactNativeAudioStreamingPackage(MainActivity.class)
new ReactNativeAudioStreamingPackage()
);
}
};
Expand Down
2 changes: 1 addition & 1 deletion Example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"dependencies": {
"react": "15.2.1",
"react-native": "0.30.0",
"react-native": "0.31.0",
"react-native-audio-streaming": "git+https://[email protected]/tlenclos/react-native-audio-streaming.git#master"
}
}
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

`$ react-native link react-native-audio-streaming`

Go to `node_modules` ➜ `react-native-audio-streaming` => `ios` and add `Pods.xcodeproj`
Go to `node_modules` ➜ `react-native-audio-streaming` => `Pods` and drag/drop `Pods.xcodeproj` to the Libraries folder in your XCode project.

In XCode, in the project navigator, select your project. Add `libReactNativeAudioStreaming.a` and `libStreamingKit.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`

Expand All @@ -30,16 +30,16 @@ In XCode, in the project navigator, select your project. Add `libReactNativeAudi
1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-audio-streaming` => `ios`
- run `pod install` to download StreamingKit dependency
- add `ReactNativeAudioStreaming.xcodeproj`
- add `Pods/Pods.xcodeproj`
- add `ReactNativeAudioStreaming.xcodeproj` to the Libraries folder in your XCode project
- add `Pods/Pods.xcodeproj` to the Libraries folder in your XCode project
3. In XCode, in the project navigator, select your project. Add `libReactNativeAudioStreaming.a` and `libStreamingKit.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)

#### Android

1. Open up `android/app/src/main/java/[...]/MainActivity.java`
- Add `import com.reactlibrary.ReactNativeAudioStreamingPackage;` to the imports at the top of the file
- Add `new ReactNativeAudioStreamingPackage(MainActivity.class)` to the list returned by the `getPackages()` method
- Add `new ReactNativeAudioStreamingPackage()` to the list returned by the `getPackages()` method
2. Append the following lines to `android/settings.gradle`:
```
include ':react-native-audio-streaming'
Expand Down Expand Up @@ -91,3 +91,9 @@ class PlayerUI extends Component {

- Android version based on the work of @EstebanFuentealba https://github.com/EstebanFuentealba/react-native-android-audio-streaming-aac
- iOS version based on the work of @jhabdas https://github.com/jhabdas/lumpen-radio

See also the list of [contributors](https://github.com/tlenclos/react-native-audio-streaming/graphs/contributors) who participated in this project.

## License

This project is licensed under the MIT License - see the LICENSE file for details
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ public class ReactNativeAudioStreamingModule extends ReactContextBaseJavaModule
private Intent bindIntent;
private String streamingURL;

public ReactNativeAudioStreamingModule(ReactApplicationContext reactContext, Class<?> cls) {
public ReactNativeAudioStreamingModule(ReactApplicationContext reactContext) {
super(reactContext);
this.clsActivity = cls;
this.context = reactContext;
}

Expand All @@ -40,6 +39,9 @@ public ReactApplicationContext getReactApplicationContextModule() {
}

public Class<?> getClassActivity() {
if (this.clsActivity == null) {
this.clsActivity = getCurrentActivity().getClass();
}
return this.clsActivity;
}

Expand Down Expand Up @@ -77,7 +79,7 @@ public void initialize() {
@Override
public void onServiceConnected(ComponentName className, IBinder service) {
signal = ((Signal.RadioBinder) service).getService();
signal.setData(this.context, this.clsActivity, this);
signal.setData(this.context, this);
WritableMap params = Arguments.createMap();
sendEvent(this.getReactApplicationContextModule(), "streamingOpen", params);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@
public class ReactNativeAudioStreamingPackage implements ReactPackage {
private Class<?> clsActivity;

public ReactNativeAudioStreamingPackage(Class<?> activity) {
super();
this.clsActivity = activity;
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> modules = new ArrayList<>();
modules.add(new ReactNativeAudioStreamingModule(reactContext, this.clsActivity));
modules.add(new ReactNativeAudioStreamingModule(reactContext));
return modules;
}

Expand Down
4 changes: 2 additions & 2 deletions android/src/main/java/com/audioStreaming/Signal.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ public class Signal extends Service implements OnErrorListener,
private TelephonyManager phoneManager;
private PhoneListener phoneStateListener;

public void setData(Context context, Class<?> clsActivity, ReactNativeAudioStreamingModule module) {
public void setData(Context context, ReactNativeAudioStreamingModule module) {
this.context = context;
this.clsActivity = clsActivity;
this.clsActivity = module.getClassActivity();
this.module = module;

this.eventsReceiver = new EventsReceiver(this.module);
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"test": "echo \"Not test yet sadly :(\" && exit 0"
},
"peerDependencies": {
"react-native": "^0.30.0"
"react-native": "^0.31.0"
},
"devDependencies": {
"react-native": "^0.30.0"
"react-native": "^0.31.0"
}
}