Skip to content

Commit

Permalink
3.0.30
Browse files Browse the repository at this point in the history
  • Loading branch information
namidan committed Aug 29, 2023
1 parent f178d8a commit 35b338b
Show file tree
Hide file tree
Showing 21 changed files with 83 additions and 18 deletions.
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ repositories {
mavenCentral()
// ref: https://www.baeldung.com/maven-local-repository
mavenLocal()
maven { url("https://packages.namiml.com/NamiSDK/Android/") }
maven { url("https://packages.namiml.com/NamiSDK/Amazon/") }
maven { url 'https://jitpack.io' }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
Expand All @@ -84,7 +84,7 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

implementation 'com.github.jeziellago:compose-markdown:0.3.0'
implementation "com.namiml:sdk-android:3.1.3"
compileOnly "com.namiml:sdk-amazon:3.1.5"

implementation 'com.facebook.react:react-native:+' // From node_modules
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:1.1.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class NamiBridgeModule(reactContext: ReactApplicationContext) :
} else {
Arguments.createArray()
}
val settingsList = mutableListOf("extendedClientInfo:react-native:3.0.29")
val settingsList = mutableListOf("extendedClientInfo:react-native:3.0.30")
namiCommandsReact?.toArrayList()?.filterIsInstance<String>()?.let { commandsFromReact ->
settingsList.addAll(commandsFromReact)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ class NamiEntitlementManagerBridgeModule(reactContext: ReactApplicationContext)
}
}

@ReactMethod
fun clearProvisionalEntitlementGrants() {
NamiEntitlementManager.clearProvisionalEntitlementGrants()
}

@ReactMethod
fun addListener(eventName: String?) {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,11 @@ class NamiPaywallManagerBridgeModule(reactContext: ReactApplicationContext) :
promise.resolve(false)
}

@ReactMethod
fun buySkuCancel() {
NamiPaywallManager.buySkuCancel()
}

@ReactMethod
fun addListener(eventName: String?) {
}
Expand Down
2 changes: 2 additions & 0 deletions examples/Basic/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.github.jeziellago:compose-markdown:0.3.0'
implementation "com.namiml:sdk-android:3.1.5"

implementation project(':react-native-screens')

if (enableHermes) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
<domain includeSubdomains="true">10.0.2.2</domain>
<domain includeSubdomains="true">localhost</domain>
</domain-config>
</network-security-config>
</network-security-config>
13 changes: 10 additions & 3 deletions examples/Basic/containers/CampaignScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ const HeaderRight = ({ onRefreshPress }: {onRefreshPress: () => void}) => (
// For Nami testing purposes only
const HeaderLeft = ({ onButtonPress } : { onButtonPress: () => void }) => (
<TouchableOpacity
style={styles.headerButton}
style={styles.headerButtonLeft}
onPress={onButtonPress}>
<Text
testID="show_paywall_button"
style={styles.headerButtonText}>
Show Paywall
Show
</Text>
</TouchableOpacity>
);
Expand Down Expand Up @@ -194,7 +194,8 @@ const CampaignScreen: FC<CampaignScreenProps> = ({ navigation }) => {
}, []);

const onButtonPress = useCallback(() => {
showPaywallIfHidden();
// showPaywallIfHidden();
NamiPaywallManager.buySkuCancel();
}, []);

