Skip to content

Commit

Permalink
feat: realm module
Browse files Browse the repository at this point in the history
codeestX committed Jun 5, 2017
1 parent a326462 commit 42b0ec2
Showing 21 changed files with 335 additions and 31 deletions.
2 changes: 2 additions & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -129,6 +129,8 @@ android {
}

dependencies {
compile project(':react-native-bottom-sheet-behavior')
compile project(':realm')
compile project(':react-native-blur')
compile project(':react-native-vector-icons')
compile project(':react-native-sound')
4 changes: 4 additions & 0 deletions android/app/src/main/java/com/moefm/MainApplication.java
Original file line number Diff line number Diff line change
@@ -3,6 +3,8 @@
import android.app.Application;

import com.facebook.react.ReactApplication;
import com.bottomsheetbehavior.BottomSheetBehaviorPackage;
import io.realm.react.RealmReactPackage;
import com.cmcewen.blurview.BlurViewPackage;
import com.oblador.vectoricons.VectorIconsPackage;
import com.zmxv.RNSound.RNSoundPackage;
@@ -27,6 +29,8 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new BottomSheetBehaviorPackage(),
new RealmReactPackage(),
new BlurViewPackage(),
new VectorIconsPackage(),
new RNSoundPackage(),
4 changes: 4 additions & 0 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
rootProject.name = 'MoeFM'
include ':react-native-bottom-sheet-behavior'
project(':react-native-bottom-sheet-behavior').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-bottom-sheet-behavior/android')
include ':realm'
project(':realm').projectDir = new File(rootProject.projectDir, '../node_modules/realm/android')
include ':react-native-blur'
project(':react-native-blur').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-blur/android')
include ':react-native-vector-icons'
34 changes: 34 additions & 0 deletions ios/MoeFM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -49,6 +49,9 @@
9AA6FA85CB9845D499572FC7 /* SimpleLineIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 863B826A7D2342DBBEDC11F9 /* SimpleLineIcons.ttf */; };
5E7D7C95DD5C473EAB6B9B4F /* Zocial.ttf in Resources */ = {isa = PBXBuildFile; fileRef = F2325848B05D4D18B96AC6B6 /* Zocial.ttf */; };
A48FD208F40B4E64A829B8C4 /* libRNBlur.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D2668D1912A94E83A737C7C5 /* libRNBlur.a */; };
F68155616BB74AE29198AE88 /* libRealmReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BA2A8130BC64419DA0BA0A3C /* libRealmReact.a */; };
8DB80E1F6A8F425CA1995EB9 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 5B5C3D91D0B34ED9ADBE48A9 /* libc++.tbd */; };
59FA70EE14CE4001A930AC43 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 63CBD2C361FB443E9E2AE199 /* libz.tbd */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
@@ -286,6 +289,10 @@
F2325848B05D4D18B96AC6B6 /* Zocial.ttf */ = {isa = PBXFileReference; name = "Zocial.ttf"; path = "../node_modules/react-native-vector-icons/Fonts/Zocial.ttf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
7507A13668024F93B1E802FB /* RNBlur.xcodeproj */ = {isa = PBXFileReference; name = "RNBlur.xcodeproj"; path = "../node_modules/react-native-blur/ios/RNBlur.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
D2668D1912A94E83A737C7C5 /* libRNBlur.a */ = {isa = PBXFileReference; name = "libRNBlur.a"; path = "libRNBlur.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
9EEDD71B489844B48105C333 /* RealmReact.xcodeproj */ = {isa = PBXFileReference; name = "RealmReact.xcodeproj"; path = "../node_modules/realm/react-native/ios/RealmReact.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
BA2A8130BC64419DA0BA0A3C /* libRealmReact.a */ = {isa = PBXFileReference; name = "libRealmReact.a"; path = "libRealmReact.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
5B5C3D91D0B34ED9ADBE48A9 /* libc++.tbd */ = {isa = PBXFileReference; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = sourcecode.text-based-dylib-definition; explicitFileType = undefined; includeInIndex = 0; };
63CBD2C361FB443E9E2AE199 /* libz.tbd */ = {isa = PBXFileReference; name = "libz.tbd"; path = "usr/lib/libz.tbd"; sourceTree = SDKROOT; fileEncoding = undefined; lastKnownFileType = sourcecode.text-based-dylib-definition; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
@@ -316,6 +323,9 @@
623D7C8F96534B27BEF85077 /* libRNVectorIcons.a in Frameworks */,
BFA58357595341E8B13D06AE /* libRCTVideo.a in Frameworks */,
A48FD208F40B4E64A829B8C4 /* libRNBlur.a in Frameworks */,
F68155616BB74AE29198AE88 /* libRealmReact.a in Frameworks */,
8DB80E1F6A8F425CA1995EB9 /* libc++.tbd in Frameworks */,
59FA70EE14CE4001A930AC43 /* libz.tbd in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -486,6 +496,7 @@
8D359BF757934EE59FE4CC2D /* RNVectorIcons.xcodeproj */,
554FAE89122B47718A23E488 /* RCTVideo.xcodeproj */,
7507A13668024F93B1E802FB /* RNBlur.xcodeproj */,
9EEDD71B489844B48105C333 /* RealmReact.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@@ -507,6 +518,7 @@
00E356EF1AD99517003FC87E /* MoeFMTests */,
83CBBA001A601CBA00E9B192 /* Products */,
DCF22BD895434DE7B5534E50 /* Resources */,
1615A125B0084FAF9A9A7FB0 /* Frameworks */,
);
indentWidth = 2;
sourceTree = "<group>";
@@ -541,6 +553,16 @@
path = "";
sourceTree = "<group>";
};
1615A125B0084FAF9A9A7FB0 /* Frameworks */ = {
isa = "PBXGroup";
children = (
5B5C3D91D0B34ED9ADBE48A9 /* libc++.tbd */,
63CBD2C361FB443E9E2AE199 /* libz.tbd */,
);
name = Frameworks;
sourceTree = "<group>";
path = "";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
@@ -1046,13 +1068,15 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
};
name = Debug;
@@ -1077,13 +1101,15 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
};
name = Release;
@@ -1109,6 +1135,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
};
name = Debug;
@@ -1133,6 +1160,7 @@
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
};
name = Release;
@@ -1166,13 +1194,15 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
};
name = Debug;
@@ -1206,13 +1236,15 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-sound/RNSound",
"$(SRCROOT)/../node_modules/react-native-vector-icons/RNVectorIconsManager",
"$(SRCROOT)/../node_modules/react-native-video/ios",
"$(SRCROOT)/../node_modules/react-native-blur/ios",
"$(SRCROOT)/../node_modules/realm/src/**",
);
};
name = Release;
@@ -1241,6 +1273,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
};
name = Debug;
@@ -1269,6 +1302,7 @@
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
};
name = Release;
4 changes: 2 additions & 2 deletions js/component/MusicList.js
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import {
FlatList,
} from 'react-native'
import Item from './MusicListItem'
import Wiki from '../model/Wiki'
import Api from '../model/Api'
import Wiki from '../model/bean/Wiki'
import Api from '../model/api/Api'

