Skip to content
This repository was archived by the owner on Jun 6, 2019. It is now read-only.

Commit 30de5c0

Browse files
author
negebauer
committed
1 parent cf90633 commit 30de5c0

File tree

142 files changed

+6824
-15
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

142 files changed

+6824
-15
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
ios/GithubPushNotificationsMobile.xcworkspace
2+
13
# OSX
24
#
35
.DS_Store

App.js

+54-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
*/
88

99
import React, {Component} from 'react';
10-
import {Platform, StyleSheet, Text, View} from 'react-native';
10+
import {Platform, StyleSheet, Text, View, Linking} from 'react-native';
11+
import OAuthManager from 'react-native-oauth';
1112

1213
const instructions = Platform.select({
1314
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
@@ -16,8 +17,60 @@ const instructions = Platform.select({
1617
'Shake or press menu button for dev menu',
1718
});
1819

20+
const OAUTH_CONFIG = {
21+
github: {
22+
client_id: Platform.select({
23+
ios: 'c8540af149a6bfe38a42',
24+
android: '075e7aaa056d3cb2c1ff'
25+
}),
26+
client_secret: Platform.select({
27+
ios: 'e4d6e5d8787d1acf145ecd8f53a92b4de25cf0c5',
28+
android: '3ca8451b4da98a11f14fc4711f9b2dff327ba009'
29+
}),
30+
},
31+
}
32+
33+
const OAUTH_APP_NAME = Platform.select({
34+
ios: 'mobilegithubpushnotificationsios',
35+
android: 'mobilegithubpushnotificationsandroid',
36+
})
37+
1938
type Props = {};
2039
export default class App extends Component<Props> {
40+
41+
constructor() {
42+
super()
43+
this.manager = new OAuthManager(OAUTH_APP_NAME)
44+
console.log(this.manager);
45+
}
46+
47+
componentDidMount() {
48+
this.manager.configure(OAUTH_CONFIG);
49+
console.log(this.manager);
50+
Linking.addEventListener('url', this.handleOpenURL);
51+
this.work()
52+
}
53+
54+
componentWillUnmount() {
55+
Linking.removeEventListener('url', this.handleOpenURL);
56+
}
57+
58+
handleOpenURL = (event) => {
59+
console.log(event.url);
60+
}
61+
62+
work = async () => {
63+
const { accounts } = await this.manager.savedAccounts()
64+
console.log('account list: ', accounts);
65+
// try {
66+
// await this.manager.deauthorize('github')
67+
// const { accounts: accounts2 } = await this.manager.savedAccounts()
68+
// console.log('account list: ', accounts2);
69+
// } catch (err) {}
70+
const res = await this.manager.authorize('github', { scopes: 'notifications,read:user' })
71+
console.log('res', res);
72+
}
73+
2174
render() {
2275
return (
2376
<View style={styles.container}>

android/app/BUCK

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ android_library(
4545

4646
android_build_config(
4747
name = "build_config",
48-
package = "com.negebauer.githubPushNotificationsMobile",
48+
package = "com.negebauer.GithubPushNotificationsMobile",
4949
)
5050

5151
android_resource(
5252
name = "res",
53-
package = "com.negebauer.githubPushNotificationsMobile",
53+
package = "com.negebauer.GithubPushNotificationsMobile",
5454
res = "src/main/res",
5555
)
5656

android/app/build.gradle

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ android {
9898
buildToolsVersion rootProject.ext.buildToolsVersion
9999

100100
defaultConfig {
101-
applicationId "com.negebauer.githubPushNotificationsMobile"
101+
applicationId "com.negebauer.GithubPushNotificationsMobile"
102102
minSdkVersion rootProject.ext.minSdkVersion
103103
targetSdkVersion rootProject.ext.targetSdkVersion
104104
versionCode 1
@@ -137,6 +137,7 @@ android {
137137
}
138138

139139
dependencies {
140+
compile project(':react-native-oauth')
140141
compile fileTree(dir: "libs", include: ["*.jar"])
141142
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
142143
compile "com.facebook.react:react-native:+" // From node_modules

android/app/src/main/AndroidManifest.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.negebauer.githubPushNotificationsMobile">
2+
package="com.negebauer.GithubPushNotificationsMobile">
33

44
<uses-permission android:name="android.permission.INTERNET" />
55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

android/app/src/main/java/com/githubpushnotificationsmobile/MainActivity.java renamed to android/app/src/main/java/com/negebauer/githubPushNotificationsMobile/MainActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.negebauer.githubPushNotificationsMobile;
1+
package com.negebauer.GithubPushNotificationsMobile;
22

33
import com.facebook.react.ReactActivity;
44

android/app/src/main/java/com/githubpushnotificationsmobile/MainApplication.java renamed to android/app/src/main/java/com/negebauer/githubPushNotificationsMobile/MainApplication.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
package com.negebauer.githubPushNotificationsMobile;
1+
package com.negebauer.GithubPushNotificationsMobile;
22

33
import android.app.Application;
44

55
import com.facebook.react.ReactApplication;
6+
import io.fullstack.oauth.OAuthManagerPackage;
67
import com.facebook.react.ReactNativeHost;
78
import com.facebook.react.ReactPackage;
89
import com.facebook.react.shell.MainReactPackage;
@@ -22,7 +23,8 @@ public boolean getUseDeveloperSupport() {
2223
@Override
2324
protected List<ReactPackage> getPackages() {
2425
return Arrays.<ReactPackage>asList(
25-
new MainReactPackage()
26+
new MainReactPackage(),
27+
new OAuthManagerPackage()
2628
);
2729
}
2830

android/build.gradle

+13-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ allprojects {
2828
url 'https://maven.google.com/'
2929
name 'Google'
3030
}
31+
maven { url "https://jitpack.io" }
3132
}
3233
}
3334

@@ -36,5 +37,16 @@ ext {
3637
minSdkVersion = 16
3738
compileSdkVersion = 26
3839
targetSdkVersion = 26
39-
supportLibVersion = "26.1.0"
40+
supportLibVersion = "26.0.1"
41+
}
42+
43+
subprojects {
44+
afterEvaluate {project ->
45+
if (project.hasProperty("android")) {
46+
android {
47+
compileSdkVersion 26
48+
buildToolsVersion '26.0.1'
49+
}
50+
}
51+
}
4052
}

android/settings.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
rootProject.name = 'GithubPushNotificationsMobile'
2+
include ':react-native-oauth'
3+
project(':react-native-oauth').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-oauth/android')
24

35
include ':app'

app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name": "GithubPushNotificationsMobile",
3-
"displayName": "Github Notifications"
3+
"displayName": "Github Push"
44
}

0 commit comments

Comments
 (0)