useLayoutEffect(() => {
Expand Down Expand Up @@ -358,6 +359,12 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
},
headerButtonLeft: {
marginLeft: 15,
height: 30,
justifyContent: 'center',
alignItems: 'center',
},
headerButtonText: {
color: theme.links,
fontSize: 16,
Expand Down
27 changes: 25 additions & 2 deletions examples/Basic/containers/EntitlementsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ const EntitlementsScreen: FC<EntitlementsScreenProps> = ({ navigation }) => {
};

const onRefreshPress = () => {
NamiEntitlementManager.refresh(newEtitlements => {
console.log('newEntitlements', newEtitlements);
NamiEntitlementManager.refresh(newEntitlements => {
console.log('newEntitlements', newEntitlements);
});
};

const onClearPress = () => {
NamiEntitlementManager.clearProvisionalEntitlementGrants();
};

useEffect(() => {
getAllEntitlements();
const subscriptionRemover =
Expand Down Expand Up @@ -65,6 +69,19 @@ const EntitlementsScreen: FC<EntitlementsScreenProps> = ({ navigation }) => {
</TouchableOpacity>
);
},
headerLeft: () => {
return (
<TouchableOpacity
style={styles.headerLeftButton}
onPress={onClearPress}>
<Text
testID="clear_entitlements"
style={styles.headerButtonText}>
Clear
</Text>
</TouchableOpacity>
);
},
});
}, [navigation]);

Expand Down Expand Up @@ -136,6 +153,12 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center',
},
headerLeftButton: {
marginLeft: 15,
height: 30,
justifyContent: 'center',
alignItems: 'center',
},
headerButtonText: {
color: theme.links,
fontSize: 16,
Expand Down
9 changes: 3 additions & 6 deletions examples/TestNamiTV/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,9 @@ android {
productFlavors {
amazon {
dimension "store"
repositories {
maven { url "https://packages.namiml.com/NamiSDK/Amazon/"}
}
}
play {
dimension "store"
repositories {
maven { url "https://packages.namiml.com/NamiSDK/Android/"}
}
}
}

Expand All @@ -233,6 +227,9 @@ dependencies {
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'com.github.jeziellago:compose-markdown:0.3.0'

amazonImplementation "com.namiml:sdk-amazon:3.1.5"
playImplementation "com.namiml:sdk-android:3.1.5"

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
Expand Down
3 changes: 3 additions & 0 deletions examples/TestNamiTV/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,8 @@ allprojects {
google()
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://packages.namiml.com/NamiSDK/Amazon/"}
maven { url "https://packages.namiml.com/NamiSDK/Android/"}

}
}
2 changes: 1 addition & 1 deletion ios/Nami.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ @implementation NamiBridge (RCTExternModule)
}

// Start commands with header iformation for Nami to let them know this is a React client.
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.0.29"]];
NSMutableArray *namiCommandStrings = [NSMutableArray arrayWithArray:@[@"extendedClientInfo:react-native:3.0.30"]];

// Add additional namiCommands app may have sent in.
NSObject *appCommandStrings = configDict[@"namiCommands"];
Expand Down
2 changes: 2 additions & 0 deletions ios/NamiEntitlementManagerBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ @interface RCT_EXTERN_MODULE(RNNamiEntitlementManager, NSObject)

RCT_EXTERN_METHOD(registerActiveEntitlementsHandler)

RCT_EXTERN_METHOD(clearProvisionalEntitlementGrants)

+ (BOOL)requiresMainQueueSetup {
return YES;
}
Expand Down
6 changes: 6 additions & 0 deletions ios/NamiEntitlementManagerBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class RNNamiEntitlementManager: RCTEventEmitter {
let dictionary = RNNamiPurchaseManager.skuToSKUDict(sku)
return dictionary
}

let dictionary: [String: Any?] = [
"name": entitlement.name,
"desc": entitlement.desc,
Expand Down Expand Up @@ -78,4 +79,9 @@ class RNNamiEntitlementManager: RCTEventEmitter {
RNNamiEntitlementManager.shared?.sendEvent(withName: "EntitlementsChanged", body: dictionaries)
}
}

@objc(clearProvisionalEntitlementGrants)
func clearProvisionalEntitlementGrants() {
NamiEntitlementManager.clearProvisionalEntitlementGrants()
}
}
2 changes: 2 additions & 0 deletions ios/NamiPaywallManagerBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ @interface RCT_EXTERN_MODULE(RNNamiPaywallManager, NSObject)

RCT_EXTERN_METHOD(isHidden:(RCTPromiseResolveBlock)resolve rejecter:(RCTPromiseRejectBlock)reject)

RCT_EXTERN_METHOD(buySkuCancel)

+ (BOOL)requiresMainQueueSetup {
return YES;
}
Expand Down
7 changes: 7 additions & 0 deletions ios/NamiPaywallManagerBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,13 @@ class RNNamiPaywallManager: RCTEventEmitter {
}
}

@objc(buySkuCancel)
func buySkuCancel() {
DispatchQueue.main.async {
NamiPaywallManager.buySkuCancel()
}
}

@objc(isHidden:rejecter:)
func isHidden(resolve: @escaping RCTPromiseResolveBlock, reject _: @escaping RCTPromiseRejectBlock) {
DispatchQueue.main.async {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-nami-sdk",
"version": "3.0.29",
"version": "3.0.30",
"description": "React Native Module for Nami - Easy subscriptions & in-app purchases, with powerful built-in paywalls and A/B testing.",
"main": "index.ts",
"types": "index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion react-native-nami-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,swift}"
s.requires_arc = true

s.dependency 'Nami', '3.1.4'
s.dependency 'Nami', '3.1.6'
s.dependency 'React'

end
1 change: 1 addition & 0 deletions src/NamiEntitlementManager.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const NamiEntitlementManager: {
registerActiveEntitlementsHandler: (
callback: (activeEntitlements: NamiEntitlement[]) => void,
) => EmitterSubscription['remove'];
clearProvisionalEntitlementGrants: () => void;
};

export type NamiEntitlement = {
Expand Down
1 change: 1 addition & 0 deletions src/NamiEntitlementManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface INamiEntitlementManager {
registerActiveEntitlementsHandler: (
callback: (activeEntitlements: NamiEntitlement[]) => void,
) => EmitterSubscription['remove'];
clearProvisionalEntitlementGrants: () => void;
}

export const NamiEntitlementManager: INamiEntitlementManager = {
Expand Down
1 change: 1 addition & 0 deletions src/NamiPaywallManager.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const NamiPaywallManager: {
) => EmitterSubscription['remove'];
show: () => void;
hide: () => void;
buySkuCancel: () => void;
isHidden: () => Promise<boolean>;
};

Expand Down
3 changes: 3 additions & 0 deletions src/NamiPaywallManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ export const NamiPaywallManager: INamiPaywallManager = {
ServicesEnum.GooglePlay,
);
},
buySkuCancel: () => {
RNNamiPaywallManager.buySkuCancel();
},
registerBuySkuHandler: (callback: (sku: NamiSKU) => void) => {
let subscription;
subscription = NamiPaywallManager.paywallEmitter.addListener(
Expand Down

0 comments on commit 35b338b

Please sign in to comment.