Added notification connection methods to esteem backend

This commit is contained in:
mistikk 2018-11-15 13:45:41 +01:00
parent f604e29383
commit f17ae844dc
4 changed files with 52 additions and 82 deletions

View File

@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
@ -45,7 +44,6 @@
3D18392E6B3D4AAAB054A206 /* EvilIcons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = CDA19DB138184C9BB67FFA73 /* EvilIcons.ttf */; };
4314A99BA5C94BCD9E527873 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 7D4E083B771D4AF2AF62E4D2 /* libz.tbd */; };
548C6A754DAD401A8235DF14 /* Sansation_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 224245E1366F46F98214C9B8 /* Sansation_Regular.ttf */; };
562E0C9042E0460E986E5415 /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B9E70136F0D4FD8A55F8031 /* libReactNativeConfig.a */; };
6C00FDC7B4B54ACBABA6F462 /* Ionicons.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 388EA3B93FD64F479AA9977E /* Ionicons.ttf */; };
7918030CDF7C4D2A98040422 /* Sansation_Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = E434A344B09D49AD966063AD /* Sansation_Bold.ttf */; };
7B80523EC6D64C05BF3B069B /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 454696104228474690AC269D /* libc++.tbd */; };
@ -68,6 +66,7 @@
EB6EA81F244E46EBA9D532B3 /* Entypo.ttf in Resources */ = {isa = PBXBuildFile; fileRef = FC41677141C34F878D9164FE /* Entypo.ttf */; };
EFDE9974B48C4BB3A554D550 /* FontAwesome5_Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = 407B133AFCE049E1866CA8F0 /* FontAwesome5_Regular.ttf */; };
F2A4ABA54EB8471B90554653 /* libRealmReact.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C88393A6064468CBBC856BA /* libRealmReact.a */; };
FC3363BD26EC4D938E489D27 /* libReactNativeConfig.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 0A3A6905338D4E8AAD107151 /* libReactNativeConfig.a */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@ -309,13 +308,6 @@
remoteGlobalIDString = 3D3CD9181DE5FBD800167DC4;
remoteInfo = "jschelpers-tvOS";
};
583D5B48219C7F2900C5006F /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = EB2648DF1C7BE17A00B8F155;
remoteInfo = ReactNativeConfig;
};
58712346219B601100354CBE /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = AAAB371C708C493896DF647D /* RCTRestart.xcodeproj */;
@ -412,7 +404,6 @@
00E356EE1AD99517003FC87E /* esteemTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = esteemTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
00E356F11AD99517003FC87E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
00E356F21AD99517003FC87E /* esteemTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = esteemTests.m; sourceTree = "<group>"; };
062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = "wrapper.pb-project"; name = ReactNativeConfig.xcodeproj; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = "<group>"; };
139105B61AF99BAD00B5F7CC /* RCTSettings.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTSettings.xcodeproj; path = "../node_modules/react-native/Libraries/Settings/RCTSettings.xcodeproj"; sourceTree = "<group>"; };
139FDEE61B06529A00C62182 /* RCTWebSocket.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTWebSocket.xcodeproj; path = "../node_modules/react-native/Libraries/WebSocket/RCTWebSocket.xcodeproj"; sourceTree = "<group>"; };
13B07F961A680F5B00A75B9A /* esteem.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = esteem.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -440,7 +431,6 @@
5E91572D1DD0AC6500FF2AA8 /* RCTAnimation.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTAnimation.xcodeproj; path = "../node_modules/react-native/Libraries/NativeAnimation/RCTAnimation.xcodeproj"; sourceTree = "<group>"; };
62AB655DC50F43FEA43A0DB5 /* Roboto.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Roboto.ttf; path = "../node_modules/native-base/Fonts/Roboto.ttf"; sourceTree = "<group>"; };
66AD4642077143E393F52059 /* MaterialIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialIcons.ttf; path = ../src/assets/Fonts/MaterialIcons.ttf; sourceTree = "<group>"; };
6B9E70136F0D4FD8A55F8031 /* libReactNativeConfig.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libReactNativeConfig.a; sourceTree = "<group>"; };
6E13BF49AA984CC7A97DBF2A /* MaterialCommunityIcons.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = MaterialCommunityIcons.ttf; path = ../src/assets/Fonts/MaterialCommunityIcons.ttf; sourceTree = "<group>"; };
78C398B01ACF4ADC00677621 /* RCTLinking.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = RCTLinking.xcodeproj; path = "../node_modules/react-native/Libraries/LinkingIOS/RCTLinking.xcodeproj"; sourceTree = "<group>"; };
7BCF48F9914F4B659820D0F8 /* libRCTRestart.a */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = archive.ar; path = libRCTRestart.a; sourceTree = "<group>"; };
@ -465,6 +455,8 @@
E434A344B09D49AD966063AD /* Sansation_Bold.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Sansation_Bold.ttf; path = ../src/assets/Fonts/Sansation_Bold.ttf; sourceTree = "<group>"; };
F68E972F63D44244A855E496 /* FontAwesome5_Solid.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = FontAwesome5_Solid.ttf; path = "../node_modules/react-native-vector-icons/Fonts/FontAwesome5_Solid.ttf"; sourceTree = "<group>"; };
FC41677141C34F878D9164FE /* Entypo.ttf */ = {isa = PBXFileReference; explicitFileType = undefined; fileEncoding = 9; includeInIndex = 0; lastKnownFileType = unknown; name = Entypo.ttf; path = ../src/assets/Fonts/Entypo.ttf; sourceTree = "<group>"; };
3DEDED70FE5C495FB34C8B13 /* ReactNativeConfig.xcodeproj */ = {isa = PBXFileReference; name = "ReactNativeConfig.xcodeproj"; path = "../node_modules/react-native-config/ios/ReactNativeConfig.xcodeproj"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = wrapper.pb-project; explicitFileType = undefined; includeInIndex = 0; };
0A3A6905338D4E8AAD107151 /* libReactNativeConfig.a */ = {isa = PBXFileReference; name = "libReactNativeConfig.a"; path = "libReactNativeConfig.a"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = archive.ar; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -499,7 +491,7 @@
F2A4ABA54EB8471B90554653 /* libRealmReact.a in Frameworks */,
7B80523EC6D64C05BF3B069B /* libc++.tbd in Frameworks */,
4314A99BA5C94BCD9E527873 /* libz.tbd in Frameworks */,
562E0C9042E0460E986E5415 /* libReactNativeConfig.a in Frameworks */,
FC3363BD26EC4D938E489D27 /* libReactNativeConfig.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -656,14 +648,6 @@
name = Frameworks;
sourceTree = "<group>";
};
583D5B45219C7F2800C5006F /* Products */ = {
isa = PBXGroup;
children = (
583D5B49219C7F2900C5006F /* libReactNativeConfig.a */,
);
name = Products;
sourceTree = "<group>";
};
5871231D219B600900354CBE /* Recovered References */ = {
isa = PBXGroup;
children = (
@ -758,7 +742,7 @@
AAAB371C708C493896DF647D /* RCTRestart.xcodeproj */,
CECE249991544C198CBC7498 /* RNVectorIcons.xcodeproj */,
2E516DDCFE2646AA87414D17 /* RealmReact.xcodeproj */,
062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */,
3DEDED70FE5C495FB34C8B13 /* ReactNativeConfig.xcodeproj */,
);
name = Libraries;
sourceTree = "<group>";
@ -1007,10 +991,6 @@
ProductGroup = 146834001AC3E56700842450 /* Products */;
ProjectRef = 146833FF1AC3E56700842450 /* React.xcodeproj */;
},
{
ProductGroup = 583D5B45219C7F2800C5006F /* Products */;
ProjectRef = 062A4D4B07614C30BF03D907 /* ReactNativeConfig.xcodeproj */;
},
{
ProductGroup = 58712351219B601200354CBE /* Products */;
ProjectRef = 2E516DDCFE2646AA87414D17 /* RealmReact.xcodeproj */;
@ -1255,13 +1235,6 @@
remoteRef = 3DAD3EAE1DF850E9000B6D8A /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
583D5B49219C7F2900C5006F /* libReactNativeConfig.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libReactNativeConfig.a;
remoteRef = 583D5B48219C7F2900C5006F /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
58712347219B601100354CBE /* libRCTRestart.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
@ -1520,12 +1493,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1557,12 +1524,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1655,12 +1616,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1700,12 +1655,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1744,12 +1693,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",
@ -1788,12 +1731,6 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
"\"$(SRCROOT)/$(TARGET_NAME)\"",
);
OTHER_LDFLAGS = (
"-ObjC",

View File

@ -43,3 +43,29 @@ export const updateDraft = data => new Promise((resolve, reject) => {
reject(error);
});
});
export const getActivities = data => new Promise((resolve, reject) => {
api
.get(`/activities/${data.user}`, {
params: {
since: data.since,
},
})
.then((res) => {
resolve(res.data);
})
.catch((error) => {
reject(error);
});
});
export const getUnreadActivityCount = data => new Promise((resolve, reject) => {
api
.get(`/activities/${data.user}/unread-count`)
.then((res) => {
resolve(res.data.count);
})
.catch((error) => {
reject(error);
});
});

View File

@ -5,9 +5,10 @@
import { Client, PrivateKey } from 'dsteem';
import { AsyncStorage } from 'react-native';
import sc2 from 'steemconnect';
import { getUnreadActivityCount } from "../esteem/esteem";
import { parsePosts, parsePost, parseComments } from '../../utils/postParser';
import { decryptKey } from '../../utils/crypto';
let rewardFund = null;
let medianPrice = null;
@ -60,7 +61,9 @@ export const getUser = async (user) => {
// get global properties to calculate Steem Power
const global_properties = await client.database.getDynamicGlobalProperties();
const rc_power = await client.call('rc_api', 'find_rc_accounts', { accounts: [user] });
// const unreadActivityCount = await getUnreadActivityCount({ user });
account[0].unread_activity_count = 12;
account[0].rc_manabar = rc_power.rc_accounts[0].rc_manabar;
account[0].steem_power = vestToSteem(
account[0].vesting_shares,
@ -81,7 +84,7 @@ export const getUser = async (user) => {
account[0].about = account[0].json_metadata && JSON.parse(account[0].json_metadata);
return account[0];
} catch (error) {
return error;
return Promise.reject(error);
}
};

View File

@ -34,18 +34,22 @@ class SplashContainer extends Component {
addOtherAccount({ username: accountData.username, avatar: accountData.avatar }),
);
});
getUser(response[response.length - 1].username).then((accountData) => {
const realmObject = response[response.length - 1];
accountData.realm_object = realmObject;
getUser(response[response.length - 1].username)
.then((accountData) => {
const realmObject = response[response.length - 1];
accountData.realm_object = realmObject;
dispatch(updateCurrentAccount(accountData));
dispatch(activeApplication());
dispatch(login());
if (__DEV__ === false) {
dispatch(openPinCodeModal());
}
navigation.navigate(ROUTES.DRAWER.MAIN);
});
dispatch(updateCurrentAccount(accountData));
dispatch(activeApplication());
dispatch(login());
if (__DEV__ === false) {
dispatch(openPinCodeModal());
}
navigation.navigate(ROUTES.DRAWER.MAIN);
})
.catch((err) => {
alert(err);
});
}
});
} else {