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

PR for desktop app #1299

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

amitpanwar789
Copy link

No description provided.

Copy link
Member

@KoalaSat KoalaSat left a comment

Choose a reason for hiding this comment

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

Awesome job 🎉 ! I only reviewed the frontend folder. I'll take a look later to desktopApp

@@ -10,7 +10,7 @@ import Notifications from '../components/Notifications';
import { useTranslation } from 'react-i18next';
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';

const Router = window.NativeRobosats === undefined ? BrowserRouter : MemoryRouter;
const Router = (window.NativeRobosats === undefined && window.DesktopRobosats === undefined)? BrowserRouter : window.DesktopRobosats === 'Desktop-App' ? HashRouter : MemoryRouter;
Copy link
Member

Choose a reason for hiding this comment

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

Not a fan of concatenated ternaries. Maybe you can solve it with a if..else or switch?

Copy link
Author

Choose a reason for hiding this comment

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

okay

@@ -71,7 +71,7 @@ const RobotAvatar: React.FC<Props> = ({

useEffect(() => {
if (shortAlias !== undefined) {
if (window.NativeRobosats === undefined) {
if (window.NativeRobosats === undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible you didn't run linterns? usually the lint:fix command will take care of these

Copy link
Author

Choose a reason for hiding this comment

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

ohh i forget let me fix it

Copy link
Member

Choose a reason for hiding this comment

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

Still present

@@ -40,6 +40,7 @@ export interface SlideDirection {
export type TorStatus = 'ON' | 'STARTING' | 'STOPPING' | 'OFF';

export const isNativeRoboSats = !(window.NativeRobosats === undefined);
export const isDesktopRoboSats = !(window.DesktopRobosats === undefined);
Copy link
Member

Choose a reason for hiding this comment

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

Great idea, but you didn't use it bellow at :81

@@ -5,6 +5,7 @@ declare global {
ReactNativeWebView?: ReactNativeWebView;
NativeRobosats?: NativeRobosats;
RobosatsSettings: 'web-basic' | 'web-pro' | 'selfhosted-basic' | 'selfhosted-pro';
DesktopRobosats: undefined | 'Desktop-App';
Copy link
Member

Choose a reason for hiding this comment

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

maybe we can generalize this do it more similar to RobosatsSettings, if we call this RobosatsClient: 'desktop-app' will be more readable and I can do the same for Mobile in another PR, what do you think?

Copy link
Author

Choose a reason for hiding this comment

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

i didn't understand

Copy link
Member

@KoalaSat KoalaSat Jun 13, 2024

Choose a reason for hiding this comment

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

Change this line for:

RobosatsClient: 'desktop-app' | undefined

And where you are checking in other parts for DesktopRobosats switch it to RobosatsClient === 'desktop-app' that way it's more readable and will help other platforms such as the mobile android to reuse it

Copy link
Author

Choose a reason for hiding this comment

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

ok i guess then i need to change in html file also, to window.RobosatsClient = 'desktop-app'

Copy link
Author

Choose a reason for hiding this comment

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

and replace every use of window.DesktopRobosats === 'Desktop-App' with RobosatsClient === 'desktop-app'

Copy link
Member

Choose a reason for hiding this comment

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

That's correct

// make the textarea out of viewport
textArea.style.position = 'fixed';
textArea.style.left = '-999999px';
textArea.style.top = '-999999px';
Copy link
Member

Choose a reason for hiding this comment

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

Maybe you can achieve the same with just visibility = hidden;?

@@ -17,4 +18,4 @@ export const systemClient: SystemClient =
// react-native-web view of the RoboSats Android app.
window.navigator.userAgent.includes('robosats')
? new SystemNativeClient()
: new SystemWebClient();
: window.navigator.userAgent.includes('Electron')? new SystemDesktopClient() : new SystemWebClient();
Copy link
Member

Choose a reason for hiding this comment

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

Same about ternaries

@amitpanwar789 amitpanwar789 changed the title Draft PR for desktop app PR for desktop app Jun 12, 2024
@amitpanwar789
Copy link
Author

@KoalaSat have a look now .

Copy link
Member

@KoalaSat KoalaSat left a comment

Choose a reason for hiding this comment

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

Awesome job with /desktopApp! I just have one quick question, I see a lot of apparent duplication in tor/tor-*:

  • Are those README files necessary/different?
  • Are the files under /datadiferent per architecture? if not, maybe you can just move it up and use a symlink

@@ -0,0 +1,142 @@
// Modules to control application life and create native browser window
Copy link
Member

Choose a reason for hiding this comment

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

Did you tried to change this file to Typescript?

Copy link
Author

Choose a reason for hiding this comment

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

just ignore this file i am gonna delete this i have converted it in ts as index.ts

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,uEAAuE;AACvE,qCAAsE;AACtE,+CAAsE;AACtE,2BAA6B;AAC7B,uBAAyB;AAEzB,IAAI,GAAG,GAA0C,IAAI,CAAC;AAEtD,2EAA2E;AAE3E,SAAS,sBAAsB;IAC7B,IAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,GAAG,GAAG,IAAA,qBAAK,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,0BAA0B,CAAC,CAAC,CAAC;YAC9D,MAAM;QACR,KAAK,QAAQ;YACX,GAAG,GAAG,IAAA,qBAAK,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC,CAAC;YAC1D,MAAM;QACR,KAAK,OAAO;YACV,GAAG,GAAG,IAAA,qBAAK,EAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAC;YAC5D,MAAM;QACR;YACE,MAAM,IAAI,KAAK,C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AAI,EAAE,CAAC;AAChD,CAAC,CAAC,CAAC"}
Copy link
Member

Choose a reason for hiding this comment

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

Is this necesary?

Copy link
Author

Choose a reason for hiding this comment

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

when i compile the ts file i got this file

slot?.hashId &&
!Boolean(robot?.lastOrderId) &&
!robot?.lastOrderId &&
Copy link
Member

Choose a reason for hiding this comment

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

Any reason for these changes?

Copy link
Author

Choose a reason for hiding this comment

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

This happens because I did lint:fix

@@ -71,7 +71,7 @@ const RobotAvatar: React.FC<Props> = ({

useEffect(() => {
if (shortAlias !== undefined) {
if (window.NativeRobosats === undefined) {
if (window.NativeRobosats === undefined) {
Copy link
Member

Choose a reason for hiding this comment

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

Still present

@amitpanwar789
Copy link
Author

#1299 (comment) i thought i only need to change for window.desktopApp ?

@KoalaSat
Copy link
Member

#1299 (comment) i thought i only need to change for window.desktopApp ?

I wad talking ahout the blank space, if you ran lint:fix, al good

@amitpanwar789
Copy link
Author

#1299 (comment) i thought i only need to change for window.desktopApp ?

I wad talking ahout the blank space, if you ran lint:fix, al good

I already run that don't know why it is there

@amitpanwar789
Copy link
Author

Awesome job with /desktopApp! I just have one quick question, I see a lot of apparent duplication in tor/tor-*:

  • Are those README files necessary/different?
  • Are the files under /datadiferent per architecture? if not, maybe you can just move it up and use a symlink

which readme file

@KoalaSat
Copy link
Member

Awesome job with /desktopApp! I just have one quick question, I see a lot of apparent duplication in tor/tor-*:

  • Are those README files necessary/different?
  • Are the files under /datadiferent per architecture? if not, maybe you can just move it up and use a symlink

which readme file

For example desktopApp/tor/tor-linux/tor/pluggable_transports/README.CONJURE.md

@amitpanwar789
Copy link
Author

Awesome job with /desktopApp! I just have one quick question, I see a lot of apparent duplication in tor/tor-*:

  • Are those README files necessary/different?
  • Are the files under /datadiferent per architecture? if not, maybe you can just move it up and use a symlink

which readme file

For example desktopApp/tor/tor-linux/tor/pluggable_transports/README.CONJURE.md

Yes Readme are same in all three tor/

@KoalaSat
Copy link
Member

Awesome job with /desktopApp! I just have one quick question, I see a lot of apparent duplication in tor/tor-*:

  • Are those README files necessary/different?
  • Are the files under /datadiferent per architecture? if not, maybe you can just move it up and use a symlink

which readme file

For example desktopApp/tor/tor-linux/tor/pluggable_transports/README.CONJURE.md

Yes Readme are same in all three tor/

Then maybe we can move it up to the parent folder and avoid duplicated files

@KoalaSat
Copy link
Member

All good now good job with the duplications, I wanted to test it but I realized I have no idea how to run it 😄 can you add a README.md file to /desktopApp with a some breve instructions?

@amitpanwar789
Copy link
Author

All good now good job with the duplications, I wanted to test it but I realized I have no idea how to run it 😄 can you add a README.md file to /desktopApp with a some breve instructions?

When I try to test it in windows and clone it in windows but the symlink is not working

@KoalaSat
Copy link
Member

KoalaSat commented Jun 21, 2024

@amitpanwar789 Tested on OSx and it looks great!! There is only one missing part on my opinion, did you configured the icon?
image

@amitpanwar789
Copy link
Author

@amitpanwar789 Tested on OSx and it looks great!! There is only one missing part on my opinion, did you configured the icon? image

for icon we need to make the icon type .ico for window and .icns for mac to configure it correctly

@KoalaSat
Copy link
Member

@amitpanwar789 Tested on OSx and it looks great!! There is only one missing part on my opinion, did you configured the icon? image

for icon we need to make the icon type .ico for window and .icns for mac to configure it correctly

You can create then with this one https://github.com/RoboSats/robosats/blob/main/nodeapp/assets/icon/Robosats.svg

@amitpanwar789
Copy link
Author

amitpanwar789 commented Jun 22, 2024

@amitpanwar789 Tested on OSx and it looks great!! There is only one missing part on my opinion, did you configured the icon? image

for icon we need to make the icon type .ico for window and .icns for mac to configure it correctly

You can create then with this one https://github.com/RoboSats/robosats/blob/main/nodeapp/assets/icon/Robosats.svg

I have tested on linux and it working fine

Copy link
Member

@KoalaSat KoalaSat left a comment

Choose a reason for hiding this comment

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

Build tested in mac and it works! 🚀

```bash
npm run package:linux
npm run package:win
npm run package:mac
Copy link
Member

Choose a reason for hiding this comment

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

npm run package-mac and I guess same for tohers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants