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

refactor(web): supporting .ts and.js config, exported types #114

Merged
merged 36 commits into from
Sep 6, 2021

Conversation

reslear
Copy link
Collaborator

@reslear reslear commented Jun 10, 2021

WIP 🚧

@reslear reslear changed the title refactor(web): support .ts, .js config refactor(web): add support .ts and.js config Jun 10, 2021
@spaghettiguru
Copy link

Any progress with this?

@reslear
Copy link
Collaborator Author

reslear commented Jun 17, 2021

Any progress with this?

i'm publish version with this changes see https://www.npmjs.com/package/@reslear/capacitor-google-auth/v/1.1.0
but did not have time for testing (I do not know whether it works, need tests)

and this pull have breaking change

@spaghettiguru
Copy link

Thanks for quick response, @reslear.

I just realized that having .js config support doesn't actually fix the issue with configuration for multiple environments, since there is still need for find/replace in some XML's anyway...

@reslear
Copy link
Collaborator Author

reslear commented Jun 20, 2021

@spaghettiguru yes, you're right, but in my case runtime config helpful partially for native ios android, and big helpful for web

p.s. if you testing https://www.npmjs.com/package/@reslear/capacitor-google-auth/v/1.1.0 please write a review :) thx

@arzyu
Copy link

arzyu commented Jul 15, 2021

@spaghettiguru yes, you're right, but in my case runtime config helpful partially for native ios android, and big helpful for web

p.s. if you testing https://www.npmjs.com/package/@reslear/capacitor-google-auth/v/1.1.0 please write a review :) thx

@reslear I tested it, but got the error: "GoogleAuth.init()" is not implemented on android. Am I missing sth.?

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    registerPlugin(com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth.class);
  }
}

@arzyu
Copy link

arzyu commented Jul 16, 2021

According to the description in the issue #116, I adjusted the front-end code, but I encountered another error {message: "Something went wrong"}.

import { Device, DeviceInfo } from "@capacitor/device";
import { GoogleAuth } from "@reslear/capacitor-google-auth";

const initAuth = async () => {
  const deviceInfo = await Device.getInfo() as DeviceInfo;

  if (deviceInfo.platform === "web") {
    GoogleAuth.init();
  }

  const user = await GoogleAuth.signIn();
  console.log(user);
};

initAuth();

@joeflateau
Copy link
Contributor

please merge this. i'm going to have to switch back to .json config temporarily.

@reslear reslear marked this pull request as ready for review August 21, 2021 17:24
@reslear
Copy link
Collaborator Author

reslear commented Aug 23, 2021

how to get response type

before

import { GoogleAuth } from '@codetrix-studio/capacitor-google-auth';

type Await<T> = T extends PromiseLike<infer U> ? U : T
type User = Await<ReturnType<typeof GoogleAuth.signIn>>
type Authentication = Await<ReturnType<typeof GoogleAuth.refresh>>

after

import { User, Authentication } from '@codetrix-studio/capacitor-google-auth';

@reslear reslear changed the title refactor(web): add support .ts and.js config refactor(web): supporting .ts and.js config, exported types Sep 6, 2021
@reslear reslear merged commit eaabf9d into CodetrixStudio:master Sep 6, 2021
@reslear reslear deleted the refactor/config branch September 6, 2021 11:25
@FY0u11
Copy link

FY0u11 commented Oct 11, 2021

Merged but still doesn't work with capacitor.config.ts?

@reslear
Copy link
Collaborator Author

reslear commented Oct 11, 2021

@FY0u11 already working and used in production, use temp repo https://www.npmjs.com/package/@reslear/capacitor-google-auth

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.

5 participants