export default class MusicList extends Component {

10 changes: 4 additions & 6 deletions js/component/PlayerUI.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ import { BlurView } from 'react-native-blur';
import CustomButton from '../component/CustomButton'
import ModeButton from '../container/ModeButton'
import PlayButton from '../container/PlayButton'
import LoveButton from '../container/LoveButton'
import DownloadButton from '../container/DownloadButton'
import PlayerSlide from '../container/PlayerSlider'

export default class PlayerUI extends Component {
@@ -64,12 +66,8 @@ export default class PlayerUI extends Component {
/>
<Text style={styles.title}>{this.props.song.title}</Text>
<View style={styles.func}>
<CustomButton onPress={() => this.props.onLove()}>
<Image style={styles.icon} source={require('../images/ic_love.png')}/>
</CustomButton>
<CustomButton onPress={() => this.props.onDownload()}>
<Image style={styles.icon} source={require('../images/ic_download.png')}/>
</CustomButton>
<LoveButton innerStyle={styles.icon}/>
<DownloadButton innerStyle={styles.icon}/>
</View>
<PlayerSlide/>
<View style={styles.control}>
4 changes: 2 additions & 2 deletions js/component/RadioList.js
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@ import {
} from 'react-native'
import Item from './RadioListItem'
import Header from './SectionHeader'
import Wiki from '../model/Wiki'
import Api from '../model/Api'
import Wiki from '../model/bean/Wiki'
import Api from '../model/api/Api'

export default class RadioList extends Component {

61 changes: 61 additions & 0 deletions js/container/DownloadButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/**
* @author: Est <codeest.dev@gmail.com>
* @date: 2017/6/5
* @description:
*/

import React, {Component} from 'react'
import { connect } from 'react-redux'
import {
Image,
} from 'react-native'
import realm from '../util/realm'
import CustomButton from '../component/CustomButton'

class DownloadButton extends Component {

getLocalIcon(isLoved) {
return isLoved? require('../images/ic_downloaded.png'): require('../images/ic_download.png');
}

handleLocal() {
if (this.props.currentSong) {
if (this.props.currentSong.isLocaled) {
realm.deleteLocaledSong(this.props.currentSong.id);
} else {
realm.insertLocaledSong(this.props.currentSong);
//Download
}
}
if (this.props.onDownload) {
this.props.onDownload();
}
}

render() {
return (
<CustomButton onPress={() => this.handleLocal()}>
<Image style={this.props.innerStyle} source={this.getLocalIcon(this.props.currentSong.isLocaled)}/>
</CustomButton>
)
}
}

const mapStateToProps = (state) => {
return {
currentSong: state.songs.currentSong,
}
};

const mapDispatchToProps = (dispatch) => {
return {
onDownload: () => {
dispatch({type: 'LOCAL'})
}
}
};

export default connect(
mapStateToProps,
mapDispatchToProps
)(DownloadButton)
60 changes: 60 additions & 0 deletions js/container/LoveButton.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/**
* @author: Est <codeest.dev@gmail.com>
* @date: 2017/6/5
* @description:
*/

import React, {Component} from 'react'
import { connect } from 'react-redux'
import {
Image,
} from 'react-native'
import realm from '../util/realm'
import CustomButton from '../component/CustomButton'

class LoveButton extends Component {

getLoveIcon(isLoved) {
return isLoved? require('../images/ic_loved.png'): require('../images/ic_love.png');
}

handleLove() {
if (this.props.currentSong) {
if (this.props.currentSong.isLoved) {
realm.deleteLovedSong(this.props.currentSong.id);
} else {
realm.insertLovedSong(this.props.currentSong);
}
}
if (this.props.onLove) {
this.props.onLove();
}
}

render() {
return (
<CustomButton onPress={() => this.handleLove()}>
<Image style={this.props.innerStyle} source={this.getLoveIcon(this.props.currentSong.isLoved)}/>
</CustomButton>
)
}
}

const mapStateToProps = (state) => {
return {
currentSong: state.songs.currentSong,
}
};

const mapDispatchToProps = (dispatch) => {
return {
onLove: () => {
dispatch({type: 'LOVE'})
}
}
};

export default connect(
mapStateToProps,
mapDispatchToProps
)(LoveButton)
Binary file added js/images/ic_downloaded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions js/middleware/player.js
Original file line number Diff line number Diff line change
@@ -70,8 +70,8 @@ const init = (url) => {
console.log('failed to load the sound', e);
return;
}
play(false);
// setTimeout(play(false), 200);
// play(false);
setTimeout(play(false), 200);
startProgress();
});
};
5 changes: 4 additions & 1 deletion js/middleware/stream.js
Original file line number Diff line number Diff line change
@@ -27,7 +27,9 @@ const streamMiddleware = store => next => action => {
const result = next(action);
const newState = store.getState();
const actionType = String(action.type);

if (newState === thisState) {
return result;
}
switch (actionType) {
case CUT_SONG:
init(newState.playList[newState.currentIndex].url);
@@ -91,4 +93,5 @@ const startProgress = () => {

const stopProgress = () => {
clearInterval(progressCountDown);
currentTime = 0;
};
2 changes: 1 addition & 1 deletion js/model/Api.js → js/model/api/Api.js
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
* @description:
*/

import showToast from '../util/toast';
import showToast from '../../util/toast';

const API_KEY = 'b3254bb3f2b76457a10e144bc6be7c8a058f22631';

5 changes: 5 additions & 0 deletions js/model/Song.js → js/model/bean/Song.js
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
* @description:
*/

import realm from '../../util/realm'

export default class Song {

constructor(item, index) {
@@ -20,6 +22,9 @@ export default class Song {
this.size = item.sub_upload[0].up_size;
}

this.isLoved = realm.queryLovedSong(this.id);
this.isLocaled = realm.queryLocaledSong(this.id);

function parseCoverUrl(parent) {
let temp = parseInt(parent/100);
let first = parseInt(temp / 1000);
File renamed without changes.
48 changes: 48 additions & 0 deletions js/model/db/Schema.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* @author: Est <codeest.dev@gmail.com>
* @date: 2017/6/5
* @description:
*/

import Realm from 'realm';

class LovedSong extends Realm.Object {}
class LocalSong extends Realm.Object {}

LovedSong.schema = {
name:'LovedSong',
primaryKey: 'id',
properties: {
index: {type: 'int'},
id: {type: 'int'},
title: {type: 'string'},
date: {type: 'int'},
cover: {type: 'string'},
url: {type: 'string', optional: true},
quality: {type: 'string', optional: true},
time: {type: 'string', optional: true},
size: {type: 'int', optional: true},
isLoved: {type: 'bool'},
isLocaled: {type: 'bool'},
}
};

LocalSong.schema = {
name:'LocalSong',
primaryKey: 'id',
properties: {
index: {type: 'int'},
id: {type: 'int'},
title: {type: 'string'},
date: {type: 'int'},
cover: {type: 'string'},
url: {type: 'string', optional: true},
quality: {type: 'string', optional: true},
time: {type: 'string', optional: true},
size: {type: 'int', optional: true},
isLoved: {type: 'bool'},
isLocaled: {type: 'bool'},
}
};

export default new Realm({schema: [LovedSong, LocalSong]})
4 changes: 2 additions & 2 deletions js/page/DetailPage.js
Original file line number Diff line number Diff line change
@@ -13,10 +13,10 @@ import {
FlatList,
} from 'react-native'
import { connect } from 'react-redux'
import Song from '../model/Song'
import Song from '../model/bean/Song'
import Item from '../component/SongItem'
import GlobalStyles from '../style/global'
import Api from '../model/Api'
import Api from '../model/api/Api'

class DetailPage extends Component {

41 changes: 27 additions & 14 deletions js/reducer/songs.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,8 @@ const PAUSE = 'PAUSE'; //暂停、恢复
const SWITCH_MODE = 'SWITCH_MODE'; //切换播放模式
const PROGRESS = 'PROGRESS'; //当前进度
const SEEK_PROGRESS = 'SEEK_PROGRESS'; //指定进度
const LOVE = 'LOVE'; //点击喜欢
const LOCAL = 'LOCAL'; //点击下载

export default function (state, action) {
if (!state) {
@@ -34,9 +36,9 @@ export default function (state, action) {
switch (action.type) {
case ADD_SONG:
let newSongIndex = -1;
for (let [index, song] of state.playList.entries()) {
if (song.id === action.song.id) {
newSongIndex = index;
for (let i = 0; i< state.playList.length; i++) {
if (state.playList[i].id === action.song.id) {
newSongIndex = i;
break;
}
}
@@ -54,16 +56,10 @@ export default function (state, action) {
let pushSongIndex = -1;
for (let i = 0; i< state.playList.length; i++) {
if (state.playList[i].id === action.song.id) {
pushSongIndex = index;
pushSongIndex = i;
break;
}
}
// for (let [index, song] of state.playList.entries()) {
// if (song.id === action.song.id) {
// pushSongIndex = index;
// break;
// }
// }
return pushSongIndex !== -1? state:
{
...state,
@@ -85,11 +81,10 @@ export default function (state, action) {
playList: []
};
case CUT_SONG:
console.log(state.playList);
let cutSongIndex = -1;
for (let [index, song] of state.playList.entries()) {
if (song.id === action.song.id) {
cutSongIndex = index;
for (let i = 0; i< state.playList.length; i++) {
if (state.playList[i].id === action.song.id) {
cutSongIndex = i;
break;
}
}
@@ -133,6 +128,24 @@ export default function (state, action) {
progressTime: action.time
};
}
case LOVE: {
return {
...state,
currentSong: {
...state.currentSong,
isLoved: !state.currentSong.isLoved
}
}
}
case LOCAL: {
return {
...state,
currentSong: {
...state.currentSong,
isLocaled: !state.currentSong.isLocaled
}
}
}
default:
return state
}
2 changes: 1 addition & 1 deletion js/util/date.js
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ export default class DateUtil {
if (second <= 9) {
second = '0' + second;
}
return min + '.' + second;
return min + ':' + second;
}

static parseString2Second(str) {
70 changes: 70 additions & 0 deletions js/util/realm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @author: Est <codeest.dev@gmail.com>
* @date: 2017/6/5
* @description:
*/

import realm from '../model/db/Schema';

export default class Realm {

static insertLovedSong(song) {
console.log(song);
realm.write(()=>{
realm.create('LovedSong',{
index: song.index,
id: song.id,
title: song.title,
date: song.date,
cover: song.cover,
url: song.url,
quality: song.quality,
time: song.time,
size: song.size,
isLoved: song.isLoved,
isLocaled: song.isLocaled
});
});
}

static deleteLovedSong(id) {
realm.write(() => {
// let target = realm.create('LovedSong', {id: id});
const target = realm.objects('LovedSong').filtered('id = ' + id);
realm.delete(target);
});
}

static queryLovedSong(id) {
const target = realm.objects('LovedSong').filtered('id = ' + id);
return target !== null && target.length > 0;
}

static insertLocaledSong(song) {
realm.write(()=>{
realm.create('LocalSong',{
index: song.index,
id: song.id,
title: song.title,
date: song.date,
cover: song.cover,
url: song.url,
quality: song.quality,
time: song.time,
size: song.size,
isLoved: song.isLoved,
isLocaled: song.isLocaled
});
});
}

static deleteLocaledSong(id) {
const target = realm.objects('LocalSong').filtered('id = ' + id);
realm.delete(target);
}

static queryLocaledSong(id) {
const target = realm.objects('LocalSong').filtered('id = ' + id);
return target !== null && target.length > 0;
}
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -11,12 +11,14 @@
"react-native": "^0.44.0",
"react-native-audio-streaming": "^2.3.2",
"react-native-blur": "^3.0.0-alpha",
"react-native-bottom-sheet-behavior": "^1.0.0-beta.5",
"react-native-elements": "^0.11.2",
"react-native-root-toast": "^1.1.2",
"react-native-sound": "github:ndbroadbent/react-native-sound#android-url-fix",
"react-native-vector-icons": "^4.0.1",
"react-navigation": "^1.0.0-beta.9",
"react-redux": "^5.0.4",
"realm": "^1.3.1",
"redux": "^3.6.0"
},
"devDependencies": {

0 comments on commit 42b0ec2

Please sign in to comment.