Skip to content

Commit

Permalink
Merge pull request #104 from BindCreative/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
tarmo888 authored Sep 20, 2021
2 parents 383fd28 + c1fc7d4 commit 8392359
Show file tree
Hide file tree
Showing 16 changed files with 219 additions and 102 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,23 +132,38 @@ Run `yarn ios`
![alt text](https://github.com/BindCreative/obbychat/raw/master/readmeImages/androidTestnetFolder.png)

- Update `android/app/src/main/res/values/strings.xml`

```
<resources>
<string name="app_name">Obby chat testnet</string>
</resources>
```

- In `android/app/src/main/AndroidManifest.xml`:

```package="chat.obby.testnet"```

- In `android/app/src/main/java/chat/obby/testnet/MainActivity.java`:

```package chat.obby.testnet;```

- In `android/app/src/main/java/chat/obby/mainnet/MainApplication.java`:

```package chat.obby.testnet;```
```import chat.obby.testnet.generated.BasePackageList;```

- In `android/app/src/main/java/chat/obby/testnet/generated/BasePackageList.java`:

```package chat.obby.testnet.generated;```

- In `android/app/src/main/AndroidManifest.xml`:

```package="chat.obby.testnet"```

- In `android/app/build.gradle`:

```applicationId "chat.obby.testnet"```

- In `android/app/_BUCK`:

```
Expand Down Expand Up @@ -226,15 +241,26 @@ android_resource(
![alt text](https://github.com/BindCreative/obbychat/raw/master/readmeImages/androidMainnetFolder.png)

- Update `android/app/src/main/res/values/strings.xml`

```
<resources>
<string name="app_name">Obby chat</string>
</resources>
```

- In `android/app/src/main/AndroidManifest.xml`:

```package="chat.obby.mainnet"```

- In `android/app/src/main/java/chat/obby/mainnet/MainActivity.java`:

```package chat.obby.mainnet;```

- In `android/app/src/main/java/chat/obby/mainnet/MainApplication.java`:

```package chat.obby.mainnet;```
```import chat.obby.mainnet.generated.BasePackageList;```

- In `android/app/src/main/java/chat/obby/mainnet/generated/BasePackageList.java`:

```package chat.obby.mainnet.generated;```
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ android {
applicationId "chat.obby.testnet"
minSdkVersion 21
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 2
versionName "1.0.1"
versionCode 3
versionName "1.0.2"
missingDimensionStrategy 'react-native-camera', 'general'
}
splits {
Expand Down
23 changes: 20 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="chat.obby.testnet">

<uses-permission android:name="android.permission.INTERNET" />
Expand All @@ -21,6 +22,23 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.firebase.messaging.default_notification_channel_id"
android:value="obby-chat-push-chanel-id-4-300"
tools:replace="android:value" />
<meta-data
android:name="com.dieam.reactnativepushnotification.notification_color"
android:resource="@color/cyan" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/cyan"
tools:replace="android:resource" />
<meta-data
android:name="com.dieam.reactnativepushnotification.notification_icon"
android:resource="@mipmap/ic_notification" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@mipmap/ic_notification" />
<service
android:name="com.reactnativehce.services.CardService"
android:exported="true"
Expand All @@ -30,10 +48,9 @@
<action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE" />
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>

<meta-data
android:name="android.nfc.cardemulation.host_apdu_service"
android:resource="@xml/aid_list" />
android:name="android.nfc.cardemulation.host_apdu_service"
android:resource="@xml/aid_list" />
</service>
<activity
android:name=".MainActivity"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions android/app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<resources>
<color name="cyan">#25C7D1</color>
</resources>
4 changes: 2 additions & 2 deletions ios/Obby Chat.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
"$(inherited)",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-lc++",
Expand Down Expand Up @@ -968,7 +968,7 @@
"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)",
"$(inherited)",
);
MARKETING_VERSION = 1.0.1;
MARKETING_VERSION = 1.0.2;
OTHER_LDFLAGS = (
"$(inherited)",
"-lc++",
Expand Down
4 changes: 3 additions & 1 deletion src/lib/NfcProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export const runNfcReader = () => new Promise(async (resolve) => {
console.log(uri);
resolve(uri);
});
await NfcManager.registerTagEvent({ alertMessage: "Put your device near the other device that has QR code open" });
await NfcManager.registerTagEvent({
alertMessage: "Put your device near NFC tag or other device that has the QR-code open"
});
} catch (ex) {
console.log(ex);
}
Expand Down
64 changes: 36 additions & 28 deletions src/sagas/device.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ import {
selectCorrespondent,
selectDeviceTempKeyData,
selectTransactionByUnitId,
selectNotificationsEnabled
selectNotificationsEnabled,
selectCorrespondentByPubKey
} from "../selectors/main";
import {
selectDeviceAddress,
Expand Down Expand Up @@ -704,36 +705,43 @@ export function* openPaymentFromChat(action) {

export function* openLink(action) {
try {
const { link } = action.payload;
const { link, pubkey } = action.payload;
const decodedLink = decodeURIComponent(link);
const linkParams = { type: "unsupported" };
decodedLink
.replace(REGEX_PAIRING, () => {
linkParams.type = 'pairing';
linkParams.data = decodedLink;
})
.replace(REGEXP_QR_REQUEST_PAYMENT, (str, payload, walletAddress) => {
linkParams.type = 'payment';
const query = link.split("?")[1];
linkParams.data = { walletAddress, query };
});
if (link) {
decodedLink
.replace(REGEX_PAIRING, () => {
linkParams.type = 'pairing';
linkParams.data = decodedLink;
})
.replace(REGEXP_QR_REQUEST_PAYMENT, (str, payload, walletAddress) => {
linkParams.type = 'payment';
const query = link.split("?")[1];
linkParams.data = { walletAddress, query };
});

const { type, data } = linkParams;
const { type, data } = linkParams;

switch (type) {
case 'pairing': {
yield put(acceptInvitation({ data }));
return;
}
case 'payment': {
NavigationService.popToTop();
yield put(openPaymentLink(data));
return;
switch (type) {
case 'pairing': {
yield put(acceptInvitation({ data }));
return;
}
case 'payment': {
NavigationService.popToTop();
yield put(openPaymentLink(data));
return;
}
default: {
NavigationService.popToTop();
yield put(setToastMessage({ type: 'ERROR', message: 'Unsupported link' }));
return;
}
}
default: {
NavigationService.popToTop();
yield put(setToastMessage({ type: 'ERROR', message: 'Unsupported link' }));
return;
} else if (pubkey) {
const correspondent = yield select(selectCorrespondentByPubKey(pubkey));
if (correspondent) {
NavigationService.navigate('Chat', { correspondent });
}
}
} catch (e) {
Expand Down Expand Up @@ -764,7 +772,7 @@ export function* enableNotifications() {
oClient.client.request(
'hub/enable_notification',
{ registrationId, platform: Platform.OS },
(request, response) => {
(_, response) => {
if (!response || (response && response !== 'ok')) {
reject(false);
} else {
Expand All @@ -786,7 +794,7 @@ export function* disableNotifications() {
oClient.client.request(
'hub/disable_notification',
registrationId,
(request, response) => {
(_, response) => {
if (!response || (response && response !== 'ok')) {
reject(true);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/sagas/wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export function* init({ payload }) {
yield put(initDeviceInfo());
// Handle websocket traffic
yield call(subscribeToHub);
yield put(initNotificationsRequest());
// Fetch wallet data from hub
yield call(fetchBalances);
yield call(fetchWitnesses);
yield call(initDefaultBots);
yield call(fetchWalletHistory);
yield put(initNotificationsRequest());
yield put(initAccountSuccess());
} catch (error) {
console.log(error);
Expand Down
Loading

0 comments on commit 8392359

Please sign in to comment.